@read-frog/api-contract 0.6.1 → 0.8.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.js CHANGED
@@ -1,5 +1,5 @@
1
- import { oc } from "@orpc/contract";
2
- import { BETA_FEATURE_KEYS, NOTEBASE_COLUMN_MAX_WIDTH, NOTEBASE_COLUMN_MIN_WIDTH, SRS_REVIEW_DURATION_MS_MAX, cardIdentityShape, cardMemoryStateShape, cardStateSchema, cardStateSchema as cardStateSchema$1, cardTemplateConfigSchema, fsrsReviewLogSnapshotSchema, notebaseColumnConfigSchema, reviewRatingSchema, scheduleStatusSchema, scheduleStatusSchema as scheduleStatusSchema$1, schedulingParamsSchema, schedulingParamsShape, srsStepSchema, srsWeightsSchema } from "@read-frog/definitions";
1
+ import { eventIterator, oc } from "@orpc/contract";
2
+ import { BETA_FEATURE_KEYS, NOTEBASE_COLUMN_MAX_WIDTH, NOTEBASE_COLUMN_MIN_WIDTH, SRS_REVIEW_DURATION_MS_MAX, activeScheduleStatusSchema, cardIdentityShape, cardMemoryStateShape, cardStateSchema, cardStateSchema as cardStateSchema$1, cardTemplateConfigSchema, fsrsReviewLogSnapshotSchema, notebaseColumnConfigSchema, reviewRatingSchema, scheduleStatusSchema, scheduleStatusSchema as scheduleStatusSchema$1, schedulingParamsSchema, schedulingParamsShape, srsStepSchema, srsWeightsSchema } from "@read-frog/definitions";
3
3
  import { z } from "zod";
4
4
  //#region src/schemas/beta-access.ts
5
5
  const BetaFeatureKeySchema = z.enum(BETA_FEATURE_KEYS);
@@ -83,6 +83,26 @@ const PUBLIC_APP_ERROR_DEFS = {
83
83
  message: "Card review cannot be rolled back",
84
84
  status: 409
85
85
  },
86
+ CARD_ALREADY_BURIED: {
87
+ message: "Card is already buried",
88
+ status: 409
89
+ },
90
+ CARD_NOT_BURIED: {
91
+ message: "Card is not buried",
92
+ status: 409
93
+ },
94
+ CARD_ALREADY_SUSPENDED: {
95
+ message: "Card is already suspended",
96
+ status: 409
97
+ },
98
+ CARD_NOT_SUSPENDED: {
99
+ message: "Card is not suspended",
100
+ status: 409
101
+ },
102
+ CARD_STATUS_CHANGE_UNAVAILABLE: {
103
+ message: "Card status change is unavailable",
104
+ status: 409
105
+ },
86
106
  NOTEBASE_VIEW_NOT_FOUND: {
87
107
  message: "Notebase view not found",
88
108
  status: 404
@@ -237,6 +257,58 @@ const cardTemplateContract = {
237
257
  }).input(CardTemplateDeleteInputSchema).output(CardTemplateDeleteOutputSchema)
238
258
  };
239
259
  //#endregion
260
+ //#region src/schemas/hosted-ai.ts
261
+ const HostedAiOutputFieldTypeSchema = z.enum(["string", "number"]);
262
+ const HostedAiOutputFieldSchema = z.strictObject({
263
+ name: z.string().trim().min(1).max(80),
264
+ type: HostedAiOutputFieldTypeSchema
265
+ });
266
+ const HostedAiStreamTextInputSchema = z.strictObject({
267
+ system: z.string().trim().min(1).max(16e3),
268
+ prompt: z.string().trim().min(1).max(32e3),
269
+ temperature: z.number().min(0).max(2).optional()
270
+ });
271
+ const HostedAiStreamStructuredObjectInputSchema = z.strictObject({
272
+ system: z.string().trim().min(1).max(16e3),
273
+ prompt: z.string().trim().min(1).max(32e3),
274
+ outputSchema: z.array(HostedAiOutputFieldSchema).min(1).max(32),
275
+ temperature: z.number().min(0).max(2).optional()
276
+ }).superRefine((input, ctx) => {
277
+ const fieldNames = /* @__PURE__ */ new Set();
278
+ input.outputSchema.forEach((field, index) => {
279
+ if (fieldNames.has(field.name)) {
280
+ ctx.addIssue({
281
+ code: "custom",
282
+ message: `Duplicate output schema name "${field.name}".`,
283
+ path: [
284
+ "outputSchema",
285
+ index,
286
+ "name"
287
+ ]
288
+ });
289
+ return;
290
+ }
291
+ fieldNames.add(field.name);
292
+ });
293
+ });
294
+ const HostedAiStreamPartSchema = z.looseObject({ type: z.string().trim().min(1) });
295
+ //#endregion
296
+ //#region src/contracts/hosted-ai.ts
297
+ const hostedAiContract = {
298
+ translate: { streamText: oc.route({
299
+ method: "POST",
300
+ path: "/hosted-ai/translate/stream-text",
301
+ summary: "Stream hosted translation text output",
302
+ tags: ["Hosted AI"]
303
+ }).input(HostedAiStreamTextInputSchema).output(eventIterator(HostedAiStreamPartSchema)) },
304
+ customAction: { streamStructuredObject: oc.route({
305
+ method: "POST",
306
+ path: "/hosted-ai/custom-actions/stream-structured-object",
307
+ summary: "Stream hosted custom action structured output",
308
+ tags: ["Hosted AI"]
309
+ }).input(HostedAiStreamStructuredObjectInputSchema).output(eventIterator(HostedAiStreamPartSchema)) }
310
+ };
311
+ //#endregion
240
312
  //#region src/schemas/notebase-column.ts
241
313
  const notebaseColumnWidthSchema = z.number().int().min(NOTEBASE_COLUMN_MIN_WIDTH).max(NOTEBASE_COLUMN_MAX_WIDTH);
