@read-frog/api-contract 0.14.0 → 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 +1105 -475
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +264 -97
- 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 -12
- package/src/index.ts +37 -33
- package/src/public-errors.ts +74 -51
- package/src/schemas/beta-access.ts +12 -10
- package/src/schemas/billing.ts +77 -59
- 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 +33 -32
package/dist/index.js
CHANGED
|
@@ -261,6 +261,18 @@ const HostedAiQuotaExhaustedDataSchema = z.strictObject({
|
|
|
261
261
|
resetAt: z.iso.datetime().nullable()
|
|
262
262
|
});
|
|
263
263
|
const PUBLIC_APP_ERROR_DEFS = {
|
|
264
|
+
RESOURCE_UPDATE_CONFLICT: {
|
|
265
|
+
message: "The resource changed. Read it again before updating.",
|
|
266
|
+
status: 409
|
|
267
|
+
},
|
|
268
|
+
RESOURCE_ALREADY_EXISTS: {
|
|
269
|
+
message: "A resource with this ID already exists.",
|
|
270
|
+
status: 409
|
|
271
|
+
},
|
|
272
|
+
FIELD_TYPE_CHANGE_UNSUPPORTED: {
|
|
273
|
+
message: "This operation cannot change the field type.",
|
|
274
|
+
status: 400
|
|
275
|
+
},
|
|
264
276
|
HOSTED_AI_TIER_RESTRICTED: {
|
|
265
277
|
data: HostedAiTierRestrictedDataSchema,
|
|
266
278
|
message: "This Built-in AI tier is not available for this account",
|
|
@@ -540,6 +552,42 @@ const billingContract = {
|
|
|
540
552
|
}).output(billingCancelScheduledChangeOutputSchema)
|
|
541
553
|
};
|
|
542
554
|
//#endregion
|
|
555
|
+
//#region src/contracts/shared.ts
|
|
556
|
+
/**
|
|
557
|
+
* Declares a procedure that is exposed to agents as an MCP tool, not only to
|
|
558
|
+
* the REST/OpenAPI surface.
|
|
559
|
+
*
|
|
560
|
+
* oRPC types `~orpc.route` as the widened `Route`, so `route.summary` reads back
|
|
561
|
+
* as `string | undefined` whatever is passed in. `$meta` is the only channel it
|
|
562
|
+
* keeps generic, so the prose is mirrored there and stays a required `string`
|
|
563
|
+
* for tool definitions. OpenAPI keeps reading `route`.
|
|
564
|
+
*/
|
|
565
|
+
function defineAgentProcedure(route) {
|
|
566
|
+
return oc.$meta({
|
|
567
|
+
summary: route.summary,
|
|
568
|
+
description: route.description
|
|
569
|
+
}).route(route);
|
|
570
|
+
}
|
|
571
|
+
//#endregion
|
|
572
|
+
//#region src/schemas/pagination.ts
|
|
573
|
+
const paginationShape = {
|
|
574
|
+
limit: z.number().int().min(1).max(500).optional(),
|
|
575
|
+
offset: z.number().int().min(0).optional()
|
|
576
|
+
};
|
|
577
|
+
function pageSchema(itemSchema) {
|
|
578
|
+
return z.object({
|
|
579
|
+
items: z.array(itemSchema),
|
|
580
|
+
hasMore: z.boolean()
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
//#endregion
|
|
584
|
+
//#region src/schemas/resource-mutation.ts
|
|
585
|
+
const expectedUpdatedAtSchema = z.iso.datetime({ offset: true });
|
|
586
|
+
const deletionResultSchema = z.object({
|
|
587
|
+
id: z.uuid(),
|
|
588
|
+
txid: z.number()
|
|
589
|
+
});
|
|
590
|
+
//#endregion
|
|
543
591
|
//#region src/schemas/card.ts
|
|
544
592
|
const cardTemplateSchema = z.object({
|
|
545
593
|
id: z.uuid(),
|
|
@@ -549,8 +597,11 @@ const cardTemplateSchema = z.object({
|
|
|
549
597
|
createdAt: z.coerce.date(),
|
|
550
598
|
updatedAt: z.coerce.date()
|
|
551
599
|
});
|
|
552
|
-
const CardTemplateListInputSchema = z.object({
|
|
553
|
-
|
|
600
|
+
const CardTemplateListInputSchema = z.object({
|
|
601
|
+
...paginationShape,
|
|
602
|
+
notebaseId: z.uuid().optional()
|
|
603
|
+
});
|
|
604
|
+
const CardTemplateListOutputSchema = pageSchema(cardTemplateSchema);
|
|
554
605
|
const CardTemplateGetInputSchema = z.object({ id: z.uuid() });
|
|
555
606
|
const CardTemplateGetOutputSchema = cardTemplateSchema;
|
|
556
607
|
const CardTemplateCreateInputSchema = z.object({
|
|
@@ -561,13 +612,14 @@ const CardTemplateCreateInputSchema = z.object({
|
|
|
561
612
|
}).strict();
|
|
562
613
|
const CardTemplateCreateOutputSchema = cardTemplateSchema.extend({ txid: z.number() });
|
|
563
614
|
const CardTemplateUpdateInputSchema = z.object({
|
|
615
|
+
expectedUpdatedAt: expectedUpdatedAtSchema.optional(),
|
|
564
616
|
id: z.uuid(),
|
|
565
617
|
name: z.string().min(1).optional(),
|
|
566
618
|
config: cardTemplateConfigSchema.optional()
|
|
567
619
|
}).strict();
|
|
568
620
|
const CardTemplateUpdateOutputSchema = cardTemplateSchema.extend({ txid: z.number() });
|
|
569
621
|
const CardTemplateDeleteInputSchema = z.object({ id: z.uuid() });
|
|
570
|
-
const CardTemplateDeleteOutputSchema =
|
|
622
|
+
const CardTemplateDeleteOutputSchema = deletionResultSchema;
|
|
571
623
|
const cardSchema = z.object({
|
|
572
624
|
...cardIdentityShape,
|
|
573
625
|
...cardMemoryStateShape,
|
|
@@ -579,12 +631,12 @@ const renderedCardSchema = cardSchema.extend({
|
|
|
579
631
|
back: z.string()
|
|
580
632
|
});
|
|
581
633
|
const CardListInputSchema = z.object({
|
|
582
|
-
notebaseId: z.uuid(),
|
|
634
|
+
notebaseId: z.uuid().optional(),
|
|
583
635
|
templateId: z.uuid().optional(),
|
|
584
|
-
|
|
585
|
-
|
|
636
|
+
scheduleStatus: scheduleStatusSchema.optional(),
|
|
637
|
+
...paginationShape
|
|
586
638
|
});
|
|
587
|
-
const CardListOutputSchema =
|
|
639
|
+
const CardListOutputSchema = pageSchema(renderedCardSchema);
|
|
588
640
|
const CardGetInputSchema = z.object({ id: z.uuid() });
|
|
589
641
|
const CardGetOutputSchema = renderedCardSchema;
|
|
590
642
|
const CardGenerateInputSchema = z.object({
|
|
@@ -596,24 +648,23 @@ const CardGenerateOutputSchema = z.object({
|
|
|
596
648
|
txid: z.number()
|
|
597
649
|
});
|
|
598
650
|
//#endregion
|
|
599
|
-
//#region src/contracts/shared.ts
|
|
600
|
-
const notebaseProcedure = oc;
|
|
601
|
-
//#endregion
|
|
602
651
|
//#region src/contracts/card.ts
|
|
603
652
|
const cardContract = {
|
|
604
|
-
list:
|
|
653
|
+
list: defineAgentProcedure({
|
|
605
654
|
method: "GET",
|
|
606
655
|
path: "/cards",
|
|
607
|
-
summary: "List
|
|
656
|
+
summary: "List cards",
|
|
657
|
+
description: "Browse owned cards with rendered fronts, backs, source IDs and learning state. Optionally filter by notebase, template or scheduleStatus. Supports limit and offset pagination.",
|
|
608
658
|
tags: ["Cards"]
|
|
609
|
-
}).input(CardListInputSchema).output(CardListOutputSchema),
|
|
610
|
-
get:
|
|
659
|
+
}).errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND")).input(CardListInputSchema).output(CardListOutputSchema),
|
|
660
|
+
get: defineAgentProcedure({
|
|
611
661
|
method: "GET",
|
|
612
662
|
path: "/cards/{id}",
|
|
613
|
-
summary: "Get
|
|
663
|
+
summary: "Get card",
|
|
664
|
+
description: "Read one owned card with its rendered front, back, source IDs and learning state.",
|
|
614
665
|
tags: ["Cards"]
|
|
615
|
-
}).input(CardGetInputSchema).output(CardGetOutputSchema),
|
|
616
|
-
generate:
|
|
666
|
+
}).errors(pickPublicErrorMap("CARD_NOT_FOUND")).input(CardGetInputSchema).output(CardGetOutputSchema),
|
|
667
|
+
generate: oc.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND", "CARD_TEMPLATE_NOT_FOUND")).route({
|
|
617
668
|
method: "POST",
|
|
618
669
|
path: "/cards/generate",
|
|
619
670
|
summary: "Generate missing cards",
|
|
@@ -623,36 +674,41 @@ const cardContract = {
|
|
|
623
674
|
//#endregion
|
|
624
675
|
//#region src/contracts/card-template.ts
|
|
625
676
|
const cardTemplateContract = {
|
|
626
|
-
list:
|
|
677
|
+
list: defineAgentProcedure({
|
|
627
678
|
method: "GET",
|
|
628
679
|
path: "/card-templates",
|
|
629
680
|
summary: "List card templates",
|
|
681
|
+
description: "List owned card templates, optionally filtered by notebase. Supports limit and offset pagination.",
|
|
630
682
|
tags: ["Card Templates"]
|
|
631
|
-
}).input(CardTemplateListInputSchema).output(CardTemplateListOutputSchema),
|
|
632
|
-
get:
|
|
683
|
+
}).errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND")).input(CardTemplateListInputSchema).output(CardTemplateListOutputSchema),
|
|
684
|
+
get: defineAgentProcedure({
|
|
633
685
|
method: "GET",
|
|
634
686
|
path: "/card-templates/{id}",
|
|
635
687
|
summary: "Get card template",
|
|
688
|
+
description: "Read the complete definition and updatedAt timestamp of an owned card template.",
|
|
636
689
|
tags: ["Card Templates"]
|
|
637
|
-
}).input(CardTemplateGetInputSchema).output(CardTemplateGetOutputSchema),
|
|
638
|
-
create:
|
|
690
|
+
}).errors(pickPublicErrorMap("CARD_TEMPLATE_NOT_FOUND")).input(CardTemplateGetInputSchema).output(CardTemplateGetOutputSchema),
|
|
691
|
+
create: defineAgentProcedure({
|
|
639
692
|
method: "POST",
|
|
640
693
|
path: "/card-templates",
|
|
641
694
|
summary: "Create card template",
|
|
695
|
+
description: "Create a template in an owned notebase using existing field IDs in its patterns. This generates cards for existing notes.",
|
|
642
696
|
tags: ["Card Templates"]
|
|
643
|
-
}).input(CardTemplateCreateInputSchema).output(CardTemplateCreateOutputSchema),
|
|
644
|
-
update:
|
|
697
|
+
}).errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND", "CARD_TEMPLATE_INVALID_NOTEBASE_COLUMNS")).errors(pickPublicErrorMap("RESOURCE_ALREADY_EXISTS")).input(CardTemplateCreateInputSchema).output(CardTemplateCreateOutputSchema),
|
|
698
|
+
update: defineAgentProcedure({
|
|
645
699
|
method: "PATCH",
|
|
646
700
|
path: "/card-templates/{id}",
|
|
647
701
|
summary: "Update card template",
|
|
702
|
+
description: "Change an owned template name or definition. Rendered cards reflect the saved template. expectedUpdatedAt guards against editing stale data.",
|
|
648
703
|
tags: ["Card Templates"]
|
|
649
|
-
}).input(CardTemplateUpdateInputSchema).output(CardTemplateUpdateOutputSchema),
|
|
650
|
-
delete:
|
|
704
|
+
}).errors(pickPublicErrorMap("CARD_TEMPLATE_NOT_FOUND", "CARD_TEMPLATE_INVALID_NOTEBASE_COLUMNS")).errors(pickPublicErrorMap("RESOURCE_UPDATE_CONFLICT")).input(CardTemplateUpdateInputSchema).output(CardTemplateUpdateOutputSchema),
|
|
705
|
+
delete: defineAgentProcedure({
|
|
651
706
|
method: "DELETE",
|
|
652
707
|
path: "/card-templates/{id}",
|
|
653
708
|
summary: "Delete card template",
|
|
709
|
+
description: "Permanently delete an owned template and its generated cards and review records. Source notes are preserved.",
|
|
654
710
|
tags: ["Card Templates"]
|
|
655
|
-
}).input(CardTemplateDeleteInputSchema).output(CardTemplateDeleteOutputSchema)
|
|
711
|
+
}).errors(pickPublicErrorMap("CARD_TEMPLATE_NOT_FOUND")).input(CardTemplateDeleteInputSchema).output(CardTemplateDeleteOutputSchema)
|
|
656
712
|
};
|
|
657
713
|
//#endregion
|
|
658
714
|
//#region src/schemas/ebook.ts
|
|
@@ -866,6 +922,7 @@ const notebaseColumnCreateDataSchema = z.object({
|
|
|
866
922
|
config: notebaseColumnConfigSchema
|
|
867
923
|
}).strict();
|
|
868
924
|
const notebaseColumnUpdateDataSchema = z.object({
|
|
925
|
+
expectedUpdatedAt: expectedUpdatedAtSchema.optional(),
|
|
869
926
|
name: z.string().min(1).optional(),
|
|
870
927
|
config: notebaseColumnConfigSchema.optional(),
|
|
871
928
|
width: notebaseColumnWidthSchema.nullable().optional(),
|
|
@@ -875,14 +932,20 @@ const NotebaseColumnCreateInputSchema = z.object({
|
|
|
875
932
|
notebaseId: z.uuid(),
|
|
876
933
|
data: notebaseColumnCreateDataSchema
|
|
877
934
|
});
|
|
878
|
-
const NotebaseColumnCreateOutputSchema = z.object({
|
|
935
|
+
const NotebaseColumnCreateOutputSchema = z.object({
|
|
936
|
+
field: notebaseColumnSchema,
|
|
937
|
+
txid: z.number()
|
|
938
|
+
});
|
|
879
939
|
const NotebaseColumnUpdateInputSchema = z.object({
|
|
880
940
|
notebaseColumnId: z.uuid(),
|
|
881
941
|
data: notebaseColumnUpdateDataSchema
|
|
882
942
|
});
|
|
883
|
-
const NotebaseColumnUpdateOutputSchema = z.object({
|
|
943
|
+
const NotebaseColumnUpdateOutputSchema = z.object({
|
|
944
|
+
field: notebaseColumnSchema,
|
|
945
|
+
txid: z.number()
|
|
946
|
+
});
|
|
884
947
|
const NotebaseColumnDeleteInputSchema = z.object({ notebaseColumnId: z.uuid() });
|
|
885
|
-
const NotebaseColumnDeleteOutputSchema =
|
|
948
|
+
const NotebaseColumnDeleteOutputSchema = deletionResultSchema;
|
|
886
949
|
const NotebaseColumnReorderInputSchema = z.object({
|
|
887
950
|
notebaseId: z.uuid(),
|
|
888
951
|
ids: z.array(z.uuid())
|
|
@@ -903,12 +966,18 @@ const notebaseRowCreateDataSchema = z.object({
|
|
|
903
966
|
id: z.uuid().optional(),
|
|
904
967
|
cells: notebaseRowCellsSchema.optional()
|
|
905
968
|
}).strict();
|
|
906
|
-
const notebaseRowUpdateDataSchema = z.object({
|
|
969
|
+
const notebaseRowUpdateDataSchema = z.object({
|
|
970
|
+
cells: notebaseRowCellsSchema.optional(),
|
|
971
|
+
expectedUpdatedAt: expectedUpdatedAtSchema.optional()
|
|
972
|
+
}).strict();
|
|
907
973
|
const NotebaseRowCreateInputSchema = z.object({
|
|
908
974
|
notebaseId: z.uuid(),
|
|
909
975
|
data: notebaseRowCreateDataSchema
|
|
910
976
|
});
|
|
911
|
-
const NotebaseRowCreateOutputSchema = z.object({
|
|
977
|
+
const NotebaseRowCreateOutputSchema = z.object({
|
|
978
|
+
note: notebaseRowSchema,
|
|
979
|
+
txid: z.number()
|
|
980
|
+
});
|
|
912
981
|
const NOTEBASE_ROW_CREATE_MANY_MAX_ROWS = 50;
|
|
913
982
|
const NotebaseRowCreateManyInputSchema = z.object({
|
|
914
983
|
notebaseId: z.uuid(),
|
|
@@ -932,7 +1001,10 @@ const NotebaseRowCreateManyInputSchema = z.object({
|
|
|
932
1001
|
seenIds.add(row.id);
|
|
933
1002
|
});
|
|
934
1003
|
});
|
|
935
|
-
const NotebaseRowCreateManyOutputSchema = z.object({
|
|
1004
|
+
const NotebaseRowCreateManyOutputSchema = z.object({
|
|
1005
|
+
items: z.array(notebaseRowSchema),
|
|
1006
|
+
txid: z.number()
|
|
1007
|
+
});
|
|
936
1008
|
const NotebaseRowUpdateInputSchema = z.object({
|
|
937
1009
|
notebaseRowId: z.uuid(),
|
|
938
1010
|
data: notebaseRowUpdateDataSchema
|
|
@@ -947,12 +1019,23 @@ const NotebaseRowUpdateOutputSchema = z.object({
|
|
|
947
1019
|
txid: z.number()
|
|
948
1020
|
});
|
|
949
1021
|
const NotebaseRowDeleteInputSchema = z.object({ notebaseRowId: z.uuid() });
|
|
950
|
-
const NotebaseRowDeleteOutputSchema =
|
|
1022
|
+
const NotebaseRowDeleteOutputSchema = deletionResultSchema;
|
|
951
1023
|
const NotebaseRowReorderInputSchema = z.object({
|
|
952
1024
|
notebaseId: z.uuid(),
|
|
953
1025
|
ids: z.array(z.uuid())
|
|
954
1026
|
});
|
|
955
1027
|
const NotebaseRowReorderOutputSchema = z.object({ txid: z.number() });
|
|
1028
|
+
const NotebaseRowListInputSchema = z.object({
|
|
1029
|
+
notebaseId: z.uuid().optional(),
|
|
1030
|
+
query: z.string().trim().min(2).max(200).optional(),
|
|
1031
|
+
...paginationShape
|
|
1032
|
+
}).refine((input) => input.query === void 0 || input.notebaseId !== void 0, {
|
|
1033
|
+
error: "notebaseId is required when query is set",
|
|
1034
|
+
path: ["notebaseId"]
|
|
1035
|
+
});
|
|
1036
|
+
const NotebaseRowListOutputSchema = pageSchema(notebaseRowSchema);
|
|
1037
|
+
const NotebaseRowGetInputSchema = z.object({ id: z.uuid() });
|
|
1038
|
+
const NotebaseRowGetOutputSchema = notebaseRowSchema;
|
|
956
1039
|
//#endregion
|
|
957
1040
|
//#region src/schemas/notebase-view.ts
|
|
958
1041
|
const notebaseViewTypeSchema = z.enum([
|
|
@@ -1006,10 +1089,11 @@ const notebaseViewSchema = z.object({
|
|
|
1006
1089
|
//#endregion
|
|
1007
1090
|
//#region src/schemas/notebase.ts
|
|
1008
1091
|
const NotebaseListInputSchema = z.object({});
|
|
1009
|
-
const
|
|
1092
|
+
const notebaseSummarySchema = z.object({
|
|
1010
1093
|
id: z.string(),
|
|
1011
1094
|
name: z.string()
|
|
1012
1095
|
});
|
|
1096
|
+
const NotebaseListItemSchema = notebaseSummarySchema;
|
|
1013
1097
|
const NotebaseListOutputSchema = z.array(NotebaseListItemSchema);
|
|
1014
1098
|
const notebaseSchema = z.object({
|
|
1015
1099
|
id: z.string(),
|
|
@@ -1070,7 +1154,10 @@ const notebaseCreateDataSchema = z.object({
|
|
|
1070
1154
|
}).optional()
|
|
1071
1155
|
}).strict();
|
|
1072
1156
|
const NotebaseCreateInputSchema = notebaseCreateDataSchema;
|
|
1073
|
-
const NotebaseCreateOutputSchema = z.object({
|
|
1157
|
+
const NotebaseCreateOutputSchema = z.object({
|
|
1158
|
+
notebase: notebaseSchema,
|
|
1159
|
+
txid: z.number()
|
|
1160
|
+
});
|
|
1074
1161
|
const notebaseUpdateDataSchema = z.object({
|
|
1075
1162
|
name: z.string().min(1).optional(),
|
|
1076
1163
|
srsNewPerDay: schedulingParamsShape.newPerDay.optional(),
|
|
@@ -1078,10 +1165,19 @@ const notebaseUpdateDataSchema = z.object({
|
|
|
1078
1165
|
srsDesiredRetention: schedulingParamsShape.desiredRetention.optional()
|
|
1079
1166
|
}).strict();
|
|
1080
1167
|
const NotebaseUpdateInputSchema = notebaseUpdateDataSchema.extend({ id: z.uuid() });
|
|
1081
|
-
const NotebaseUpdateOutputSchema = z.object({
|
|
1168
|
+
const NotebaseUpdateOutputSchema = z.object({
|
|
1169
|
+
notebase: notebaseSchema,
|
|
1170
|
+
txid: z.number()
|
|
1171
|
+
});
|
|
1082
1172
|
const NotebaseDeleteInputSchema = z.object({ id: z.uuid() });
|
|
1083
|
-
const NotebaseDeleteOutputSchema =
|
|
1173
|
+
const NotebaseDeleteOutputSchema = deletionResultSchema;
|
|
1084
1174
|
const NotebaseGetInputSchema = z.object({ id: z.uuid() });
|
|
1175
|
+
const NotebaseGetSummaryInputSchema = z.object({ id: z.uuid() });
|
|
1176
|
+
const NotebaseGetSummaryOutputSchema = notebaseSummarySchema.extend({
|
|
1177
|
+
srsNewPerDay: schedulingParamsShape.newPerDay,
|
|
1178
|
+
srsReviewsPerDay: schedulingParamsShape.reviewsPerDay,
|
|
1179
|
+
srsDesiredRetention: schedulingParamsShape.desiredRetention
|
|
1180
|
+
});
|
|
1085
1181
|
const NotebaseGetSchemaInputSchema = z.object({ id: z.uuid() });
|
|
1086
1182
|
const NotebaseGetOutputSchema = notebaseSchema.extend({
|
|
1087
1183
|
createdAt: z.coerce.date(),
|
|
@@ -1099,65 +1195,80 @@ const NotebaseGetSchemaOutputSchema = z.object({
|
|
|
1099
1195
|
//#endregion
|
|
1100
1196
|
//#region src/contracts/notebase.ts
|
|
1101
1197
|
const notebaseContract = {
|
|
1102
|
-
list:
|
|
1198
|
+
list: defineAgentProcedure({
|
|
1103
1199
|
method: "GET",
|
|
1104
1200
|
path: "/notebases",
|
|
1105
1201
|
summary: "List notebases",
|
|
1202
|
+
description: "List the notebases (word books) owned by the current user.",
|
|
1106
1203
|
tags: ["Notebases"]
|
|
1107
1204
|
}).input(NotebaseListInputSchema).output(NotebaseListOutputSchema),
|
|
1108
|
-
|
|
1205
|
+
getSummary: defineAgentProcedure({
|
|
1206
|
+
method: "GET",
|
|
1207
|
+
path: "/notebases/{id}/summary",
|
|
1208
|
+
summary: "Get notebase summary",
|
|
1209
|
+
description: "Read the name and public study settings of an owned notebase without loading note content.",
|
|
1210
|
+
tags: ["Notebases"]
|
|
1211
|
+
}).errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND")).input(NotebaseGetSummaryInputSchema).output(NotebaseGetSummaryOutputSchema),
|
|
1212
|
+
get: oc.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND")).route({
|
|
1109
1213
|
method: "GET",
|
|
1110
1214
|
path: "/notebases/{id}",
|
|
1111
1215
|
summary: "Get notebase with notebase columns, rows, and views",
|
|
1112
1216
|
tags: ["Notebases"]
|
|
1113
1217
|
}).input(NotebaseGetInputSchema).output(NotebaseGetOutputSchema),
|
|
1114
|
-
getSchema:
|
|
1218
|
+
getSchema: defineAgentProcedure({
|
|
1115
1219
|
method: "GET",
|
|
1116
1220
|
path: "/notebases/{id}/schema",
|
|
1117
1221
|
summary: "Get notebase schema",
|
|
1222
|
+
description: "Read an owned notebase name and field definitions, including field IDs, types and updatedAt timestamps. Does not return note content.",
|
|
1118
1223
|
tags: ["Notebases"]
|
|
1119
|
-
}).input(NotebaseGetSchemaInputSchema).output(NotebaseGetSchemaOutputSchema),
|
|
1120
|
-
create:
|
|
1224
|
+
}).errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND")).input(NotebaseGetSchemaInputSchema).output(NotebaseGetSchemaOutputSchema),
|
|
1225
|
+
create: defineAgentProcedure({
|
|
1121
1226
|
method: "POST",
|
|
1122
1227
|
path: "/notebases",
|
|
1123
1228
|
summary: "Create notebase",
|
|
1229
|
+
description: "Create an owned notebase with optional initial fields and notes. Client-provided entity IDs are supported; duplicate IDs produce a conflict.",
|
|
1124
1230
|
tags: ["Notebases"]
|
|
1125
|
-
}).input(NotebaseCreateInputSchema).output(NotebaseCreateOutputSchema),
|
|
1126
|
-
update:
|
|
1231
|
+
}).errors(pickPublicErrorMap("NOTE_LIMIT_EXCEEDED", "CELL_VALIDATION_FAILED")).errors(pickPublicErrorMap("RESOURCE_ALREADY_EXISTS")).input(NotebaseCreateInputSchema).output(NotebaseCreateOutputSchema),
|
|
1232
|
+
update: defineAgentProcedure({
|
|
1127
1233
|
method: "PUT",
|
|
1128
1234
|
path: "/notebases/{id}",
|
|
1129
1235
|
summary: "Update notebase",
|
|
1236
|
+
description: "Update the supplied name or public study settings of an owned notebase, preserving omitted properties.",
|
|
1130
1237
|
tags: ["Notebases"]
|
|
1131
|
-
}).input(NotebaseUpdateInputSchema).output(NotebaseUpdateOutputSchema),
|
|
1132
|
-
delete:
|
|
1238
|
+
}).errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND")).input(NotebaseUpdateInputSchema).output(NotebaseUpdateOutputSchema),
|
|
1239
|
+
delete: defineAgentProcedure({
|
|
1133
1240
|
method: "DELETE",
|
|
1134
1241
|
path: "/notebases/{id}",
|
|
1135
1242
|
summary: "Delete notebase",
|
|
1243
|
+
description: "Permanently delete an owned notebase and its fields, notes, templates, cards and review records. Return the deleted notebase ID.",
|
|
1136
1244
|
tags: ["Notebases"]
|
|
1137
|
-
}).input(NotebaseDeleteInputSchema).output(NotebaseDeleteOutputSchema)
|
|
1245
|
+
}).errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND")).input(NotebaseDeleteInputSchema).output(NotebaseDeleteOutputSchema)
|
|
1138
1246
|
};
|
|
1139
1247
|
//#endregion
|
|
1140
1248
|
//#region src/contracts/notebase-column.ts
|
|
1141
1249
|
const notebaseColumnContract = {
|
|
1142
|
-
create:
|
|
1250
|
+
create: defineAgentProcedure({
|
|
1143
1251
|
method: "POST",
|
|
1144
1252
|
path: "/notebase-columns",
|
|
1145
|
-
summary: "Create notebase
|
|
1253
|
+
summary: "Create notebase field",
|
|
1254
|
+
description: "Create a field in an owned notebase. The returned field ID is used as a key in note cells.",
|
|
1146
1255
|
tags: ["Notebase Columns"]
|
|
1147
|
-
}).input(NotebaseColumnCreateInputSchema).output(NotebaseColumnCreateOutputSchema),
|
|
1148
|
-
update:
|
|
1256
|
+
}).errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND", "CONCURRENT_POSITION_CONFLICT")).errors(pickPublicErrorMap("RESOURCE_ALREADY_EXISTS")).input(NotebaseColumnCreateInputSchema).output(NotebaseColumnCreateOutputSchema),
|
|
1257
|
+
update: defineAgentProcedure({
|
|
1149
1258
|
method: "PATCH",
|
|
1150
1259
|
path: "/notebase-columns/{notebaseColumnId}",
|
|
1151
|
-
summary: "Update notebase
|
|
1260
|
+
summary: "Update notebase field",
|
|
1261
|
+
description: "Update an owned field without changing its type. Removing select options clears affected note values. expectedUpdatedAt guards against editing stale data.",
|
|
1152
1262
|
tags: ["Notebase Columns"]
|
|
1153
|
-
}).input(NotebaseColumnUpdateInputSchema).output(NotebaseColumnUpdateOutputSchema),
|
|
1154
|
-
delete:
|
|
1263
|
+
}).errors(pickPublicErrorMap("NOTEBASE_COLUMN_NOT_FOUND")).errors(pickPublicErrorMap("RESOURCE_UPDATE_CONFLICT", "FIELD_TYPE_CHANGE_UNSUPPORTED")).input(NotebaseColumnUpdateInputSchema).output(NotebaseColumnUpdateOutputSchema),
|
|
1264
|
+
delete: defineAgentProcedure({
|
|
1155
1265
|
method: "DELETE",
|
|
1156
1266
|
path: "/notebase-columns/{notebaseColumnId}",
|
|
1157
|
-
summary: "Delete notebase
|
|
1267
|
+
summary: "Delete notebase field",
|
|
1268
|
+
description: "Delete an owned field and remove its values from notes. Primary fields and fields referenced by templates cannot be deleted.",
|
|
1158
1269
|
tags: ["Notebase Columns"]
|
|
1159
|
-
}).input(NotebaseColumnDeleteInputSchema).output(NotebaseColumnDeleteOutputSchema),
|
|
1160
|
-
reorder:
|
|
1270
|
+
}).errors(pickPublicErrorMap("NOTEBASE_COLUMN_NOT_FOUND", "PRIMARY_NOTEBASE_COLUMN_DELETE_NOT_ALLOWED", "CARD_TEMPLATE_NOTEBASE_COLUMN_IN_USE", "CONCURRENT_POSITION_CONFLICT")).input(NotebaseColumnDeleteInputSchema).output(NotebaseColumnDeleteOutputSchema),
|
|
1271
|
+
reorder: oc.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND", "CONCURRENT_POSITION_CONFLICT")).route({
|
|
1161
1272
|
method: "POST",
|
|
1162
1273
|
path: "/notebase-columns/reorder",
|
|
1163
1274
|
summary: "Reorder notebase columns",
|
|
@@ -1167,31 +1278,49 @@ const notebaseColumnContract = {
|
|
|
1167
1278
|
//#endregion
|
|
1168
1279
|
//#region src/contracts/notebase-row.ts
|
|
1169
1280
|
const notebaseRowContract = {
|
|
1170
|
-
|
|
1281
|
+
list: defineAgentProcedure({
|
|
1282
|
+
method: "GET",
|
|
1283
|
+
path: "/notebase-rows",
|
|
1284
|
+
summary: "List or search notes",
|
|
1285
|
+
description: "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.",
|
|
1286
|
+
tags: ["Notebase Rows"]
|
|
1287
|
+
}).errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND")).input(NotebaseRowListInputSchema).output(NotebaseRowListOutputSchema),
|
|
1288
|
+
get: defineAgentProcedure({
|
|
1289
|
+
method: "GET",
|
|
1290
|
+
path: "/notebase-rows/{id}",
|
|
1291
|
+
summary: "Get note",
|
|
1292
|
+
description: "Read one owned note with field-ID values and the updatedAt timestamp used for modification checks.",
|
|
1293
|
+
tags: ["Notebase Rows"]
|
|
1294
|
+
}).errors(pickPublicErrorMap("NOTEBASE_ROW_NOT_FOUND")).input(NotebaseRowGetInputSchema).output(NotebaseRowGetOutputSchema),
|
|
1295
|
+
create: defineAgentProcedure({
|
|
1171
1296
|
method: "POST",
|
|
1172
1297
|
path: "/notebase-rows",
|
|
1173
|
-
summary: "Create
|
|
1298
|
+
summary: "Create note",
|
|
1299
|
+
description: "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.",
|
|
1174
1300
|
tags: ["Notebase Rows"]
|
|
1175
|
-
}).input(NotebaseRowCreateInputSchema).output(NotebaseRowCreateOutputSchema),
|
|
1176
|
-
createMany:
|
|
1301
|
+
}).errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND", "CELL_VALIDATION_FAILED", "CONCURRENT_POSITION_CONFLICT", "NOTE_LIMIT_EXCEEDED")).errors(pickPublicErrorMap("RESOURCE_ALREADY_EXISTS")).input(NotebaseRowCreateInputSchema).output(NotebaseRowCreateOutputSchema),
|
|
1302
|
+
createMany: defineAgentProcedure({
|
|
1177
1303
|
method: "POST",
|
|
1178
1304
|
path: "/notebase-rows/batch",
|
|
1179
|
-
summary: "Create
|
|
1305
|
+
summary: "Create notes",
|
|
1306
|
+
description: "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.",
|
|
1180
1307
|
tags: ["Notebase Rows"]
|
|
1181
|
-
}).input(NotebaseRowCreateManyInputSchema).output(NotebaseRowCreateManyOutputSchema),
|
|
1182
|
-
update:
|
|
1308
|
+
}).errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND", "CELL_VALIDATION_FAILED", "CONCURRENT_POSITION_CONFLICT", "NOTE_LIMIT_EXCEEDED")).errors(pickPublicErrorMap("RESOURCE_ALREADY_EXISTS")).input(NotebaseRowCreateManyInputSchema).output(NotebaseRowCreateManyOutputSchema),
|
|
1309
|
+
update: defineAgentProcedure({
|
|
1183
1310
|
method: "PATCH",
|
|
1184
1311
|
path: "/notebase-rows/{notebaseRowId}",
|
|
1185
|
-
summary: "Update
|
|
1312
|
+
summary: "Update note",
|
|
1313
|
+
description: "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.",
|
|
1186
1314
|
tags: ["Notebase Rows"]
|
|
1187
|
-
}).input(NotebaseRowUpdateInputSchema).output(NotebaseRowUpdateOutputSchema),
|
|
1188
|
-
delete:
|
|
1315
|
+
}).errors(pickPublicErrorMap("NOTEBASE_ROW_NOT_FOUND", "CELL_VALIDATION_FAILED")).errors(pickPublicErrorMap("RESOURCE_UPDATE_CONFLICT")).input(NotebaseRowUpdateInputSchema).output(NotebaseRowUpdateOutputSchema),
|
|
1316
|
+
delete: defineAgentProcedure({
|
|
1189
1317
|
method: "DELETE",
|
|
1190
1318
|
path: "/notebase-rows/{notebaseRowId}",
|
|
1191
|
-
summary: "Delete
|
|
1319
|
+
summary: "Delete note",
|
|
1320
|
+
description: "Permanently delete an owned note and its derived cards and review records. Return the deleted note ID.",
|
|
1192
1321
|
tags: ["Notebase Rows"]
|
|
1193
|
-
}).input(NotebaseRowDeleteInputSchema).output(NotebaseRowDeleteOutputSchema),
|
|
1194
|
-
reorder:
|
|
1322
|
+
}).errors(pickPublicErrorMap("NOTEBASE_ROW_NOT_FOUND", "CONCURRENT_POSITION_CONFLICT")).input(NotebaseRowDeleteInputSchema).output(NotebaseRowDeleteOutputSchema),
|
|
1323
|
+
reorder: oc.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND", "CONCURRENT_POSITION_CONFLICT")).route({
|
|
1195
1324
|
method: "POST",
|
|
1196
1325
|
path: "/notebase-rows/reorder",
|
|
1197
1326
|
summary: "Reorder notebase rows",
|
|
@@ -1233,7 +1362,10 @@ const srsReviewInputSchema = z.object({
|
|
|
1233
1362
|
durationMs: z.number().int().min(0).max(SRS_REVIEW_DURATION_MS_MAX),
|
|
1234
1363
|
timezone: timezoneSchema
|
|
1235
1364
|
}).strict();
|
|
1236
|
-
const srsRollbackReviewInputSchema = z.object({
|
|
1365
|
+
const srsRollbackReviewInputSchema = z.object({
|
|
1366
|
+
expectedReviewId: z.uuid().optional(),
|
|
1367
|
+
cardId: z.uuid()
|
|
1368
|
+
}).strict();
|
|
1237
1369
|
const srsScheduleStatusStatsSchema = z.record(activeScheduleStatusSchema, z.number().int().min(0));
|
|
1238
1370
|
const srsScheduleStatusStatsInputSchema = z.object({
|
|
1239
1371
|
notebaseIds: z.array(z.uuid()).optional(),
|
|
@@ -1261,8 +1393,15 @@ const srsRevlogSchema = z.object({
|
|
|
1261
1393
|
createdAt: z.coerce.date()
|
|
1262
1394
|
});
|
|
1263
1395
|
const srsRevlogWithoutSnapshotSchema = srsRevlogSchema.omit({ fsrsReviewLogSnapshot: true });
|
|
1264
|
-
const srsListCardRevlogsInputSchema = z.object({
|
|
1265
|
-
|
|
1396
|
+
const srsListCardRevlogsInputSchema = z.object({
|
|
1397
|
+
...paginationShape,
|
|
1398
|
+
notebaseId: z.uuid().optional(),
|
|
1399
|
+
cardId: z.uuid().optional()
|
|
1400
|
+
}).strict();
|
|
1401
|
+
const srsListCardRevlogsOutputSchema = z.object({
|
|
1402
|
+
items: z.array(srsRevlogWithoutSnapshotSchema),
|
|
1403
|
+
hasMore: z.boolean()
|
|
1404
|
+
}).strict();
|
|
1266
1405
|
const srsReviewOutputSchema = z.object({
|
|
1267
1406
|
card: cardSchema,
|
|
1268
1407
|
revlog: srsRevlogSchema,
|
|
@@ -1277,6 +1416,16 @@ const srsRollbackReviewOutputSchema = z.object({
|
|
|
1277
1416
|
const srsTxidOutputSchema = z.object({ txid: z.number() });
|
|
1278
1417
|
const srsSetCardBuriedOutputSchema = srsTxidOutputSchema;
|
|
1279
1418
|
const srsSetCardSuspendedOutputSchema = srsTxidOutputSchema;
|
|
1419
|
+
const srsListUnreadOptimizerResultsInputSchema = z.object({}).strict();
|
|
1420
|
+
const srsOptimizerUnreadResultSchema = z.object({
|
|
1421
|
+
runId: z.uuid(),
|
|
1422
|
+
notebaseName: z.string().min(1),
|
|
1423
|
+
revlogCount: z.number().int().positive(),
|
|
1424
|
+
improvement: z.number().nonnegative().nullable()
|
|
1425
|
+
}).strict();
|
|
1426
|
+
const srsListUnreadOptimizerResultsOutputSchema = z.array(srsOptimizerUnreadResultSchema);
|
|
1427
|
+
const srsAcknowledgeOptimizerResultsInputSchema = z.object({ runIds: z.array(z.uuid()).min(1) }).strict();
|
|
1428
|
+
const srsAcknowledgeOptimizerResultsOutputSchema = z.object({ acknowledgedCount: z.number().int().nonnegative() }).strict();
|
|
1280
1429
|
function formatLastReviewTime(lastReviewTime) {
|
|
1281
1430
|
return lastReviewTime ? new Date(lastReviewTime).toISOString() : nullLastReviewTimeSentinel;
|
|
1282
1431
|
}
|
|
@@ -1313,42 +1462,60 @@ function bytesToUuid(bytes) {
|
|
|
1313
1462
|
//#endregion
|
|
1314
1463
|
//#region src/contracts/srs.ts
|
|
1315
1464
|
const srsContract = {
|
|
1316
|
-
scheduleStatusStats:
|
|
1465
|
+
scheduleStatusStats: defineAgentProcedure({
|
|
1317
1466
|
method: "GET",
|
|
1318
1467
|
path: "/srs/schedule-status-stats",
|
|
1319
|
-
summary: "
|
|
1468
|
+
summary: "Get study statistics",
|
|
1469
|
+
description: "Read existing study queue counts for owned notebases in the supplied timezone. Does not return note content or card faces.",
|
|
1470
|
+
tags: ["SRS"]
|
|
1471
|
+
}).errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND")).input(srsScheduleStatusStatsInputSchema).output(srsScheduleStatusStatsOutputSchema),
|
|
1472
|
+
listUnreadOptimizerResults: oc.route({
|
|
1473
|
+
method: "GET",
|
|
1474
|
+
path: "/srs/optimizer-results/unread",
|
|
1475
|
+
summary: "List unread applied SRS optimizer results",
|
|
1476
|
+
tags: ["SRS"]
|
|
1477
|
+
}).input(srsListUnreadOptimizerResultsInputSchema).output(srsListUnreadOptimizerResultsOutputSchema),
|
|
1478
|
+
acknowledgeOptimizerResults: oc.route({
|
|
1479
|
+
method: "POST",
|
|
1480
|
+
path: "/srs/optimizer-results/acknowledge",
|
|
1481
|
+
summary: "Acknowledge current SRS optimizer results",
|
|
1320
1482
|
tags: ["SRS"]
|
|
1321
|
-
}).input(
|
|
1322
|
-
listCardRevlogs:
|
|
1483
|
+
}).input(srsAcknowledgeOptimizerResultsInputSchema).output(srsAcknowledgeOptimizerResultsOutputSchema),
|
|
1484
|
+
listCardRevlogs: defineAgentProcedure({
|
|
1323
1485
|
method: "GET",
|
|
1324
|
-
path: "/srs/
|
|
1325
|
-
summary: "List
|
|
1486
|
+
path: "/srs/revlogs",
|
|
1487
|
+
summary: "List review history",
|
|
1488
|
+
description: "Read owned review records, optionally filtered by notebase or card. Supports limit and offset pagination. Note content, card faces and rollback snapshots are excluded.",
|
|
1326
1489
|
tags: ["SRS"]
|
|
1327
|
-
}).input(srsListCardRevlogsInputSchema).output(srsListCardRevlogsOutputSchema),
|
|
1328
|
-
review:
|
|
1490
|
+
}).errors(pickPublicErrorMap("CARD_NOT_FOUND", "NOTEBASE_NOT_FOUND")).input(srsListCardRevlogsInputSchema).output(srsListCardRevlogsOutputSchema),
|
|
1491
|
+
review: defineAgentProcedure({
|
|
1329
1492
|
method: "POST",
|
|
1330
1493
|
path: "/srs/review",
|
|
1331
|
-
summary: "
|
|
1494
|
+
summary: "Record review",
|
|
1495
|
+
description: "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.",
|
|
1332
1496
|
tags: ["SRS"]
|
|
1333
|
-
}).input(srsReviewInputSchema).output(srsReviewOutputSchema),
|
|
1334
|
-
rollbackReview:
|
|
1497
|
+
}).errors(pickPublicErrorMap("CARD_NOT_FOUND", "CARD_NOT_REVIEWABLE", "CARD_REVIEW_STATE_STALE")).input(srsReviewInputSchema).output(srsReviewOutputSchema),
|
|
1498
|
+
rollbackReview: defineAgentProcedure({
|
|
1335
1499
|
method: "POST",
|
|
1336
1500
|
path: "/srs/review/rollback",
|
|
1337
|
-
summary: "
|
|
1501
|
+
summary: "Undo review",
|
|
1502
|
+
description: "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.",
|
|
1338
1503
|
tags: ["SRS"]
|
|
1339
|
-
}).input(srsRollbackReviewInputSchema).output(srsRollbackReviewOutputSchema),
|
|
1340
|
-
setCardBuried:
|
|
1504
|
+
}).errors(pickPublicErrorMap("CARD_NOT_FOUND", "CARD_REVIEW_ROLLBACK_UNAVAILABLE", "CARD_REVIEW_STATE_STALE")).input(srsRollbackReviewInputSchema).output(srsRollbackReviewOutputSchema),
|
|
1505
|
+
setCardBuried: defineAgentProcedure({
|
|
1341
1506
|
method: "POST",
|
|
1342
1507
|
path: "/srs/card/bury",
|
|
1343
|
-
summary: "
|
|
1508
|
+
summary: "Set card buried",
|
|
1509
|
+
description: "Bury or unbury one owned card. enabled=true buries and enabled=false unburies it. Existing state-change rules apply.",
|
|
1344
1510
|
tags: ["SRS"]
|
|
1345
|
-
}).input(srsSetCardBuriedInputSchema).output(srsSetCardBuriedOutputSchema),
|
|
1346
|
-
setCardSuspended:
|
|
1511
|
+
}).errors(pickPublicErrorMap("CARD_NOT_FOUND", "CARD_ALREADY_BURIED", "CARD_NOT_BURIED", "CARD_STATUS_CHANGE_UNAVAILABLE")).input(srsSetCardBuriedInputSchema).output(srsSetCardBuriedOutputSchema),
|
|
1512
|
+
setCardSuspended: defineAgentProcedure({
|
|
1347
1513
|
method: "POST",
|
|
1348
1514
|
path: "/srs/card/suspend",
|
|
1349
|
-
summary: "
|
|
1515
|
+
summary: "Set card suspended",
|
|
1516
|
+
description: "Suspend or resume one owned card. enabled=true suspends and enabled=false resumes it. Existing state-change rules apply.",
|
|
1350
1517
|
tags: ["SRS"]
|
|
1351
|
-
}).input(srsSetCardSuspendedInputSchema).output(srsSetCardSuspendedOutputSchema)
|
|
1518
|
+
}).errors(pickPublicErrorMap("CARD_NOT_FOUND", "CARD_ALREADY_SUSPENDED", "CARD_NOT_SUSPENDED", "CARD_STATUS_CHANGE_UNAVAILABLE")).input(srsSetCardSuspendedInputSchema).output(srsSetCardSuspendedOutputSchema)
|
|
1352
1519
|
};
|
|
1353
1520
|
//#endregion
|
|
1354
1521
|
//#region src/schemas/notebase-stats.ts
|
|
@@ -1403,19 +1570,19 @@ const activityStatsOutputSchema = z.object({
|
|
|
1403
1570
|
//#endregion
|
|
1404
1571
|
//#region src/contracts/stats.ts
|
|
1405
1572
|
const statsContract = {
|
|
1406
|
-
activity:
|
|
1573
|
+
activity: oc.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND")).route({
|
|
1407
1574
|
method: "GET",
|
|
1408
1575
|
path: "/stats/activity",
|
|
1409
1576
|
summary: "Get SRS and notebase activity statistics",
|
|
1410
1577
|
tags: ["Statistics"]
|
|
1411
1578
|
}).input(statsInputSchema).output(activityStatsOutputSchema),
|
|
1412
|
-
srsMemoryGrowth:
|
|
1579
|
+
srsMemoryGrowth: oc.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND")).route({
|
|
1413
1580
|
method: "GET",
|
|
1414
1581
|
path: "/srs/stats/memory-growth",
|
|
1415
1582
|
summary: "Get SRS long-term memory growth statistics",
|
|
1416
1583
|
tags: ["Statistics"]
|
|
1417
1584
|
}).input(statsInputSchema).output(srsMemoryGrowthStatsOutputSchema),
|
|
1418
|
-
notebaseRowGrowth:
|
|
1585
|
+
notebaseRowGrowth: oc.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND")).route({
|
|
1419
1586
|
method: "GET",
|
|
1420
1587
|
path: "/notebases/stats/row-growth",
|
|
1421
1588
|
summary: "Get notebase row growth statistics",
|
|
@@ -1536,6 +1703,6 @@ const contract = {
|
|
|
1536
1703
|
}
|
|
1537
1704
|
};
|
|
1538
1705
|
//#endregion
|
|
1539
|
-
export { BetaAccessStatusInputSchema, BetaAccessStatusOutputSchema, BetaFeatureKeySchema, CardGenerateInputSchema, CardGenerateOutputSchema, CardGetInputSchema, CardGetOutputSchema, CardListInputSchema, CardListOutputSchema, CardTemplateCreateInputSchema, CardTemplateCreateOutputSchema, CardTemplateDeleteInputSchema, CardTemplateDeleteOutputSchema, CardTemplateGetInputSchema, CardTemplateGetOutputSchema, CardTemplateInvalidColumnsDataSchema, CardTemplateListInputSchema, CardTemplateListOutputSchema, CardTemplateUpdateInputSchema, CardTemplateUpdateOutputSchema, CellValidationFailedDataSchema, CellValidationFailureDetailsSchema, CellValidationFailureReasonSchema, HOSTED_AI_CLIENT_STREAM_PART_TYPES, HOSTED_AI_NOTE_SUGGESTION_MAX_NOTES, HOSTED_AI_NOTE_SUGGESTION_MAX_NOTE_FIELDS, HostedAiCreditPeriodKindSchema, HostedAiCreditPolicyIdSchema, HostedAiCreditStatusSchema, HostedAiFeatureSchema, HostedAiFeatureStatusSchema, HostedAiModelTierSchema, HostedAiNoteSuggestionObjectSchema, HostedAiNoteSuggestionStreamInputSchema, HostedAiOutputFieldSchema, HostedAiOutputFieldTypeSchema, HostedAiQuotaExhaustedDataSchema, HostedAiQuotaScopeSchema, HostedAiRateLimitErrorDataSchema, HostedAiRequestIdSchema, HostedAiStatusInputSchema, HostedAiStatusOutputSchema, HostedAiStreamPartSchema, HostedAiStreamStructuredObjectInputSchema, HostedAiStreamTextInputSchema, HostedAiTierRestrictedDataSchema, HostedAiTierStatusSchema, HostedAiUnavailableReasonSchema, NOTEBASE_ROW_CREATE_MANY_MAX_ROWS, NotebaseColumnCreateInputSchema, NotebaseColumnCreateOutputSchema, NotebaseColumnDeleteInputSchema, NotebaseColumnDeleteOutputSchema, NotebaseColumnReorderInputSchema, NotebaseColumnReorderOutputSchema, NotebaseColumnUpdateInputSchema, NotebaseColumnUpdateOutputSchema, NotebaseCreateInputSchema, NotebaseCreateOutputSchema, NotebaseDeleteInputSchema, NotebaseDeleteOutputSchema, NotebaseGetInputSchema, NotebaseGetOutputSchema, NotebaseGetSchemaInputSchema, NotebaseGetSchemaOutputSchema, NotebaseListInputSchema, NotebaseListItemSchema, NotebaseListOutputSchema, NotebaseRowCreateInputSchema, NotebaseRowCreateManyInputSchema, NotebaseRowCreateManyOutputSchema, NotebaseRowCreateOutputSchema, NotebaseRowDeleteInputSchema, NotebaseRowDeleteOutputSchema, NotebaseRowReorderInputSchema, NotebaseRowReorderOutputSchema, NotebaseRowUpdateInputSchema, NotebaseRowUpdateOutputSchema, NotebaseUpdateInputSchema, NotebaseUpdateOutputSchema, PUBLIC_APP_ERROR_DEFS, SRS_REVIEW_CLIENT_ID_NAMESPACE, SRS_REVIEW_DURATION_MS_MAX, activityStatsOutputSchema, billingAccessSourceSchema, billingCancelScheduledChangeOutputSchema, billingCheckoutPlanSchema, billingCreateCheckoutSessionInputSchema, billingCreateCustomerPortalSessionInputSchema, billingCurrencySchema, billingIntervalSchema, billingLocaleSchema, billingPlanSchema, billingScheduledChangeSchema, billingSessionUrlOutputSchema, billingStatusSchema, billingSubscriptionStatusSchema, cardSchema, cardStateSchema, cardTemplateSchema, contract, createSrsReviewClientId, ebookCoverContentTypeSchema, ebookDeleteInputSchema, ebookDeleteOutputSchema, ebookDetailSchema, ebookFinalizeUploadInputSchema, ebookFinalizeUploadOutputSchema, ebookGetDownloadUrlInputSchema, ebookGetDownloadUrlOutputSchema, ebookGetInputSchema, ebookGetOutputSchema, ebookListInputSchema, ebookListItemSchema, ebookListOutputSchema, ebookPresignedPostSchema, ebookQuotaSchema, ebookRenameDataSchema, ebookRenameInputSchema, ebookRenameOutputSchema, ebookRequestUploadInputSchema, ebookRequestUploadOutputSchema, ebookStatusSchema, ebookUpdateProgressDataSchema, ebookUpdateProgressInputSchema, ebookUpdateProgressOutputSchema, getPublicErrorDefinition, isPublicAppErrorCode, notebaseActivityStatsItemSchema, notebaseActivityStatsOutputSchema, notebaseColumnCreateDataSchema, notebaseColumnSchema, notebaseColumnUpdateDataSchema, notebaseColumnWidthSchema, notebaseCreateDataSchema, notebaseRowCellsSchema, notebaseRowCreateDataSchema, notebaseRowGrowthStatsItemSchema, notebaseRowGrowthStatsOutputSchema, notebaseRowSchema, notebaseRowUpdateDataSchema, notebaseSchema, notebaseUpdateDataSchema, notebaseViewConfigSchema, notebaseViewCreateDataSchema, notebaseViewFilterSchema, notebaseViewFiltersSchema, notebaseViewSchema, notebaseViewSortSchema, notebaseViewSortsSchema, notebaseViewTypeSchema, notebaseViewUpdateDataSchema, pickPublicErrorMap, renderedCardSchema, reviewRatingSchema, scheduleStatusSchema, schedulingParamsSchema, srsActivityStatsItemSchema, srsActivityStatsOutputSchema, srsListCardRevlogsInputSchema, srsListCardRevlogsOutputSchema, srsManualCardStatusInputSchema, srsMemoryGrowthStatsItemSchema, srsMemoryGrowthStatsOutputSchema, srsReviewInputSchema, srsReviewOutputSchema, srsRevlogSchema, srsRevlogWithoutSnapshotSchema, srsRollbackReviewInputSchema, srsRollbackReviewOutputSchema, srsScheduleStatusStatsInputSchema, srsScheduleStatusStatsOutputSchema, srsScheduleStatusStatsSchema, srsSetCardBuriedInputSchema, srsSetCardBuriedOutputSchema, srsSetCardSuspendedInputSchema, srsSetCardSuspendedOutputSchema, srsTxidOutputSchema, statsInputSchema, stepSchema, timezoneSchema, userEnsureTimezoneInputSchema, userEnsureTimezoneOutputSchema, userUpdateTimezoneInputSchema, userUpdateTimezoneOutputSchema, videoTranscriptCreateInputSchema, videoTranscriptGetInputSchema, videoTranscriptResourceSchema, videoTranscriptStatusSchema, videoTranscriptSubtitlesSchema, videoTranscriptUsagePoolSchema, videoTranscriptUsageSchema };
|
|
1706
|
+
export { BetaAccessStatusInputSchema, BetaAccessStatusOutputSchema, BetaFeatureKeySchema, CardGenerateInputSchema, CardGenerateOutputSchema, CardGetInputSchema, CardGetOutputSchema, CardListInputSchema, CardListOutputSchema, CardTemplateCreateInputSchema, CardTemplateCreateOutputSchema, CardTemplateDeleteInputSchema, CardTemplateDeleteOutputSchema, CardTemplateGetInputSchema, CardTemplateGetOutputSchema, CardTemplateInvalidColumnsDataSchema, CardTemplateListInputSchema, CardTemplateListOutputSchema, CardTemplateUpdateInputSchema, CardTemplateUpdateOutputSchema, CellValidationFailedDataSchema, CellValidationFailureDetailsSchema, CellValidationFailureReasonSchema, HOSTED_AI_CLIENT_STREAM_PART_TYPES, HOSTED_AI_NOTE_SUGGESTION_MAX_NOTES, HOSTED_AI_NOTE_SUGGESTION_MAX_NOTE_FIELDS, HostedAiCreditPeriodKindSchema, HostedAiCreditPolicyIdSchema, HostedAiCreditStatusSchema, HostedAiFeatureSchema, HostedAiFeatureStatusSchema, HostedAiModelTierSchema, HostedAiNoteSuggestionObjectSchema, HostedAiNoteSuggestionStreamInputSchema, HostedAiOutputFieldSchema, HostedAiOutputFieldTypeSchema, HostedAiQuotaExhaustedDataSchema, HostedAiQuotaScopeSchema, HostedAiRateLimitErrorDataSchema, HostedAiRequestIdSchema, HostedAiStatusInputSchema, HostedAiStatusOutputSchema, HostedAiStreamPartSchema, HostedAiStreamStructuredObjectInputSchema, HostedAiStreamTextInputSchema, HostedAiTierRestrictedDataSchema, HostedAiTierStatusSchema, HostedAiUnavailableReasonSchema, NOTEBASE_ROW_CREATE_MANY_MAX_ROWS, NotebaseColumnCreateInputSchema, NotebaseColumnCreateOutputSchema, NotebaseColumnDeleteInputSchema, NotebaseColumnDeleteOutputSchema, NotebaseColumnReorderInputSchema, NotebaseColumnReorderOutputSchema, NotebaseColumnUpdateInputSchema, NotebaseColumnUpdateOutputSchema, NotebaseCreateInputSchema, NotebaseCreateOutputSchema, NotebaseDeleteInputSchema, NotebaseDeleteOutputSchema, NotebaseGetInputSchema, NotebaseGetOutputSchema, NotebaseGetSchemaInputSchema, NotebaseGetSchemaOutputSchema, NotebaseGetSummaryInputSchema, NotebaseGetSummaryOutputSchema, NotebaseListInputSchema, NotebaseListItemSchema, NotebaseListOutputSchema, NotebaseRowCreateInputSchema, NotebaseRowCreateManyInputSchema, NotebaseRowCreateManyOutputSchema, NotebaseRowCreateOutputSchema, NotebaseRowDeleteInputSchema, NotebaseRowDeleteOutputSchema, NotebaseRowGetInputSchema, NotebaseRowGetOutputSchema, NotebaseRowListInputSchema, NotebaseRowListOutputSchema, NotebaseRowReorderInputSchema, NotebaseRowReorderOutputSchema, NotebaseRowUpdateInputSchema, NotebaseRowUpdateOutputSchema, NotebaseUpdateInputSchema, NotebaseUpdateOutputSchema, PUBLIC_APP_ERROR_DEFS, SRS_REVIEW_CLIENT_ID_NAMESPACE, SRS_REVIEW_DURATION_MS_MAX, activityStatsOutputSchema, billingAccessSourceSchema, billingCancelScheduledChangeOutputSchema, billingCheckoutPlanSchema, billingCreateCheckoutSessionInputSchema, billingCreateCustomerPortalSessionInputSchema, billingCurrencySchema, billingIntervalSchema, billingLocaleSchema, billingPlanSchema, billingScheduledChangeSchema, billingSessionUrlOutputSchema, billingStatusSchema, billingSubscriptionStatusSchema, cardSchema, cardStateSchema, cardTemplateSchema, contract, createSrsReviewClientId, defineAgentProcedure, deletionResultSchema, ebookCoverContentTypeSchema, ebookDeleteInputSchema, ebookDeleteOutputSchema, ebookDetailSchema, ebookFinalizeUploadInputSchema, ebookFinalizeUploadOutputSchema, ebookGetDownloadUrlInputSchema, ebookGetDownloadUrlOutputSchema, ebookGetInputSchema, ebookGetOutputSchema, ebookListInputSchema, ebookListItemSchema, ebookListOutputSchema, ebookPresignedPostSchema, ebookQuotaSchema, ebookRenameDataSchema, ebookRenameInputSchema, ebookRenameOutputSchema, ebookRequestUploadInputSchema, ebookRequestUploadOutputSchema, ebookStatusSchema, ebookUpdateProgressDataSchema, ebookUpdateProgressInputSchema, ebookUpdateProgressOutputSchema, expectedUpdatedAtSchema, getPublicErrorDefinition, isPublicAppErrorCode, notebaseActivityStatsItemSchema, notebaseActivityStatsOutputSchema, notebaseColumnCreateDataSchema, notebaseColumnSchema, notebaseColumnUpdateDataSchema, notebaseColumnWidthSchema, notebaseCreateDataSchema, notebaseRowCellsSchema, notebaseRowCreateDataSchema, notebaseRowGrowthStatsItemSchema, notebaseRowGrowthStatsOutputSchema, notebaseRowSchema, notebaseRowUpdateDataSchema, notebaseSchema, notebaseSummarySchema, notebaseUpdateDataSchema, notebaseViewConfigSchema, notebaseViewCreateDataSchema, notebaseViewFilterSchema, notebaseViewFiltersSchema, notebaseViewSchema, notebaseViewSortSchema, notebaseViewSortsSchema, notebaseViewTypeSchema, notebaseViewUpdateDataSchema, pageSchema, paginationShape, pickPublicErrorMap, renderedCardSchema, reviewRatingSchema, scheduleStatusSchema, schedulingParamsSchema, srsAcknowledgeOptimizerResultsInputSchema, srsAcknowledgeOptimizerResultsOutputSchema, srsActivityStatsItemSchema, srsActivityStatsOutputSchema, srsListCardRevlogsInputSchema, srsListCardRevlogsOutputSchema, srsListUnreadOptimizerResultsInputSchema, srsListUnreadOptimizerResultsOutputSchema, srsManualCardStatusInputSchema, srsMemoryGrowthStatsItemSchema, srsMemoryGrowthStatsOutputSchema, srsOptimizerUnreadResultSchema, srsReviewInputSchema, srsReviewOutputSchema, srsRevlogSchema, srsRevlogWithoutSnapshotSchema, srsRollbackReviewInputSchema, srsRollbackReviewOutputSchema, srsScheduleStatusStatsInputSchema, srsScheduleStatusStatsOutputSchema, srsScheduleStatusStatsSchema, srsSetCardBuriedInputSchema, srsSetCardBuriedOutputSchema, srsSetCardSuspendedInputSchema, srsSetCardSuspendedOutputSchema, srsTxidOutputSchema, statsInputSchema, stepSchema, timezoneSchema, userEnsureTimezoneInputSchema, userEnsureTimezoneOutputSchema, userUpdateTimezoneInputSchema, userUpdateTimezoneOutputSchema, videoTranscriptCreateInputSchema, videoTranscriptGetInputSchema, videoTranscriptResourceSchema, videoTranscriptStatusSchema, videoTranscriptSubtitlesSchema, videoTranscriptUsagePoolSchema, videoTranscriptUsageSchema };
|
|
1540
1707
|
|
|
1541
1708
|
//# sourceMappingURL=index.js.map
|