@read-frog/api-contract 0.4.1 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1355 -525
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +486 -202
- package/dist/index.js.map +1 -1
- package/package.json +18 -10
- package/src/contracts/beta-access.ts +1 -1
- package/src/contracts/card-template.ts +71 -0
- package/src/contracts/card.ts +45 -0
- package/src/contracts/notebase-column.ts +63 -0
- package/src/contracts/notebase-row.ts +62 -0
- package/src/contracts/notebase.ts +82 -0
- package/src/contracts/shared.ts +1 -1
- package/src/contracts/srs.ts +38 -0
- package/src/contracts/user.ts +17 -0
- package/src/index.ts +22 -10
- package/src/public-errors.ts +46 -12
- package/src/schemas/card.ts +120 -0
- package/src/schemas/notebase-column.ts +74 -0
- package/src/schemas/notebase-row.ts +73 -0
- package/src/schemas/notebase-view.ts +61 -0
- package/src/schemas/notebase.ts +103 -0
- package/src/schemas/srs.ts +129 -0
- package/src/schemas/timezone.ts +23 -0
- package/src/schemas/user.ts +13 -0
- package/src/contracts/column.ts +0 -62
- package/src/contracts/custom-table.ts +0 -82
- package/src/contracts/row.ts +0 -62
- package/src/schemas/column.ts +0 -74
- package/src/schemas/custom-table.ts +0 -86
- package/src/schemas/row.ts +0 -73
- package/src/schemas/view.ts +0 -61
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/schemas/beta-access.ts","../src/contracts/beta-access.ts","../src/public-errors.ts","../src/schemas/column.ts","../src/contracts/shared.ts","../src/contracts/column.ts","../src/schemas/row.ts","../src/schemas/view.ts","../src/schemas/custom-table.ts","../src/contracts/custom-table.ts","../src/contracts/row.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_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 columnId: z.string(),\n details: CellValidationFailureDetailsSchema,\n reason: CellValidationFailureReasonSchema,\n}).strict()\nexport type CellValidationFailedData = z.infer<typeof CellValidationFailedDataSchema>\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 TABLE_NOT_FOUND: {\n message: \"Table not found\",\n status: 404,\n },\n COLUMN_NOT_FOUND: {\n message: \"Column not found\",\n status: 404,\n },\n ROW_NOT_FOUND: {\n message: \"Row not found\",\n status: 404,\n },\n VIEW_NOT_FOUND: {\n message: \"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_COLUMN_DELETE_NOT_ALLOWED: {\n message: \"Cannot delete primary 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 { COLUMN_MAX_WIDTH, COLUMN_MIN_WIDTH, columnConfigSchema } from \"@read-frog/definitions\"\nimport { z } from \"zod\"\n\nexport const columnWidthSchema = z.number().int().min(COLUMN_MIN_WIDTH).max(COLUMN_MAX_WIDTH)\n\nexport const tableColumnSchema = z.object({\n id: z.string(),\n tableId: z.string(),\n name: z.string(),\n config: columnConfigSchema,\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 TableColumn = z.infer<typeof tableColumnSchema>\n\nexport const columnCreateDataSchema = z.object({\n id: z.uuid().optional(),\n name: z.string().min(1),\n config: columnConfigSchema,\n}).strict()\nexport type ColumnCreateData = z.infer<typeof columnCreateDataSchema>\n\nexport const columnUpdateDataSchema = z.object({\n name: z.string().min(1).optional(),\n config: columnConfigSchema.optional(),\n width: columnWidthSchema.nullable().optional(),\n}).strict()\nexport type ColumnUpdateData = z.infer<typeof columnUpdateDataSchema>\n\nexport const ColumnCreateInputSchema = z.object({\n tableId: z.uuid(),\n data: columnCreateDataSchema,\n})\nexport type ColumnCreateInput = z.infer<typeof ColumnCreateInputSchema>\n\nexport const ColumnCreateOutputSchema = z.object({\n txid: z.number(),\n})\nexport type ColumnCreateOutput = z.infer<typeof ColumnCreateOutputSchema>\n\nexport const ColumnUpdateInputSchema = z.object({\n columnId: z.uuid(),\n data: columnUpdateDataSchema,\n})\nexport type ColumnUpdateInput = z.infer<typeof ColumnUpdateInputSchema>\n\nexport const ColumnUpdateOutputSchema = z.object({\n txid: z.number(),\n})\nexport type ColumnUpdateOutput = z.infer<typeof ColumnUpdateOutputSchema>\n\nexport const ColumnDeleteInputSchema = z.object({\n columnId: z.uuid(),\n})\nexport type ColumnDeleteInput = z.infer<typeof ColumnDeleteInputSchema>\n\nexport const ColumnDeleteOutputSchema = z.object({\n txid: z.number(),\n})\nexport type ColumnDeleteOutput = z.infer<typeof ColumnDeleteOutputSchema>\n\nexport const ColumnReorderInputSchema = z.object({\n tableId: z.uuid(),\n ids: z.array(z.uuid()),\n})\nexport type ColumnReorderInput = z.infer<typeof ColumnReorderInputSchema>\n\nexport const ColumnReorderOutputSchema = z.object({\n txid: z.number(),\n})\nexport type ColumnReorderOutput = z.infer<typeof ColumnReorderOutputSchema>\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 ColumnCreateInputSchema,\n ColumnCreateOutputSchema,\n ColumnDeleteInputSchema,\n ColumnDeleteOutputSchema,\n ColumnReorderInputSchema,\n ColumnReorderOutputSchema,\n ColumnUpdateInputSchema,\n ColumnUpdateOutputSchema,\n} from \"@/schemas/column\"\nimport { notebaseProcedure } from \"./shared\"\n\nexport const columnContract = {\n create: notebaseProcedure\n .errors(pickPublicErrorMap(\"TABLE_NOT_FOUND\", \"CONCURRENT_POSITION_CONFLICT\"))\n .route({\n method: \"POST\",\n path: \"/columns\",\n summary: \"Create column\",\n tags: [\"Columns\"],\n })\n .input(ColumnCreateInputSchema)\n .output(ColumnCreateOutputSchema),\n\n update: notebaseProcedure\n .errors(pickPublicErrorMap(\"COLUMN_NOT_FOUND\"))\n .route({\n method: \"PATCH\",\n path: \"/columns/{columnId}\",\n summary: \"Update column\",\n tags: [\"Columns\"],\n })\n .input(ColumnUpdateInputSchema)\n .output(ColumnUpdateOutputSchema),\n\n delete: notebaseProcedure\n .errors(pickPublicErrorMap(\n \"COLUMN_NOT_FOUND\",\n \"PRIMARY_COLUMN_DELETE_NOT_ALLOWED\",\n \"CONCURRENT_POSITION_CONFLICT\",\n ))\n .route({\n method: \"DELETE\",\n path: \"/columns/{columnId}\",\n summary: \"Delete column\",\n tags: [\"Columns\"],\n })\n .input(ColumnDeleteInputSchema)\n .output(ColumnDeleteOutputSchema),\n\n reorder: notebaseProcedure\n .errors(pickPublicErrorMap(\"TABLE_NOT_FOUND\", \"CONCURRENT_POSITION_CONFLICT\"))\n .route({\n method: \"POST\",\n path: \"/columns/reorder\",\n summary: \"Reorder columns in a table\",\n tags: [\"Columns\"],\n })\n .input(ColumnReorderInputSchema)\n .output(ColumnReorderOutputSchema),\n}\n","import { z } from \"zod\"\n\nexport const rowCellsSchema = z.record(z.string(), z.unknown())\n\nexport const tableRowSchema = z.object({\n id: z.string(),\n tableId: z.string(),\n cells: rowCellsSchema,\n position: z.number(),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n})\nexport type TableRow = z.infer<typeof tableRowSchema>\n\nexport const rowCreateDataSchema = z.object({\n id: z.uuid().optional(),\n cells: rowCellsSchema.optional(),\n}).strict()\nexport type RowCreateData = z.infer<typeof rowCreateDataSchema>\n\nexport const rowUpdateDataSchema = z.object({\n cells: rowCellsSchema.optional(),\n}).strict()\nexport type RowUpdateData = z.infer<typeof rowUpdateDataSchema>\n\nexport const RowCreateInputSchema = z.object({\n tableId: z.uuid(),\n data: rowCreateDataSchema,\n})\nexport type RowCreateInput = z.infer<typeof RowCreateInputSchema>\n\nexport const RowCreateOutputSchema = z.object({\n txid: z.number(),\n})\nexport type RowCreateOutput = z.infer<typeof RowCreateOutputSchema>\n\nexport const RowUpdateInputSchema = z.object({\n rowId: z.uuid(),\n data: rowUpdateDataSchema,\n})\nexport type RowUpdateInput = z.infer<typeof RowUpdateInputSchema>\n\nexport const RowUpdateOutputSchema = z.object({\n id: z.uuid(),\n tableId: z.uuid(),\n cells: rowCellsSchema,\n position: z.number().int(),\n createdAt: z.date(),\n updatedAt: z.date(),\n txid: z.number(),\n})\nexport type RowUpdateOutput = z.infer<typeof RowUpdateOutputSchema>\n\nexport const RowDeleteInputSchema = z.object({\n rowId: z.uuid(),\n})\nexport type RowDeleteInput = z.infer<typeof RowDeleteInputSchema>\n\nexport const RowDeleteOutputSchema = z.object({\n txid: z.number(),\n})\nexport type RowDeleteOutput = z.infer<typeof RowDeleteOutputSchema>\n\nexport const RowReorderInputSchema = z.object({\n tableId: z.uuid(),\n ids: z.array(z.uuid()),\n})\nexport type RowReorderInput = z.infer<typeof RowReorderInputSchema>\n\nexport const RowReorderOutputSchema = z.object({\n txid: z.number(),\n})\nexport type RowReorderOutput = z.infer<typeof RowReorderOutputSchema>\n","import { z } from \"zod\"\n\nexport const tableViewTypeSchema = z.enum([\"table\", \"kanban\", \"gallery\"])\nexport type TableViewType = z.infer<typeof tableViewTypeSchema>\n\nexport const viewConfigSchema = z.object({\n columnWidths: z.record(z.string(), z.number()).optional(),\n hiddenColumns: z.array(z.string()).optional(),\n groupByColumnId: z.string().optional(),\n}).catchall(z.unknown())\nexport type ViewConfig = z.infer<typeof viewConfigSchema>\n\nexport const viewFilterSchema = z.object({\n columnId: z.string(),\n operator: z.string(),\n value: z.unknown(),\n}).strict()\nexport type ViewFilter = z.infer<typeof viewFilterSchema>\n\nexport const viewFiltersSchema = z.array(viewFilterSchema)\n\nexport const viewSortSchema = z.object({\n columnId: z.string(),\n direction: z.enum([\"asc\", \"desc\"]),\n}).strict()\nexport type ViewSort = z.infer<typeof viewSortSchema>\n\nexport const viewSortsSchema = z.array(viewSortSchema)\n\nexport const viewCreateDataSchema = z.object({\n id: z.uuid().optional(),\n name: z.string().min(1),\n type: tableViewTypeSchema,\n config: viewConfigSchema.optional(),\n filters: viewFiltersSchema.optional(),\n sorts: viewSortsSchema.optional(),\n}).strict()\nexport type ViewCreateData = z.infer<typeof viewCreateDataSchema>\n\nexport const viewUpdateDataSchema = z.object({\n name: z.string().min(1).optional(),\n type: tableViewTypeSchema.optional(),\n config: viewConfigSchema.optional(),\n filters: viewFiltersSchema.optional(),\n sorts: viewSortsSchema.optional(),\n}).strict()\nexport type ViewUpdateData = z.infer<typeof viewUpdateDataSchema>\n\nexport const tableViewSchema = z.object({\n id: z.string(),\n tableId: z.string(),\n name: z.string(),\n type: tableViewTypeSchema,\n config: viewConfigSchema.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 TableView = z.infer<typeof tableViewSchema>\n","import { z } from \"zod\"\nimport { tableColumnSchema } from \"./column\"\nimport { tableRowSchema } from \"./row\"\nimport { tableViewSchema } from \"./view\"\n\nexport const CustomTableListInputSchema = z.object({})\nexport type CustomTableListInput = z.infer<typeof CustomTableListInputSchema>\n\nexport const CustomTableListItemSchema = z.object({\n id: z.string(),\n name: z.string(),\n})\nexport type CustomTableListItem = z.infer<typeof CustomTableListItemSchema>\n\nexport const CustomTableListOutputSchema = z.array(CustomTableListItemSchema)\nexport type CustomTableListOutput = z.infer<typeof CustomTableListOutputSchema>\n\nexport const customTableCreateDataSchema = z.object({\n id: z.uuid().optional(),\n name: z.string().min(1),\n}).strict()\nexport type CustomTableCreateData = z.infer<typeof customTableCreateDataSchema>\n\nexport const CustomTableCreateInputSchema = customTableCreateDataSchema\nexport type CustomTableCreateInput = z.infer<typeof CustomTableCreateInputSchema>\n\nexport const CustomTableCreateOutputSchema = z.object({\n txid: z.number(),\n})\nexport type CustomTableCreateOutput = z.infer<typeof CustomTableCreateOutputSchema>\n\nexport const customTableUpdateDataSchema = z.object({\n name: z.string().min(1).optional(),\n}).strict()\nexport type CustomTableUpdateData = z.infer<typeof customTableUpdateDataSchema>\n\nexport const CustomTableUpdateInputSchema = customTableUpdateDataSchema.extend({\n id: z.uuid(),\n})\nexport type CustomTableUpdateInput = z.infer<typeof CustomTableUpdateInputSchema>\n\nexport const CustomTableUpdateOutputSchema = z.object({\n txid: z.number(),\n})\nexport type CustomTableUpdateOutput = z.infer<typeof CustomTableUpdateOutputSchema>\n\nexport const CustomTableDeleteInputSchema = z.object({\n id: z.uuid(),\n})\nexport type CustomTableDeleteInput = z.infer<typeof CustomTableDeleteInputSchema>\n\nexport const CustomTableDeleteOutputSchema = z.object({\n txid: z.number(),\n})\nexport type CustomTableDeleteOutput = z.infer<typeof CustomTableDeleteOutputSchema>\n\n// Get endpoint schemas\nexport const CustomTableGetInputSchema = z.object({\n id: z.uuid(),\n})\nexport type CustomTableGetInput = z.infer<typeof CustomTableGetInputSchema>\n\nexport const CustomTableGetSchemaInputSchema = z.object({\n id: z.uuid(),\n})\nexport type CustomTableGetSchemaInput = z.infer<typeof CustomTableGetSchemaInputSchema>\n\nexport const CustomTableGetOutputSchema = z.object({\n id: z.string(),\n userId: z.string(),\n name: z.string(),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n columns: z.array(tableColumnSchema),\n rows: z.array(tableRowSchema),\n views: z.array(tableViewSchema),\n})\nexport type CustomTableGetOutput = z.infer<typeof CustomTableGetOutputSchema>\n\nexport const CustomTableGetSchemaOutputSchema = z.object({\n id: z.string(),\n name: z.string(),\n updatedAt: z.coerce.date(),\n columns: z.array(tableColumnSchema),\n})\nexport type CustomTableGetSchemaOutput = z.infer<typeof CustomTableGetSchemaOutputSchema>\n","import { pickPublicErrorMap } from \"@/public-errors\"\nimport {\n CustomTableCreateInputSchema,\n CustomTableCreateOutputSchema,\n CustomTableDeleteInputSchema,\n CustomTableDeleteOutputSchema,\n CustomTableGetInputSchema,\n CustomTableGetOutputSchema,\n CustomTableGetSchemaInputSchema,\n CustomTableGetSchemaOutputSchema,\n CustomTableListInputSchema,\n CustomTableListOutputSchema,\n CustomTableUpdateInputSchema,\n CustomTableUpdateOutputSchema,\n} from \"@/schemas/custom-table\"\nimport { notebaseProcedure } from \"./shared\"\n\nexport const customTableContract = {\n list: notebaseProcedure\n .route({\n method: \"GET\",\n path: \"/custom-tables\",\n summary: \"List custom tables\",\n tags: [\"Custom Tables\"],\n })\n .input(CustomTableListInputSchema)\n .output(CustomTableListOutputSchema),\n\n get: notebaseProcedure\n .errors(pickPublicErrorMap(\"TABLE_NOT_FOUND\"))\n .route({\n method: \"GET\",\n path: \"/custom-tables/{id}\",\n summary: \"Get custom table with columns, rows, and views\",\n tags: [\"Custom Tables\"],\n })\n .input(CustomTableGetInputSchema)\n .output(CustomTableGetOutputSchema),\n\n getSchema: notebaseProcedure\n .errors(pickPublicErrorMap(\"TABLE_NOT_FOUND\"))\n .route({\n method: \"GET\",\n path: \"/custom-tables/{id}/schema\",\n summary: \"Get custom table schema\",\n tags: [\"Custom Tables\"],\n })\n .input(CustomTableGetSchemaInputSchema)\n .output(CustomTableGetSchemaOutputSchema),\n\n create: notebaseProcedure\n .route({\n method: \"POST\",\n path: \"/custom-tables\",\n summary: \"Create custom table\",\n tags: [\"Custom Tables\"],\n })\n .input(CustomTableCreateInputSchema)\n .output(CustomTableCreateOutputSchema),\n\n update: notebaseProcedure\n .errors(pickPublicErrorMap(\"TABLE_NOT_FOUND\"))\n .route({\n method: \"PUT\",\n path: \"/custom-tables/{id}\",\n summary: \"Update custom table\",\n tags: [\"Custom Tables\"],\n })\n .input(CustomTableUpdateInputSchema)\n .output(CustomTableUpdateOutputSchema),\n\n delete: notebaseProcedure\n .errors(pickPublicErrorMap(\"TABLE_NOT_FOUND\"))\n .route({\n method: \"DELETE\",\n path: \"/custom-tables/{id}\",\n summary: \"Delete custom table\",\n tags: [\"Custom Tables\"],\n })\n .input(CustomTableDeleteInputSchema)\n .output(CustomTableDeleteOutputSchema),\n}\n","import { pickPublicErrorMap } from \"@/public-errors\"\nimport {\n RowCreateInputSchema,\n RowCreateOutputSchema,\n RowDeleteInputSchema,\n RowDeleteOutputSchema,\n RowReorderInputSchema,\n RowReorderOutputSchema,\n RowUpdateInputSchema,\n RowUpdateOutputSchema,\n} from \"@/schemas/row\"\nimport { notebaseProcedure } from \"./shared\"\n\nexport const rowContract = {\n create: notebaseProcedure\n .errors(pickPublicErrorMap(\n \"TABLE_NOT_FOUND\",\n \"CELL_VALIDATION_FAILED\",\n \"CONCURRENT_POSITION_CONFLICT\",\n ))\n .route({\n method: \"POST\",\n path: \"/rows\",\n summary: \"Create row\",\n tags: [\"Rows\"],\n })\n .input(RowCreateInputSchema)\n .output(RowCreateOutputSchema),\n\n update: notebaseProcedure\n .errors(pickPublicErrorMap(\"ROW_NOT_FOUND\", \"CELL_VALIDATION_FAILED\"))\n .route({\n method: \"PATCH\",\n path: \"/rows/{rowId}\",\n summary: \"Update row cells\",\n tags: [\"Rows\"],\n })\n .input(RowUpdateInputSchema)\n .output(RowUpdateOutputSchema),\n\n delete: notebaseProcedure\n .errors(pickPublicErrorMap(\"ROW_NOT_FOUND\", \"CONCURRENT_POSITION_CONFLICT\"))\n .route({\n method: \"DELETE\",\n path: \"/rows/{rowId}\",\n summary: \"Delete row\",\n tags: [\"Rows\"],\n })\n .input(RowDeleteInputSchema)\n .output(RowDeleteOutputSchema),\n\n reorder: notebaseProcedure\n .errors(pickPublicErrorMap(\"TABLE_NOT_FOUND\", \"CONCURRENT_POSITION_CONFLICT\"))\n .route({\n method: \"POST\",\n path: \"/rows/reorder\",\n summary: \"Reorder rows in a table\",\n tags: [\"Rows\"],\n })\n .input(RowReorderInputSchema)\n .output(RowReorderOutputSchema),\n}\n","import type { ContractRouterClient } from \"@orpc/contract\"\nimport { betaAccessContract } from \"./contracts/beta-access\"\nimport { columnContract } from \"./contracts/column\"\nimport { customTableContract } from \"./contracts/custom-table\"\nimport { rowContract } from \"./contracts/row\"\n\nexport const contract = {\n betaAccess: betaAccessContract,\n customTable: customTableContract,\n column: columnContract,\n row: rowContract,\n}\n\nexport type ORPCRouterClient = ContractRouterClient<typeof contract>\n\nexport * from \"./public-errors\"\nexport * from \"./schemas/beta-access\"\nexport * from \"./schemas/column\"\nexport * from \"./schemas/custom-table\"\nexport * from \"./schemas/row\"\nexport * from \"./schemas/view\"\n"],"mappings":";;;;AAGA,MAAa,uBAAuB,EAAE,KAAK,kBAAkB;AAG7D,MAAa,8BAA8B,EAAE,OAAO,EAClD,YAAY,sBACb,CAAC,CAAC,QAAQ;AAGX,MAAa,+BAA+B,EAAE,OAAO;CACnD,YAAY;CACZ,SAAS,EAAE,SAAS;CACrB,CAAC;;;ACRF,MAAa,qBAAqB,EAChC,QAAQ,GACL,MAAM;CACL,QAAQ;CACR,MAAM;CACN,SAAS;CACT,MAAM,CAAC,cAAc;CACtB,CAAC,CACD,MAAM,4BAA4B,CAClC,OAAO,6BAA6B,EACxC;;;ACPD,MAAa,oCAAoC,EAAE,KAAK;CACtD;CACA;CACA;CACA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AAiB,yBAAyB,CAAC,CACrE,MAAM;GACL,QAAQ;GACR,MAAM;GACN,SAAS;GACT,MAAM,CAAC,OAAO;GACf,CAAC,CACD,MAAM,qBAAqB,CAC3B,OAAO,sBAAsB;EAEhC,QAAQ,kBACL,OAAO,mBAAmB,iBAAiB,+BAA+B,CAAC,CAC3E,MAAM;GACL,QAAQ;GACR,MAAM;GACN,SAAS;GACT,MAAM,CAAC,OAAO;GACf,CAAC,CACD,MAAM,qBAAqB,CAC3B,OAAO,sBAAsB;EAEhC,SAAS,kBACN,OAAO,mBAAmB,mBAAmB,+BAA+B,CAAC,CAC7E,MAAM;GACL,QAAQ;GACR,MAAM;GACN,SAAS;GACT,MAAM,CAAC,OAAO;GACf,CAAC,CACD,MAAM,sBAAsB,CAC5B,OAAO,uBAAuB;EAClC;CClDA"}
|
|
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;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AM;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"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@read-frog/api-contract",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.1",
|
|
5
5
|
"private": false,
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/mengxi-ream/read-frog-monorepo",
|
|
9
|
+
"directory": "packages/api-contract"
|
|
10
|
+
},
|
|
11
|
+
"imports": {
|
|
12
|
+
"#/*": "./src/*.ts"
|
|
13
|
+
},
|
|
6
14
|
"exports": {
|
|
7
15
|
".": {
|
|
8
|
-
"
|
|
9
|
-
"
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js"
|
|
10
18
|
}
|
|
11
19
|
},
|
|
12
20
|
"main": "./dist/index.js",
|
|
@@ -16,13 +24,13 @@
|
|
|
16
24
|
"src"
|
|
17
25
|
],
|
|
18
26
|
"dependencies": {
|
|
19
|
-
"@orpc/contract": "^1.
|
|
20
|
-
"zod": "^4.3
|
|
21
|
-
"@read-frog/definitions": "0.1
|
|
27
|
+
"@orpc/contract": "^1.14.5",
|
|
28
|
+
"zod": "^4.4.3",
|
|
29
|
+
"@read-frog/definitions": "0.3.1"
|
|
22
30
|
},
|
|
23
31
|
"devDependencies": {
|
|
24
|
-
"@types/node": "^25.
|
|
25
|
-
"tsdown": "^0.
|
|
32
|
+
"@types/node": "^25.9.2",
|
|
33
|
+
"tsdown": "^0.22.2",
|
|
26
34
|
"@repo/eslint-config": "0.0.1",
|
|
27
35
|
"@repo/tsdown-config": "0.0.0",
|
|
28
36
|
"@repo/typescript-config": "0.0.0"
|
|
@@ -32,7 +40,7 @@
|
|
|
32
40
|
"dev": "tsdown --watch",
|
|
33
41
|
"build:publish": "tsdown",
|
|
34
42
|
"type-check": "tsc --noEmit",
|
|
35
|
-
"lint": "eslint .",
|
|
36
|
-
"lint:fix": "eslint --fix"
|
|
43
|
+
"lint": "eslint . --max-warnings 0",
|
|
44
|
+
"lint:fix": "eslint --fix --max-warnings 0"
|
|
37
45
|
}
|
|
38
46
|
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { pickPublicErrorMap } from "#/public-errors"
|
|
2
|
+
import {
|
|
3
|
+
CardTemplateCreateInputSchema,
|
|
4
|
+
CardTemplateCreateOutputSchema,
|
|
5
|
+
CardTemplateDeleteInputSchema,
|
|
6
|
+
CardTemplateDeleteOutputSchema,
|
|
7
|
+
CardTemplateGetInputSchema,
|
|
8
|
+
CardTemplateGetOutputSchema,
|
|
9
|
+
CardTemplateListInputSchema,
|
|
10
|
+
CardTemplateListOutputSchema,
|
|
11
|
+
CardTemplateUpdateInputSchema,
|
|
12
|
+
CardTemplateUpdateOutputSchema,
|
|
13
|
+
} from "#/schemas/card"
|
|
14
|
+
import { notebaseProcedure } from "./shared"
|
|
15
|
+
|
|
16
|
+
export const cardTemplateContract = {
|
|
17
|
+
list: notebaseProcedure
|
|
18
|
+
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND"))
|
|
19
|
+
.route({
|
|
20
|
+
method: "GET",
|
|
21
|
+
path: "/card-templates",
|
|
22
|
+
summary: "List card templates",
|
|
23
|
+
tags: ["Card Templates"],
|
|
24
|
+
})
|
|
25
|
+
.input(CardTemplateListInputSchema)
|
|
26
|
+
.output(CardTemplateListOutputSchema),
|
|
27
|
+
|
|
28
|
+
get: notebaseProcedure
|
|
29
|
+
.errors(pickPublicErrorMap("CARD_TEMPLATE_NOT_FOUND"))
|
|
30
|
+
.route({
|
|
31
|
+
method: "GET",
|
|
32
|
+
path: "/card-templates/{id}",
|
|
33
|
+
summary: "Get card template",
|
|
34
|
+
tags: ["Card Templates"],
|
|
35
|
+
})
|
|
36
|
+
.input(CardTemplateGetInputSchema)
|
|
37
|
+
.output(CardTemplateGetOutputSchema),
|
|
38
|
+
|
|
39
|
+
create: notebaseProcedure
|
|
40
|
+
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND", "CARD_TEMPLATE_INVALID_NOTEBASE_COLUMNS"))
|
|
41
|
+
.route({
|
|
42
|
+
method: "POST",
|
|
43
|
+
path: "/card-templates",
|
|
44
|
+
summary: "Create card template",
|
|
45
|
+
tags: ["Card Templates"],
|
|
46
|
+
})
|
|
47
|
+
.input(CardTemplateCreateInputSchema)
|
|
48
|
+
.output(CardTemplateCreateOutputSchema),
|
|
49
|
+
|
|
50
|
+
update: notebaseProcedure
|
|
51
|
+
.errors(pickPublicErrorMap("CARD_TEMPLATE_NOT_FOUND", "CARD_TEMPLATE_INVALID_NOTEBASE_COLUMNS"))
|
|
52
|
+
.route({
|
|
53
|
+
method: "PATCH",
|
|
54
|
+
path: "/card-templates/{id}",
|
|
55
|
+
summary: "Update card template",
|
|
56
|
+
tags: ["Card Templates"],
|
|
57
|
+
})
|
|
58
|
+
.input(CardTemplateUpdateInputSchema)
|
|
59
|
+
.output(CardTemplateUpdateOutputSchema),
|
|
60
|
+
|
|
61
|
+
delete: notebaseProcedure
|
|
62
|
+
.errors(pickPublicErrorMap("CARD_TEMPLATE_NOT_FOUND"))
|
|
63
|
+
.route({
|
|
64
|
+
method: "DELETE",
|
|
65
|
+
path: "/card-templates/{id}",
|
|
66
|
+
summary: "Delete card template",
|
|
67
|
+
tags: ["Card Templates"],
|
|
68
|
+
})
|
|
69
|
+
.input(CardTemplateDeleteInputSchema)
|
|
70
|
+
.output(CardTemplateDeleteOutputSchema),
|
|
71
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { pickPublicErrorMap } from "#/public-errors"
|
|
2
|
+
import {
|
|
3
|
+
CardGenerateInputSchema,
|
|
4
|
+
CardGenerateOutputSchema,
|
|
5
|
+
CardGetInputSchema,
|
|
6
|
+
CardGetOutputSchema,
|
|
7
|
+
CardListInputSchema,
|
|
8
|
+
CardListOutputSchema,
|
|
9
|
+
} from "#/schemas/card"
|
|
10
|
+
import { notebaseProcedure } from "./shared"
|
|
11
|
+
|
|
12
|
+
export const cardContract = {
|
|
13
|
+
list: notebaseProcedure
|
|
14
|
+
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND"))
|
|
15
|
+
.route({
|
|
16
|
+
method: "GET",
|
|
17
|
+
path: "/cards",
|
|
18
|
+
summary: "List rendered cards",
|
|
19
|
+
tags: ["Cards"],
|
|
20
|
+
})
|
|
21
|
+
.input(CardListInputSchema)
|
|
22
|
+
.output(CardListOutputSchema),
|
|
23
|
+
|
|
24
|
+
get: notebaseProcedure
|
|
25
|
+
.errors(pickPublicErrorMap("CARD_NOT_FOUND"))
|
|
26
|
+
.route({
|
|
27
|
+
method: "GET",
|
|
28
|
+
path: "/cards/{id}",
|
|
29
|
+
summary: "Get rendered card",
|
|
30
|
+
tags: ["Cards"],
|
|
31
|
+
})
|
|
32
|
+
.input(CardGetInputSchema)
|
|
33
|
+
.output(CardGetOutputSchema),
|
|
34
|
+
|
|
35
|
+
generate: notebaseProcedure
|
|
36
|
+
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND", "CARD_TEMPLATE_NOT_FOUND"))
|
|
37
|
+
.route({
|
|
38
|
+
method: "POST",
|
|
39
|
+
path: "/cards/generate",
|
|
40
|
+
summary: "Generate missing cards",
|
|
41
|
+
tags: ["Cards"],
|
|
42
|
+
})
|
|
43
|
+
.input(CardGenerateInputSchema)
|
|
44
|
+
.output(CardGenerateOutputSchema),
|
|
45
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { pickPublicErrorMap } from "#/public-errors"
|
|
2
|
+
import {
|
|
3
|
+
NotebaseColumnCreateInputSchema,
|
|
4
|
+
NotebaseColumnCreateOutputSchema,
|
|
5
|
+
NotebaseColumnDeleteInputSchema,
|
|
6
|
+
NotebaseColumnDeleteOutputSchema,
|
|
7
|
+
NotebaseColumnReorderInputSchema,
|
|
8
|
+
NotebaseColumnReorderOutputSchema,
|
|
9
|
+
NotebaseColumnUpdateInputSchema,
|
|
10
|
+
NotebaseColumnUpdateOutputSchema,
|
|
11
|
+
} from "#/schemas/notebase-column"
|
|
12
|
+
import { notebaseProcedure } from "./shared"
|
|
13
|
+
|
|
14
|
+
export const notebaseColumnContract = {
|
|
15
|
+
create: notebaseProcedure
|
|
16
|
+
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND", "CONCURRENT_POSITION_CONFLICT"))
|
|
17
|
+
.route({
|
|
18
|
+
method: "POST",
|
|
19
|
+
path: "/notebase-columns",
|
|
20
|
+
summary: "Create notebase column",
|
|
21
|
+
tags: ["Notebase Columns"],
|
|
22
|
+
})
|
|
23
|
+
.input(NotebaseColumnCreateInputSchema)
|
|
24
|
+
.output(NotebaseColumnCreateOutputSchema),
|
|
25
|
+
|
|
26
|
+
update: notebaseProcedure
|
|
27
|
+
.errors(pickPublicErrorMap("NOTEBASE_COLUMN_NOT_FOUND"))
|
|
28
|
+
.route({
|
|
29
|
+
method: "PATCH",
|
|
30
|
+
path: "/notebase-columns/{notebaseColumnId}",
|
|
31
|
+
summary: "Update notebase column",
|
|
32
|
+
tags: ["Notebase Columns"],
|
|
33
|
+
})
|
|
34
|
+
.input(NotebaseColumnUpdateInputSchema)
|
|
35
|
+
.output(NotebaseColumnUpdateOutputSchema),
|
|
36
|
+
|
|
37
|
+
delete: notebaseProcedure
|
|
38
|
+
.errors(pickPublicErrorMap(
|
|
39
|
+
"NOTEBASE_COLUMN_NOT_FOUND",
|
|
40
|
+
"PRIMARY_NOTEBASE_COLUMN_DELETE_NOT_ALLOWED",
|
|
41
|
+
"CARD_TEMPLATE_NOTEBASE_COLUMN_IN_USE",
|
|
42
|
+
"CONCURRENT_POSITION_CONFLICT",
|
|
43
|
+
))
|
|
44
|
+
.route({
|
|
45
|
+
method: "DELETE",
|
|
46
|
+
path: "/notebase-columns/{notebaseColumnId}",
|
|
47
|
+
summary: "Delete notebase column",
|
|
48
|
+
tags: ["Notebase Columns"],
|
|
49
|
+
})
|
|
50
|
+
.input(NotebaseColumnDeleteInputSchema)
|
|
51
|
+
.output(NotebaseColumnDeleteOutputSchema),
|
|
52
|
+
|
|
53
|
+
reorder: notebaseProcedure
|
|
54
|
+
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND", "CONCURRENT_POSITION_CONFLICT"))
|
|
55
|
+
.route({
|
|
56
|
+
method: "POST",
|
|
57
|
+
path: "/notebase-columns/reorder",
|
|
58
|
+
summary: "Reorder notebase columns",
|
|
59
|
+
tags: ["Notebase Columns"],
|
|
60
|
+
})
|
|
61
|
+
.input(NotebaseColumnReorderInputSchema)
|
|
62
|
+
.output(NotebaseColumnReorderOutputSchema),
|
|
63
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { pickPublicErrorMap } from "#/public-errors"
|
|
2
|
+
import {
|
|
3
|
+
NotebaseRowCreateInputSchema,
|
|
4
|
+
NotebaseRowCreateOutputSchema,
|
|
5
|
+
NotebaseRowDeleteInputSchema,
|
|
6
|
+
NotebaseRowDeleteOutputSchema,
|
|
7
|
+
NotebaseRowReorderInputSchema,
|
|
8
|
+
NotebaseRowReorderOutputSchema,
|
|
9
|
+
NotebaseRowUpdateInputSchema,
|
|
10
|
+
NotebaseRowUpdateOutputSchema,
|
|
11
|
+
} from "#/schemas/notebase-row"
|
|
12
|
+
import { notebaseProcedure } from "./shared"
|
|
13
|
+
|
|
14
|
+
export const notebaseRowContract = {
|
|
15
|
+
create: notebaseProcedure
|
|
16
|
+
.errors(pickPublicErrorMap(
|
|
17
|
+
"NOTEBASE_NOT_FOUND",
|
|
18
|
+
"CELL_VALIDATION_FAILED",
|
|
19
|
+
"CONCURRENT_POSITION_CONFLICT",
|
|
20
|
+
))
|
|
21
|
+
.route({
|
|
22
|
+
method: "POST",
|
|
23
|
+
path: "/notebase-rows",
|
|
24
|
+
summary: "Create notebase row",
|
|
25
|
+
tags: ["Notebase Rows"],
|
|
26
|
+
})
|
|
27
|
+
.input(NotebaseRowCreateInputSchema)
|
|
28
|
+
.output(NotebaseRowCreateOutputSchema),
|
|
29
|
+
|
|
30
|
+
update: notebaseProcedure
|
|
31
|
+
.errors(pickPublicErrorMap("NOTEBASE_ROW_NOT_FOUND", "CELL_VALIDATION_FAILED"))
|
|
32
|
+
.route({
|
|
33
|
+
method: "PATCH",
|
|
34
|
+
path: "/notebase-rows/{notebaseRowId}",
|
|
35
|
+
summary: "Update notebase row cells",
|
|
36
|
+
tags: ["Notebase Rows"],
|
|
37
|
+
})
|
|
38
|
+
.input(NotebaseRowUpdateInputSchema)
|
|
39
|
+
.output(NotebaseRowUpdateOutputSchema),
|
|
40
|
+
|
|
41
|
+
delete: notebaseProcedure
|
|
42
|
+
.errors(pickPublicErrorMap("NOTEBASE_ROW_NOT_FOUND", "CONCURRENT_POSITION_CONFLICT"))
|
|
43
|
+
.route({
|
|
44
|
+
method: "DELETE",
|
|
45
|
+
path: "/notebase-rows/{notebaseRowId}",
|
|
46
|
+
summary: "Delete notebase row",
|
|
47
|
+
tags: ["Notebase Rows"],
|
|
48
|
+
})
|
|
49
|
+
.input(NotebaseRowDeleteInputSchema)
|
|
50
|
+
.output(NotebaseRowDeleteOutputSchema),
|
|
51
|
+
|
|
52
|
+
reorder: notebaseProcedure
|
|
53
|
+
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND", "CONCURRENT_POSITION_CONFLICT"))
|
|
54
|
+
.route({
|
|
55
|
+
method: "POST",
|
|
56
|
+
path: "/notebase-rows/reorder",
|
|
57
|
+
summary: "Reorder notebase rows",
|
|
58
|
+
tags: ["Notebase Rows"],
|
|
59
|
+
})
|
|
60
|
+
.input(NotebaseRowReorderInputSchema)
|
|
61
|
+
.output(NotebaseRowReorderOutputSchema),
|
|
62
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { pickPublicErrorMap } from "#/public-errors"
|
|
2
|
+
import {
|
|
3
|
+
NotebaseCreateInputSchema,
|
|
4
|
+
NotebaseCreateOutputSchema,
|
|
5
|
+
NotebaseDeleteInputSchema,
|
|
6
|
+
NotebaseDeleteOutputSchema,
|
|
7
|
+
NotebaseGetInputSchema,
|
|
8
|
+
NotebaseGetOutputSchema,
|
|
9
|
+
NotebaseGetSchemaInputSchema,
|
|
10
|
+
NotebaseGetSchemaOutputSchema,
|
|
11
|
+
NotebaseListInputSchema,
|
|
12
|
+
NotebaseListOutputSchema,
|
|
13
|
+
NotebaseUpdateInputSchema,
|
|
14
|
+
NotebaseUpdateOutputSchema,
|
|
15
|
+
} from "#/schemas/notebase"
|
|
16
|
+
import { notebaseProcedure } from "./shared"
|
|
17
|
+
|
|
18
|
+
export const notebaseContract = {
|
|
19
|
+
list: notebaseProcedure
|
|
20
|
+
.route({
|
|
21
|
+
method: "GET",
|
|
22
|
+
path: "/notebases",
|
|
23
|
+
summary: "List notebases",
|
|
24
|
+
tags: ["Notebases"],
|
|
25
|
+
})
|
|
26
|
+
.input(NotebaseListInputSchema)
|
|
27
|
+
.output(NotebaseListOutputSchema),
|
|
28
|
+
|
|
29
|
+
get: notebaseProcedure
|
|
30
|
+
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND"))
|
|
31
|
+
.route({
|
|
32
|
+
method: "GET",
|
|
33
|
+
path: "/notebases/{id}",
|
|
34
|
+
summary: "Get notebase with notebase columns, rows, and views",
|
|
35
|
+
tags: ["Notebases"],
|
|
36
|
+
})
|
|
37
|
+
.input(NotebaseGetInputSchema)
|
|
38
|
+
.output(NotebaseGetOutputSchema),
|
|
39
|
+
|
|
40
|
+
getSchema: notebaseProcedure
|
|
41
|
+
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND"))
|
|
42
|
+
.route({
|
|
43
|
+
method: "GET",
|
|
44
|
+
path: "/notebases/{id}/schema",
|
|
45
|
+
summary: "Get notebase schema",
|
|
46
|
+
tags: ["Notebases"],
|
|
47
|
+
})
|
|
48
|
+
.input(NotebaseGetSchemaInputSchema)
|
|
49
|
+
.output(NotebaseGetSchemaOutputSchema),
|
|
50
|
+
|
|
51
|
+
create: notebaseProcedure
|
|
52
|
+
.route({
|
|
53
|
+
method: "POST",
|
|
54
|
+
path: "/notebases",
|
|
55
|
+
summary: "Create notebase",
|
|
56
|
+
tags: ["Notebases"],
|
|
57
|
+
})
|
|
58
|
+
.input(NotebaseCreateInputSchema)
|
|
59
|
+
.output(NotebaseCreateOutputSchema),
|
|
60
|
+
|
|
61
|
+
update: notebaseProcedure
|
|
62
|
+
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND"))
|
|
63
|
+
.route({
|
|
64
|
+
method: "PUT",
|
|
65
|
+
path: "/notebases/{id}",
|
|
66
|
+
summary: "Update notebase",
|
|
67
|
+
tags: ["Notebases"],
|
|
68
|
+
})
|
|
69
|
+
.input(NotebaseUpdateInputSchema)
|
|
70
|
+
.output(NotebaseUpdateOutputSchema),
|
|
71
|
+
|
|
72
|
+
delete: notebaseProcedure
|
|
73
|
+
.errors(pickPublicErrorMap("NOTEBASE_NOT_FOUND"))
|
|
74
|
+
.route({
|
|
75
|
+
method: "DELETE",
|
|
76
|
+
path: "/notebases/{id}",
|
|
77
|
+
summary: "Delete notebase",
|
|
78
|
+
tags: ["Notebases"],
|
|
79
|
+
})
|
|
80
|
+
.input(NotebaseDeleteInputSchema)
|
|
81
|
+
.output(NotebaseDeleteOutputSchema),
|
|
82
|
+
}
|
package/src/contracts/shared.ts
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { pickPublicErrorMap } from "#/public-errors"
|
|
2
|
+
import {
|
|
3
|
+
srsReviewInputSchema,
|
|
4
|
+
srsReviewOutputSchema,
|
|
5
|
+
srsRollbackReviewInputSchema,
|
|
6
|
+
srsRollbackReviewOutputSchema,
|
|
7
|
+
} from "#/schemas/srs"
|
|
8
|
+
import { notebaseProcedure } from "./shared"
|
|
9
|
+
|
|
10
|
+
export const srsContract = {
|
|
11
|
+
review: notebaseProcedure
|
|
12
|
+
.errors(pickPublicErrorMap(
|
|
13
|
+
"CARD_NOT_FOUND",
|
|
14
|
+
"CARD_NOT_REVIEWABLE",
|
|
15
|
+
"CARD_REVIEW_STATE_STALE",
|
|
16
|
+
))
|
|
17
|
+
.route({
|
|
18
|
+
method: "POST",
|
|
19
|
+
path: "/srs/review",
|
|
20
|
+
summary: "Review a card with SRS scheduling",
|
|
21
|
+
tags: ["SRS"],
|
|
22
|
+
})
|
|
23
|
+
.input(srsReviewInputSchema)
|
|
24
|
+
.output(srsReviewOutputSchema),
|
|
25
|
+
rollbackReview: notebaseProcedure
|
|
26
|
+
.errors(pickPublicErrorMap(
|
|
27
|
+
"CARD_NOT_FOUND",
|
|
28
|
+
"CARD_REVIEW_ROLLBACK_UNAVAILABLE",
|
|
29
|
+
))
|
|
30
|
+
.route({
|
|
31
|
+
method: "POST",
|
|
32
|
+
path: "/srs/review/rollback",
|
|
33
|
+
summary: "Roll back the latest SRS review for a card",
|
|
34
|
+
tags: ["SRS"],
|
|
35
|
+
})
|
|
36
|
+
.input(srsRollbackReviewInputSchema)
|
|
37
|
+
.output(srsRollbackReviewOutputSchema),
|
|
38
|
+
}
|