242
314
  const notebaseColumnSchema = z.object({
@@ -395,11 +467,26 @@ const notebaseSchema = z.object({
395
467
  });
396
468
  const notebaseCreateDataSchema = z.object({
397
469
  id: z.uuid().optional(),
398
- name: z.string().min(1)
470
+ name: z.string().min(1),
471
+ options: z.object({
472
+ initialColumns: z.array(z.object({
473
+ id: z.uuid(),
474
+ name: z.string().min(1),
475
+ config: notebaseColumnConfigSchema
476
+ }).strict()).min(1),
477
+ initialRow: z.object({
478
+ id: z.uuid().optional(),
479
+ cells: z.record(z.string(), z.unknown())
480
+ }).strict().optional()
481
+ }).strict().optional()
399
482
  }).strict();
400
483
  const NotebaseCreateInputSchema = notebaseCreateDataSchema;
401
484
  const NotebaseCreateOutputSchema = z.object({ txid: z.number() });
402
- const notebaseUpdateDataSchema = z.object({ name: z.string().min(1).optional() }).strict();
485
+ const notebaseUpdateDataSchema = z.object({
486
+ name: z.string().min(1).optional(),
487
+ srsNewPerDay: schedulingParamsShape.newPerDay.optional(),
488
+ srsReviewsPerDay: schedulingParamsShape.reviewsPerDay.optional()
489
+ }).strict();
403
490
  const NotebaseUpdateInputSchema = notebaseUpdateDataSchema.extend({ id: z.uuid() });
404
491
  const NotebaseUpdateOutputSchema = z.object({ txid: z.number() });
405
492
  const NotebaseDeleteInputSchema = z.object({ id: z.uuid() });
@@ -551,6 +638,18 @@ const srsReviewInputSchema = z.object({
551
638
  timezone: timezoneSchema
552
639
  }).strict();
553
640
  const srsRollbackReviewInputSchema = z.object({ cardId: z.uuid() }).strict();
641
+ const srsScheduleStatusStatsSchema = z.record(activeScheduleStatusSchema, z.number().int().min(0));
642
+ const srsScheduleStatusStatsInputSchema = z.object({
643
+ notebaseIds: z.array(z.uuid()).optional(),
644
+ timezone: timezoneSchema
645
+ }).strict();
646
+ const srsScheduleStatusStatsOutputSchema = z.record(z.uuid(), srsScheduleStatusStatsSchema);
647
+ const srsManualCardStatusInputSchema = z.object({
648
+ cardId: z.uuid(),
649
+ enabled: z.boolean()
650
+ }).strict();
651
+ const srsSetCardBuriedInputSchema = srsManualCardStatusInputSchema;
652
+ const srsSetCardSuspendedInputSchema = srsManualCardStatusInputSchema;
554
653
  const srsRevlogSchema = z.object({
555
654
  id: z.uuid(),
556
655
  notebaseId: z.uuid(),
@@ -563,6 +662,7 @@ const srsRevlogSchema = z.object({
563
662
  fsrsReviewLogSnapshot: fsrsReviewLogSnapshotSchema,
564
663
  createdAt: z.coerce.date()
565
664
  });
665
+ const srsRevlogWithoutSnapshotSchema = srsRevlogSchema.omit({ fsrsReviewLogSnapshot: true });
566
666
  const srsReviewOutputSchema = z.object({
567
667
  card: cardSchema,
568
668
  revlog: srsRevlogSchema,
@@ -573,6 +673,9 @@ const srsRollbackReviewOutputSchema = z.object({
573
673
  rolledBackRevlogId: z.uuid(),
574
674
  txid: z.number()
575
675
  });
676
+ const srsTxidOutputSchema = z.object({ txid: z.number() });
677
+ const srsSetCardBuriedOutputSchema = srsTxidOutputSchema;
678
+ const srsSetCardSuspendedOutputSchema = srsTxidOutputSchema;
576
679
  function formatLastReviewTime(lastReviewTime) {
577
680
  return lastReviewTime ? new Date(lastReviewTime).toISOString() : nullLastReviewTimeSentinel;
578
681
  }
@@ -592,6 +695,7 @@ async function uuidV5(name, namespace) {
592
695
  }
593
696
  function uuidToBytes(uuid) {
594
697
  const hex = uuid.replaceAll("-", "").toLowerCase();
698
+ /* v8 ignore next 3 -- SRS_REVIEW_CLIENT_ID_NAMESPACE is a fixed valid UUID. */
595
699
  if (!/^[0-9a-f]{32}$/.test(hex)) throw new Error("Invalid UUID namespace");
596
700
  return new Uint8Array(Array.from({ length: 16 }, (_, index) => Number.parseInt(hex.slice(index * 2, index * 2 + 2), 16)));
597
701
  }
@@ -608,6 +712,12 @@ function bytesToUuid(bytes) {
608
712
  //#endregion
609
713
  //#region src/contracts/srs.ts
610
714
  const srsContract = {
715
+ scheduleStatusStats: notebaseProcedure.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND")).route({
716
+ method: "GET",
717
+ path: "/srs/schedule-status-stats",
718
+ summary: "List today schedule status stats for notebases",
719
+ tags: ["SRS"]
720
+ }).input(srsScheduleStatusStatsInputSchema).output(srsScheduleStatusStatsOutputSchema),
611
721
  review: notebaseProcedure.errors(pickPublicErrorMap("CARD_NOT_FOUND", "CARD_NOT_REVIEWABLE", "CARD_REVIEW_STATE_STALE")).route({
612
722
  method: "POST",
613
723
  path: "/srs/review",
@@ -619,7 +729,19 @@ const srsContract = {
619
729
  path: "/srs/review/rollback",
620
730
  summary: "Roll back the latest SRS review for a card",
621
731
  tags: ["SRS"]
622
- }).input(srsRollbackReviewInputSchema).output(srsRollbackReviewOutputSchema)
732
+ }).input(srsRollbackReviewInputSchema).output(srsRollbackReviewOutputSchema),
733
+ setCardBuried: notebaseProcedure.errors(pickPublicErrorMap("CARD_NOT_FOUND", "CARD_ALREADY_BURIED", "CARD_NOT_BURIED", "CARD_STATUS_CHANGE_UNAVAILABLE")).route({
734
+ method: "POST",
735
+ path: "/srs/card/bury",
736
+ summary: "Manually bury or unbury a card",
737
+ tags: ["SRS"]
738
+ }).input(srsSetCardBuriedInputSchema).output(srsSetCardBuriedOutputSchema),
739
+ setCardSuspended: notebaseProcedure.errors(pickPublicErrorMap("CARD_NOT_FOUND", "CARD_ALREADY_SUSPENDED", "CARD_NOT_SUSPENDED", "CARD_STATUS_CHANGE_UNAVAILABLE")).route({
740
+ method: "POST",
741
+ path: "/srs/card/suspend",
742
+ summary: "Manually suspend or unsuspend a card",
743
+ tags: ["SRS"]
744
+ }).input(srsSetCardSuspendedInputSchema).output(srsSetCardSuspendedOutputSchema)
623
745
  };
624
746
  //#endregion
625
747
  //#region src/schemas/user.ts
@@ -628,24 +750,35 @@ const userEnsureTimezoneOutputSchema = z.object({
628
750
  timezone: timezoneSchema,
629
751
  updated: z.boolean()
630
752
  }).strict();
753
+ const userUpdateTimezoneInputSchema = z.object({ timezone: timezoneSchema }).strict();
754
+ const userUpdateTimezoneOutputSchema = z.object({ timezone: timezoneSchema }).strict();
631
755
  //#endregion
632
756
  //#region src/index.ts
633
757
  const contract = {
634
758
  betaAccess: betaAccessContract,
635
759
  card: cardContract,
636
760
  cardTemplate: cardTemplateContract,
761
+ hostedAi: hostedAiContract,
637
762
  notebase: notebaseContract,
638
763
  notebaseColumn: notebaseColumnContract,
639
764
  notebaseRow: notebaseRowContract,
640
765
  srs: srsContract,
641
- user: { ensureTimezone: oc.route({
642
- method: "POST",
643
- path: "/users/me/timezone/ensure",
644
- summary: "Ensure the authenticated user has a timezone",
645
- tags: ["Users"]
646
- }).input(userEnsureTimezoneInputSchema).output(userEnsureTimezoneOutputSchema) }
766
+ user: {
767
+ ensureTimezone: oc.route({
768
+ method: "POST",
769
+ path: "/users/me/timezone/ensure",
770
+ summary: "Ensure the authenticated user has a timezone",
771
+ tags: ["Users"]
772
+ }).input(userEnsureTimezoneInputSchema).output(userEnsureTimezoneOutputSchema),
773
+ updateTimezone: oc.route({
774
+ method: "PATCH",
775
+ path: "/users/me/timezone",
776
+ summary: "Update the authenticated user's timezone",
777
+ tags: ["Users"]
778
+ }).input(userUpdateTimezoneInputSchema).output(userUpdateTimezoneOutputSchema)
779
+ }
647
780
  };
648
781
  //#endregion
649
- export { BetaAccessStatusInputSchema, BetaAccessStatusOutputSchema, BetaFeatureKeySchema, CardGenerateInputSchema, CardGenerateOutputSchema, CardGetInputSchema, CardGetOutputSchema, CardListInputSchema, CardListOutputSchema, CardTemplateCreateInputSchema, CardTemplateCreateOutputSchema, CardTemplateDeleteInputSchema, CardTemplateDeleteOutputSchema, CardTemplateGetInputSchema, CardTemplateGetOutputSchema, CardTemplateInvalidColumnsDataSchema, CardTemplateListInputSchema, CardTemplateListOutputSchema, CardTemplateUpdateInputSchema, CardTemplateUpdateOutputSchema, CellValidationFailedDataSchema, CellValidationFailureDetailsSchema, CellValidationFailureReasonSchema, NotebaseColumnCreateInputSchema, NotebaseColumnCreateOutputSchema, NotebaseColumnDeleteInputSchema, NotebaseColumnDeleteOutputSchema, NotebaseColumnReorderInputSchema, NotebaseColumnReorderOutputSchema, NotebaseColumnUpdateInputSchema, NotebaseColumnUpdateOutputSchema, NotebaseCreateInputSchema, NotebaseCreateOutputSchema, NotebaseDeleteInputSchema, NotebaseDeleteOutputSchema, NotebaseGetInputSchema, NotebaseGetOutputSchema, NotebaseGetSchemaInputSchema, NotebaseGetSchemaOutputSchema, NotebaseListInputSchema, NotebaseListItemSchema, NotebaseListOutputSchema, NotebaseRowCreateInputSchema, NotebaseRowCreateOutputSchema, NotebaseRowDeleteInputSchema, NotebaseRowDeleteOutputSchema, NotebaseRowReorderInputSchema, NotebaseRowReorderOutputSchema, NotebaseRowUpdateInputSchema, NotebaseRowUpdateOutputSchema, NotebaseUpdateInputSchema, NotebaseUpdateOutputSchema, PUBLIC_APP_ERROR_DEFS, SRS_REVIEW_CLIENT_ID_NAMESPACE, SRS_REVIEW_DURATION_MS_MAX, cardSchema, cardStateSchema, cardTemplateSchema, contract, createSrsReviewClientId, getPublicErrorDefinition, isPublicAppErrorCode, notebaseColumnCreateDataSchema, notebaseColumnSchema, notebaseColumnUpdateDataSchema, notebaseColumnWidthSchema, notebaseCreateDataSchema, notebaseRowCellsSchema, notebaseRowCreateDataSchema, notebaseRowSchema, notebaseRowUpdateDataSchema, notebaseSchema, notebaseUpdateDataSchema, notebaseViewConfigSchema, notebaseViewCreateDataSchema, notebaseViewFilterSchema, notebaseViewFiltersSchema, notebaseViewSchema, notebaseViewSortSchema, notebaseViewSortsSchema, notebaseViewTypeSchema, notebaseViewUpdateDataSchema, pickPublicErrorMap, renderedCardSchema, reviewRatingSchema, scheduleStatusSchema, schedulingParamsSchema, srsReviewInputSchema, srsReviewOutputSchema, srsRevlogSchema, srsRollbackReviewInputSchema, srsRollbackReviewOutputSchema, stepSchema, timezoneSchema, userEnsureTimezoneInputSchema, userEnsureTimezoneOutputSchema };
782
+ export { BetaAccessStatusInputSchema, BetaAccessStatusOutputSchema, BetaFeatureKeySchema, CardGenerateInputSchema, CardGenerateOutputSchema, CardGetInputSchema, CardGetOutputSchema, CardListInputSchema, CardListOutputSchema, CardTemplateCreateInputSchema, CardTemplateCreateOutputSchema, CardTemplateDeleteInputSchema, CardTemplateDeleteOutputSchema, CardTemplateGetInputSchema, CardTemplateGetOutputSchema, CardTemplateInvalidColumnsDataSchema, CardTemplateListInputSchema, CardTemplateListOutputSchema, CardTemplateUpdateInputSchema, CardTemplateUpdateOutputSchema, CellValidationFailedDataSchema, CellValidationFailureDetailsSchema, CellValidationFailureReasonSchema, HostedAiOutputFieldSchema, HostedAiOutputFieldTypeSchema, HostedAiStreamPartSchema, HostedAiStreamStructuredObjectInputSchema, HostedAiStreamTextInputSchema, NotebaseColumnCreateInputSchema, NotebaseColumnCreateOutputSchema, NotebaseColumnDeleteInputSchema, NotebaseColumnDeleteOutputSchema, NotebaseColumnReorderInputSchema, NotebaseColumnReorderOutputSchema, NotebaseColumnUpdateInputSchema, NotebaseColumnUpdateOutputSchema, NotebaseCreateInputSchema, NotebaseCreateOutputSchema, NotebaseDeleteInputSchema, NotebaseDeleteOutputSchema, NotebaseGetInputSchema, NotebaseGetOutputSchema, NotebaseGetSchemaInputSchema, NotebaseGetSchemaOutputSchema, NotebaseListInputSchema, NotebaseListItemSchema, NotebaseListOutputSchema, NotebaseRowCreateInputSchema, NotebaseRowCreateOutputSchema, NotebaseRowDeleteInputSchema, NotebaseRowDeleteOutputSchema, NotebaseRowReorderInputSchema, NotebaseRowReorderOutputSchema, NotebaseRowUpdateInputSchema, NotebaseRowUpdateOutputSchema, NotebaseUpdateInputSchema, NotebaseUpdateOutputSchema, PUBLIC_APP_ERROR_DEFS, SRS_REVIEW_CLIENT_ID_NAMESPACE, SRS_REVIEW_DURATION_MS_MAX, cardSchema, cardStateSchema, cardTemplateSchema, contract, createSrsReviewClientId, getPublicErrorDefinition, isPublicAppErrorCode, notebaseColumnCreateDataSchema, notebaseColumnSchema, notebaseColumnUpdateDataSchema, notebaseColumnWidthSchema, notebaseCreateDataSchema, notebaseRowCellsSchema, notebaseRowCreateDataSchema, notebaseRowSchema, notebaseRowUpdateDataSchema, notebaseSchema, notebaseUpdateDataSchema, notebaseViewConfigSchema, notebaseViewCreateDataSchema, notebaseViewFilterSchema, notebaseViewFiltersSchema, notebaseViewSchema, notebaseViewSortSchema, notebaseViewSortsSchema, notebaseViewTypeSchema, notebaseViewUpdateDataSchema, pickPublicErrorMap, renderedCardSchema, reviewRatingSchema, scheduleStatusSchema, schedulingParamsSchema, srsManualCardStatusInputSchema, srsReviewInputSchema, srsReviewOutputSchema, srsRevlogSchema, srsRevlogWithoutSnapshotSchema, srsRollbackReviewInputSchema, srsRollbackReviewOutputSchema, srsScheduleStatusStatsInputSchema, srsScheduleStatusStatsOutputSchema, srsScheduleStatusStatsSchema, srsSetCardBuriedInputSchema, srsSetCardBuriedOutputSchema, srsSetCardSuspendedInputSchema, srsSetCardSuspendedOutputSchema, srsTxidOutputSchema, stepSchema, timezoneSchema, userEnsureTimezoneInputSchema, userEnsureTimezoneOutputSchema, userUpdateTimezoneInputSchema, userUpdateTimezoneOutputSchema };
650
783
 
651
784
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["cardStateSchema","scheduleStatusSchema"],"sources":["../src/schemas/beta-access.ts","../src/contracts/beta-access.ts","../src/public-errors.ts","../src/schemas/card.ts","../src/contracts/shared.ts","../src/contracts/card.ts","../src/contracts/card-template.ts","../src/schemas/notebase-column.ts","../src/schemas/notebase-row.ts","../src/schemas/notebase-view.ts","../src/schemas/notebase.ts","../src/contracts/notebase.ts","../src/contracts/notebase-column.ts","../src/contracts/notebase-row.ts","../src/schemas/timezone.ts","../src/schemas/srs.ts","../src/contracts/srs.ts","../src/schemas/user.ts","../src/contracts/user.ts","../src/index.ts"],"sourcesContent":["import { BETA_FEATURE_KEYS } from \"@read-frog/definitions\"\nimport { z } from \"zod\"\n\nexport const BetaFeatureKeySchema = z.enum(BETA_FEATURE_KEYS)\nexport type BetaFeatureKey = z.infer<typeof BetaFeatureKeySchema>\n\nexport const BetaAccessStatusInputSchema = z.object({\n featureKey: BetaFeatureKeySchema,\n}).strict()\nexport type BetaAccessStatusInput = z.infer<typeof BetaAccessStatusInputSchema>\n\nexport const BetaAccessStatusOutputSchema = z.object({\n featureKey: BetaFeatureKeySchema,\n allowed: z.boolean(),\n})\nexport type BetaAccessStatusOutput = z.infer<typeof BetaAccessStatusOutputSchema>\n","import { oc } from \"@orpc/contract\"\nimport {\n BetaAccessStatusInputSchema,\n BetaAccessStatusOutputSchema,\n} from \"#/schemas/beta-access\"\n\nexport const betaAccessContract = {\n status: oc\n .route({\n method: \"GET\",\n path: \"/beta-access/status\",\n summary: \"Get beta access status for a feature\",\n tags: [\"Beta Access\"],\n })\n .input(BetaAccessStatusInputSchema)\n .output(BetaAccessStatusOutputSchema),\n}\n","import type { ErrorMap } from \"@orpc/contract\"\nimport { z } from \"zod\"\n\ninterface PublicAppErrorDefinition {\n data?: z.ZodTypeAny\n message: string\n status: number\n}\n\nexport const CellValidationFailureReasonSchema = z.enum([\n \"unknown_notebase_column\",\n \"type_mismatch\",\n \"invalid_select_option\",\n \"invalid_date_format\",\n])\nexport type CellValidationFailureReason = z.infer<typeof CellValidationFailureReasonSchema>\n\nexport const CellValidationFailureDetailsSchema = z.object({\n expectedFormat: z.string().optional(),\n expectedType: z.string().optional(),\n receivedType: z.string().optional(),\n receivedValue: z.unknown().optional(),\n validOptions: z.array(z.string()).optional(),\n}).strict()\nexport type CellValidationFailureDetails = z.infer<typeof CellValidationFailureDetailsSchema>\n\nexport const CellValidationFailedDataSchema = z.object({\n notebaseColumnId: z.string(),\n details: CellValidationFailureDetailsSchema,\n reason: CellValidationFailureReasonSchema,\n}).strict()\nexport type CellValidationFailedData = z.infer<typeof CellValidationFailedDataSchema>\n\nexport const CardTemplateInvalidColumnsDataSchema = z.object({\n notebaseColumnIds: z.array(z.string()),\n}).strict()\nexport type CardTemplateInvalidColumnsData = z.infer<typeof CardTemplateInvalidColumnsDataSchema>\n\nexport const PUBLIC_APP_ERROR_DEFS = {\n NOTEBASE_BETA_RESTRICTED: {\n message: \"Notebase is currently in beta for selected accounts\",\n status: 403,\n },\n NOTEBASE_NOT_FOUND: {\n message: \"Notebase not found\",\n status: 404,\n },\n NOTEBASE_COLUMN_NOT_FOUND: {\n message: \"Notebase column not found\",\n status: 404,\n },\n NOTEBASE_ROW_NOT_FOUND: {\n message: \"Notebase row not found\",\n status: 404,\n },\n CARD_NOT_FOUND: {\n message: \"Card not found\",\n status: 404,\n },\n CARD_TEMPLATE_NOT_FOUND: {\n message: \"Card template not found\",\n status: 404,\n },\n CARD_TEMPLATE_INVALID_NOTEBASE_COLUMNS: {\n data: CardTemplateInvalidColumnsDataSchema,\n message: \"Card template references unknown notebase columns\",\n status: 422,\n },\n CARD_TEMPLATE_NOTEBASE_COLUMN_IN_USE: {\n message: \"Notebase column is used by a card template\",\n status: 409,\n },\n CARD_NOT_REVIEWABLE: {\n message: \"Card cannot be reviewed in its current state\",\n status: 409,\n },\n CARD_REVIEW_STATE_STALE: {\n message: \"Card review state is stale\",\n status: 409,\n },\n CARD_REVIEW_ROLLBACK_UNAVAILABLE: {\n message: \"Card review cannot be rolled back\",\n status: 409,\n },\n NOTEBASE_VIEW_NOT_FOUND: {\n message: \"Notebase view not found\",\n status: 404,\n },\n CELL_VALIDATION_FAILED: {\n data: CellValidationFailedDataSchema,\n message: \"Cell validation failed\",\n status: 422,\n },\n PRIMARY_NOTEBASE_COLUMN_DELETE_NOT_ALLOWED: {\n message: \"Cannot delete primary notebase column\",\n status: 400,\n },\n CONCURRENT_POSITION_CONFLICT: {\n message: \"Concurrent position conflict, please retry\",\n status: 409,\n },\n} as const satisfies Record<string, PublicAppErrorDefinition>\n\nexport type PublicAppErrorCode = keyof typeof PUBLIC_APP_ERROR_DEFS\n\nexport type PublicAppErrorData<TCode extends PublicAppErrorCode>\n = (typeof PUBLIC_APP_ERROR_DEFS)[TCode] extends { data: infer TSchema extends z.ZodTypeAny }\n ? z.output<TSchema>\n : undefined\n\nexport function isPublicAppErrorCode(code: string | undefined): code is PublicAppErrorCode {\n return code !== undefined && code in PUBLIC_APP_ERROR_DEFS\n}\n\nexport function getPublicErrorDefinition<TCode extends PublicAppErrorCode>(code: TCode) {\n return PUBLIC_APP_ERROR_DEFS[code]\n}\n\nexport function pickPublicErrorMap<const TCodes extends readonly PublicAppErrorCode[]>(\n ...codes: TCodes\n) {\n return Object.fromEntries(codes.map((code) => {\n const definition = PUBLIC_APP_ERROR_DEFS[code]\n\n if (\"data\" in definition) {\n return [code, {\n data: definition.data,\n message: definition.message,\n status: definition.status,\n }]\n }\n\n return [code, {\n message: definition.message,\n status: definition.status,\n }]\n })) as Pick<ErrorMap, TCodes[number]>\n}\n","import {\n cardIdentityShape,\n cardMemoryStateShape,\n cardStateSchema,\n cardTemplateConfigSchema,\n scheduleStatusSchema,\n} from \"@read-frog/definitions\"\nimport { z } from \"zod\"\n\nexport {\n cardStateSchema,\n scheduleStatusSchema,\n}\nexport type { CardState, ScheduleStatus } from \"@read-frog/definitions\"\n\nexport const cardTemplateSchema = z.object({\n id: z.uuid(),\n notebaseId: z.uuid(),\n name: z.string(),\n config: cardTemplateConfigSchema,\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n})\nexport type CardTemplate = z.infer<typeof cardTemplateSchema>\n\nexport const CardTemplateListInputSchema = z.object({\n notebaseId: z.uuid(),\n})\nexport type CardTemplateListInput = z.infer<typeof CardTemplateListInputSchema>\n\nexport const CardTemplateListOutputSchema = z.array(cardTemplateSchema)\nexport type CardTemplateListOutput = z.infer<typeof CardTemplateListOutputSchema>\n\nexport const CardTemplateGetInputSchema = z.object({\n id: z.uuid(),\n})\nexport type CardTemplateGetInput = z.infer<typeof CardTemplateGetInputSchema>\n\nexport const CardTemplateGetOutputSchema = cardTemplateSchema\nexport type CardTemplateGetOutput = z.infer<typeof CardTemplateGetOutputSchema>\n\nexport const CardTemplateCreateInputSchema = z.object({\n id: z.uuid().optional(),\n notebaseId: z.uuid(),\n name: z.string().min(1),\n config: cardTemplateConfigSchema,\n}).strict()\nexport type CardTemplateCreateInput = z.infer<typeof CardTemplateCreateInputSchema>\n\nexport const CardTemplateCreateOutputSchema = cardTemplateSchema.extend({\n txid: z.number(),\n})\nexport type CardTemplateCreateOutput = z.infer<typeof CardTemplateCreateOutputSchema>\n\nexport const CardTemplateUpdateInputSchema = z.object({\n id: z.uuid(),\n name: z.string().min(1).optional(),\n config: cardTemplateConfigSchema.optional(),\n}).strict()\nexport type CardTemplateUpdateInput = z.infer<typeof CardTemplateUpdateInputSchema>\n\nexport const CardTemplateUpdateOutputSchema = cardTemplateSchema.extend({\n txid: z.number(),\n})\nexport type CardTemplateUpdateOutput = z.infer<typeof CardTemplateUpdateOutputSchema>\n\nexport const CardTemplateDeleteInputSchema = z.object({\n id: z.uuid(),\n})\nexport type CardTemplateDeleteInput = z.infer<typeof CardTemplateDeleteInputSchema>\n\nexport const CardTemplateDeleteOutputSchema = z.object({\n txid: z.number(),\n})\nexport type CardTemplateDeleteOutput = z.infer<typeof CardTemplateDeleteOutputSchema>\n\nexport const cardSchema = z.object({\n ...cardIdentityShape,\n ...cardMemoryStateShape,\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n})\nexport type Card = z.infer<typeof cardSchema>\n\nexport const renderedCardSchema = cardSchema.extend({\n front: z.string(),\n back: z.string(),\n})\nexport type RenderedCard = z.infer<typeof renderedCardSchema>\n\nexport const CardListInputSchema = z.object({\n notebaseId: z.uuid(),\n templateId: z.uuid().optional(),\n limit: z.number().int().min(1).max(500).optional(),\n offset: z.number().int().min(0).optional(),\n})\nexport type CardListInput = z.infer<typeof CardListInputSchema>\n\nexport const CardListOutputSchema = z.array(renderedCardSchema)\nexport type CardListOutput = z.infer<typeof CardListOutputSchema>\n\nexport const CardGetInputSchema = z.object({\n id: z.uuid(),\n})\nexport type CardGetInput = z.infer<typeof CardGetInputSchema>\n\nexport const CardGetOutputSchema = renderedCardSchema\nexport type CardGetOutput = z.infer<typeof CardGetOutputSchema>\n\nexport const CardGenerateInputSchema = z.object({\n notebaseId: z.uuid(),\n templateId: z.uuid().optional(),\n})\nexport type CardGenerateInput = z.infer<typeof CardGenerateInputSchema>\n\nexport const CardGenerateOutputSchema = z.object({\n created: z.number().int().min(0),\n txid: z.number(),\n})\nexport type CardGenerateOutput = z.infer<typeof CardGenerateOutputSchema>\n","import { oc } from \"@orpc/contract\"\nimport { pickPublicErrorMap } from \"#/public-errors\"\n\nexport const notebaseProcedure = oc.errors(\n pickPublicErrorMap(\"NOTEBASE_BETA_RESTRICTED\"),\n)\n","import { pickPublicErrorMap } from \"#/public-errors\"\nimport {\n CardGenerateInputSchema,\n CardGenerateOutputSchema,\n CardGetInputSchema,\n CardGetOutputSchema,\n CardListInputSchema,\n CardListOutputSchema,\n} from \"#/schemas/card\"\nimport { notebaseProcedure } from \"./shared\"\n\nexport const cardContract = {\n list: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\"))\n .route({\n method: \"GET\",\n path: \"/cards\",\n summary: \"List rendered cards\",\n tags: [\"Cards\"],\n })\n .input(CardListInputSchema)\n .output(CardListOutputSchema),\n\n get: notebaseProcedure\n .errors(pickPublicErrorMap(\"CARD_NOT_FOUND\"))\n .route({\n method: \"GET\",\n path: \"/cards/{id}\",\n summary: \"Get rendered card\",\n tags: [\"Cards\"],\n })\n .input(CardGetInputSchema)\n .output(CardGetOutputSchema),\n\n generate: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\", \"CARD_TEMPLATE_NOT_FOUND\"))\n .route({\n method: \"POST\",\n path: \"/cards/generate\",\n summary: \"Generate missing cards\",\n tags: [\"Cards\"],\n })\n .input(CardGenerateInputSchema)\n .output(CardGenerateOutputSchema),\n}\n","import { pickPublicErrorMap } from \"#/public-errors\"\nimport {\n CardTemplateCreateInputSchema,\n CardTemplateCreateOutputSchema,\n CardTemplateDeleteInputSchema,\n CardTemplateDeleteOutputSchema,\n CardTemplateGetInputSchema,\n CardTemplateGetOutputSchema,\n CardTemplateListInputSchema,\n CardTemplateListOutputSchema,\n CardTemplateUpdateInputSchema,\n CardTemplateUpdateOutputSchema,\n} from \"#/schemas/card\"\nimport { notebaseProcedure } from \"./shared\"\n\nexport const cardTemplateContract = {\n list: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\"))\n .route({\n method: \"GET\",\n path: \"/card-templates\",\n summary: \"List card templates\",\n tags: [\"Card Templates\"],\n })\n .input(CardTemplateListInputSchema)\n .output(CardTemplateListOutputSchema),\n\n get: notebaseProcedure\n .errors(pickPublicErrorMap(\"CARD_TEMPLATE_NOT_FOUND\"))\n .route({\n method: \"GET\",\n path: \"/card-templates/{id}\",\n summary: \"Get card template\",\n tags: [\"Card Templates\"],\n })\n .input(CardTemplateGetInputSchema)\n .output(CardTemplateGetOutputSchema),\n\n create: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\", \"CARD_TEMPLATE_INVALID_NOTEBASE_COLUMNS\"))\n .route({\n method: \"POST\",\n path: \"/card-templates\",\n summary: \"Create card template\",\n tags: [\"Card Templates\"],\n })\n .input(CardTemplateCreateInputSchema)\n .output(CardTemplateCreateOutputSchema),\n\n update: notebaseProcedure\n .errors(pickPublicErrorMap(\"CARD_TEMPLATE_NOT_FOUND\", \"CARD_TEMPLATE_INVALID_NOTEBASE_COLUMNS\"))\n .route({\n method: \"PATCH\",\n path: \"/card-templates/{id}\",\n summary: \"Update card template\",\n tags: [\"Card Templates\"],\n })\n .input(CardTemplateUpdateInputSchema)\n .output(CardTemplateUpdateOutputSchema),\n\n delete: notebaseProcedure\n .errors(pickPublicErrorMap(\"CARD_TEMPLATE_NOT_FOUND\"))\n .route({\n method: \"DELETE\",\n path: \"/card-templates/{id}\",\n summary: \"Delete card template\",\n tags: [\"Card Templates\"],\n })\n .input(CardTemplateDeleteInputSchema)\n .output(CardTemplateDeleteOutputSchema),\n}\n","import { NOTEBASE_COLUMN_MAX_WIDTH, NOTEBASE_COLUMN_MIN_WIDTH, notebaseColumnConfigSchema } from \"@read-frog/definitions\"\nimport { z } from \"zod\"\n\nexport const notebaseColumnWidthSchema = z.number().int().min(NOTEBASE_COLUMN_MIN_WIDTH).max(NOTEBASE_COLUMN_MAX_WIDTH)\n\nexport const notebaseColumnSchema = z.object({\n id: z.string(),\n notebaseId: z.string(),\n name: z.string(),\n config: notebaseColumnConfigSchema,\n position: z.number(),\n isPrimary: z.boolean(),\n width: z.number().nullable(),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n})\nexport type NotebaseColumn = z.infer<typeof notebaseColumnSchema>\n\nexport const notebaseColumnCreateDataSchema = z.object({\n id: z.uuid().optional(),\n name: z.string().min(1),\n config: notebaseColumnConfigSchema,\n}).strict()\nexport type NotebaseColumnCreateData = z.infer<typeof notebaseColumnCreateDataSchema>\n\nexport const notebaseColumnUpdateDataSchema = z.object({\n name: z.string().min(1).optional(),\n config: notebaseColumnConfigSchema.optional(),\n width: notebaseColumnWidthSchema.nullable().optional(),\n}).strict()\nexport type NotebaseColumnUpdateData = z.infer<typeof notebaseColumnUpdateDataSchema>\n\nexport const NotebaseColumnCreateInputSchema = z.object({\n notebaseId: z.uuid(),\n data: notebaseColumnCreateDataSchema,\n})\nexport type NotebaseColumnCreateInput = z.infer<typeof NotebaseColumnCreateInputSchema>\n\nexport const NotebaseColumnCreateOutputSchema = z.object({\n txid: z.number(),\n})\nexport type NotebaseColumnCreateOutput = z.infer<typeof NotebaseColumnCreateOutputSchema>\n\nexport const NotebaseColumnUpdateInputSchema = z.object({\n notebaseColumnId: z.uuid(),\n data: notebaseColumnUpdateDataSchema,\n})\nexport type NotebaseColumnUpdateInput = z.infer<typeof NotebaseColumnUpdateInputSchema>\n\nexport const NotebaseColumnUpdateOutputSchema = z.object({\n txid: z.number(),\n})\nexport type NotebaseColumnUpdateOutput = z.infer<typeof NotebaseColumnUpdateOutputSchema>\n\nexport const NotebaseColumnDeleteInputSchema = z.object({\n notebaseColumnId: z.uuid(),\n})\nexport type NotebaseColumnDeleteInput = z.infer<typeof NotebaseColumnDeleteInputSchema>\n\nexport const NotebaseColumnDeleteOutputSchema = z.object({\n txid: z.number(),\n})\nexport type NotebaseColumnDeleteOutput = z.infer<typeof NotebaseColumnDeleteOutputSchema>\n\nexport const NotebaseColumnReorderInputSchema = z.object({\n notebaseId: z.uuid(),\n ids: z.array(z.uuid()),\n})\nexport type NotebaseColumnReorderInput = z.infer<typeof NotebaseColumnReorderInputSchema>\n\nexport const NotebaseColumnReorderOutputSchema = z.object({\n txid: z.number(),\n})\nexport type NotebaseColumnReorderOutput = z.infer<typeof NotebaseColumnReorderOutputSchema>\n","import { z } from \"zod\"\n\nexport const notebaseRowCellsSchema = z.record(z.string(), z.unknown())\n\nexport const notebaseRowSchema = z.object({\n id: z.string(),\n notebaseId: z.string(),\n cells: notebaseRowCellsSchema,\n position: z.number(),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n})\nexport type NotebaseRow = z.infer<typeof notebaseRowSchema>\n\nexport const notebaseRowCreateDataSchema = z.object({\n id: z.uuid().optional(),\n cells: notebaseRowCellsSchema.optional(),\n}).strict()\nexport type NotebaseRowCreateData = z.infer<typeof notebaseRowCreateDataSchema>\n\nexport const notebaseRowUpdateDataSchema = z.object({\n cells: notebaseRowCellsSchema.optional(),\n}).strict()\nexport type NotebaseRowUpdateData = z.infer<typeof notebaseRowUpdateDataSchema>\n\nexport const NotebaseRowCreateInputSchema = z.object({\n notebaseId: z.uuid(),\n data: notebaseRowCreateDataSchema,\n})\nexport type NotebaseRowCreateInput = z.infer<typeof NotebaseRowCreateInputSchema>\n\nexport const NotebaseRowCreateOutputSchema = z.object({\n txid: z.number(),\n})\nexport type NotebaseRowCreateOutput = z.infer<typeof NotebaseRowCreateOutputSchema>\n\nexport const NotebaseRowUpdateInputSchema = z.object({\n notebaseRowId: z.uuid(),\n data: notebaseRowUpdateDataSchema,\n})\nexport type NotebaseRowUpdateInput = z.infer<typeof NotebaseRowUpdateInputSchema>\n\nexport const NotebaseRowUpdateOutputSchema = z.object({\n id: z.uuid(),\n notebaseId: z.uuid(),\n cells: notebaseRowCellsSchema,\n position: z.number().int(),\n createdAt: z.date(),\n updatedAt: z.date(),\n txid: z.number(),\n})\nexport type NotebaseRowUpdateOutput = z.infer<typeof NotebaseRowUpdateOutputSchema>\n\nexport const NotebaseRowDeleteInputSchema = z.object({\n notebaseRowId: z.uuid(),\n})\nexport type NotebaseRowDeleteInput = z.infer<typeof NotebaseRowDeleteInputSchema>\n\nexport const NotebaseRowDeleteOutputSchema = z.object({\n txid: z.number(),\n})\nexport type NotebaseRowDeleteOutput = z.infer<typeof NotebaseRowDeleteOutputSchema>\n\nexport const NotebaseRowReorderInputSchema = z.object({\n notebaseId: z.uuid(),\n ids: z.array(z.uuid()),\n})\nexport type NotebaseRowReorderInput = z.infer<typeof NotebaseRowReorderInputSchema>\n\nexport const NotebaseRowReorderOutputSchema = z.object({\n txid: z.number(),\n})\nexport type NotebaseRowReorderOutput = z.infer<typeof NotebaseRowReorderOutputSchema>\n","import { z } from \"zod\"\n\nexport const notebaseViewTypeSchema = z.enum([\"table\", \"kanban\", \"gallery\"])\nexport type NotebaseViewType = z.infer<typeof notebaseViewTypeSchema>\n\nexport const notebaseViewConfigSchema = z.object({\n notebaseColumnWidths: z.record(z.string(), z.number()).optional(),\n hiddenNotebaseColumns: z.array(z.string()).optional(),\n groupByNotebaseColumnId: z.string().optional(),\n}).catchall(z.unknown())\nexport type NotebaseViewConfig = z.infer<typeof notebaseViewConfigSchema>\n\nexport const notebaseViewFilterSchema = z.object({\n notebaseColumnId: z.string(),\n operator: z.string(),\n value: z.unknown(),\n}).strict()\nexport type NotebaseViewFilter = z.infer<typeof notebaseViewFilterSchema>\n\nexport const notebaseViewFiltersSchema = z.array(notebaseViewFilterSchema)\n\nexport const notebaseViewSortSchema = z.object({\n notebaseColumnId: z.string(),\n direction: z.enum([\"asc\", \"desc\"]),\n}).strict()\nexport type NotebaseViewSort = z.infer<typeof notebaseViewSortSchema>\n\nexport const notebaseViewSortsSchema = z.array(notebaseViewSortSchema)\n\nexport const notebaseViewCreateDataSchema = z.object({\n id: z.uuid().optional(),\n name: z.string().min(1),\n type: notebaseViewTypeSchema,\n config: notebaseViewConfigSchema.optional(),\n filters: notebaseViewFiltersSchema.optional(),\n sorts: notebaseViewSortsSchema.optional(),\n}).strict()\nexport type NotebaseViewCreateData = z.infer<typeof notebaseViewCreateDataSchema>\n\nexport const notebaseViewUpdateDataSchema = z.object({\n name: z.string().min(1).optional(),\n type: notebaseViewTypeSchema.optional(),\n config: notebaseViewConfigSchema.optional(),\n filters: notebaseViewFiltersSchema.optional(),\n sorts: notebaseViewSortsSchema.optional(),\n}).strict()\nexport type NotebaseViewUpdateData = z.infer<typeof notebaseViewUpdateDataSchema>\n\nexport const notebaseViewSchema = z.object({\n id: z.string(),\n notebaseId: z.string(),\n name: z.string(),\n type: notebaseViewTypeSchema,\n config: notebaseViewConfigSchema.nullable(),\n filters: z.array(z.unknown()).nullable(),\n sorts: z.array(z.unknown()).nullable(),\n position: z.number(),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n})\nexport type NotebaseView = z.infer<typeof notebaseViewSchema>\n","import { schedulingParamsShape, srsWeightsSchema } from \"@read-frog/definitions\"\nimport { z } from \"zod\"\nimport { notebaseColumnSchema } from \"./notebase-column\"\nimport { notebaseRowSchema } from \"./notebase-row\"\nimport { notebaseViewSchema } from \"./notebase-view\"\n\nexport const NotebaseListInputSchema = z.object({})\nexport type NotebaseListInput = z.infer<typeof NotebaseListInputSchema>\n\nexport const NotebaseListItemSchema = z.object({\n id: z.string(),\n name: z.string(),\n})\nexport type NotebaseListItem = z.infer<typeof NotebaseListItemSchema>\n\nexport const NotebaseListOutputSchema = z.array(NotebaseListItemSchema)\nexport type NotebaseListOutput = z.infer<typeof NotebaseListOutputSchema>\n\nexport const notebaseSchema = z.object({\n id: z.string(),\n userId: z.string(),\n name: z.string(),\n srsNewPerDay: schedulingParamsShape.newPerDay,\n srsReviewsPerDay: schedulingParamsShape.reviewsPerDay,\n srsDesiredRetention: schedulingParamsShape.desiredRetention,\n srsEnableShortTerm: schedulingParamsShape.enableShortTerm,\n srsMaximumInterval: schedulingParamsShape.maximumInterval,\n srsLearningSteps: schedulingParamsShape.learningSteps,\n srsRelearningSteps: schedulingParamsShape.relearningSteps,\n srsLeechThreshold: schedulingParamsShape.leechThreshold,\n srsEnableFuzz: schedulingParamsShape.enableFuzz,\n srsWeights: srsWeightsSchema.nullable(),\n createdAt: z.date(),\n updatedAt: z.date(),\n})\nexport type Notebase = z.infer<typeof notebaseSchema>\n\nexport const notebaseCreateDataSchema = z.object({\n id: z.uuid().optional(),\n name: z.string().min(1),\n}).strict()\nexport type NotebaseCreateData = z.infer<typeof notebaseCreateDataSchema>\n\nexport const NotebaseCreateInputSchema = notebaseCreateDataSchema\nexport type NotebaseCreateInput = z.infer<typeof NotebaseCreateInputSchema>\n\nexport const NotebaseCreateOutputSchema = z.object({\n txid: z.number(),\n})\nexport type NotebaseCreateOutput = z.infer<typeof NotebaseCreateOutputSchema>\n\nexport const notebaseUpdateDataSchema = z.object({\n name: z.string().min(1).optional(),\n}).strict()\nexport type NotebaseUpdateData = z.infer<typeof notebaseUpdateDataSchema>\n\nexport const NotebaseUpdateInputSchema = notebaseUpdateDataSchema.extend({\n id: z.uuid(),\n})\nexport type NotebaseUpdateInput = z.infer<typeof NotebaseUpdateInputSchema>\n\nexport const NotebaseUpdateOutputSchema = z.object({\n txid: z.number(),\n})\nexport type NotebaseUpdateOutput = z.infer<typeof NotebaseUpdateOutputSchema>\n\nexport const NotebaseDeleteInputSchema = z.object({\n id: z.uuid(),\n})\nexport type NotebaseDeleteInput = z.infer<typeof NotebaseDeleteInputSchema>\n\nexport const NotebaseDeleteOutputSchema = z.object({\n txid: z.number(),\n})\nexport type NotebaseDeleteOutput = z.infer<typeof NotebaseDeleteOutputSchema>\n\n// Get endpoint schemas\nexport const NotebaseGetInputSchema = z.object({\n id: z.uuid(),\n})\nexport type NotebaseGetInput = z.infer<typeof NotebaseGetInputSchema>\n\nexport const NotebaseGetSchemaInputSchema = z.object({\n id: z.uuid(),\n})\nexport type NotebaseGetSchemaInput = z.infer<typeof NotebaseGetSchemaInputSchema>\n\nexport const NotebaseGetOutputSchema = notebaseSchema.extend({\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n notebaseColumns: z.array(notebaseColumnSchema),\n notebaseRows: z.array(notebaseRowSchema),\n notebaseViews: z.array(notebaseViewSchema),\n})\nexport type NotebaseGetOutput = z.infer<typeof NotebaseGetOutputSchema>\n\nexport const NotebaseGetSchemaOutputSchema = z.object({\n id: z.string(),\n name: z.string(),\n updatedAt: z.coerce.date(),\n notebaseColumns: z.array(notebaseColumnSchema),\n})\nexport type NotebaseGetSchemaOutput = z.infer<typeof NotebaseGetSchemaOutputSchema>\n","import { pickPublicErrorMap } from \"#/public-errors\"\nimport {\n NotebaseCreateInputSchema,\n NotebaseCreateOutputSchema,\n NotebaseDeleteInputSchema,\n NotebaseDeleteOutputSchema,\n NotebaseGetInputSchema,\n NotebaseGetOutputSchema,\n NotebaseGetSchemaInputSchema,\n NotebaseGetSchemaOutputSchema,\n NotebaseListInputSchema,\n NotebaseListOutputSchema,\n NotebaseUpdateInputSchema,\n NotebaseUpdateOutputSchema,\n} from \"#/schemas/notebase\"\nimport { notebaseProcedure } from \"./shared\"\n\nexport const notebaseContract = {\n list: notebaseProcedure\n .route({\n method: \"GET\",\n path: \"/notebases\",\n summary: \"List notebases\",\n tags: [\"Notebases\"],\n })\n .input(NotebaseListInputSchema)\n .output(NotebaseListOutputSchema),\n\n get: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\"))\n .route({\n method: \"GET\",\n path: \"/notebases/{id}\",\n summary: \"Get notebase with notebase columns, rows, and views\",\n tags: [\"Notebases\"],\n })\n .input(NotebaseGetInputSchema)\n .output(NotebaseGetOutputSchema),\n\n getSchema: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\"))\n .route({\n method: \"GET\",\n path: \"/notebases/{id}/schema\",\n summary: \"Get notebase schema\",\n tags: [\"Notebases\"],\n })\n .input(NotebaseGetSchemaInputSchema)\n .output(NotebaseGetSchemaOutputSchema),\n\n create: notebaseProcedure\n .route({\n method: \"POST\",\n path: \"/notebases\",\n summary: \"Create notebase\",\n tags: [\"Notebases\"],\n })\n .input(NotebaseCreateInputSchema)\n .output(NotebaseCreateOutputSchema),\n\n update: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\"))\n .route({\n method: \"PUT\",\n path: \"/notebases/{id}\",\n summary: \"Update notebase\",\n tags: [\"Notebases\"],\n })\n .input(NotebaseUpdateInputSchema)\n .output(NotebaseUpdateOutputSchema),\n\n delete: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\"))\n .route({\n method: \"DELETE\",\n path: \"/notebases/{id}\",\n summary: \"Delete notebase\",\n tags: [\"Notebases\"],\n })\n .input(NotebaseDeleteInputSchema)\n .output(NotebaseDeleteOutputSchema),\n}\n","import { pickPublicErrorMap } from \"#/public-errors\"\nimport {\n NotebaseColumnCreateInputSchema,\n NotebaseColumnCreateOutputSchema,\n NotebaseColumnDeleteInputSchema,\n NotebaseColumnDeleteOutputSchema,\n NotebaseColumnReorderInputSchema,\n NotebaseColumnReorderOutputSchema,\n NotebaseColumnUpdateInputSchema,\n NotebaseColumnUpdateOutputSchema,\n} from \"#/schemas/notebase-column\"\nimport { notebaseProcedure } from \"./shared\"\n\nexport const notebaseColumnContract = {\n create: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\", \"CONCURRENT_POSITION_CONFLICT\"))\n .route({\n method: \"POST\",\n path: \"/notebase-columns\",\n summary: \"Create notebase column\",\n tags: [\"Notebase Columns\"],\n })\n .input(NotebaseColumnCreateInputSchema)\n .output(NotebaseColumnCreateOutputSchema),\n\n update: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_COLUMN_NOT_FOUND\"))\n .route({\n method: \"PATCH\",\n path: \"/notebase-columns/{notebaseColumnId}\",\n summary: \"Update notebase column\",\n tags: [\"Notebase Columns\"],\n })\n .input(NotebaseColumnUpdateInputSchema)\n .output(NotebaseColumnUpdateOutputSchema),\n\n delete: notebaseProcedure\n .errors(pickPublicErrorMap(\n \"NOTEBASE_COLUMN_NOT_FOUND\",\n \"PRIMARY_NOTEBASE_COLUMN_DELETE_NOT_ALLOWED\",\n \"CARD_TEMPLATE_NOTEBASE_COLUMN_IN_USE\",\n \"CONCURRENT_POSITION_CONFLICT\",\n ))\n .route({\n method: \"DELETE\",\n path: \"/notebase-columns/{notebaseColumnId}\",\n summary: \"Delete notebase column\",\n tags: [\"Notebase Columns\"],\n })\n .input(NotebaseColumnDeleteInputSchema)\n .output(NotebaseColumnDeleteOutputSchema),\n\n reorder: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\", \"CONCURRENT_POSITION_CONFLICT\"))\n .route({\n method: \"POST\",\n path: \"/notebase-columns/reorder\",\n summary: \"Reorder notebase columns\",\n tags: [\"Notebase Columns\"],\n })\n .input(NotebaseColumnReorderInputSchema)\n .output(NotebaseColumnReorderOutputSchema),\n}\n","import { pickPublicErrorMap } from \"#/public-errors\"\nimport {\n NotebaseRowCreateInputSchema,\n NotebaseRowCreateOutputSchema,\n NotebaseRowDeleteInputSchema,\n NotebaseRowDeleteOutputSchema,\n NotebaseRowReorderInputSchema,\n NotebaseRowReorderOutputSchema,\n NotebaseRowUpdateInputSchema,\n NotebaseRowUpdateOutputSchema,\n} from \"#/schemas/notebase-row\"\nimport { notebaseProcedure } from \"./shared\"\n\nexport const notebaseRowContract = {\n create: notebaseProcedure\n .errors(pickPublicErrorMap(\n \"NOTEBASE_NOT_FOUND\",\n \"CELL_VALIDATION_FAILED\",\n \"CONCURRENT_POSITION_CONFLICT\",\n ))\n .route({\n method: \"POST\",\n path: \"/notebase-rows\",\n summary: \"Create notebase row\",\n tags: [\"Notebase Rows\"],\n })\n .input(NotebaseRowCreateInputSchema)\n .output(NotebaseRowCreateOutputSchema),\n\n update: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_ROW_NOT_FOUND\", \"CELL_VALIDATION_FAILED\"))\n .route({\n method: \"PATCH\",\n path: \"/notebase-rows/{notebaseRowId}\",\n summary: \"Update notebase row cells\",\n tags: [\"Notebase Rows\"],\n })\n .input(NotebaseRowUpdateInputSchema)\n .output(NotebaseRowUpdateOutputSchema),\n\n delete: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_ROW_NOT_FOUND\", \"CONCURRENT_POSITION_CONFLICT\"))\n .route({\n method: \"DELETE\",\n path: \"/notebase-rows/{notebaseRowId}\",\n summary: \"Delete notebase row\",\n tags: [\"Notebase Rows\"],\n })\n .input(NotebaseRowDeleteInputSchema)\n .output(NotebaseRowDeleteOutputSchema),\n\n reorder: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\", \"CONCURRENT_POSITION_CONFLICT\"))\n .route({\n method: \"POST\",\n path: \"/notebase-rows/reorder\",\n summary: \"Reorder notebase rows\",\n tags: [\"Notebase Rows\"],\n })\n .input(NotebaseRowReorderInputSchema)\n .output(NotebaseRowReorderOutputSchema),\n}\n","import { z } from \"zod\"\n\n// @ref https://zenn.dev/herp_inc/articles/js-intl-date-time-format-performance\nconst localeTimeZoneFormatter = new Map<string, Intl.DateTimeFormat>()\nfunction createTimezoneFormatter(timezone: string): Intl.DateTimeFormat {\n let formatter = localeTimeZoneFormatter.get(timezone)\n if (!formatter) {\n formatter = new Intl.DateTimeFormat(\"en-US\", { timeZone: timezone })\n localeTimeZoneFormatter.set(timezone, formatter)\n }\n return formatter\n}\n\nexport const timezoneSchema = z.string().trim().min(1).refine((timezone) => {\n try {\n createTimezoneFormatter(timezone).format(new Date())\n return true\n }\n catch {\n return false\n }\n}, \"Invalid timezone\")\nexport type Timezone = z.infer<typeof timezoneSchema>\n","import {\n cardStateSchema,\n fsrsReviewLogSnapshotSchema,\n reviewRatingSchema,\n scheduleStatusSchema,\n schedulingParamsSchema,\n SRS_REVIEW_DURATION_MS_MAX,\n srsStepSchema,\n} from \"@read-frog/definitions\"\nimport { z } from \"zod\"\nimport { cardSchema } from \"./card\"\nimport { timezoneSchema } from \"./timezone\"\n\nexport {\n reviewRatingSchema,\n schedulingParamsSchema,\n SRS_REVIEW_DURATION_MS_MAX,\n}\nexport { timezoneSchema } from \"./timezone\"\nexport type { Timezone } from \"./timezone\"\nexport type { ReviewRating, SchedulingParams } from \"@read-frog/definitions\"\n\nexport const stepSchema = srsStepSchema\nexport type Step = z.infer<typeof stepSchema>\n\nexport const SRS_REVIEW_CLIENT_ID_NAMESPACE = \"6ba7b811-9dad-11d1-80b4-00c04fd430c8\"\nconst srsReviewClientIdNamePrefix = \"readfrog:srs-review\"\nconst nullLastReviewTimeSentinel = \"null\"\n\nexport interface SrsReviewClientIdCard {\n id: string\n lastReviewTime: Date | string | null\n}\n\nexport async function createSrsReviewClientId(card: SrsReviewClientIdCard) {\n return uuidV5(\n `${srsReviewClientIdNamePrefix}:${card.id}:${formatLastReviewTime(card.lastReviewTime)}`,\n SRS_REVIEW_CLIENT_ID_NAMESPACE,\n )\n}\n\nexport const srsReviewInputSchema = z.object({\n cardId: z.uuid(),\n id: z.uuid().optional(),\n rating: reviewRatingSchema,\n durationMs: z.number().int().min(0).max(SRS_REVIEW_DURATION_MS_MAX),\n timezone: timezoneSchema,\n}).strict()\nexport type SrsReviewInput = z.infer<typeof srsReviewInputSchema>\n\nexport const srsRollbackReviewInputSchema = z.object({\n cardId: z.uuid(),\n}).strict()\nexport type SrsRollbackReviewInput = z.infer<typeof srsRollbackReviewInputSchema>\n\nexport const srsRevlogSchema = z.object({\n id: z.uuid(),\n notebaseId: z.uuid(),\n cardId: z.uuid(),\n rating: reviewRatingSchema,\n state: cardStateSchema,\n afterScheduleStatus: scheduleStatusSchema,\n reviewedAt: z.coerce.date(),\n durationMs: z.number().int(),\n fsrsReviewLogSnapshot: fsrsReviewLogSnapshotSchema,\n createdAt: z.coerce.date(),\n})\nexport type SrsRevlog = z.infer<typeof srsRevlogSchema>\n\nexport const srsReviewOutputSchema = z.object({\n card: cardSchema,\n revlog: srsRevlogSchema,\n txid: z.number(),\n})\nexport type SrsReviewOutput = z.infer<typeof srsReviewOutputSchema>\n\nexport const srsRollbackReviewOutputSchema = z.object({\n card: cardSchema,\n rolledBackRevlogId: z.uuid(),\n txid: z.number(),\n})\nexport type SrsRollbackReviewOutput = z.infer<typeof srsRollbackReviewOutputSchema>\n\nfunction formatLastReviewTime(lastReviewTime: Date | string | null) {\n return lastReviewTime ? new Date(lastReviewTime).toISOString() : nullLastReviewTimeSentinel\n}\n\nasync function uuidV5(name: string, namespace: string) {\n const namespaceBytes = uuidToBytes(namespace)\n const nameBytes = new TextEncoder().encode(name)\n const input = new Uint8Array(namespaceBytes.length + nameBytes.length)\n input.set(namespaceBytes)\n input.set(nameBytes, namespaceBytes.length)\n\n const hash = new Uint8Array(await crypto.subtle.digest(\"SHA-1\", input))\n const bytes = hash.slice(0, 16)\n const versionByte = bytes[6]\n const variantByte = bytes[8]\n if (versionByte === undefined || variantByte === undefined) {\n throw new Error(\"SHA-1 digest was too short\")\n }\n bytes[6] = (versionByte & 0x0F) | 0x50\n bytes[8] = (variantByte & 0x3F) | 0x80\n\n return bytesToUuid(bytes)\n}\n\nfunction uuidToBytes(uuid: string) {\n const hex = uuid.replaceAll(\"-\", \"\").toLowerCase()\n if (!/^[0-9a-f]{32}$/.test(hex)) {\n throw new Error(\"Invalid UUID namespace\")\n }\n\n return new Uint8Array(\n Array.from({ length: 16 }, (_, index) =>\n Number.parseInt(hex.slice(index * 2, index * 2 + 2), 16)),\n )\n}\n\nfunction bytesToUuid(bytes: Uint8Array) {\n const hex = Array.from(bytes, byte => byte.toString(16).padStart(2, \"0\"))\n return [\n hex.slice(0, 4).join(\"\"),\n hex.slice(4, 6).join(\"\"),\n hex.slice(6, 8).join(\"\"),\n hex.slice(8, 10).join(\"\"),\n hex.slice(10, 16).join(\"\"),\n ].join(\"-\")\n}\n","import { pickPublicErrorMap } from \"#/public-errors\"\nimport {\n srsReviewInputSchema,\n srsReviewOutputSchema,\n srsRollbackReviewInputSchema,\n srsRollbackReviewOutputSchema,\n} from \"#/schemas/srs\"\nimport { notebaseProcedure } from \"./shared\"\n\nexport const srsContract = {\n review: notebaseProcedure\n .errors(pickPublicErrorMap(\n \"CARD_NOT_FOUND\",\n \"CARD_NOT_REVIEWABLE\",\n \"CARD_REVIEW_STATE_STALE\",\n ))\n .route({\n method: \"POST\",\n path: \"/srs/review\",\n summary: \"Review a card with SRS scheduling\",\n tags: [\"SRS\"],\n })\n .input(srsReviewInputSchema)\n .output(srsReviewOutputSchema),\n rollbackReview: notebaseProcedure\n .errors(pickPublicErrorMap(\n \"CARD_NOT_FOUND\",\n \"CARD_REVIEW_ROLLBACK_UNAVAILABLE\",\n ))\n .route({\n method: \"POST\",\n path: \"/srs/review/rollback\",\n summary: \"Roll back the latest SRS review for a card\",\n tags: [\"SRS\"],\n })\n .input(srsRollbackReviewInputSchema)\n .output(srsRollbackReviewOutputSchema),\n}\n","import { z } from \"zod\"\nimport { timezoneSchema } from \"./timezone\"\n\nexport const userEnsureTimezoneInputSchema = z.object({\n timezone: timezoneSchema,\n}).strict()\nexport type UserEnsureTimezoneInput = z.infer<typeof userEnsureTimezoneInputSchema>\n\nexport const userEnsureTimezoneOutputSchema = z.object({\n timezone: timezoneSchema,\n updated: z.boolean(),\n}).strict()\nexport type UserEnsureTimezoneOutput = z.infer<typeof userEnsureTimezoneOutputSchema>\n","import { oc } from \"@orpc/contract\"\nimport {\n userEnsureTimezoneInputSchema,\n userEnsureTimezoneOutputSchema,\n} from \"#/schemas/user\"\n\nexport const userContract = {\n ensureTimezone: oc\n .route({\n method: \"POST\",\n path: \"/users/me/timezone/ensure\",\n summary: \"Ensure the authenticated user has a timezone\",\n tags: [\"Users\"],\n })\n .input(userEnsureTimezoneInputSchema)\n .output(userEnsureTimezoneOutputSchema),\n}\n","import type { ContractRouterClient } from \"@orpc/contract\"\nimport { betaAccessContract } from \"./contracts/beta-access\"\nimport { cardContract } from \"./contracts/card\"\nimport { cardTemplateContract } from \"./contracts/card-template\"\nimport { notebaseContract } from \"./contracts/notebase\"\nimport { notebaseColumnContract } from \"./contracts/notebase-column\"\nimport { notebaseRowContract } from \"./contracts/notebase-row\"\nimport { srsContract } from \"./contracts/srs\"\nimport { userContract } from \"./contracts/user\"\n\nexport const contract = {\n betaAccess: betaAccessContract,\n card: cardContract,\n cardTemplate: cardTemplateContract,\n notebase: notebaseContract,\n notebaseColumn: notebaseColumnContract,\n notebaseRow: notebaseRowContract,\n srs: srsContract,\n user: userContract,\n}\n\nexport type ORPCRouterClient = ContractRouterClient<typeof contract>\n\nexport * from \"./public-errors\"\nexport * from \"./schemas/beta-access\"\nexport * from \"./schemas/card\"\nexport * from \"./schemas/notebase\"\nexport * from \"./schemas/notebase-column\"\nexport * from \"./schemas/notebase-row\"\nexport * from \"./schemas/notebase-view\"\nexport * from \"./schemas/srs\"\nexport * from \"./schemas/timezone\"\nexport * from \"./schemas/user\"\n"],"mappings":";;;;AAGA,MAAa,uBAAuB,EAAE,KAAK,iBAAiB;AAG5D,MAAa,8BAA8B,EAAE,OAAO,EAClD,YAAY,qBACd,CAAC,CAAC,CAAC,OAAO;AAGV,MAAa,+BAA+B,EAAE,OAAO;CACnD,YAAY;CACZ,SAAS,EAAE,QAAQ;AACrB,CAAC;;;ACRD,MAAa,qBAAqB,EAChC,QAAQ,GACL,MAAM;CACL,QAAQ;CACR,MAAM;CACN,SAAS;CACT,MAAM,CAAC,aAAa;AACtB,CAAC,CAAC,CACD,MAAM,2BAA2B,CAAC,CAClC,OAAO,4BAA4B,EACxC;;;ACPA,MAAa,oCAAoC,EAAE,KAAK;CACtD;CACA;CACA;CACA;AACF,CAAC;AAGD,MAAa,qCAAqC,EAAE,OAAO;CACzD,gBAAgB,EAAE,OAAO,CAAC,CAAC,SAAS;CACpC,cAAc,EAAE,OAAO,CAAC,CAAC,SAAS;CAClC,cAAc,EAAE,OAAO,CAAC,CAAC,SAAS;CAClC,eAAe,EAAE,QAAQ,CAAC,CAAC,SAAS;CACpC,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS;AAC7C,CAAC,CAAC,CAAC,OAAO;AAGV,MAAa,iCAAiC,EAAE,OAAO;CACrD,kBAAkB,EAAE,OAAO;CAC3B,SAAS;CACT,QAAQ;AACV,CAAC,CAAC,CAAC,OAAO;AAGV,MAAa,uCAAuC,EAAE,OAAO,EAC3D,mBAAmB,EAAE,MAAM,EAAE,OAAO,CAAC,EACvC,CAAC,CAAC,CAAC,OAAO;AAGV,MAAa,wBAAwB;CACnC,0BAA0B;EACxB,SAAS;EACT,QAAQ;CACV;CACA,oBAAoB;EAClB,SAAS;EACT,QAAQ;CACV;CACA,2BAA2B;EACzB,SAAS;EACT,QAAQ;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AAE,CAAC,CAAC,KAAK,EAAE;CAC3B,CAAC,CAAC,KAAK,GAAG;AACZ;;;ACvHA,MAAa,cAAc;CACzB,QAAQ,kBACL,OAAO,mBACN,kBACA,uBACA,yBACF,CAAC,CAAC,CACD,MAAM;EACL,QAAQ;EACR,MAAM;EACN,SAAS;EACT,MAAM,CAAC,KAAK;CACd,CAAC,CAAC,CACD,MAAM,oBAAoB,CAAC,CAC3B,OAAO,qBAAqB;CAC/B,gBAAgB,kBACb,OAAO,mBACN,kBACA,kCACF,CAAC,CAAC,CACD,MAAM;EACL,QAAQ;EACR,MAAM;EACN,SAAS;EACT,MAAM,CAAC,KAAK;CACd,CAAC,CAAC,CACD,MAAM,4BAA4B,CAAC,CACnC,OAAO,6BAA6B;AACzC;;;AClCA,MAAa,gCAAgC,EAAE,OAAO,EACpD,UAAU,eACZ,CAAC,CAAC,CAAC,OAAO;AAGV,MAAa,iCAAiC,EAAE,OAAO;CACrD,UAAU;CACV,SAAS,EAAE,QAAQ;AACrB,CAAC,CAAC,CAAC,OAAO;;;AEDV,MAAa,WAAW;CACtB,YAAY;CACZ,MAAM;CACN,cAAc;CACd,UAAU;CACV,gBAAgB;CAChB,aAAa;CACb,KAAK;CACL,MAAM,EDXN,gBAAgB,GACb,MAAM;EACL,QAAQ;EACR,MAAM;EACN,SAAS;EACT,MAAM,CAAC,OAAO;CAChB,CAAC,CAAC,CACD,MAAM,6BAA6B,CAAC,CACpC,OAAO,8BAA8B,ECGlC;AACR"}
1
+ {"version":3,"file":"index.js","names":["cardStateSchema","scheduleStatusSchema"],"sources":["../src/schemas/beta-access.ts","../src/contracts/beta-access.ts","../src/public-errors.ts","../src/schemas/card.ts","../src/contracts/shared.ts","../src/contracts/card.ts","../src/contracts/card-template.ts","../src/schemas/hosted-ai.ts","../src/contracts/hosted-ai.ts","../src/schemas/notebase-column.ts","../src/schemas/notebase-row.ts","../src/schemas/notebase-view.ts","../src/schemas/notebase.ts","../src/contracts/notebase.ts","../src/contracts/notebase-column.ts","../src/contracts/notebase-row.ts","../src/schemas/timezone.ts","../src/schemas/srs.ts","../src/contracts/srs.ts","../src/schemas/user.ts","../src/contracts/user.ts","../src/index.ts"],"sourcesContent":["import { BETA_FEATURE_KEYS } from \"@read-frog/definitions\"\nimport { z } from \"zod\"\n\nexport const BetaFeatureKeySchema = z.enum(BETA_FEATURE_KEYS)\nexport type BetaFeatureKey = z.infer<typeof BetaFeatureKeySchema>\n\nexport const BetaAccessStatusInputSchema = z.object({\n featureKey: BetaFeatureKeySchema,\n}).strict()\nexport type BetaAccessStatusInput = z.infer<typeof BetaAccessStatusInputSchema>\n\nexport const BetaAccessStatusOutputSchema = z.object({\n featureKey: BetaFeatureKeySchema,\n allowed: z.boolean(),\n})\nexport type BetaAccessStatusOutput = z.infer<typeof BetaAccessStatusOutputSchema>\n","import { oc } from \"@orpc/contract\"\nimport {\n BetaAccessStatusInputSchema,\n BetaAccessStatusOutputSchema,\n} from \"#/schemas/beta-access\"\n\nexport const betaAccessContract = {\n status: oc\n .route({\n method: \"GET\",\n path: \"/beta-access/status\",\n summary: \"Get beta access status for a feature\",\n tags: [\"Beta Access\"],\n })\n .input(BetaAccessStatusInputSchema)\n .output(BetaAccessStatusOutputSchema),\n}\n","import type { ErrorMap } from \"@orpc/contract\"\nimport { z } from \"zod\"\n\ninterface PublicAppErrorDefinition {\n data?: z.ZodTypeAny\n message: string\n status: number\n}\n\nexport const CellValidationFailureReasonSchema = z.enum([\n \"unknown_notebase_column\",\n \"type_mismatch\",\n \"invalid_select_option\",\n \"invalid_date_format\",\n])\nexport type CellValidationFailureReason = z.infer<typeof CellValidationFailureReasonSchema>\n\nexport const CellValidationFailureDetailsSchema = z.object({\n expectedFormat: z.string().optional(),\n expectedType: z.string().optional(),\n receivedType: z.string().optional(),\n receivedValue: z.unknown().optional(),\n validOptions: z.array(z.string()).optional(),\n}).strict()\nexport type CellValidationFailureDetails = z.infer<typeof CellValidationFailureDetailsSchema>\n\nexport const CellValidationFailedDataSchema = z.object({\n notebaseColumnId: z.string(),\n details: CellValidationFailureDetailsSchema,\n reason: CellValidationFailureReasonSchema,\n}).strict()\nexport type CellValidationFailedData = z.infer<typeof CellValidationFailedDataSchema>\n\nexport const CardTemplateInvalidColumnsDataSchema = z.object({\n notebaseColumnIds: z.array(z.string()),\n}).strict()\nexport type CardTemplateInvalidColumnsData = z.infer<typeof CardTemplateInvalidColumnsDataSchema>\n\nexport const PUBLIC_APP_ERROR_DEFS = {\n NOTEBASE_BETA_RESTRICTED: {\n message: \"Notebase is currently in beta for selected accounts\",\n status: 403,\n },\n NOTEBASE_NOT_FOUND: {\n message: \"Notebase not found\",\n status: 404,\n },\n NOTEBASE_COLUMN_NOT_FOUND: {\n message: \"Notebase column not found\",\n status: 404,\n },\n NOTEBASE_ROW_NOT_FOUND: {\n message: \"Notebase row not found\",\n status: 404,\n },\n CARD_NOT_FOUND: {\n message: \"Card not found\",\n status: 404,\n },\n CARD_TEMPLATE_NOT_FOUND: {\n message: \"Card template not found\",\n status: 404,\n },\n CARD_TEMPLATE_INVALID_NOTEBASE_COLUMNS: {\n data: CardTemplateInvalidColumnsDataSchema,\n message: \"Card template references unknown notebase columns\",\n status: 422,\n },\n CARD_TEMPLATE_NOTEBASE_COLUMN_IN_USE: {\n message: \"Notebase column is used by a card template\",\n status: 409,\n },\n CARD_NOT_REVIEWABLE: {\n message: \"Card cannot be reviewed in its current state\",\n status: 409,\n },\n CARD_REVIEW_STATE_STALE: {\n message: \"Card review state is stale\",\n status: 409,\n },\n CARD_REVIEW_ROLLBACK_UNAVAILABLE: {\n message: \"Card review cannot be rolled back\",\n status: 409,\n },\n CARD_ALREADY_BURIED: {\n message: \"Card is already buried\",\n status: 409,\n },\n CARD_NOT_BURIED: {\n message: \"Card is not buried\",\n status: 409,\n },\n CARD_ALREADY_SUSPENDED: {\n message: \"Card is already suspended\",\n status: 409,\n },\n CARD_NOT_SUSPENDED: {\n message: \"Card is not suspended\",\n status: 409,\n },\n CARD_STATUS_CHANGE_UNAVAILABLE: {\n message: \"Card status change is unavailable\",\n status: 409,\n },\n NOTEBASE_VIEW_NOT_FOUND: {\n message: \"Notebase view not found\",\n status: 404,\n },\n CELL_VALIDATION_FAILED: {\n data: CellValidationFailedDataSchema,\n message: \"Cell validation failed\",\n status: 422,\n },\n PRIMARY_NOTEBASE_COLUMN_DELETE_NOT_ALLOWED: {\n message: \"Cannot delete primary notebase column\",\n status: 400,\n },\n CONCURRENT_POSITION_CONFLICT: {\n message: \"Concurrent position conflict, please retry\",\n status: 409,\n },\n} as const satisfies Record<string, PublicAppErrorDefinition>\n\nexport type PublicAppErrorCode = keyof typeof PUBLIC_APP_ERROR_DEFS\n\nexport type PublicAppErrorData<TCode extends PublicAppErrorCode>\n = (typeof PUBLIC_APP_ERROR_DEFS)[TCode] extends { data: infer TSchema extends z.ZodTypeAny }\n ? z.output<TSchema>\n : undefined\n\nexport function isPublicAppErrorCode(code: string | undefined): code is PublicAppErrorCode {\n return code !== undefined && code in PUBLIC_APP_ERROR_DEFS\n}\n\nexport function getPublicErrorDefinition<TCode extends PublicAppErrorCode>(code: TCode) {\n return PUBLIC_APP_ERROR_DEFS[code]\n}\n\nexport function pickPublicErrorMap<const TCodes extends readonly PublicAppErrorCode[]>(\n ...codes: TCodes\n) {\n return Object.fromEntries(codes.map((code) => {\n const definition = PUBLIC_APP_ERROR_DEFS[code]\n\n if (\"data\" in definition) {\n return [code, {\n data: definition.data,\n message: definition.message,\n status: definition.status,\n }]\n }\n\n return [code, {\n message: definition.message,\n status: definition.status,\n }]\n })) as Pick<ErrorMap, TCodes[number]>\n}\n","import {\n cardIdentityShape,\n cardMemoryStateShape,\n cardStateSchema,\n cardTemplateConfigSchema,\n scheduleStatusSchema,\n} from \"@read-frog/definitions\"\nimport { z } from \"zod\"\n\nexport {\n cardStateSchema,\n scheduleStatusSchema,\n}\nexport type { CardState, ScheduleStatus } from \"@read-frog/definitions\"\n\nexport const cardTemplateSchema = z.object({\n id: z.uuid(),\n notebaseId: z.uuid(),\n name: z.string(),\n config: cardTemplateConfigSchema,\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n})\nexport type CardTemplate = z.infer<typeof cardTemplateSchema>\n\nexport const CardTemplateListInputSchema = z.object({\n notebaseId: z.uuid(),\n})\nexport type CardTemplateListInput = z.infer<typeof CardTemplateListInputSchema>\n\nexport const CardTemplateListOutputSchema = z.array(cardTemplateSchema)\nexport type CardTemplateListOutput = z.infer<typeof CardTemplateListOutputSchema>\n\nexport const CardTemplateGetInputSchema = z.object({\n id: z.uuid(),\n})\nexport type CardTemplateGetInput = z.infer<typeof CardTemplateGetInputSchema>\n\nexport const CardTemplateGetOutputSchema = cardTemplateSchema\nexport type CardTemplateGetOutput = z.infer<typeof CardTemplateGetOutputSchema>\n\nexport const CardTemplateCreateInputSchema = z.object({\n id: z.uuid().optional(),\n notebaseId: z.uuid(),\n name: z.string().min(1),\n config: cardTemplateConfigSchema,\n}).strict()\nexport type CardTemplateCreateInput = z.infer<typeof CardTemplateCreateInputSchema>\n\nexport const CardTemplateCreateOutputSchema = cardTemplateSchema.extend({\n txid: z.number(),\n})\nexport type CardTemplateCreateOutput = z.infer<typeof CardTemplateCreateOutputSchema>\n\nexport const CardTemplateUpdateInputSchema = z.object({\n id: z.uuid(),\n name: z.string().min(1).optional(),\n config: cardTemplateConfigSchema.optional(),\n}).strict()\nexport type CardTemplateUpdateInput = z.infer<typeof CardTemplateUpdateInputSchema>\n\nexport const CardTemplateUpdateOutputSchema = cardTemplateSchema.extend({\n txid: z.number(),\n})\nexport type CardTemplateUpdateOutput = z.infer<typeof CardTemplateUpdateOutputSchema>\n\nexport const CardTemplateDeleteInputSchema = z.object({\n id: z.uuid(),\n})\nexport type CardTemplateDeleteInput = z.infer<typeof CardTemplateDeleteInputSchema>\n\nexport const CardTemplateDeleteOutputSchema = z.object({\n txid: z.number(),\n})\nexport type CardTemplateDeleteOutput = z.infer<typeof CardTemplateDeleteOutputSchema>\n\nexport const cardSchema = z.object({\n ...cardIdentityShape,\n ...cardMemoryStateShape,\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n})\nexport type Card = z.infer<typeof cardSchema>\n\nexport const renderedCardSchema = cardSchema.extend({\n front: z.string(),\n back: z.string(),\n})\nexport type RenderedCard = z.infer<typeof renderedCardSchema>\n\nexport const CardListInputSchema = z.object({\n notebaseId: z.uuid(),\n templateId: z.uuid().optional(),\n limit: z.number().int().min(1).max(500).optional(),\n offset: z.number().int().min(0).optional(),\n})\nexport type CardListInput = z.infer<typeof CardListInputSchema>\n\nexport const CardListOutputSchema = z.array(renderedCardSchema)\nexport type CardListOutput = z.infer<typeof CardListOutputSchema>\n\nexport const CardGetInputSchema = z.object({\n id: z.uuid(),\n})\nexport type CardGetInput = z.infer<typeof CardGetInputSchema>\n\nexport const CardGetOutputSchema = renderedCardSchema\nexport type CardGetOutput = z.infer<typeof CardGetOutputSchema>\n\nexport const CardGenerateInputSchema = z.object({\n notebaseId: z.uuid(),\n templateId: z.uuid().optional(),\n})\nexport type CardGenerateInput = z.infer<typeof CardGenerateInputSchema>\n\nexport const CardGenerateOutputSchema = z.object({\n created: z.number().int().min(0),\n txid: z.number(),\n})\nexport type CardGenerateOutput = z.infer<typeof CardGenerateOutputSchema>\n","import { oc } from \"@orpc/contract\"\nimport { pickPublicErrorMap } from \"#/public-errors\"\n\nexport const notebaseProcedure = oc.errors(\n pickPublicErrorMap(\"NOTEBASE_BETA_RESTRICTED\"),\n)\n","import { pickPublicErrorMap } from \"#/public-errors\"\nimport {\n CardGenerateInputSchema,\n CardGenerateOutputSchema,\n CardGetInputSchema,\n CardGetOutputSchema,\n CardListInputSchema,\n CardListOutputSchema,\n} from \"#/schemas/card\"\nimport { notebaseProcedure } from \"./shared\"\n\nexport const cardContract = {\n list: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\"))\n .route({\n method: \"GET\",\n path: \"/cards\",\n summary: \"List rendered cards\",\n tags: [\"Cards\"],\n })\n .input(CardListInputSchema)\n .output(CardListOutputSchema),\n\n get: notebaseProcedure\n .errors(pickPublicErrorMap(\"CARD_NOT_FOUND\"))\n .route({\n method: \"GET\",\n path: \"/cards/{id}\",\n summary: \"Get rendered card\",\n tags: [\"Cards\"],\n })\n .input(CardGetInputSchema)\n .output(CardGetOutputSchema),\n\n generate: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\", \"CARD_TEMPLATE_NOT_FOUND\"))\n .route({\n method: \"POST\",\n path: \"/cards/generate\",\n summary: \"Generate missing cards\",\n tags: [\"Cards\"],\n })\n .input(CardGenerateInputSchema)\n .output(CardGenerateOutputSchema),\n}\n","import { pickPublicErrorMap } from \"#/public-errors\"\nimport {\n CardTemplateCreateInputSchema,\n CardTemplateCreateOutputSchema,\n CardTemplateDeleteInputSchema,\n CardTemplateDeleteOutputSchema,\n CardTemplateGetInputSchema,\n CardTemplateGetOutputSchema,\n CardTemplateListInputSchema,\n CardTemplateListOutputSchema,\n CardTemplateUpdateInputSchema,\n CardTemplateUpdateOutputSchema,\n} from \"#/schemas/card\"\nimport { notebaseProcedure } from \"./shared\"\n\nexport const cardTemplateContract = {\n list: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\"))\n .route({\n method: \"GET\",\n path: \"/card-templates\",\n summary: \"List card templates\",\n tags: [\"Card Templates\"],\n })\n .input(CardTemplateListInputSchema)\n .output(CardTemplateListOutputSchema),\n\n get: notebaseProcedure\n .errors(pickPublicErrorMap(\"CARD_TEMPLATE_NOT_FOUND\"))\n .route({\n method: \"GET\",\n path: \"/card-templates/{id}\",\n summary: \"Get card template\",\n tags: [\"Card Templates\"],\n })\n .input(CardTemplateGetInputSchema)\n .output(CardTemplateGetOutputSchema),\n\n create: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\", \"CARD_TEMPLATE_INVALID_NOTEBASE_COLUMNS\"))\n .route({\n method: \"POST\",\n path: \"/card-templates\",\n summary: \"Create card template\",\n tags: [\"Card Templates\"],\n })\n .input(CardTemplateCreateInputSchema)\n .output(CardTemplateCreateOutputSchema),\n\n update: notebaseProcedure\n .errors(pickPublicErrorMap(\"CARD_TEMPLATE_NOT_FOUND\", \"CARD_TEMPLATE_INVALID_NOTEBASE_COLUMNS\"))\n .route({\n method: \"PATCH\",\n path: \"/card-templates/{id}\",\n summary: \"Update card template\",\n tags: [\"Card Templates\"],\n })\n .input(CardTemplateUpdateInputSchema)\n .output(CardTemplateUpdateOutputSchema),\n\n delete: notebaseProcedure\n .errors(pickPublicErrorMap(\"CARD_TEMPLATE_NOT_FOUND\"))\n .route({\n method: \"DELETE\",\n path: \"/card-templates/{id}\",\n summary: \"Delete card template\",\n tags: [\"Card Templates\"],\n })\n .input(CardTemplateDeleteInputSchema)\n .output(CardTemplateDeleteOutputSchema),\n}\n","import { z } from \"zod\"\n\nexport const HostedAiOutputFieldTypeSchema = z.enum([\"string\", \"number\"])\n\nexport const HostedAiOutputFieldSchema = z.strictObject({\n name: z.string().trim().min(1).max(80),\n type: HostedAiOutputFieldTypeSchema,\n})\n\nexport const HostedAiStreamTextInputSchema = z.strictObject({\n system: z.string().trim().min(1).max(16000),\n prompt: z.string().trim().min(1).max(32000),\n temperature: z.number().min(0).max(2).optional(),\n})\n\nexport const HostedAiStreamStructuredObjectInputSchema = z.strictObject({\n system: z.string().trim().min(1).max(16000),\n prompt: z.string().trim().min(1).max(32000),\n outputSchema: z.array(HostedAiOutputFieldSchema).min(1).max(32),\n temperature: z.number().min(0).max(2).optional(),\n}).superRefine((input, ctx) => {\n const fieldNames = new Set<string>()\n\n input.outputSchema.forEach((field, index) => {\n if (fieldNames.has(field.name)) {\n ctx.addIssue({\n code: \"custom\",\n message: `Duplicate output schema name \"${field.name}\".`,\n path: [\"outputSchema\", index, \"name\"],\n })\n return\n }\n\n fieldNames.add(field.name)\n })\n})\n\nexport const HostedAiStreamPartSchema = z.looseObject({\n type: z.string().trim().min(1),\n})\n\nexport type HostedAiOutputFieldType = z.infer<typeof HostedAiOutputFieldTypeSchema>\nexport type HostedAiOutputField = z.infer<typeof HostedAiOutputFieldSchema>\nexport type HostedAiStreamTextInput = z.infer<typeof HostedAiStreamTextInputSchema>\nexport type HostedAiStreamStructuredObjectInput = z.infer<typeof HostedAiStreamStructuredObjectInputSchema>\nexport type HostedAiStreamPart = z.infer<typeof HostedAiStreamPartSchema>\n","import { eventIterator, oc } from \"@orpc/contract\"\nimport {\n HostedAiStreamPartSchema,\n HostedAiStreamStructuredObjectInputSchema,\n HostedAiStreamTextInputSchema,\n} from \"#/schemas/hosted-ai\"\n\nexport const hostedAiContract = {\n translate: {\n streamText: oc\n .route({\n method: \"POST\",\n path: \"/hosted-ai/translate/stream-text\",\n summary: \"Stream hosted translation text output\",\n tags: [\"Hosted AI\"],\n })\n .input(HostedAiStreamTextInputSchema)\n .output(eventIterator(HostedAiStreamPartSchema)),\n },\n customAction: {\n streamStructuredObject: oc\n .route({\n method: \"POST\",\n path: \"/hosted-ai/custom-actions/stream-structured-object\",\n summary: \"Stream hosted custom action structured output\",\n tags: [\"Hosted AI\"],\n })\n .input(HostedAiStreamStructuredObjectInputSchema)\n .output(eventIterator(HostedAiStreamPartSchema)),\n },\n}\n","import { NOTEBASE_COLUMN_MAX_WIDTH, NOTEBASE_COLUMN_MIN_WIDTH, notebaseColumnConfigSchema } from \"@read-frog/definitions\"\nimport { z } from \"zod\"\n\nexport const notebaseColumnWidthSchema = z.number().int().min(NOTEBASE_COLUMN_MIN_WIDTH).max(NOTEBASE_COLUMN_MAX_WIDTH)\n\nexport const notebaseColumnSchema = z.object({\n id: z.string(),\n notebaseId: z.string(),\n name: z.string(),\n config: notebaseColumnConfigSchema,\n position: z.number(),\n isPrimary: z.boolean(),\n width: z.number().nullable(),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n})\nexport type NotebaseColumn = z.infer<typeof notebaseColumnSchema>\n\nexport const notebaseColumnCreateDataSchema = z.object({\n id: z.uuid().optional(),\n name: z.string().min(1),\n config: notebaseColumnConfigSchema,\n}).strict()\nexport type NotebaseColumnCreateData = z.infer<typeof notebaseColumnCreateDataSchema>\n\nexport const notebaseColumnUpdateDataSchema = z.object({\n name: z.string().min(1).optional(),\n config: notebaseColumnConfigSchema.optional(),\n width: notebaseColumnWidthSchema.nullable().optional(),\n}).strict()\nexport type NotebaseColumnUpdateData = z.infer<typeof notebaseColumnUpdateDataSchema>\n\nexport const NotebaseColumnCreateInputSchema = z.object({\n notebaseId: z.uuid(),\n data: notebaseColumnCreateDataSchema,\n})\nexport type NotebaseColumnCreateInput = z.infer<typeof NotebaseColumnCreateInputSchema>\n\nexport const NotebaseColumnCreateOutputSchema = z.object({\n txid: z.number(),\n})\nexport type NotebaseColumnCreateOutput = z.infer<typeof NotebaseColumnCreateOutputSchema>\n\nexport const NotebaseColumnUpdateInputSchema = z.object({\n notebaseColumnId: z.uuid(),\n data: notebaseColumnUpdateDataSchema,\n})\nexport type NotebaseColumnUpdateInput = z.infer<typeof NotebaseColumnUpdateInputSchema>\n\nexport const NotebaseColumnUpdateOutputSchema = z.object({\n txid: z.number(),\n})\nexport type NotebaseColumnUpdateOutput = z.infer<typeof NotebaseColumnUpdateOutputSchema>\n\nexport const NotebaseColumnDeleteInputSchema = z.object({\n notebaseColumnId: z.uuid(),\n})\nexport type NotebaseColumnDeleteInput = z.infer<typeof NotebaseColumnDeleteInputSchema>\n\nexport const NotebaseColumnDeleteOutputSchema = z.object({\n txid: z.number(),\n})\nexport type NotebaseColumnDeleteOutput = z.infer<typeof NotebaseColumnDeleteOutputSchema>\n\nexport const NotebaseColumnReorderInputSchema = z.object({\n notebaseId: z.uuid(),\n ids: z.array(z.uuid()),\n})\nexport type NotebaseColumnReorderInput = z.infer<typeof NotebaseColumnReorderInputSchema>\n\nexport const NotebaseColumnReorderOutputSchema = z.object({\n txid: z.number(),\n})\nexport type NotebaseColumnReorderOutput = z.infer<typeof NotebaseColumnReorderOutputSchema>\n","import { z } from \"zod\"\n\nexport const notebaseRowCellsSchema = z.record(z.string(), z.unknown())\n\nexport const notebaseRowSchema = z.object({\n id: z.string(),\n notebaseId: z.string(),\n cells: notebaseRowCellsSchema,\n position: z.number(),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n})\nexport type NotebaseRow = z.infer<typeof notebaseRowSchema>\n\nexport const notebaseRowCreateDataSchema = z.object({\n id: z.uuid().optional(),\n cells: notebaseRowCellsSchema.optional(),\n}).strict()\nexport type NotebaseRowCreateData = z.infer<typeof notebaseRowCreateDataSchema>\n\nexport const notebaseRowUpdateDataSchema = z.object({\n cells: notebaseRowCellsSchema.optional(),\n}).strict()\nexport type NotebaseRowUpdateData = z.infer<typeof notebaseRowUpdateDataSchema>\n\nexport const NotebaseRowCreateInputSchema = z.object({\n notebaseId: z.uuid(),\n data: notebaseRowCreateDataSchema,\n})\nexport type NotebaseRowCreateInput = z.infer<typeof NotebaseRowCreateInputSchema>\n\nexport const NotebaseRowCreateOutputSchema = z.object({\n txid: z.number(),\n})\nexport type NotebaseRowCreateOutput = z.infer<typeof NotebaseRowCreateOutputSchema>\n\nexport const NotebaseRowUpdateInputSchema = z.object({\n notebaseRowId: z.uuid(),\n data: notebaseRowUpdateDataSchema,\n})\nexport type NotebaseRowUpdateInput = z.infer<typeof NotebaseRowUpdateInputSchema>\n\nexport const NotebaseRowUpdateOutputSchema = z.object({\n id: z.uuid(),\n notebaseId: z.uuid(),\n cells: notebaseRowCellsSchema,\n position: z.number().int(),\n createdAt: z.date(),\n updatedAt: z.date(),\n txid: z.number(),\n})\nexport type NotebaseRowUpdateOutput = z.infer<typeof NotebaseRowUpdateOutputSchema>\n\nexport const NotebaseRowDeleteInputSchema = z.object({\n notebaseRowId: z.uuid(),\n})\nexport type NotebaseRowDeleteInput = z.infer<typeof NotebaseRowDeleteInputSchema>\n\nexport const NotebaseRowDeleteOutputSchema = z.object({\n txid: z.number(),\n})\nexport type NotebaseRowDeleteOutput = z.infer<typeof NotebaseRowDeleteOutputSchema>\n\nexport const NotebaseRowReorderInputSchema = z.object({\n notebaseId: z.uuid(),\n ids: z.array(z.uuid()),\n})\nexport type NotebaseRowReorderInput = z.infer<typeof NotebaseRowReorderInputSchema>\n\nexport const NotebaseRowReorderOutputSchema = z.object({\n txid: z.number(),\n})\nexport type NotebaseRowReorderOutput = z.infer<typeof NotebaseRowReorderOutputSchema>\n","import { z } from \"zod\"\n\nexport const notebaseViewTypeSchema = z.enum([\"table\", \"kanban\", \"gallery\"])\nexport type NotebaseViewType = z.infer<typeof notebaseViewTypeSchema>\n\nexport const notebaseViewConfigSchema = z.object({\n notebaseColumnWidths: z.record(z.string(), z.number()).optional(),\n hiddenNotebaseColumns: z.array(z.string()).optional(),\n groupByNotebaseColumnId: z.string().optional(),\n}).catchall(z.unknown())\nexport type NotebaseViewConfig = z.infer<typeof notebaseViewConfigSchema>\n\nexport const notebaseViewFilterSchema = z.object({\n notebaseColumnId: z.string(),\n operator: z.string(),\n value: z.unknown(),\n}).strict()\nexport type NotebaseViewFilter = z.infer<typeof notebaseViewFilterSchema>\n\nexport const notebaseViewFiltersSchema = z.array(notebaseViewFilterSchema)\n\nexport const notebaseViewSortSchema = z.object({\n notebaseColumnId: z.string(),\n direction: z.enum([\"asc\", \"desc\"]),\n}).strict()\nexport type NotebaseViewSort = z.infer<typeof notebaseViewSortSchema>\n\nexport const notebaseViewSortsSchema = z.array(notebaseViewSortSchema)\n\nexport const notebaseViewCreateDataSchema = z.object({\n id: z.uuid().optional(),\n name: z.string().min(1),\n type: notebaseViewTypeSchema,\n config: notebaseViewConfigSchema.optional(),\n filters: notebaseViewFiltersSchema.optional(),\n sorts: notebaseViewSortsSchema.optional(),\n}).strict()\nexport type NotebaseViewCreateData = z.infer<typeof notebaseViewCreateDataSchema>\n\nexport const notebaseViewUpdateDataSchema = z.object({\n name: z.string().min(1).optional(),\n type: notebaseViewTypeSchema.optional(),\n config: notebaseViewConfigSchema.optional(),\n filters: notebaseViewFiltersSchema.optional(),\n sorts: notebaseViewSortsSchema.optional(),\n}).strict()\nexport type NotebaseViewUpdateData = z.infer<typeof notebaseViewUpdateDataSchema>\n\nexport const notebaseViewSchema = z.object({\n id: z.string(),\n notebaseId: z.string(),\n name: z.string(),\n type: notebaseViewTypeSchema,\n config: notebaseViewConfigSchema.nullable(),\n filters: z.array(z.unknown()).nullable(),\n sorts: z.array(z.unknown()).nullable(),\n position: z.number(),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n})\nexport type NotebaseView = z.infer<typeof notebaseViewSchema>\n","import { notebaseColumnConfigSchema, schedulingParamsShape, srsWeightsSchema } from \"@read-frog/definitions\"\nimport { z } from \"zod\"\nimport { notebaseColumnSchema } from \"./notebase-column\"\nimport { notebaseRowSchema } from \"./notebase-row\"\nimport { notebaseViewSchema } from \"./notebase-view\"\n\nexport const NotebaseListInputSchema = z.object({})\nexport type NotebaseListInput = z.infer<typeof NotebaseListInputSchema>\n\nexport const NotebaseListItemSchema = z.object({\n id: z.string(),\n name: z.string(),\n})\nexport type NotebaseListItem = z.infer<typeof NotebaseListItemSchema>\n\nexport const NotebaseListOutputSchema = z.array(NotebaseListItemSchema)\nexport type NotebaseListOutput = z.infer<typeof NotebaseListOutputSchema>\n\nexport const notebaseSchema = z.object({\n id: z.string(),\n userId: z.string(),\n name: z.string(),\n srsNewPerDay: schedulingParamsShape.newPerDay,\n srsReviewsPerDay: schedulingParamsShape.reviewsPerDay,\n srsDesiredRetention: schedulingParamsShape.desiredRetention,\n srsEnableShortTerm: schedulingParamsShape.enableShortTerm,\n srsMaximumInterval: schedulingParamsShape.maximumInterval,\n srsLearningSteps: schedulingParamsShape.learningSteps,\n srsRelearningSteps: schedulingParamsShape.relearningSteps,\n srsLeechThreshold: schedulingParamsShape.leechThreshold,\n srsEnableFuzz: schedulingParamsShape.enableFuzz,\n srsWeights: srsWeightsSchema.nullable(),\n createdAt: z.date(),\n updatedAt: z.date(),\n})\nexport type Notebase = z.infer<typeof notebaseSchema>\n\nexport const notebaseCreateDataSchema = z.object({\n id: z.uuid().optional(),\n name: z.string().min(1),\n options: z.object({\n initialColumns: z.array(z.object({\n id: z.uuid(),\n name: z.string().min(1),\n config: notebaseColumnConfigSchema,\n }).strict()).min(1),\n initialRow: z.object({\n id: z.uuid().optional(),\n cells: z.record(z.string(), z.unknown()),\n }).strict().optional(),\n }).strict().optional(),\n}).strict()\nexport type NotebaseCreateData = z.infer<typeof notebaseCreateDataSchema>\n\nexport const NotebaseCreateInputSchema = notebaseCreateDataSchema\nexport type NotebaseCreateInput = z.infer<typeof NotebaseCreateInputSchema>\n\nexport const NotebaseCreateOutputSchema = z.object({\n txid: z.number(),\n})\nexport type NotebaseCreateOutput = z.infer<typeof NotebaseCreateOutputSchema>\n\nexport const notebaseUpdateDataSchema = z.object({\n name: z.string().min(1).optional(),\n srsNewPerDay: schedulingParamsShape.newPerDay.optional(),\n srsReviewsPerDay: schedulingParamsShape.reviewsPerDay.optional(),\n}).strict()\nexport type NotebaseUpdateData = z.infer<typeof notebaseUpdateDataSchema>\n\nexport const NotebaseUpdateInputSchema = notebaseUpdateDataSchema.extend({\n id: z.uuid(),\n})\nexport type NotebaseUpdateInput = z.infer<typeof NotebaseUpdateInputSchema>\n\nexport const NotebaseUpdateOutputSchema = z.object({\n txid: z.number(),\n})\nexport type NotebaseUpdateOutput = z.infer<typeof NotebaseUpdateOutputSchema>\n\nexport const NotebaseDeleteInputSchema = z.object({\n id: z.uuid(),\n})\nexport type NotebaseDeleteInput = z.infer<typeof NotebaseDeleteInputSchema>\n\nexport const NotebaseDeleteOutputSchema = z.object({\n txid: z.number(),\n})\nexport type NotebaseDeleteOutput = z.infer<typeof NotebaseDeleteOutputSchema>\n\n// Get endpoint schemas\nexport const NotebaseGetInputSchema = z.object({\n id: z.uuid(),\n})\nexport type NotebaseGetInput = z.infer<typeof NotebaseGetInputSchema>\n\nexport const NotebaseGetSchemaInputSchema = z.object({\n id: z.uuid(),\n})\nexport type NotebaseGetSchemaInput = z.infer<typeof NotebaseGetSchemaInputSchema>\n\nexport const NotebaseGetOutputSchema = notebaseSchema.extend({\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n notebaseColumns: z.array(notebaseColumnSchema),\n notebaseRows: z.array(notebaseRowSchema),\n notebaseViews: z.array(notebaseViewSchema),\n})\nexport type NotebaseGetOutput = z.infer<typeof NotebaseGetOutputSchema>\n\nexport const NotebaseGetSchemaOutputSchema = z.object({\n id: z.string(),\n name: z.string(),\n updatedAt: z.coerce.date(),\n notebaseColumns: z.array(notebaseColumnSchema),\n})\nexport type NotebaseGetSchemaOutput = z.infer<typeof NotebaseGetSchemaOutputSchema>\n","import { pickPublicErrorMap } from \"#/public-errors\"\nimport {\n NotebaseCreateInputSchema,\n NotebaseCreateOutputSchema,\n NotebaseDeleteInputSchema,\n NotebaseDeleteOutputSchema,\n NotebaseGetInputSchema,\n NotebaseGetOutputSchema,\n NotebaseGetSchemaInputSchema,\n NotebaseGetSchemaOutputSchema,\n NotebaseListInputSchema,\n NotebaseListOutputSchema,\n NotebaseUpdateInputSchema,\n NotebaseUpdateOutputSchema,\n} from \"#/schemas/notebase\"\nimport { notebaseProcedure } from \"./shared\"\n\nexport const notebaseContract = {\n list: notebaseProcedure\n .route({\n method: \"GET\",\n path: \"/notebases\",\n summary: \"List notebases\",\n tags: [\"Notebases\"],\n })\n .input(NotebaseListInputSchema)\n .output(NotebaseListOutputSchema),\n\n get: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\"))\n .route({\n method: \"GET\",\n path: \"/notebases/{id}\",\n summary: \"Get notebase with notebase columns, rows, and views\",\n tags: [\"Notebases\"],\n })\n .input(NotebaseGetInputSchema)\n .output(NotebaseGetOutputSchema),\n\n getSchema: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\"))\n .route({\n method: \"GET\",\n path: \"/notebases/{id}/schema\",\n summary: \"Get notebase schema\",\n tags: [\"Notebases\"],\n })\n .input(NotebaseGetSchemaInputSchema)\n .output(NotebaseGetSchemaOutputSchema),\n\n create: notebaseProcedure\n .route({\n method: \"POST\",\n path: \"/notebases\",\n summary: \"Create notebase\",\n tags: [\"Notebases\"],\n })\n .input(NotebaseCreateInputSchema)\n .output(NotebaseCreateOutputSchema),\n\n update: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\"))\n .route({\n method: \"PUT\",\n path: \"/notebases/{id}\",\n summary: \"Update notebase\",\n tags: [\"Notebases\"],\n })\n .input(NotebaseUpdateInputSchema)\n .output(NotebaseUpdateOutputSchema),\n\n delete: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\"))\n .route({\n method: \"DELETE\",\n path: \"/notebases/{id}\",\n summary: \"Delete notebase\",\n tags: [\"Notebases\"],\n })\n .input(NotebaseDeleteInputSchema)\n .output(NotebaseDeleteOutputSchema),\n}\n","import { pickPublicErrorMap } from \"#/public-errors\"\nimport {\n NotebaseColumnCreateInputSchema,\n NotebaseColumnCreateOutputSchema,\n NotebaseColumnDeleteInputSchema,\n NotebaseColumnDeleteOutputSchema,\n NotebaseColumnReorderInputSchema,\n NotebaseColumnReorderOutputSchema,\n NotebaseColumnUpdateInputSchema,\n NotebaseColumnUpdateOutputSchema,\n} from \"#/schemas/notebase-column\"\nimport { notebaseProcedure } from \"./shared\"\n\nexport const notebaseColumnContract = {\n create: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\", \"CONCURRENT_POSITION_CONFLICT\"))\n .route({\n method: \"POST\",\n path: \"/notebase-columns\",\n summary: \"Create notebase column\",\n tags: [\"Notebase Columns\"],\n })\n .input(NotebaseColumnCreateInputSchema)\n .output(NotebaseColumnCreateOutputSchema),\n\n update: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_COLUMN_NOT_FOUND\"))\n .route({\n method: \"PATCH\",\n path: \"/notebase-columns/{notebaseColumnId}\",\n summary: \"Update notebase column\",\n tags: [\"Notebase Columns\"],\n })\n .input(NotebaseColumnUpdateInputSchema)\n .output(NotebaseColumnUpdateOutputSchema),\n\n delete: notebaseProcedure\n .errors(pickPublicErrorMap(\n \"NOTEBASE_COLUMN_NOT_FOUND\",\n \"PRIMARY_NOTEBASE_COLUMN_DELETE_NOT_ALLOWED\",\n \"CARD_TEMPLATE_NOTEBASE_COLUMN_IN_USE\",\n \"CONCURRENT_POSITION_CONFLICT\",\n ))\n .route({\n method: \"DELETE\",\n path: \"/notebase-columns/{notebaseColumnId}\",\n summary: \"Delete notebase column\",\n tags: [\"Notebase Columns\"],\n })\n .input(NotebaseColumnDeleteInputSchema)\n .output(NotebaseColumnDeleteOutputSchema),\n\n reorder: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\", \"CONCURRENT_POSITION_CONFLICT\"))\n .route({\n method: \"POST\",\n path: \"/notebase-columns/reorder\",\n summary: \"Reorder notebase columns\",\n tags: [\"Notebase Columns\"],\n })\n .input(NotebaseColumnReorderInputSchema)\n .output(NotebaseColumnReorderOutputSchema),\n}\n","import { pickPublicErrorMap } from \"#/public-errors\"\nimport {\n NotebaseRowCreateInputSchema,\n NotebaseRowCreateOutputSchema,\n NotebaseRowDeleteInputSchema,\n NotebaseRowDeleteOutputSchema,\n NotebaseRowReorderInputSchema,\n NotebaseRowReorderOutputSchema,\n NotebaseRowUpdateInputSchema,\n NotebaseRowUpdateOutputSchema,\n} from \"#/schemas/notebase-row\"\nimport { notebaseProcedure } from \"./shared\"\n\nexport const notebaseRowContract = {\n create: notebaseProcedure\n .errors(pickPublicErrorMap(\n \"NOTEBASE_NOT_FOUND\",\n \"CELL_VALIDATION_FAILED\",\n \"CONCURRENT_POSITION_CONFLICT\",\n ))\n .route({\n method: \"POST\",\n path: \"/notebase-rows\",\n summary: \"Create notebase row\",\n tags: [\"Notebase Rows\"],\n })\n .input(NotebaseRowCreateInputSchema)\n .output(NotebaseRowCreateOutputSchema),\n\n update: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_ROW_NOT_FOUND\", \"CELL_VALIDATION_FAILED\"))\n .route({\n method: \"PATCH\",\n path: \"/notebase-rows/{notebaseRowId}\",\n summary: \"Update notebase row cells\",\n tags: [\"Notebase Rows\"],\n })\n .input(NotebaseRowUpdateInputSchema)\n .output(NotebaseRowUpdateOutputSchema),\n\n delete: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_ROW_NOT_FOUND\", \"CONCURRENT_POSITION_CONFLICT\"))\n .route({\n method: \"DELETE\",\n path: \"/notebase-rows/{notebaseRowId}\",\n summary: \"Delete notebase row\",\n tags: [\"Notebase Rows\"],\n })\n .input(NotebaseRowDeleteInputSchema)\n .output(NotebaseRowDeleteOutputSchema),\n\n reorder: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\", \"CONCURRENT_POSITION_CONFLICT\"))\n .route({\n method: \"POST\",\n path: \"/notebase-rows/reorder\",\n summary: \"Reorder notebase rows\",\n tags: [\"Notebase Rows\"],\n })\n .input(NotebaseRowReorderInputSchema)\n .output(NotebaseRowReorderOutputSchema),\n}\n","import { z } from \"zod\"\n\n// @ref https://zenn.dev/herp_inc/articles/js-intl-date-time-format-performance\nconst localeTimeZoneFormatter = new Map<string, Intl.DateTimeFormat>()\nfunction createTimezoneFormatter(timezone: string): Intl.DateTimeFormat {\n let formatter = localeTimeZoneFormatter.get(timezone)\n if (!formatter) {\n formatter = new Intl.DateTimeFormat(\"en-US\", { timeZone: timezone })\n localeTimeZoneFormatter.set(timezone, formatter)\n }\n return formatter\n}\n\nexport const timezoneSchema = z.string().trim().min(1).refine((timezone) => {\n try {\n createTimezoneFormatter(timezone).format(new Date())\n return true\n }\n catch {\n return false\n }\n}, \"Invalid timezone\")\nexport type Timezone = z.infer<typeof timezoneSchema>\n","import {\n activeScheduleStatusSchema,\n cardStateSchema,\n fsrsReviewLogSnapshotSchema,\n reviewRatingSchema,\n scheduleStatusSchema,\n schedulingParamsSchema,\n SRS_REVIEW_DURATION_MS_MAX,\n srsStepSchema,\n} from \"@read-frog/definitions\"\nimport { z } from \"zod\"\nimport { cardSchema } from \"./card\"\nimport { timezoneSchema } from \"./timezone\"\n\nexport {\n reviewRatingSchema,\n schedulingParamsSchema,\n SRS_REVIEW_DURATION_MS_MAX,\n}\nexport { timezoneSchema } from \"./timezone\"\nexport type { Timezone } from \"./timezone\"\nexport type { ReviewRating, SchedulingParams } from \"@read-frog/definitions\"\n\nexport const stepSchema = srsStepSchema\nexport type Step = z.infer<typeof stepSchema>\n\nexport const SRS_REVIEW_CLIENT_ID_NAMESPACE = \"6ba7b811-9dad-11d1-80b4-00c04fd430c8\"\nconst srsReviewClientIdNamePrefix = \"readfrog:srs-review\"\nconst nullLastReviewTimeSentinel = \"null\"\n\nexport interface SrsReviewClientIdCard {\n id: string\n lastReviewTime: Date | string | null\n}\n\nexport async function createSrsReviewClientId(card: SrsReviewClientIdCard) {\n return uuidV5(\n `${srsReviewClientIdNamePrefix}:${card.id}:${formatLastReviewTime(card.lastReviewTime)}`,\n SRS_REVIEW_CLIENT_ID_NAMESPACE,\n )\n}\n\nexport const srsReviewInputSchema = z.object({\n cardId: z.uuid(),\n id: z.uuid().optional(),\n rating: reviewRatingSchema,\n durationMs: z.number().int().min(0).max(SRS_REVIEW_DURATION_MS_MAX),\n timezone: timezoneSchema,\n}).strict()\nexport type SrsReviewInput = z.infer<typeof srsReviewInputSchema>\n\nexport const srsRollbackReviewInputSchema = z.object({\n cardId: z.uuid(),\n}).strict()\nexport type SrsRollbackReviewInput = z.infer<typeof srsRollbackReviewInputSchema>\n\nexport const srsScheduleStatusStatsSchema = z.record(\n activeScheduleStatusSchema,\n z.number().int().min(0),\n)\nexport type SrsScheduleStatusStats = z.infer<typeof srsScheduleStatusStatsSchema>\n\nexport const srsScheduleStatusStatsInputSchema = z.object({\n notebaseIds: z.array(z.uuid()).optional(),\n timezone: timezoneSchema,\n}).strict()\nexport type SrsScheduleStatusStatsInput = z.infer<typeof srsScheduleStatusStatsInputSchema>\n\nexport const srsScheduleStatusStatsOutputSchema = z.record(\n z.uuid(),\n srsScheduleStatusStatsSchema,\n)\nexport type SrsScheduleStatusStatsOutput = z.infer<typeof srsScheduleStatusStatsOutputSchema>\n\nexport const srsManualCardStatusInputSchema = z.object({\n cardId: z.uuid(),\n enabled: z.boolean(),\n}).strict()\nexport type SrsManualCardStatusInput = z.infer<typeof srsManualCardStatusInputSchema>\n\nexport const srsSetCardBuriedInputSchema = srsManualCardStatusInputSchema\nexport type SrsSetCardBuriedInput = SrsManualCardStatusInput\n\nexport const srsSetCardSuspendedInputSchema = srsManualCardStatusInputSchema\nexport type SrsSetCardSuspendedInput = SrsManualCardStatusInput\n\nexport const srsRevlogSchema = z.object({\n id: z.uuid(),\n notebaseId: z.uuid(),\n cardId: z.uuid(),\n rating: reviewRatingSchema,\n state: cardStateSchema,\n afterScheduleStatus: scheduleStatusSchema,\n reviewedAt: z.coerce.date(),\n durationMs: z.number().int(),\n fsrsReviewLogSnapshot: fsrsReviewLogSnapshotSchema,\n createdAt: z.coerce.date(),\n})\nexport type SrsRevlog = z.infer<typeof srsRevlogSchema>\n\nexport const srsRevlogWithoutSnapshotSchema = srsRevlogSchema.omit({\n fsrsReviewLogSnapshot: true,\n})\nexport type SrsRevlogWithoutSnapshot = z.infer<typeof srsRevlogWithoutSnapshotSchema>\n\nexport const srsReviewOutputSchema = z.object({\n card: cardSchema,\n revlog: srsRevlogSchema,\n txid: z.number(),\n})\nexport type SrsReviewOutput = z.infer<typeof srsReviewOutputSchema>\n\nexport const srsRollbackReviewOutputSchema = z.object({\n card: cardSchema,\n rolledBackRevlogId: z.uuid(),\n txid: z.number(),\n})\nexport type SrsRollbackReviewOutput = z.infer<typeof srsRollbackReviewOutputSchema>\n\nexport const srsTxidOutputSchema = z.object({\n txid: z.number(),\n})\nexport type SrsTxidOutput = z.infer<typeof srsTxidOutputSchema>\n\nexport const srsSetCardBuriedOutputSchema = srsTxidOutputSchema\nexport type SrsSetCardBuriedOutput = SrsTxidOutput\n\nexport const srsSetCardSuspendedOutputSchema = srsTxidOutputSchema\nexport type SrsSetCardSuspendedOutput = SrsTxidOutput\n\nfunction formatLastReviewTime(lastReviewTime: Date | string | null) {\n return lastReviewTime ? new Date(lastReviewTime).toISOString() : nullLastReviewTimeSentinel\n}\n\nasync function uuidV5(name: string, namespace: string) {\n const namespaceBytes = uuidToBytes(namespace)\n const nameBytes = new TextEncoder().encode(name)\n const input = new Uint8Array(namespaceBytes.length + nameBytes.length)\n input.set(namespaceBytes)\n input.set(nameBytes, namespaceBytes.length)\n\n const hash = new Uint8Array(await crypto.subtle.digest(\"SHA-1\", input))\n const bytes = hash.slice(0, 16)\n const versionByte = bytes[6]\n const variantByte = bytes[8]\n if (versionByte === undefined || variantByte === undefined) {\n throw new Error(\"SHA-1 digest was too short\")\n }\n bytes[6] = (versionByte & 0x0F) | 0x50\n bytes[8] = (variantByte & 0x3F) | 0x80\n\n return bytesToUuid(bytes)\n}\n\nfunction uuidToBytes(uuid: string) {\n const hex = uuid.replaceAll(\"-\", \"\").toLowerCase()\n /* v8 ignore next 3 -- SRS_REVIEW_CLIENT_ID_NAMESPACE is a fixed valid UUID. */\n if (!/^[0-9a-f]{32}$/.test(hex)) {\n throw new Error(\"Invalid UUID namespace\")\n }\n\n return new Uint8Array(\n Array.from({ length: 16 }, (_, index) =>\n Number.parseInt(hex.slice(index * 2, index * 2 + 2), 16)),\n )\n}\n\nfunction bytesToUuid(bytes: Uint8Array) {\n const hex = Array.from(bytes, byte => byte.toString(16).padStart(2, \"0\"))\n return [\n hex.slice(0, 4).join(\"\"),\n hex.slice(4, 6).join(\"\"),\n hex.slice(6, 8).join(\"\"),\n hex.slice(8, 10).join(\"\"),\n hex.slice(10, 16).join(\"\"),\n ].join(\"-\")\n}\n","import { pickPublicErrorMap } from \"#/public-errors\"\nimport {\n srsReviewInputSchema,\n srsReviewOutputSchema,\n srsRollbackReviewInputSchema,\n srsRollbackReviewOutputSchema,\n srsScheduleStatusStatsInputSchema,\n srsScheduleStatusStatsOutputSchema,\n srsSetCardBuriedInputSchema,\n srsSetCardBuriedOutputSchema,\n srsSetCardSuspendedInputSchema,\n srsSetCardSuspendedOutputSchema,\n} from \"#/schemas/srs\"\nimport { notebaseProcedure } from \"./shared\"\n\nexport const srsContract = {\n scheduleStatusStats: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\"))\n .route({\n method: \"GET\",\n path: \"/srs/schedule-status-stats\",\n summary: \"List today schedule status stats for notebases\",\n tags: [\"SRS\"],\n })\n .input(srsScheduleStatusStatsInputSchema)\n .output(srsScheduleStatusStatsOutputSchema),\n\n review: notebaseProcedure\n .errors(pickPublicErrorMap(\n \"CARD_NOT_FOUND\",\n \"CARD_NOT_REVIEWABLE\",\n \"CARD_REVIEW_STATE_STALE\",\n ))\n .route({\n method: \"POST\",\n path: \"/srs/review\",\n summary: \"Review a card with SRS scheduling\",\n tags: [\"SRS\"],\n })\n .input(srsReviewInputSchema)\n .output(srsReviewOutputSchema),\n rollbackReview: notebaseProcedure\n .errors(pickPublicErrorMap(\n \"CARD_NOT_FOUND\",\n \"CARD_REVIEW_ROLLBACK_UNAVAILABLE\",\n ))\n .route({\n method: \"POST\",\n path: \"/srs/review/rollback\",\n summary: \"Roll back the latest SRS review for a card\",\n tags: [\"SRS\"],\n })\n .input(srsRollbackReviewInputSchema)\n .output(srsRollbackReviewOutputSchema),\n setCardBuried: notebaseProcedure\n .errors(pickPublicErrorMap(\n \"CARD_NOT_FOUND\",\n \"CARD_ALREADY_BURIED\",\n \"CARD_NOT_BURIED\",\n \"CARD_STATUS_CHANGE_UNAVAILABLE\",\n ))\n .route({\n method: \"POST\",\n path: \"/srs/card/bury\",\n summary: \"Manually bury or unbury a card\",\n tags: [\"SRS\"],\n })\n .input(srsSetCardBuriedInputSchema)\n .output(srsSetCardBuriedOutputSchema),\n setCardSuspended: notebaseProcedure\n .errors(pickPublicErrorMap(\n \"CARD_NOT_FOUND\",\n \"CARD_ALREADY_SUSPENDED\",\n \"CARD_NOT_SUSPENDED\",\n \"CARD_STATUS_CHANGE_UNAVAILABLE\",\n ))\n .route({\n method: \"POST\",\n path: \"/srs/card/suspend\",\n summary: \"Manually suspend or unsuspend a card\",\n tags: [\"SRS\"],\n })\n .input(srsSetCardSuspendedInputSchema)\n .output(srsSetCardSuspendedOutputSchema),\n}\n","import { z } from \"zod\"\nimport { timezoneSchema } from \"./timezone\"\n\nexport const userEnsureTimezoneInputSchema = z.object({\n timezone: timezoneSchema,\n}).strict()\nexport type UserEnsureTimezoneInput = z.infer<typeof userEnsureTimezoneInputSchema>\n\nexport const userEnsureTimezoneOutputSchema = z.object({\n timezone: timezoneSchema,\n updated: z.boolean(),\n}).strict()\nexport type UserEnsureTimezoneOutput = z.infer<typeof userEnsureTimezoneOutputSchema>\n\nexport const userUpdateTimezoneInputSchema = z.object({\n timezone: timezoneSchema,\n}).strict()\nexport type UserUpdateTimezoneInput = z.infer<typeof userUpdateTimezoneInputSchema>\n\nexport const userUpdateTimezoneOutputSchema = z.object({\n timezone: timezoneSchema,\n}).strict()\nexport type UserUpdateTimezoneOutput = z.infer<typeof userUpdateTimezoneOutputSchema>\n","import { oc } from \"@orpc/contract\"\nimport {\n userEnsureTimezoneInputSchema,\n userEnsureTimezoneOutputSchema,\n userUpdateTimezoneInputSchema,\n userUpdateTimezoneOutputSchema,\n} from \"#/schemas/user\"\n\nexport const userContract = {\n ensureTimezone: oc\n .route({\n method: \"POST\",\n path: \"/users/me/timezone/ensure\",\n summary: \"Ensure the authenticated user has a timezone\",\n tags: [\"Users\"],\n })\n .input(userEnsureTimezoneInputSchema)\n .output(userEnsureTimezoneOutputSchema),\n updateTimezone: oc\n .route({\n method: \"PATCH\",\n path: \"/users/me/timezone\",\n summary: \"Update the authenticated user's timezone\",\n tags: [\"Users\"],\n })\n .input(userUpdateTimezoneInputSchema)\n .output(userUpdateTimezoneOutputSchema),\n}\n","import type { ContractRouterClient } from \"@orpc/contract\"\nimport { betaAccessContract } from \"./contracts/beta-access\"\nimport { cardContract } from \"./contracts/card\"\nimport { cardTemplateContract } from \"./contracts/card-template\"\nimport { hostedAiContract } from \"./contracts/hosted-ai\"\nimport { notebaseContract } from \"./contracts/notebase\"\nimport { notebaseColumnContract } from \"./contracts/notebase-column\"\nimport { notebaseRowContract } from \"./contracts/notebase-row\"\nimport { srsContract } from \"./contracts/srs\"\nimport { userContract } from \"./contracts/user\"\n\nexport const contract = {\n betaAccess: betaAccessContract,\n card: cardContract,\n cardTemplate: cardTemplateContract,\n hostedAi: hostedAiContract,\n notebase: notebaseContract,\n notebaseColumn: notebaseColumnContract,\n notebaseRow: notebaseRowContract,\n srs: srsContract,\n user: userContract,\n}\n\nexport type ORPCRouterClient = ContractRouterClient<typeof contract>\n\nexport * from \"./public-errors\"\nexport * from \"./schemas/beta-access\"\nexport * from \"./schemas/card\"\nexport * from \"./schemas/hosted-ai\"\nexport * from \"./schemas/notebase\"\nexport * from \"./schemas/notebase-column\"\nexport * from \"./schemas/notebase-row\"\nexport * from \"./schemas/notebase-view\"\nexport * from \"./schemas/srs\"\nexport * from \"./schemas/timezone\"\nexport * from \"./schemas/user\"\n"],"mappings":";;;;AAGA,MAAa,uBAAuB,EAAE,KAAK,iBAAiB;AAG5D,MAAa,8BAA8B,EAAE,OAAO,EAClD,YAAY,qBACd,CAAC,CAAC,CAAC,OAAO;AAGV,MAAa,+BAA+B,EAAE,OAAO;CACnD,YAAY;CACZ,SAAS,EAAE,QAAQ;AACrB,CAAC;;;ACRD,MAAa,qBAAqB,EAChC,QAAQ,GACL,MAAM;CACL,QAAQ;CACR,MAAM;CACN,SAAS;CACT,MAAM,CAAC,aAAa;AACtB,CAAC,CAAC,CACD,MAAM,2BAA2B,CAAC,CAClC,OAAO,4BAA4B,EACxC;;;ACPA,MAAa,oCAAoC,EAAE,KAAK;CACtD;CACA;CACA;CACA;AACF,CAAC;AAGD,MAAa,qCA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AAC,CAAC,OAAO;AAGV,MAAa,gCAAgC,EAAE,OAAO,EACpD,UAAU,eACZ,CAAC,CAAC,CAAC,OAAO;AAGV,MAAa,iCAAiC,EAAE,OAAO,EACrD,UAAU,eACZ,CAAC,CAAC,CAAC,OAAO;;;AEVV,MAAa,WAAW;CACtB,YAAY;CACZ,MAAM;CACN,cAAc;CACd,UAAU;CACV,UAAU;CACV,gBAAgB;CAChB,aAAa;CACb,KAAK;CACL,MAAM;EDXN,gBAAgB,GACb,MAAM;GACL,QAAQ;GACR,MAAM;GACN,SAAS;GACT,MAAM,CAAC,OAAO;EAChB,CAAC,CAAC,CACD,MAAM,6BAA6B,CAAC,CACpC,OAAO,8BAA8B;EACxC,gBAAgB,GACb,MAAM;GACL,QAAQ;GACR,MAAM;GACN,SAAS;GACT,MAAM,CAAC,OAAO;EAChB,CAAC,CAAC,CACD,MAAM,6BAA6B,CAAC,CACpC,OAAO,8BAA8B;CCNlC;AACR"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@read-frog/api-contract",
3
3
  "type": "module",
4
- "version": "0.6.1",
4
+ "version": "0.8.0",
5
5
  "private": false,
6
6
  "repository": {
7
7
  "type": "git",
@@ -26,7 +26,7 @@
26
26
  "dependencies": {
27
27
  "@orpc/contract": "^1.14.5",
28
28
  "zod": "^4.4.3",
29
- "@read-frog/definitions": "0.3.1"
29
+ "@read-frog/definitions": "0.3.3"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/node": "^25.9.2",
@@ -0,0 +1,31 @@
1
+ import { eventIterator, oc } from "@orpc/contract"
2
+ import {
3
+ HostedAiStreamPartSchema,
4
+ HostedAiStreamStructuredObjectInputSchema,
5
+ HostedAiStreamTextInputSchema,
6
+ } from "#/schemas/hosted-ai"
7
+
8
+ export const hostedAiContract = {
9
+ translate: {
10
+ streamText: oc
11
+ .route({
12
+ method: "POST",
13
+ path: "/hosted-ai/translate/stream-text",
14
+ summary: "Stream hosted translation text output",
15
+ tags: ["Hosted AI"],
16
+ })
17
+ .input(HostedAiStreamTextInputSchema)
18
+ .output(eventIterator(HostedAiStreamPartSchema)),
19
+ },
20
+ customAction: {
21
+ streamStructuredObject: oc
22
+ .route({
23
+ method: "POST",
24
+ path: "/hosted-ai/custom-actions/stream-structured-object",
25
+ summary: "Stream hosted custom action structured output",
26
+ tags: ["Hosted AI"],
27
+ })
28
+ .input(HostedAiStreamStructuredObjectInputSchema)
29
+ .output(eventIterator(HostedAiStreamPartSchema)),
30
+ },
31
+ }