@read-frog/api-contract 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1105 -475
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +264 -97
- package/dist/index.js.map +1 -1
- package/package.json +15 -14
- package/src/contracts/beta-access.ts +3 -6
- package/src/contracts/billing.ts +5 -5
- package/src/contracts/card-template.ts +45 -39
- package/src/contracts/card.ts +22 -19
- package/src/contracts/ebook.ts +13 -11
- package/src/contracts/hosted-ai.ts +5 -5
- package/src/contracts/notebase-column.ts +40 -32
- package/src/contracts/notebase-row.ts +85 -45
- package/src/contracts/notebase.ts +60 -40
- package/src/contracts/shared.ts +21 -2
- package/src/contracts/srs.ts +96 -63
- package/src/contracts/stats.ts +9 -11
- package/src/contracts/user.ts +3 -3
- package/src/contracts/video-transcript.ts +22 -12
- package/src/index.ts +37 -33
- package/src/public-errors.ts +74 -51
- package/src/schemas/beta-access.ts +12 -10
- package/src/schemas/billing.ts +77 -59
- package/src/schemas/card.ts +66 -63
- package/src/schemas/ebook.ts +165 -129
- package/src/schemas/hosted-ai.ts +84 -74
- package/src/schemas/notebase-column.ts +50 -36
- package/src/schemas/notebase-row.ts +88 -57
- package/src/schemas/notebase-stats.ts +28 -20
- package/src/schemas/notebase-view.ts +59 -49
- package/src/schemas/notebase.ts +136 -96
- package/src/schemas/pagination.ts +9 -0
- package/src/schemas/resource-mutation.ts +6 -0
- package/src/schemas/srs-stats.ts +30 -22
- package/src/schemas/srs.ts +152 -106
- package/src/schemas/stats.ts +27 -21
- package/src/schemas/timezone.ts +19 -16
- package/src/schemas/user.ts +27 -19
- package/src/schemas/video-transcript.ts +33 -32
package/dist/index.js.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/schemas/hosted-ai.ts","../src/public-errors.ts","../src/schemas/billing.ts","../src/contracts/billing.ts","../src/schemas/card.ts","../src/contracts/shared.ts","../src/contracts/card.ts","../src/contracts/card-template.ts","../src/schemas/ebook.ts","../src/contracts/ebook.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/notebase-stats.ts","../src/schemas/srs-stats.ts","../src/schemas/stats.ts","../src/contracts/stats.ts","../src/schemas/user.ts","../src/contracts/user.ts","../src/schemas/video-transcript.ts","../src/contracts/video-transcript.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 { 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\nconst HostedAiInstructionsSchema = z.string().trim().min(1).max(16000)\n\n/**\n * Which hosted model a request runs on. Deliberately NOT named after a billing\n * plan: which plans may reach which tier is policy (see `access-policy.ts`),\n * not identity, so a future plan can be sold with any tier without a rename.\n */\nexport const HostedAiModelTierSchema = z.enum([\"normal\", \"advance\"])\n/**\n * The billing/access subject of a hosted request, not a route id. Sub-calls\n * bill against the feature they serve: the page summary is `pageTranslation`,\n * and the video summary and subtitle segmentation are `videoSubtitles`.\n *\n * Appended last on purpose: the db pgEnum mirrors this order, and appending\n * keeps drizzle from emitting the ADD VALUE ... BEFORE variant.\n */\nexport const HostedAiFeatureSchema = z.enum([\n \"pageTranslation\",\n \"customAction\",\n \"noteSuggestion\",\n \"selectionTranslation\",\n \"videoSubtitles\",\n \"inputTranslation\",\n \"languageDetection\",\n])\nexport const HostedAiRequestIdSchema = z.uuid()\n\nconst HostedAiRequestMetadataSchema = {\n /**\n * Optional on the wire, always present after parsing: these endpoints shipped\n * before tiers existed, so every installed extension below 1.46.0 sends no\n * `modelTier` at all, and the input objects are strict. Defaulting here keeps\n * those clients working while giving handlers a single source of truth\n * instead of a `?? \"normal\"` at every call site.\n *\n * TODO(2026-11-01): Drop the default and make this required once extensions\n * below 1.46.0 have drained from the store.\n */\n modelTier: HostedAiModelTierSchema.default(\"normal\"),\n requestId: HostedAiRequestIdSchema.optional(),\n}\n\nexport const HostedAiStreamTextInputSchema = z.strictObject({\n ...HostedAiRequestMetadataSchema,\n instructions: HostedAiInstructionsSchema,\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 ...HostedAiRequestMetadataSchema,\n instructions: HostedAiInstructionsSchema,\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 HOSTED_AI_NOTE_SUGGESTION_MAX_NOTES = 2\nexport const HOSTED_AI_NOTE_SUGGESTION_MAX_NOTE_FIELDS = 16\n\nexport const HostedAiNoteSuggestionStreamInputSchema = z.strictObject({\n ...HostedAiRequestMetadataSchema,\n instructions: HostedAiInstructionsSchema,\n prompt: z.string().trim().min(1).max(32000),\n temperature: z.number().min(0).max(2).optional(),\n})\n\n/**\n * Fixed structured-output schema for hosted note suggestions. Must stay\n * strict-structured-outputs-safe: strict objects only, no records, no\n * `.optional()` (nullable-only), unions limited to primitives. If the upstream\n * deployment rejects `maxItems`/`maxLength` constraint keywords, strip the\n * `.max()` calls from the model-facing copy only — clients still validate\n * against this schema.\n */\nexport const HostedAiNoteSuggestionObjectSchema = z.strictObject({\n action: z.strictObject({\n createNewDictionaryAction: z.boolean(),\n targetActionId: z.string().max(128).nullable(),\n /**\n * Name of the chosen schema's field whose value best works as a one-line\n * explanation of the term in UI (usually a definition/meaning field);\n * null when no field fits. Purely a display hint — clients sanitize it\n * and fall back to their own ordering when invalid.\n */\n summaryFieldName: z.string().max(80).nullable(),\n }),\n notes: z.array(\n z.strictObject({\n fields: z.array(\n z.strictObject({\n name: z.string().max(80),\n value: z.union([z.string(), z.number()]).nullable(),\n }),\n ).max(HOSTED_AI_NOTE_SUGGESTION_MAX_NOTE_FIELDS),\n }),\n ).max(HOSTED_AI_NOTE_SUGGESTION_MAX_NOTES),\n})\n\nexport const HostedAiStreamPartSchema = z.looseObject({\n type: z.string().trim().min(1),\n})\n\n/**\n * The only stream part types this API emits. Every other part the AI SDK\n * produces (`start-step`, `finish-step`, `text-start`, ...) carries upstream\n * metadata — provider model id, response headers, request body — and is dropped\n * server-side so it never reaches a client.\n *\n * The consumer switch lives in the extension's background stream reader. Adding\n * a type here without teaching that switch about it is a no-op; removing one\n * breaks rendering. `error` is absent on purpose: it is converted into a thrown\n * error before it can be yielded.\n */\nexport const HOSTED_AI_CLIENT_STREAM_PART_TYPES = [\n \"text-delta\",\n \"reasoning-start\",\n \"reasoning-delta\",\n \"reasoning-end\",\n \"reasoning-file\",\n \"finish\",\n] as const\n\n/**\n * Status is per-identity, not per-feature: one call reports every feature and\n * every pool, so a client caches a single response instead of one per feature.\n * Non-strict so a client still sending the retired `feature` argument gets a\n * useful response rather than a validation error.\n */\nexport const HostedAiStatusInputSchema = z.object({})\n\nexport const HostedAiUnavailableReasonSchema = z.enum([\n \"authentication_required\",\n \"ultra_required\",\n \"quota_exhausted\",\n \"service_unavailable\",\n])\n\nexport const HostedAiCreditPolicyIdSchema = z.enum([\n \"custom-action-guest-daily-v1\",\n \"custom-action-user-daily-v1\",\n \"custom-action-pro-daily-v1\",\n \"ultra-weekly-v1\",\n])\n\nexport const HostedAiCreditPeriodKindSchema = z.enum([\"daily\", \"weekly\"])\n\nexport const HostedAiQuotaScopeSchema = z.enum([\"guest\", \"user\"])\n\n/**\n * Data payload of the TOO_MANY_REQUESTS error every hosted AI guard emits.\n * The code itself is ORPC's own rather than a PUBLIC_APP_ERROR_DEFS entry, so\n * this schema is the only contract tying the server's construction to the\n * extension's parsing of it.\n *\n * Deliberately NOT strict: installed extensions parse this payload at runtime\n * and lag server deploys by weeks, so rejecting unknown keys would turn any\n * additive server-side field into a fleet-wide parse failure that silently\n * drops retryAfterMs (queue backoff timing) and quotaScope (guest sign-in\n * prompt). Unknown keys are stripped; the required fields keep drift\n * protection.\n */\nexport const HostedAiRateLimitErrorDataSchema = z.object({\n retryAfterMs: z.number().int().min(0),\n quotaScope: HostedAiQuotaScopeSchema,\n})\n\n/**\n * Deliberately free of dollar amounts and of the versioned policy id. Clients\n * render a consumption bar and a reset time, so a percentage and a period kind\n * are all they need, and neither leaks what a call costs us. `usedPercent`\n * counts settled spend only: including in-flight reservations would make the\n * bar jump forward and then back as each stream settles.\n */\nexport const HostedAiCreditStatusSchema = z.strictObject({\n periodKind: HostedAiCreditPeriodKindSchema,\n usedPercent: z.number().min(0).max(100),\n resetAt: z.iso.datetime().nullable(),\n /**\n * Every feature drawing on this pool. Ultra shares one weekly pool across all\n * three, so the grouping lives here rather than inlined per feature — that way\n * a client can tell one shared pool from several separate ones.\n */\n features: z.array(HostedAiFeatureSchema).min(1),\n})\n\nexport const HostedAiTierStatusSchema = z.strictObject({\n accessAllowed: z.boolean(),\n available: z.boolean(),\n unavailableReason: HostedAiUnavailableReasonSchema.nullable(),\n /**\n * Viewer-independent product fact: no non-Ultra account can ever use this\n * feature/tier, so signing in alone will not unlock it. Unlike the fields\n * above, this does not vary with the caller's identity or plan — clients use\n * it to label Ultra-only options rather than to gate the current user.\n */\n requiresUltra: z.boolean(),\n modelRevision: z.string().trim().min(1),\n})\n\nexport const HostedAiFeatureStatusSchema = z.strictObject({\n normal: HostedAiTierStatusSchema,\n advance: HostedAiTierStatusSchema,\n})\n\nexport const HostedAiStatusOutputSchema = z.strictObject({\n credits: z.array(HostedAiCreditStatusSchema),\n features: z.strictObject({\n pageTranslation: HostedAiFeatureStatusSchema,\n customAction: HostedAiFeatureStatusSchema,\n noteSuggestion: HostedAiFeatureStatusSchema,\n selectionTranslation: HostedAiFeatureStatusSchema,\n videoSubtitles: HostedAiFeatureStatusSchema,\n inputTranslation: HostedAiFeatureStatusSchema,\n languageDetection: HostedAiFeatureStatusSchema,\n }),\n})\n\nexport type HostedAiOutputFieldType = z.infer<typeof HostedAiOutputFieldTypeSchema>\nexport type HostedAiOutputField = z.infer<typeof HostedAiOutputFieldSchema>\nexport type HostedAiModelTier = z.infer<typeof HostedAiModelTierSchema>\nexport type HostedAiFeature = z.infer<typeof HostedAiFeatureSchema>\nexport type HostedAiStreamTextInput = z.infer<typeof HostedAiStreamTextInputSchema>\nexport type HostedAiStreamStructuredObjectInput = z.infer<typeof HostedAiStreamStructuredObjectInputSchema>\nexport type HostedAiNoteSuggestionStreamInput = z.infer<typeof HostedAiNoteSuggestionStreamInputSchema>\nexport type HostedAiNoteSuggestionObject = z.infer<typeof HostedAiNoteSuggestionObjectSchema>\nexport type HostedAiStreamPart = z.infer<typeof HostedAiStreamPartSchema>\nexport type HostedAiStatusInput = z.infer<typeof HostedAiStatusInputSchema>\nexport type HostedAiUnavailableReason = z.infer<typeof HostedAiUnavailableReasonSchema>\nexport type HostedAiCreditPolicyId = z.infer<typeof HostedAiCreditPolicyIdSchema>\nexport type HostedAiCreditPeriodKind = z.infer<typeof HostedAiCreditPeriodKindSchema>\nexport type HostedAiQuotaScope = z.infer<typeof HostedAiQuotaScopeSchema>\nexport type HostedAiRateLimitErrorData = z.infer<typeof HostedAiRateLimitErrorDataSchema>\nexport type HostedAiCreditStatus = z.infer<typeof HostedAiCreditStatusSchema>\nexport type HostedAiTierStatus = z.infer<typeof HostedAiTierStatusSchema>\nexport type HostedAiFeatureStatus = z.infer<typeof HostedAiFeatureStatusSchema>\nexport type HostedAiStatusOutput = z.infer<typeof HostedAiStatusOutputSchema>\n","import type { ErrorMap } from \"@orpc/contract\"\nimport { z } from \"zod\"\nimport { HostedAiCreditPolicyIdSchema, HostedAiModelTierSchema } from \"./schemas/hosted-ai\"\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 /** Index of the failing row within a batch input (createMany / initialRows). */\n rowIndex: z.number().int().min(0).optional(),\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 HostedAiTierRestrictedDataSchema = z.strictObject({\n modelTier: HostedAiModelTierSchema,\n})\n\nexport const HostedAiQuotaExhaustedDataSchema = z.strictObject({\n modelTier: HostedAiModelTierSchema,\n // Reuses the credit-status enum rather than restating it: these two always\n // describe the same set of policy ids, and a second copy silently drifts —\n // the error payload is `strictObject`, so a policy missing only here fails\n // output validation at exactly the moment a user runs out of credit.\n policyId: HostedAiCreditPolicyIdSchema,\n usedPercent: z.number().min(0).max(100),\n resetAt: z.iso.datetime().nullable(),\n})\n\nexport const PUBLIC_APP_ERROR_DEFS = {\n HOSTED_AI_TIER_RESTRICTED: {\n data: HostedAiTierRestrictedDataSchema,\n message: \"This Built-in AI tier is not available for this account\",\n status: 403,\n },\n HOSTED_AI_QUOTA_EXHAUSTED: {\n data: HostedAiQuotaExhaustedDataSchema,\n message: \"Built-in AI credit exhausted\",\n status: 429,\n },\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 // Retired at launch (2026-08-14) but kept defined for one release so old\n // clients' error maps keep parsing; the server no longer emits it. Remove\n // together with the beta feature key in the follow-up cleanup.\n VIDEO_TRANSCRIPTION_BETA_RESTRICTED: {\n message: \"Video transcription is currently in beta for selected accounts\",\n status: 403,\n },\n VIDEO_TRANSCRIPTION_SUBSCRIPTION_REQUIRED: {\n message: \"AI subtitles require a Pro or Ultra subscription\",\n status: 403,\n },\n // Dunning (`past_due` / `paused`), not cancellation: the account keeps\n // reading subtitles it already paid to generate, but cannot start new work\n // that spends upstream money until the payment method is fixed. Distinct\n // from SUBSCRIPTION_REQUIRED so the client can say \"update your card\"\n // instead of \"subscribe\".\n VIDEO_TRANSCRIPTION_PAYMENT_REQUIRED: {\n message: \"Update your payment method to generate new AI subtitles\",\n status: 402,\n },\n VIDEO_TRANSCRIPT_NOT_FOUND: {\n message: \"Video transcript not found\",\n status: 404,\n },\n VIDEO_TRANSCRIPT_NOT_READY: {\n message: \"Video transcript is not ready yet\",\n status: 409,\n },\n VIDEO_TRANSCRIPTION_QUOTA_EXCEEDED: {\n message: \"Monthly transcription quota exceeded\",\n status: 429,\n },\n // A property of the video, not of the account: upgrading or waiting for the\n // quota to reset changes nothing. Kept apart from QUOTA_EXCEEDED so the\n // client does not answer it with an upgrade wall.\n VIDEO_TRANSCRIPTION_UNSUPPORTED_LENGTH: {\n message: \"This video is longer than AI subtitles support\",\n status: 422,\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 NOTE_LIMIT_EXCEEDED: {\n message: \"Upgrade is required to create more Notebase notes\",\n status: 403,\n },\n BILLING_NOT_CONFIGURED: {\n message: \"Billing is not configured\",\n status: 503,\n },\n BILLING_CUSTOMER_NOT_FOUND: {\n message: \"Billing customer not found\",\n status: 404,\n },\n BILLING_PASS_ACTIVE: {\n message: \"An active Pro pass already covers this account\",\n status: 409,\n },\n BILLING_CHANGE_SCHEDULED: {\n message: \"A subscription change is already scheduled\",\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 EBOOK_BETA_RESTRICTED: {\n message: \"Ebooks are currently in beta for selected accounts\",\n status: 403,\n },\n EBOOK_NOT_FOUND: {\n message: \"Ebook not found\",\n status: 404,\n },\n EBOOK_LIMIT_EXCEEDED: {\n message: \"Upgrade is required to upload more ebooks\",\n status: 403,\n },\n EBOOK_FILE_TOO_LARGE: {\n message: \"Ebook file exceeds the maximum allowed size\",\n status: 413,\n },\n EBOOK_UPLOAD_NOT_COMPLETED: {\n message: \"Ebook upload has not been completed\",\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 { z } from \"zod\"\n\nexport const billingIntervalSchema = z.enum([\"month\", \"year\"])\nexport type BillingInterval = z.infer<typeof billingIntervalSchema>\n\nexport const billingSubscriptionStatusSchema = z.enum([\n \"incomplete\",\n \"incomplete_expired\",\n \"trialing\",\n \"active\",\n \"past_due\",\n \"canceled\",\n \"unpaid\",\n \"paused\",\n])\nexport type BillingSubscriptionStatus = z.infer<typeof billingSubscriptionStatusSchema>\n\nexport const billingPlanSchema = z.enum([\"free\", \"pro\", \"ultra\"])\nexport type BillingPlan = z.infer<typeof billingPlanSchema>\n\n// Plans a user can actively check out into (the free tier has no price).\nexport const billingCheckoutPlanSchema = z.enum([\"pro\", \"ultra\"])\nexport type BillingCheckoutPlan = z.infer<typeof billingCheckoutPlanSchema>\n\nexport const billingCurrencySchema = z.enum([\"usd\", \"cad\", \"cny\"])\nexport type BillingCurrency = z.infer<typeof billingCurrencySchema>\n\nexport const billingLocaleSchema = z.enum([\n \"en\",\n \"es\",\n \"ja\",\n \"ko\",\n \"ru\",\n \"tr\",\n \"vi\",\n \"zh\",\n \"zh-TW\",\n])\nexport type BillingLocale = z.infer<typeof billingLocaleSchema>\n\nexport const billingAccessSourceSchema = z.enum([\"subscription\", \"pass\"])\nexport type BillingAccessSource = z.infer<typeof billingAccessSourceSchema>\n\nexport const billingScheduledChangeSchema = z.object({\n plan: billingCheckoutPlanSchema,\n interval: billingIntervalSchema,\n effectiveAt: z.coerce.date(),\n}).strict()\nexport type BillingScheduledChange = z.infer<typeof billingScheduledChangeSchema>\n\nexport const billingStatusSchema = z.object({\n plan: billingPlanSchema,\n status: billingSubscriptionStatusSchema.nullable(),\n interval: billingIntervalSchema.nullable(),\n currentPeriodEnd: z.coerce.date().nullable(),\n /**\n * When the subscription terminates, or null if it renews. Replaces the\n * `cancelAtPeriodEnd` boolean: Stripe deprecated its counterpart and the\n * Customer Portal no longer sets it, and the termination date is not always\n * `currentPeriodEnd` — a stacked pass pushes that past the cancellation.\n */\n cancelAt: z.coerce.date().nullable(),\n accessSource: billingAccessSourceSchema.nullable(),\n scheduledChange: billingScheduledChangeSchema.nullable(),\n unlimitedNotebaseNotes: z.boolean(),\n notebaseNoteLimit: z.number().int().positive(),\n notebaseNoteCount: z.number().int().min(0),\n}).strict()\nexport type BillingStatus = z.infer<typeof billingStatusSchema>\n\nexport const billingCreateCheckoutSessionInputSchema = z.object({\n currency: billingCurrencySchema,\n interval: billingIntervalSchema,\n locale: billingLocaleSchema,\n plan: billingCheckoutPlanSchema.default(\"pro\"),\n}).strict()\nexport type BillingCreateCheckoutSessionInput = z.infer<typeof billingCreateCheckoutSessionInputSchema>\n\nexport const billingCreateCustomerPortalSessionInputSchema = z.object({\n locale: billingLocaleSchema,\n}).strict()\nexport type BillingCreateCustomerPortalSessionInput = z.infer<typeof billingCreateCustomerPortalSessionInputSchema>\n\nexport const billingSessionUrlOutputSchema = z.object({\n url: z.url(),\n}).strict()\nexport type BillingSessionUrlOutput = z.infer<typeof billingSessionUrlOutputSchema>\n\nexport const billingCancelScheduledChangeOutputSchema = z.object({\n success: z.literal(true),\n}).strict()\nexport type BillingCancelScheduledChangeOutput = z.infer<typeof billingCancelScheduledChangeOutputSchema>\n","import { oc } from \"@orpc/contract\"\nimport { pickPublicErrorMap } from \"#/public-errors\"\nimport {\n billingCancelScheduledChangeOutputSchema,\n billingCreateCheckoutSessionInputSchema,\n billingCreateCustomerPortalSessionInputSchema,\n billingSessionUrlOutputSchema,\n billingStatusSchema,\n} from \"#/schemas/billing\"\n\nconst billingProcedure = oc.errors(\n pickPublicErrorMap(\n \"BILLING_NOT_CONFIGURED\",\n \"BILLING_CUSTOMER_NOT_FOUND\",\n \"BILLING_PASS_ACTIVE\",\n \"BILLING_CHANGE_SCHEDULED\",\n ),\n)\n\nexport const billingContract = {\n status: billingProcedure\n .route({\n method: \"GET\",\n path: \"/billing/status\",\n summary: \"Get authenticated user's billing status\",\n tags: [\"Billing\"],\n })\n .output(billingStatusSchema),\n createCheckoutSession: billingProcedure\n .route({\n method: \"POST\",\n path: \"/billing/checkout-sessions\",\n summary: \"Create a localized Stripe Checkout Session for a subscription\",\n tags: [\"Billing\"],\n })\n .input(billingCreateCheckoutSessionInputSchema)\n .output(billingSessionUrlOutputSchema),\n createCustomerPortalSession: billingProcedure\n .route({\n method: \"POST\",\n path: \"/billing/customer-portal-sessions\",\n summary: \"Create a Stripe Customer Portal Session\",\n tags: [\"Billing\"],\n })\n .input(billingCreateCustomerPortalSessionInputSchema)\n .output(billingSessionUrlOutputSchema),\n cancelScheduledChange: billingProcedure\n .route({\n method: \"POST\",\n path: \"/billing/scheduled-change/cancel\",\n summary: \"Cancel a scheduled subscription change\",\n tags: [\"Billing\"],\n })\n .output(billingCancelScheduledChangeOutputSchema),\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\"\n\nexport const notebaseProcedure = oc\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 { EBOOK_ALLOWED_COVER_CONTENT_TYPES } from \"@read-frog/definitions\"\nimport { z } from \"zod\"\n\nexport const ebookStatusSchema = z.enum([\"pending\", \"ready\"])\nexport type EbookStatus = z.infer<typeof ebookStatusSchema>\n\nexport const ebookCoverContentTypeSchema = z.enum(EBOOK_ALLOWED_COVER_CONTENT_TYPES)\nexport type EbookCoverContentType = z.infer<typeof ebookCoverContentTypeSchema>\n\nexport const ebookListItemSchema = z.object({\n id: z.uuid(),\n title: z.string(),\n author: z.string().nullable(),\n language: z.string().nullable(),\n fileByteSize: z.number().int(),\n status: ebookStatusSchema,\n progressFraction: z.number(),\n lastReadAt: z.coerce.date().nullable(),\n coverUrl: z.url().nullable(),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n}).strict()\nexport type EbookListItem = z.infer<typeof ebookListItemSchema>\n\nexport const ebookDetailSchema = ebookListItemSchema.extend({\n progressCfi: z.string().nullable(),\n})\nexport type EbookDetail = z.infer<typeof ebookDetailSchema>\n\nexport const ebookQuotaSchema = z.object({\n count: z.number().int().min(0),\n // 0 is a valid limit: uploading is a paid feature, so free plans get no quota.\n limit: z.number().int().min(0),\n}).strict()\nexport type EbookQuota = z.infer<typeof ebookQuotaSchema>\n\nexport const ebookListInputSchema = z.object({}).strict()\nexport type EbookListInput = z.infer<typeof ebookListInputSchema>\n\nexport const ebookListOutputSchema = z.object({\n items: z.array(ebookListItemSchema),\n quota: ebookQuotaSchema,\n}).strict()\nexport type EbookListOutput = z.infer<typeof ebookListOutputSchema>\n\nexport const ebookGetInputSchema = z.object({\n id: z.uuid(),\n}).strict()\nexport type EbookGetInput = z.infer<typeof ebookGetInputSchema>\n\nexport const ebookGetOutputSchema = z.object({\n ebook: ebookDetailSchema,\n}).strict()\nexport type EbookGetOutput = z.infer<typeof ebookGetOutputSchema>\n\nexport const ebookRequestUploadInputSchema = z.object({\n title: z.string().min(1).max(500),\n author: z.string().max(500).optional(),\n language: z.string().max(35).optional(),\n coverContentType: ebookCoverContentTypeSchema.optional(),\n}).strict()\nexport type EbookRequestUploadInput = z.infer<typeof ebookRequestUploadInputSchema>\n\n/**\n * S3 POST form policy. `fields` must be appended to the form in iteration order\n * with the file last; S3 ignores anything sent after the `file` part.\n */\nexport const ebookPresignedPostSchema = z.object({\n url: z.url(),\n fields: z.record(z.string(), z.string()),\n}).strict()\nexport type EbookPresignedPost = z.infer<typeof ebookPresignedPostSchema>\n\nexport const ebookRequestUploadOutputSchema = z.object({\n ebookId: z.uuid(),\n upload: ebookPresignedPostSchema,\n coverUpload: ebookPresignedPostSchema.nullable(),\n expiresAt: z.coerce.date(),\n}).strict()\nexport type EbookRequestUploadOutput = z.infer<typeof ebookRequestUploadOutputSchema>\n\nexport const ebookFinalizeUploadInputSchema = z.object({\n ebookId: z.uuid(),\n}).strict()\nexport type EbookFinalizeUploadInput = z.infer<typeof ebookFinalizeUploadInputSchema>\n\nexport const ebookFinalizeUploadOutputSchema = z.object({\n ebook: ebookListItemSchema,\n}).strict()\nexport type EbookFinalizeUploadOutput = z.infer<typeof ebookFinalizeUploadOutputSchema>\n\nexport const ebookGetDownloadUrlInputSchema = z.object({\n id: z.uuid(),\n}).strict()\nexport type EbookGetDownloadUrlInput = z.infer<typeof ebookGetDownloadUrlInputSchema>\n\nexport const ebookGetDownloadUrlOutputSchema = z.object({\n url: z.url(),\n expiresAt: z.coerce.date(),\n}).strict()\nexport type EbookGetDownloadUrlOutput = z.infer<typeof ebookGetDownloadUrlOutputSchema>\n\nexport const ebookUpdateProgressDataSchema = z.object({\n cfi: z.string().max(2000),\n fraction: z.number().min(0).max(1),\n}).strict()\nexport type EbookUpdateProgressData = z.infer<typeof ebookUpdateProgressDataSchema>\n\nexport const ebookUpdateProgressInputSchema = ebookUpdateProgressDataSchema.extend({\n id: z.uuid(),\n})\nexport type EbookUpdateProgressInput = z.infer<typeof ebookUpdateProgressInputSchema>\n\nexport const ebookUpdateProgressOutputSchema = z.object({\n lastReadAt: z.coerce.date(),\n}).strict()\nexport type EbookUpdateProgressOutput = z.infer<typeof ebookUpdateProgressOutputSchema>\n\nexport const ebookRenameDataSchema = z.object({\n title: z.string().min(1).max(500),\n author: z.string().max(500).nullable().optional(),\n}).strict()\nexport type EbookRenameData = z.infer<typeof ebookRenameDataSchema>\n\nexport const ebookRenameInputSchema = ebookRenameDataSchema.extend({\n id: z.uuid(),\n})\nexport type EbookRenameInput = z.infer<typeof ebookRenameInputSchema>\n\nexport const ebookRenameOutputSchema = z.object({\n ebook: ebookListItemSchema,\n}).strict()\nexport type EbookRenameOutput = z.infer<typeof ebookRenameOutputSchema>\n\nexport const ebookDeleteInputSchema = z.object({\n id: z.uuid(),\n}).strict()\nexport type EbookDeleteInput = z.infer<typeof ebookDeleteInputSchema>\n\nexport const ebookDeleteOutputSchema = z.object({\n id: z.uuid(),\n}).strict()\nexport type EbookDeleteOutput = z.infer<typeof ebookDeleteOutputSchema>\n","import { oc } from \"@orpc/contract\"\nimport { pickPublicErrorMap } from \"#/public-errors\"\nimport {\n ebookDeleteInputSchema,\n ebookDeleteOutputSchema,\n ebookFinalizeUploadInputSchema,\n ebookFinalizeUploadOutputSchema,\n ebookGetDownloadUrlInputSchema,\n ebookGetDownloadUrlOutputSchema,\n ebookGetInputSchema,\n ebookGetOutputSchema,\n ebookListInputSchema,\n ebookListOutputSchema,\n ebookRenameInputSchema,\n ebookRenameOutputSchema,\n ebookRequestUploadInputSchema,\n ebookRequestUploadOutputSchema,\n ebookUpdateProgressInputSchema,\n ebookUpdateProgressOutputSchema,\n} from \"#/schemas/ebook\"\n\nconst ebookProcedure = oc\n\nexport const ebookContract = {\n list: ebookProcedure\n .errors(pickPublicErrorMap(\"EBOOK_BETA_RESTRICTED\"))\n .route({\n method: \"GET\",\n path: \"/ebooks\",\n summary: \"List ebooks with quota\",\n tags: [\"Ebooks\"],\n })\n .input(ebookListInputSchema)\n .output(ebookListOutputSchema),\n\n get: ebookProcedure\n .errors(pickPublicErrorMap(\"EBOOK_BETA_RESTRICTED\", \"EBOOK_NOT_FOUND\"))\n .route({\n method: \"GET\",\n path: \"/ebooks/{id}\",\n summary: \"Get an ebook with reading progress\",\n tags: [\"Ebooks\"],\n })\n .input(ebookGetInputSchema)\n .output(ebookGetOutputSchema),\n\n requestUpload: ebookProcedure\n .errors(pickPublicErrorMap(\"EBOOK_BETA_RESTRICTED\", \"EBOOK_LIMIT_EXCEEDED\"))\n .route({\n method: \"POST\",\n path: \"/ebooks/uploads\",\n summary: \"Request presigned upload URLs for a new ebook\",\n tags: [\"Ebooks\"],\n })\n .input(ebookRequestUploadInputSchema)\n .output(ebookRequestUploadOutputSchema),\n\n finalizeUpload: ebookProcedure\n .errors(pickPublicErrorMap(\n \"EBOOK_BETA_RESTRICTED\",\n \"EBOOK_NOT_FOUND\",\n \"EBOOK_UPLOAD_NOT_COMPLETED\",\n \"EBOOK_FILE_TOO_LARGE\",\n ))\n .route({\n method: \"POST\",\n path: \"/ebooks/{ebookId}/finalize\",\n summary: \"Finalize an ebook upload\",\n tags: [\"Ebooks\"],\n })\n .input(ebookFinalizeUploadInputSchema)\n .output(ebookFinalizeUploadOutputSchema),\n\n getDownloadUrl: ebookProcedure\n .errors(pickPublicErrorMap(\"EBOOK_BETA_RESTRICTED\", \"EBOOK_NOT_FOUND\"))\n .route({\n method: \"GET\",\n path: \"/ebooks/{id}/download-url\",\n summary: \"Get a presigned download URL for an ebook\",\n tags: [\"Ebooks\"],\n })\n .input(ebookGetDownloadUrlInputSchema)\n .output(ebookGetDownloadUrlOutputSchema),\n\n updateProgress: ebookProcedure\n .errors(pickPublicErrorMap(\"EBOOK_BETA_RESTRICTED\", \"EBOOK_NOT_FOUND\"))\n .route({\n method: \"PATCH\",\n path: \"/ebooks/{id}/progress\",\n summary: \"Update ebook reading progress\",\n tags: [\"Ebooks\"],\n })\n .input(ebookUpdateProgressInputSchema)\n .output(ebookUpdateProgressOutputSchema),\n\n rename: ebookProcedure\n .errors(pickPublicErrorMap(\"EBOOK_BETA_RESTRICTED\", \"EBOOK_NOT_FOUND\"))\n .route({\n method: \"PATCH\",\n path: \"/ebooks/{id}\",\n summary: \"Rename an ebook\",\n tags: [\"Ebooks\"],\n })\n .input(ebookRenameInputSchema)\n .output(ebookRenameOutputSchema),\n\n delete: ebookProcedure\n .errors(pickPublicErrorMap(\"EBOOK_BETA_RESTRICTED\", \"EBOOK_NOT_FOUND\"))\n .route({\n method: \"DELETE\",\n path: \"/ebooks/{id}\",\n summary: \"Delete an ebook\",\n tags: [\"Ebooks\"],\n })\n .input(ebookDeleteInputSchema)\n .output(ebookDeleteOutputSchema),\n}\n","import { eventIterator, oc } from \"@orpc/contract\"\nimport { pickPublicErrorMap } from \"#/public-errors\"\nimport {\n HostedAiNoteSuggestionStreamInputSchema,\n HostedAiStatusInputSchema,\n HostedAiStatusOutputSchema,\n HostedAiStreamPartSchema,\n HostedAiStreamStructuredObjectInputSchema,\n HostedAiStreamTextInputSchema,\n} from \"#/schemas/hosted-ai\"\n\nconst hostedAiStreamErrors = pickPublicErrorMap(\n \"HOSTED_AI_TIER_RESTRICTED\",\n \"HOSTED_AI_QUOTA_EXHAUSTED\",\n)\n\nexport const hostedAiContract = {\n status: oc\n .route({\n method: \"GET\",\n path: \"/hosted-ai/status\",\n summary: \"Get Built-in AI availability and quota status\",\n tags: [\"Hosted AI\"],\n })\n .input(HostedAiStatusInputSchema)\n .output(HostedAiStatusOutputSchema),\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 .errors(hostedAiStreamErrors),\n },\n selectionTranslation: {\n streamText: oc\n .route({\n method: \"POST\",\n path: \"/hosted-ai/selection-translation/stream-text\",\n summary: \"Stream hosted selection translation text output\",\n tags: [\"Hosted AI\"],\n })\n .input(HostedAiStreamTextInputSchema)\n .output(eventIterator(HostedAiStreamPartSchema))\n .errors(hostedAiStreamErrors),\n },\n videoSubtitles: {\n // Subtitle lines and the video summary share this route: both are short\n // text and both bill against `videoSubtitles`.\n streamText: oc\n .route({\n method: \"POST\",\n path: \"/hosted-ai/video-subtitles/stream-text\",\n summary: \"Stream hosted subtitle translation or video summary text output\",\n tags: [\"Hosted AI\"],\n })\n .input(HostedAiStreamTextInputSchema)\n .output(eventIterator(HostedAiStreamPartSchema))\n .errors(hostedAiStreamErrors),\n /**\n * Segmentation shares the `videoSubtitles` feature but not its route,\n * because `endpointMaxOutputTokens` sizes the credit reservation: emitting\n * a WebVTT block needs several times a subtitle line's budget, and folding\n * both into one route would make every line reserve — and, near the end of\n * a credit window, fail to afford — what only segmentation needs.\n */\n streamSegmentation: oc\n .route({\n method: \"POST\",\n path: \"/hosted-ai/video-subtitles/stream-segmentation\",\n summary: \"Stream hosted subtitle segmentation output\",\n tags: [\"Hosted AI\"],\n })\n .input(HostedAiStreamTextInputSchema)\n .output(eventIterator(HostedAiStreamPartSchema))\n .errors(hostedAiStreamErrors),\n },\n inputTranslation: {\n streamText: oc\n .route({\n method: \"POST\",\n path: \"/hosted-ai/input-translation/stream-text\",\n summary: \"Stream hosted input box translation text output\",\n tags: [\"Hosted AI\"],\n })\n .input(HostedAiStreamTextInputSchema)\n .output(eventIterator(HostedAiStreamPartSchema))\n .errors(hostedAiStreamErrors),\n },\n languageDetection: {\n // Detection wants one short string back, not a stream, but the quota\n // reserve/settle path is stream-shaped end to end. Reusing it keeps one\n // metering implementation; the client collects the deltas.\n streamText: oc\n .route({\n method: \"POST\",\n path: \"/hosted-ai/language-detection/stream-text\",\n summary: \"Stream hosted language detection output\",\n tags: [\"Hosted AI\"],\n })\n .input(HostedAiStreamTextInputSchema)\n .output(eventIterator(HostedAiStreamPartSchema))\n .errors(hostedAiStreamErrors),\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 .errors(hostedAiStreamErrors),\n },\n noteSuggestion: {\n streamStructuredObject: oc\n .route({\n method: \"POST\",\n path: \"/hosted-ai/note-suggestions/stream-structured-object\",\n summary: \"Stream hosted note suggestion structured output\",\n tags: [\"Hosted AI\"],\n })\n .input(HostedAiNoteSuggestionStreamInputSchema)\n .output(eventIterator(HostedAiStreamPartSchema))\n .errors(hostedAiStreamErrors),\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 wrap: z.boolean(),\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 wrap: z.boolean().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 NOTEBASE_ROW_CREATE_MANY_MAX_ROWS = 50\n\nexport const NotebaseRowCreateManyInputSchema = z.object({\n notebaseId: z.uuid(),\n rows: z.array(notebaseRowCreateDataSchema).min(1).max(NOTEBASE_ROW_CREATE_MANY_MAX_ROWS),\n}).superRefine((input, ctx) => {\n const seenIds = new Set<string>()\n\n input.rows.forEach((row, index) => {\n if (row.id === undefined) {\n return\n }\n\n if (seenIds.has(row.id)) {\n ctx.addIssue({\n code: \"custom\",\n message: `Duplicate row id \"${row.id}\".`,\n path: [\"rows\", index, \"id\"],\n })\n return\n }\n\n seenIds.add(row.id)\n })\n})\nexport type NotebaseRowCreateManyInput = z.infer<typeof NotebaseRowCreateManyInputSchema>\n\nexport const NotebaseRowCreateManyOutputSchema = z.object({\n txid: z.number(),\n})\nexport type NotebaseRowCreateManyOutput = z.infer<typeof NotebaseRowCreateManyOutputSchema>\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 { NOTEBASE_ROW_CREATE_MANY_MAX_ROWS, 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\nconst notebaseInitialRowSchema = z.object({\n id: z.uuid().optional(),\n cells: z.record(z.string(), z.unknown()),\n}).strict()\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: notebaseInitialRowSchema.optional(),\n initialRows: z.array(notebaseInitialRowSchema).min(1).max(NOTEBASE_ROW_CREATE_MANY_MAX_ROWS).optional(),\n }).strict().superRefine((options, ctx) => {\n if (options.initialRow && options.initialRows) {\n ctx.addIssue({\n code: \"custom\",\n message: \"Provide either initialRow or initialRows, not both.\",\n path: [\"initialRows\"],\n })\n }\n\n if (!options.initialRows) {\n return\n }\n\n const seenIds = new Set<string>()\n options.initialRows.forEach((row, index) => {\n if (row.id === undefined) {\n return\n }\n\n if (seenIds.has(row.id)) {\n ctx.addIssue({\n code: \"custom\",\n message: `Duplicate row id \"${row.id}\".`,\n path: [\"initialRows\", index, \"id\"],\n })\n return\n }\n\n seenIds.add(row.id)\n })\n }).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 srsDesiredRetention: schedulingParamsShape.desiredRetention.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 .errors(pickPublicErrorMap(\"NOTE_LIMIT_EXCEEDED\", \"CELL_VALIDATION_FAILED\"))\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 NotebaseRowCreateManyInputSchema,\n NotebaseRowCreateManyOutputSchema,\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 \"NOTE_LIMIT_EXCEEDED\",\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 createMany: notebaseProcedure\n .errors(pickPublicErrorMap(\n \"NOTEBASE_NOT_FOUND\",\n \"CELL_VALIDATION_FAILED\",\n \"CONCURRENT_POSITION_CONFLICT\",\n \"NOTE_LIMIT_EXCEEDED\",\n ))\n .route({\n method: \"POST\",\n path: \"/notebase-rows/batch\",\n summary: \"Create notebase rows in a single transaction\",\n tags: [\"Notebase Rows\"],\n })\n .input(NotebaseRowCreateManyInputSchema)\n .output(NotebaseRowCreateManyOutputSchema),\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 stability: z.number(),\n afterScheduleStatus: scheduleStatusSchema,\n afterStability: z.number(),\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 srsListCardRevlogsInputSchema = z.object({\n cardId: z.uuid(),\n}).strict()\nexport type SrsListCardRevlogsInput = z.infer<typeof srsListCardRevlogsInputSchema>\n\nexport const srsListCardRevlogsOutputSchema = z.object({\n items: z.array(srsRevlogWithoutSnapshotSchema),\n}).strict()\nexport type SrsListCardRevlogsOutput = z.infer<typeof srsListCardRevlogsOutputSchema>\n\nexport const srsReviewOutputSchema = z.object({\n card: cardSchema,\n revlog: srsRevlogSchema,\n txid: z.number(),\n // False when an idempotent replay returned an existing revlog instead of creating one.\n created: z.boolean(),\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 srsListCardRevlogsInputSchema,\n srsListCardRevlogsOutputSchema,\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 listCardRevlogs: notebaseProcedure\n .errors(pickPublicErrorMap(\"CARD_NOT_FOUND\"))\n .route({\n method: \"GET\",\n path: \"/srs/cards/{cardId}/revlogs\",\n summary: \"List complete review history for a card\",\n tags: [\"SRS\"],\n })\n .input(srsListCardRevlogsInputSchema)\n .output(srsListCardRevlogsOutputSchema),\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\"\n\nexport const notebaseActivityStatsItemSchema = z.object({\n date: z.iso.date(),\n notes: z.number().int().nonnegative(),\n}).strict()\nexport type NotebaseActivityStatsItem = z.infer<typeof notebaseActivityStatsItemSchema>\n\nexport const notebaseActivityStatsOutputSchema = z.object({\n daily: z.array(notebaseActivityStatsItemSchema),\n}).strict()\nexport type NotebaseActivityStatsOutput = z.infer<typeof notebaseActivityStatsOutputSchema>\n\nexport const notebaseRowGrowthStatsItemSchema = z.object({\n date: z.iso.date(),\n delta: z.number().int(),\n}).strict()\nexport type NotebaseRowGrowthStatsItem = z.infer<typeof notebaseRowGrowthStatsItemSchema>\n\nexport const notebaseRowGrowthStatsOutputSchema = z.object({\n baseTotal: z.number().int().nonnegative(),\n daily: z.array(notebaseRowGrowthStatsItemSchema),\n}).strict()\nexport type NotebaseRowGrowthStatsOutput = z.infer<typeof notebaseRowGrowthStatsOutputSchema>\n","import { z } from \"zod\"\n\nexport const srsActivityStatsItemSchema = z.object({\n date: z.iso.date(),\n answers: z.number().int().nonnegative(),\n durationMs: z.number().int().nonnegative(),\n}).strict()\nexport type SrsActivityStatsItem = z.infer<typeof srsActivityStatsItemSchema>\n\nexport const srsActivityStatsOutputSchema = z.object({\n learnedCards: z.number().int().nonnegative(),\n daily: z.array(srsActivityStatsItemSchema),\n}).strict()\nexport type SrsActivityStatsOutput = z.infer<typeof srsActivityStatsOutputSchema>\n\nexport const srsMemoryGrowthStatsItemSchema = z.object({\n date: z.iso.date(),\n delta: z.number().int(),\n}).strict()\nexport type SrsMemoryGrowthStatsItem = z.infer<typeof srsMemoryGrowthStatsItemSchema>\n\nexport const srsMemoryGrowthStatsOutputSchema = z.object({\n baseTotal: z.number().int().nonnegative(),\n daily: z.array(srsMemoryGrowthStatsItemSchema),\n}).strict()\nexport type SrsMemoryGrowthStatsOutput = z.infer<typeof srsMemoryGrowthStatsOutputSchema>\n","import { z } from \"zod\"\nimport { notebaseActivityStatsOutputSchema } from \"./notebase-stats\"\nimport { srsActivityStatsOutputSchema } from \"./srs-stats\"\nimport { timezoneSchema } from \"./timezone\"\n\nconst statsNotebaseIdsSchema = z.array(z.uuid())\n .min(1)\n .transform(ids => Array.from(new Set(ids)))\n\nexport const statsInputSchema = z.object({\n notebaseIds: statsNotebaseIdsSchema.optional(),\n from: z.iso.date().optional(),\n to: z.iso.date(),\n timezone: timezoneSchema,\n}).strict().refine(input => !input.from || input.from <= input.to, {\n message: \"from must be before or equal to to\",\n path: [\"from\"],\n})\nexport type StatsInput = z.infer<typeof statsInputSchema>\n\nexport const activityStatsOutputSchema = z.object({\n srs: srsActivityStatsOutputSchema,\n notebase: notebaseActivityStatsOutputSchema,\n}).strict()\nexport type ActivityStatsOutput = z.infer<typeof activityStatsOutputSchema>\n","import { pickPublicErrorMap } from \"#/public-errors\"\nimport { notebaseRowGrowthStatsOutputSchema } from \"#/schemas/notebase-stats\"\nimport {\n srsMemoryGrowthStatsOutputSchema,\n} from \"#/schemas/srs-stats\"\nimport { activityStatsOutputSchema, statsInputSchema } from \"#/schemas/stats\"\nimport { notebaseProcedure } from \"./shared\"\n\nexport const statsContract = {\n activity: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\"))\n .route({\n method: \"GET\",\n path: \"/stats/activity\",\n summary: \"Get SRS and notebase activity statistics\",\n tags: [\"Statistics\"],\n })\n .input(statsInputSchema)\n .output(activityStatsOutputSchema),\n\n srsMemoryGrowth: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\"))\n .route({\n method: \"GET\",\n path: \"/srs/stats/memory-growth\",\n summary: \"Get SRS long-term memory growth statistics\",\n tags: [\"Statistics\"],\n })\n .input(statsInputSchema)\n .output(srsMemoryGrowthStatsOutputSchema),\n\n notebaseRowGrowth: notebaseProcedure\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\"))\n .route({\n method: \"GET\",\n path: \"/notebases/stats/row-growth\",\n summary: \"Get notebase row growth statistics\",\n tags: [\"Statistics\"],\n })\n .input(statsInputSchema)\n .output(notebaseRowGrowthStatsOutputSchema),\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 { getVideoIdFromUrl, transcriptSegmentSchema } from \"@read-frog/definitions\"\nimport { z } from \"zod\"\nimport { billingPlanSchema } from \"./billing\"\n\nexport const videoTranscriptStatusSchema = z.enum([\n \"pending\",\n \"processing\",\n \"completed\",\n \"failed\",\n])\nexport type VideoTranscriptStatus = z.infer<typeof videoTranscriptStatusSchema>\n\n// The transcript \"job\" resource: status + metadata, without the (heavy) segments payload.\nexport const videoTranscriptResourceSchema = z.object({\n id: z.string(),\n platform: z.string(),\n videoId: z.string(),\n url: z.string(),\n status: videoTranscriptStatusSchema,\n title: z.string().nullable(),\n durationSec: z.number().nullable(),\n detectedLanguage: z.string().nullable(),\n error: z.string().nullable(),\n createdAt: z.date(),\n updatedAt: z.date(),\n})\nexport type VideoTranscriptResource = z.infer<typeof videoTranscriptResourceSchema>\n\n// The subtitles sub-resource: the segments + model-detected language, only available once completed.\nexport const videoTranscriptSubtitlesSchema = z.object({\n id: z.string(),\n detectedLanguage: z.string().nullable(),\n segments: z.array(transcriptSegmentSchema),\n})\nexport type VideoTranscriptSubtitles = z.infer<typeof videoTranscriptSubtitlesSchema>\n\nexport const videoTranscriptCreateInputSchema = z.object({\n url: z.url().refine(url => getVideoIdFromUrl(url) !== null, { message: \"url must be a supported video URL\" }),\n // The player's own duration, read from the media element. REQUIRED, and an\n // untrusted UX hint only: admission uses it to reject an over-quota request\n // instantly, but every reservation and charge is made against the\n // server-measured duration in the worker — lying here changes nothing about\n // what gets billed.\n durationSec: z.number().int().positive(),\n}).strict()\nexport type VideoTranscriptCreateInput = z.infer<typeof videoTranscriptCreateInputSchema>\n\nexport const videoTranscriptGetInputSchema = z.object({\n id: z.uuid(),\n}).strict()\nexport type VideoTranscriptGetInput = z.infer<typeof videoTranscriptGetInputSchema>\n\n// One quota pool as shown to the user. `resetAt` is null for a one-time grant\n// (it never resets); `expiresAt` is null for a monthly pool (its end is the\n// reset). Minutes are display units: `usedMinutes` rounds up and\n// `limitMinutes` rounds down, so the UI can never show headroom that\n// admission (which compares raw seconds) would deny.\nexport const videoTranscriptUsagePoolSchema = z.object({\n id: z.string(),\n usedMinutes: z.number().int(),\n limitMinutes: z.number().int(),\n remainingMinutes: z.number().int(),\n resetAt: z.iso.datetime().nullable(),\n expiresAt: z.iso.datetime().nullable(),\n})\nexport type VideoTranscriptUsagePool = z.infer<typeof videoTranscriptUsagePoolSchema>\n\n// The caller's transcription quota usage. Totals aggregate across pools;\n// `remainingMinutes` nets out in-flight reservations (committed), while each\n// pool's `usedMinutes` shows settled spend only, so a progress bar cannot run\n// forward and then backwards when a job is released. Deliberately a non-strict\n// object: old clients strip the keys they don't know.\nexport const videoTranscriptUsageSchema = z.object({\n usedMinutes: z.number().int(),\n limitMinutes: z.number().int(),\n remainingMinutes: z.number().int(),\n plan: billingPlanSchema,\n pools: z.array(videoTranscriptUsagePoolSchema),\n})\nexport type VideoTranscriptUsage = z.infer<typeof videoTranscriptUsageSchema>\n","import { oc } from \"@orpc/contract\"\nimport { pickPublicErrorMap } from \"#/public-errors\"\nimport {\n videoTranscriptCreateInputSchema,\n videoTranscriptGetInputSchema,\n videoTranscriptResourceSchema,\n videoTranscriptSubtitlesSchema,\n videoTranscriptUsageSchema,\n} from \"#/schemas/video-transcript\"\n\nexport const videoTranscriptContract = {\n create: oc\n .errors(pickPublicErrorMap(\n \"VIDEO_TRANSCRIPTION_QUOTA_EXCEEDED\",\n \"VIDEO_TRANSCRIPTION_SUBSCRIPTION_REQUIRED\",\n \"VIDEO_TRANSCRIPTION_PAYMENT_REQUIRED\",\n \"VIDEO_TRANSCRIPTION_UNSUPPORTED_LENGTH\",\n ))\n .route({\n method: \"POST\",\n path: \"/video-transcripts\",\n summary: \"Create or reuse a video transcription job\",\n tags: [\"Video Transcription\"],\n })\n .input(videoTranscriptCreateInputSchema)\n .output(videoTranscriptResourceSchema),\n getUsage: oc\n .route({\n method: \"GET\",\n path: \"/video-transcripts/usage\",\n summary: \"Get the caller's monthly transcription quota usage\",\n tags: [\"Video Transcription\"],\n })\n .output(videoTranscriptUsageSchema),\n get: oc\n .errors(pickPublicErrorMap(\"VIDEO_TRANSCRIPT_NOT_FOUND\", \"VIDEO_TRANSCRIPTION_SUBSCRIPTION_REQUIRED\"))\n .route({\n method: \"GET\",\n path: \"/video-transcripts/{id}\",\n summary: \"Get a video transcription job's status\",\n tags: [\"Video Transcription\"],\n })\n .input(videoTranscriptGetInputSchema)\n .output(videoTranscriptResourceSchema),\n getSubtitles: oc\n .errors(pickPublicErrorMap(\"VIDEO_TRANSCRIPT_NOT_FOUND\", \"VIDEO_TRANSCRIPT_NOT_READY\", \"VIDEO_TRANSCRIPTION_SUBSCRIPTION_REQUIRED\"))\n .route({\n method: \"GET\",\n path: \"/video-transcripts/{id}/subtitles\",\n summary: \"Get a completed video transcript's subtitles\",\n tags: [\"Video Transcription\"],\n })\n .input(videoTranscriptGetInputSchema)\n .output(videoTranscriptSubtitlesSchema),\n}\n","import type { ContractRouterClient } from \"@orpc/contract\"\nimport { betaAccessContract } from \"./contracts/beta-access\"\nimport { billingContract } from \"./contracts/billing\"\nimport { cardContract } from \"./contracts/card\"\nimport { cardTemplateContract } from \"./contracts/card-template\"\nimport { ebookContract } from \"./contracts/ebook\"\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 { statsContract } from \"./contracts/stats\"\nimport { userContract } from \"./contracts/user\"\nimport { videoTranscriptContract } from \"./contracts/video-transcript\"\n\nexport const contract = {\n betaAccess: betaAccessContract,\n billing: billingContract,\n card: cardContract,\n cardTemplate: cardTemplateContract,\n ebook: ebookContract,\n hostedAi: hostedAiContract,\n notebase: notebaseContract,\n notebaseColumn: notebaseColumnContract,\n notebaseRow: notebaseRowContract,\n srs: srsContract,\n stats: statsContract,\n user: userContract,\n videoTranscript: videoTranscriptContract,\n}\n\nexport type ORPCRouterClient = ContractRouterClient<typeof contract>\n\nexport * from \"./public-errors\"\nexport * from \"./schemas/beta-access\"\nexport * from \"./schemas/billing\"\nexport * from \"./schemas/card\"\nexport * from \"./schemas/ebook\"\nexport * from \"./schemas/hosted-ai\"\nexport * from \"./schemas/notebase\"\nexport * from \"./schemas/notebase-column\"\nexport * from \"./schemas/notebase-row\"\nexport * from \"./schemas/notebase-stats\"\nexport * from \"./schemas/notebase-view\"\nexport * from \"./schemas/srs\"\nexport * from \"./schemas/srs-stats\"\nexport * from \"./schemas/stats\"\nexport * from \"./schemas/timezone\"\nexport * from \"./schemas/user\"\nexport * from \"./schemas/video-transcript\"\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;;;ACdA,MAAa,gCAAgC,EAAE,KAAK,CAAC,UAAU,QAAQ,CAAC;AAExE,MAAa,4BAA4B,EAAE,aAAa;CACtD,MAAM,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE;CACrC,MAAM;AACR,CAAC;AAED,MAAM,6BAA6B,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAK;;;;;;AAOrE,MAAa,0BAA0B,EAAE,KAAK,CAAC,UAAU,SAAS,CAAC;;;;;;;;;AASnE,MAAa,wBAAwB,EAAE,KAAK;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AACD,MAAa,0BAA0B,EAAE,KAAK;AAE9C,MAAM,gCAAgC;;;;;;;;;;;CAWpC,WAAW,wBAAwB,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IAAI;CAC5B,cAAc,EAAE,OAAO,CAAC,CAAC,IAAI;CAC7B,kBAAkB,EAAE,OAAO,CAAC,CAAC,IAAI;CACjC,MAAM;CACN,OAAO,EAAE,MAAM,8BAA8B;AAC/C,CAAC;;;AE/DD,MAAa,WAAW;CACtB,YAAY;CACZ,SAAS;CACT,MAAM;CACN,cAAc;CACd,OAAO;CACP,UAAU;CACV,UAAU;CACV,gBAAgB;CAChB,aAAa;CACb,KAAK;CACL,OAAO;CACP,MAAM;CACN,iBAAiB;EDjBjB,QAAQ,GACL,OAAO,mBACN,sCACA,6CACA,wCACA,wCACF,CAAC,CAAC,CACD,MAAM;GACL,QAAQ;GACR,MAAM;GACN,SAAS;GACT,MAAM,CAAC,qBAAqB;EAC9B,CAAC,CAAC,CACD,MAAM,gCAAgC,CAAC,CACvC,OAAO,6BAA6B;EACvC,UAAU,GACP,MAAM;GACL,QAAQ;GACR,MAAM;GACN,SAAS;GACT,MAAM,CAAC,qBAAqB;EAC9B,CAAC,CAAC,CACD,OAAO,0BAA0B;EACpC,KAAK,GACF,OAAO,mBAAmB,8BAA8B,2CAA2C,CAAC,CAAC,CACrG,MAAM;GACL,QAAQ;GACR,MAAM;GACN,SAAS;GACT,MAAM,CAAC,qBAAqB;EAC9B,CAAC,CAAC,CACD,MAAM,6BAA6B,CAAC,CACpC,OAAO,6BAA6B;EACvC,cAAc,GACX,OAAO,mBAAmB,8BAA8B,8BAA8B,2CAA2C,CAAC,CAAC,CACnI,MAAM;GACL,QAAQ;GACR,MAAM;GACN,SAAS;GACT,MAAM,CAAC,qBAAqB;EAC9B,CAAC,CAAC,CACD,MAAM,6BAA6B,CAAC,CACpC,OAAO,8BAA8B;CCzBvB;AACnB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["cardStateSchema","scheduleStatusSchema"],"sources":["../src/schemas/beta-access.ts","../src/contracts/beta-access.ts","../src/schemas/hosted-ai.ts","../src/public-errors.ts","../src/schemas/billing.ts","../src/contracts/billing.ts","../src/contracts/shared.ts","../src/schemas/pagination.ts","../src/schemas/resource-mutation.ts","../src/schemas/card.ts","../src/contracts/card.ts","../src/contracts/card-template.ts","../src/schemas/ebook.ts","../src/contracts/ebook.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/notebase-stats.ts","../src/schemas/srs-stats.ts","../src/schemas/stats.ts","../src/contracts/stats.ts","../src/schemas/user.ts","../src/contracts/user.ts","../src/schemas/video-transcript.ts","../src/contracts/video-transcript.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\n .object({\n featureKey: BetaFeatureKeySchema,\n })\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 { BetaAccessStatusInputSchema, BetaAccessStatusOutputSchema } 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 { 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\nconst HostedAiInstructionsSchema = z.string().trim().min(1).max(16000);\n\n/**\n * Which hosted model a request runs on. Deliberately NOT named after a billing\n * plan: which plans may reach which tier is policy (see `access-policy.ts`),\n * not identity, so a future plan can be sold with any tier without a rename.\n */\nexport const HostedAiModelTierSchema = z.enum([\"normal\", \"advance\"]);\n/**\n * The billing/access subject of a hosted request, not a route id. Sub-calls\n * bill against the feature they serve: the page summary is `pageTranslation`,\n * and the video summary and subtitle segmentation are `videoSubtitles`.\n *\n * Appended last on purpose: the db pgEnum mirrors this order, and appending\n * keeps drizzle from emitting the ADD VALUE ... BEFORE variant.\n */\nexport const HostedAiFeatureSchema = z.enum([\n \"pageTranslation\",\n \"customAction\",\n \"noteSuggestion\",\n \"selectionTranslation\",\n \"videoSubtitles\",\n \"inputTranslation\",\n \"languageDetection\",\n]);\nexport const HostedAiRequestIdSchema = z.uuid();\n\nconst HostedAiRequestMetadataSchema = {\n /**\n * Optional on the wire, always present after parsing: these endpoints shipped\n * before tiers existed, so every installed extension below 1.46.0 sends no\n * `modelTier` at all, and the input objects are strict. Defaulting here keeps\n * those clients working while giving handlers a single source of truth\n * instead of a `?? \"normal\"` at every call site.\n *\n * TODO(2026-11-01): Drop the default and make this required once extensions\n * below 1.46.0 have drained from the store.\n */\n modelTier: HostedAiModelTierSchema.default(\"normal\"),\n requestId: HostedAiRequestIdSchema.optional(),\n};\n\nexport const HostedAiStreamTextInputSchema = z.strictObject({\n ...HostedAiRequestMetadataSchema,\n instructions: HostedAiInstructionsSchema,\n prompt: z.string().trim().min(1).max(32000),\n temperature: z.number().min(0).max(2).optional(),\n});\n\nexport const HostedAiStreamStructuredObjectInputSchema = z\n .strictObject({\n ...HostedAiRequestMetadataSchema,\n instructions: HostedAiInstructionsSchema,\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 })\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 HOSTED_AI_NOTE_SUGGESTION_MAX_NOTES = 2;\nexport const HOSTED_AI_NOTE_SUGGESTION_MAX_NOTE_FIELDS = 16;\n\nexport const HostedAiNoteSuggestionStreamInputSchema = z.strictObject({\n ...HostedAiRequestMetadataSchema,\n instructions: HostedAiInstructionsSchema,\n prompt: z.string().trim().min(1).max(32000),\n temperature: z.number().min(0).max(2).optional(),\n});\n\n/**\n * Fixed structured-output schema for hosted note suggestions. Must stay\n * strict-structured-outputs-safe: strict objects only, no records, no\n * `.optional()` (nullable-only), unions limited to primitives. If the upstream\n * deployment rejects `maxItems`/`maxLength` constraint keywords, strip the\n * `.max()` calls from the model-facing copy only — clients still validate\n * against this schema.\n */\nexport const HostedAiNoteSuggestionObjectSchema = z.strictObject({\n action: z.strictObject({\n createNewDictionaryAction: z.boolean(),\n targetActionId: z.string().max(128).nullable(),\n /**\n * Name of the chosen schema's field whose value best works as a one-line\n * explanation of the term in UI (usually a definition/meaning field);\n * null when no field fits. Purely a display hint — clients sanitize it\n * and fall back to their own ordering when invalid.\n */\n summaryFieldName: z.string().max(80).nullable(),\n }),\n notes: z\n .array(\n z.strictObject({\n fields: z\n .array(\n z.strictObject({\n name: z.string().max(80),\n value: z.union([z.string(), z.number()]).nullable(),\n }),\n )\n .max(HOSTED_AI_NOTE_SUGGESTION_MAX_NOTE_FIELDS),\n }),\n )\n .max(HOSTED_AI_NOTE_SUGGESTION_MAX_NOTES),\n});\n\nexport const HostedAiStreamPartSchema = z.looseObject({\n type: z.string().trim().min(1),\n});\n\n/**\n * The only stream part types this API emits. Every other part the AI SDK\n * produces (`start-step`, `finish-step`, `text-start`, ...) carries upstream\n * metadata — provider model id, response headers, request body — and is dropped\n * server-side so it never reaches a client.\n *\n * The consumer switch lives in the extension's background stream reader. Adding\n * a type here without teaching that switch about it is a no-op; removing one\n * breaks rendering. `error` is absent on purpose: it is converted into a thrown\n * error before it can be yielded.\n */\nexport const HOSTED_AI_CLIENT_STREAM_PART_TYPES = [\n \"text-delta\",\n \"reasoning-start\",\n \"reasoning-delta\",\n \"reasoning-end\",\n \"reasoning-file\",\n \"finish\",\n] as const;\n\n/**\n * Status is per-identity, not per-feature: one call reports every feature and\n * every pool, so a client caches a single response instead of one per feature.\n * Non-strict so a client still sending the retired `feature` argument gets a\n * useful response rather than a validation error.\n */\nexport const HostedAiStatusInputSchema = z.object({});\n\nexport const HostedAiUnavailableReasonSchema = z.enum([\n \"authentication_required\",\n \"ultra_required\",\n \"quota_exhausted\",\n \"service_unavailable\",\n]);\n\nexport const HostedAiCreditPolicyIdSchema = z.enum([\n \"custom-action-guest-daily-v1\",\n \"custom-action-user-daily-v1\",\n \"custom-action-pro-daily-v1\",\n \"ultra-weekly-v1\",\n]);\n\nexport const HostedAiCreditPeriodKindSchema = z.enum([\"daily\", \"weekly\"]);\n\nexport const HostedAiQuotaScopeSchema = z.enum([\"guest\", \"user\"]);\n\n/**\n * Data payload of the TOO_MANY_REQUESTS error every hosted AI guard emits.\n * The code itself is ORPC's own rather than a PUBLIC_APP_ERROR_DEFS entry, so\n * this schema is the only contract tying the server's construction to the\n * extension's parsing of it.\n *\n * Deliberately NOT strict: installed extensions parse this payload at runtime\n * and lag server deploys by weeks, so rejecting unknown keys would turn any\n * additive server-side field into a fleet-wide parse failure that silently\n * drops retryAfterMs (queue backoff timing) and quotaScope (guest sign-in\n * prompt). Unknown keys are stripped; the required fields keep drift\n * protection.\n */\nexport const HostedAiRateLimitErrorDataSchema = z.object({\n retryAfterMs: z.number().int().min(0),\n quotaScope: HostedAiQuotaScopeSchema,\n});\n\n/**\n * Deliberately free of dollar amounts and of the versioned policy id. Clients\n * render a consumption bar and a reset time, so a percentage and a period kind\n * are all they need, and neither leaks what a call costs us. `usedPercent`\n * counts settled spend only: including in-flight reservations would make the\n * bar jump forward and then back as each stream settles.\n */\nexport const HostedAiCreditStatusSchema = z.strictObject({\n periodKind: HostedAiCreditPeriodKindSchema,\n usedPercent: z.number().min(0).max(100),\n resetAt: z.iso.datetime().nullable(),\n /**\n * Every feature drawing on this pool. Ultra shares one weekly pool across all\n * three, so the grouping lives here rather than inlined per feature — that way\n * a client can tell one shared pool from several separate ones.\n */\n features: z.array(HostedAiFeatureSchema).min(1),\n});\n\nexport const HostedAiTierStatusSchema = z.strictObject({\n accessAllowed: z.boolean(),\n available: z.boolean(),\n unavailableReason: HostedAiUnavailableReasonSchema.nullable(),\n /**\n * Viewer-independent product fact: no non-Ultra account can ever use this\n * feature/tier, so signing in alone will not unlock it. Unlike the fields\n * above, this does not vary with the caller's identity or plan — clients use\n * it to label Ultra-only options rather than to gate the current user.\n */\n requiresUltra: z.boolean(),\n modelRevision: z.string().trim().min(1),\n});\n\nexport const HostedAiFeatureStatusSchema = z.strictObject({\n normal: HostedAiTierStatusSchema,\n advance: HostedAiTierStatusSchema,\n});\n\nexport const HostedAiStatusOutputSchema = z.strictObject({\n credits: z.array(HostedAiCreditStatusSchema),\n features: z.strictObject({\n pageTranslation: HostedAiFeatureStatusSchema,\n customAction: HostedAiFeatureStatusSchema,\n noteSuggestion: HostedAiFeatureStatusSchema,\n selectionTranslation: HostedAiFeatureStatusSchema,\n videoSubtitles: HostedAiFeatureStatusSchema,\n inputTranslation: HostedAiFeatureStatusSchema,\n languageDetection: HostedAiFeatureStatusSchema,\n }),\n});\n\nexport type HostedAiOutputFieldType = z.infer<typeof HostedAiOutputFieldTypeSchema>;\nexport type HostedAiOutputField = z.infer<typeof HostedAiOutputFieldSchema>;\nexport type HostedAiModelTier = z.infer<typeof HostedAiModelTierSchema>;\nexport type HostedAiFeature = z.infer<typeof HostedAiFeatureSchema>;\nexport type HostedAiStreamTextInput = z.infer<typeof HostedAiStreamTextInputSchema>;\nexport type HostedAiStreamStructuredObjectInput = z.infer<\n typeof HostedAiStreamStructuredObjectInputSchema\n>;\nexport type HostedAiNoteSuggestionStreamInput = z.infer<\n typeof HostedAiNoteSuggestionStreamInputSchema\n>;\nexport type HostedAiNoteSuggestionObject = z.infer<typeof HostedAiNoteSuggestionObjectSchema>;\nexport type HostedAiStreamPart = z.infer<typeof HostedAiStreamPartSchema>;\nexport type HostedAiStatusInput = z.infer<typeof HostedAiStatusInputSchema>;\nexport type HostedAiUnavailableReason = z.infer<typeof HostedAiUnavailableReasonSchema>;\nexport type HostedAiCreditPolicyId = z.infer<typeof HostedAiCreditPolicyIdSchema>;\nexport type HostedAiCreditPeriodKind = z.infer<typeof HostedAiCreditPeriodKindSchema>;\nexport type HostedAiQuotaScope = z.infer<typeof HostedAiQuotaScopeSchema>;\nexport type HostedAiRateLimitErrorData = z.infer<typeof HostedAiRateLimitErrorDataSchema>;\nexport type HostedAiCreditStatus = z.infer<typeof HostedAiCreditStatusSchema>;\nexport type HostedAiTierStatus = z.infer<typeof HostedAiTierStatusSchema>;\nexport type HostedAiFeatureStatus = z.infer<typeof HostedAiFeatureStatusSchema>;\nexport type HostedAiStatusOutput = z.infer<typeof HostedAiStatusOutputSchema>;\n","import type { ErrorMap } from \"@orpc/contract\";\nimport { z } from \"zod\";\nimport { HostedAiCreditPolicyIdSchema, HostedAiModelTierSchema } from \"./schemas/hosted-ai\";\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\n .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 })\n .strict();\nexport type CellValidationFailureDetails = z.infer<typeof CellValidationFailureDetailsSchema>;\n\nexport const CellValidationFailedDataSchema = z\n .object({\n notebaseColumnId: z.string(),\n details: CellValidationFailureDetailsSchema,\n reason: CellValidationFailureReasonSchema,\n /** Index of the failing row within a batch input (createMany / initialRows). */\n rowIndex: z.number().int().min(0).optional(),\n })\n .strict();\nexport type CellValidationFailedData = z.infer<typeof CellValidationFailedDataSchema>;\n\nexport const CardTemplateInvalidColumnsDataSchema = z\n .object({\n notebaseColumnIds: z.array(z.string()),\n })\n .strict();\nexport type CardTemplateInvalidColumnsData = z.infer<typeof CardTemplateInvalidColumnsDataSchema>;\n\nexport const HostedAiTierRestrictedDataSchema = z.strictObject({\n modelTier: HostedAiModelTierSchema,\n});\n\nexport const HostedAiQuotaExhaustedDataSchema = z.strictObject({\n modelTier: HostedAiModelTierSchema,\n // Reuses the credit-status enum rather than restating it: these two always\n // describe the same set of policy ids, and a second copy silently drifts —\n // the error payload is `strictObject`, so a policy missing only here fails\n // output validation at exactly the moment a user runs out of credit.\n policyId: HostedAiCreditPolicyIdSchema,\n usedPercent: z.number().min(0).max(100),\n resetAt: z.iso.datetime().nullable(),\n});\n\nexport const PUBLIC_APP_ERROR_DEFS = {\n RESOURCE_UPDATE_CONFLICT: {\n message: \"The resource changed. Read it again before updating.\",\n status: 409,\n },\n RESOURCE_ALREADY_EXISTS: { message: \"A resource with this ID already exists.\", status: 409 },\n FIELD_TYPE_CHANGE_UNSUPPORTED: {\n message: \"This operation cannot change the field type.\",\n status: 400,\n },\n HOSTED_AI_TIER_RESTRICTED: {\n data: HostedAiTierRestrictedDataSchema,\n message: \"This Built-in AI tier is not available for this account\",\n status: 403,\n },\n HOSTED_AI_QUOTA_EXHAUSTED: {\n data: HostedAiQuotaExhaustedDataSchema,\n message: \"Built-in AI credit exhausted\",\n status: 429,\n },\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 // Retired at launch (2026-08-14) but kept defined for one release so old\n // clients' error maps keep parsing; the server no longer emits it. Remove\n // together with the beta feature key in the follow-up cleanup.\n VIDEO_TRANSCRIPTION_BETA_RESTRICTED: {\n message: \"Video transcription is currently in beta for selected accounts\",\n status: 403,\n },\n VIDEO_TRANSCRIPTION_SUBSCRIPTION_REQUIRED: {\n message: \"AI subtitles require a Pro or Ultra subscription\",\n status: 403,\n },\n // Dunning (`past_due` / `paused`), not cancellation: the account keeps\n // reading subtitles it already paid to generate, but cannot start new work\n // that spends upstream money until the payment method is fixed. Distinct\n // from SUBSCRIPTION_REQUIRED so the client can say \"update your card\"\n // instead of \"subscribe\".\n VIDEO_TRANSCRIPTION_PAYMENT_REQUIRED: {\n message: \"Update your payment method to generate new AI subtitles\",\n status: 402,\n },\n VIDEO_TRANSCRIPT_NOT_FOUND: {\n message: \"Video transcript not found\",\n status: 404,\n },\n VIDEO_TRANSCRIPT_NOT_READY: {\n message: \"Video transcript is not ready yet\",\n status: 409,\n },\n VIDEO_TRANSCRIPTION_QUOTA_EXCEEDED: {\n message: \"Monthly transcription quota exceeded\",\n status: 429,\n },\n // A property of the video, not of the account: upgrading or waiting for the\n // quota to reset changes nothing. Kept apart from QUOTA_EXCEEDED so the\n // client does not answer it with an upgrade wall.\n VIDEO_TRANSCRIPTION_UNSUPPORTED_LENGTH: {\n message: \"This video is longer than AI subtitles support\",\n status: 422,\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 NOTE_LIMIT_EXCEEDED: {\n message: \"Upgrade is required to create more Notebase notes\",\n status: 403,\n },\n BILLING_NOT_CONFIGURED: {\n message: \"Billing is not configured\",\n status: 503,\n },\n BILLING_CUSTOMER_NOT_FOUND: {\n message: \"Billing customer not found\",\n status: 404,\n },\n BILLING_PASS_ACTIVE: {\n message: \"An active Pro pass already covers this account\",\n status: 409,\n },\n BILLING_CHANGE_SCHEDULED: {\n message: \"A subscription change is already scheduled\",\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 EBOOK_BETA_RESTRICTED: {\n message: \"Ebooks are currently in beta for selected accounts\",\n status: 403,\n },\n EBOOK_NOT_FOUND: {\n message: \"Ebook not found\",\n status: 404,\n },\n EBOOK_LIMIT_EXCEEDED: {\n message: \"Upgrade is required to upload more ebooks\",\n status: 403,\n },\n EBOOK_FILE_TOO_LARGE: {\n message: \"Ebook file exceeds the maximum allowed size\",\n status: 413,\n },\n EBOOK_UPLOAD_NOT_COMPLETED: {\n message: \"Ebook upload has not been completed\",\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(\n codes.map((code) => {\n const definition = PUBLIC_APP_ERROR_DEFS[code];\n\n if (\"data\" in definition) {\n return [\n code,\n {\n data: definition.data,\n message: definition.message,\n status: definition.status,\n },\n ];\n }\n\n return [\n code,\n {\n message: definition.message,\n status: definition.status,\n },\n ];\n }),\n ) as Pick<ErrorMap, TCodes[number]>;\n}\n","import { z } from \"zod\";\n\nexport const billingIntervalSchema = z.enum([\"month\", \"year\"]);\nexport type BillingInterval = z.infer<typeof billingIntervalSchema>;\n\nexport const billingSubscriptionStatusSchema = z.enum([\n \"incomplete\",\n \"incomplete_expired\",\n \"trialing\",\n \"active\",\n \"past_due\",\n \"canceled\",\n \"unpaid\",\n \"paused\",\n]);\nexport type BillingSubscriptionStatus = z.infer<typeof billingSubscriptionStatusSchema>;\n\nexport const billingPlanSchema = z.enum([\"free\", \"pro\", \"ultra\"]);\nexport type BillingPlan = z.infer<typeof billingPlanSchema>;\n\n// Plans a user can actively check out into (the free tier has no price).\nexport const billingCheckoutPlanSchema = z.enum([\"pro\", \"ultra\"]);\nexport type BillingCheckoutPlan = z.infer<typeof billingCheckoutPlanSchema>;\n\nexport const billingCurrencySchema = z.enum([\"usd\", \"cad\", \"cny\"]);\nexport type BillingCurrency = z.infer<typeof billingCurrencySchema>;\n\nexport const billingLocaleSchema = z.enum([\n \"en\",\n \"es\",\n \"ja\",\n \"ko\",\n \"ru\",\n \"tr\",\n \"vi\",\n \"zh\",\n \"zh-TW\",\n]);\nexport type BillingLocale = z.infer<typeof billingLocaleSchema>;\n\nexport const billingAccessSourceSchema = z.enum([\"subscription\", \"pass\"]);\nexport type BillingAccessSource = z.infer<typeof billingAccessSourceSchema>;\n\nexport const billingScheduledChangeSchema = z\n .object({\n plan: billingCheckoutPlanSchema,\n interval: billingIntervalSchema,\n effectiveAt: z.coerce.date(),\n })\n .strict();\nexport type BillingScheduledChange = z.infer<typeof billingScheduledChangeSchema>;\n\nexport const billingStatusSchema = z\n .object({\n plan: billingPlanSchema,\n status: billingSubscriptionStatusSchema.nullable(),\n interval: billingIntervalSchema.nullable(),\n currentPeriodEnd: z.coerce.date().nullable(),\n /**\n * When the subscription terminates, or null if it renews. Replaces the\n * `cancelAtPeriodEnd` boolean: Stripe deprecated its counterpart and the\n * Customer Portal no longer sets it, and the termination date is not always\n * `currentPeriodEnd` — a stacked pass pushes that past the cancellation.\n */\n cancelAt: z.coerce.date().nullable(),\n accessSource: billingAccessSourceSchema.nullable(),\n scheduledChange: billingScheduledChangeSchema.nullable(),\n unlimitedNotebaseNotes: z.boolean(),\n notebaseNoteLimit: z.number().int().positive(),\n notebaseNoteCount: z.number().int().min(0),\n })\n .strict();\nexport type BillingStatus = z.infer<typeof billingStatusSchema>;\n\nexport const billingCreateCheckoutSessionInputSchema = z\n .object({\n currency: billingCurrencySchema,\n interval: billingIntervalSchema,\n locale: billingLocaleSchema,\n plan: billingCheckoutPlanSchema.default(\"pro\"),\n })\n .strict();\nexport type BillingCreateCheckoutSessionInput = z.infer<\n typeof billingCreateCheckoutSessionInputSchema\n>;\n\nexport const billingCreateCustomerPortalSessionInputSchema = z\n .object({\n locale: billingLocaleSchema,\n })\n .strict();\nexport type BillingCreateCustomerPortalSessionInput = z.infer<\n typeof billingCreateCustomerPortalSessionInputSchema\n>;\n\nexport const billingSessionUrlOutputSchema = z\n .object({\n url: z.url(),\n })\n .strict();\nexport type BillingSessionUrlOutput = z.infer<typeof billingSessionUrlOutputSchema>;\n\nexport const billingCancelScheduledChangeOutputSchema = z\n .object({\n success: z.literal(true),\n })\n .strict();\nexport type BillingCancelScheduledChangeOutput = z.infer<\n typeof billingCancelScheduledChangeOutputSchema\n>;\n","import { oc } from \"@orpc/contract\";\nimport { pickPublicErrorMap } from \"#/public-errors\";\nimport {\n billingCancelScheduledChangeOutputSchema,\n billingCreateCheckoutSessionInputSchema,\n billingCreateCustomerPortalSessionInputSchema,\n billingSessionUrlOutputSchema,\n billingStatusSchema,\n} from \"#/schemas/billing\";\n\nconst billingProcedure = oc.errors(\n pickPublicErrorMap(\n \"BILLING_NOT_CONFIGURED\",\n \"BILLING_CUSTOMER_NOT_FOUND\",\n \"BILLING_PASS_ACTIVE\",\n \"BILLING_CHANGE_SCHEDULED\",\n ),\n);\n\nexport const billingContract = {\n status: billingProcedure\n .route({\n method: \"GET\",\n path: \"/billing/status\",\n summary: \"Get authenticated user's billing status\",\n tags: [\"Billing\"],\n })\n .output(billingStatusSchema),\n createCheckoutSession: billingProcedure\n .route({\n method: \"POST\",\n path: \"/billing/checkout-sessions\",\n summary: \"Create a localized Stripe Checkout Session for a subscription\",\n tags: [\"Billing\"],\n })\n .input(billingCreateCheckoutSessionInputSchema)\n .output(billingSessionUrlOutputSchema),\n createCustomerPortalSession: billingProcedure\n .route({\n method: \"POST\",\n path: \"/billing/customer-portal-sessions\",\n summary: \"Create a Stripe Customer Portal Session\",\n tags: [\"Billing\"],\n })\n .input(billingCreateCustomerPortalSessionInputSchema)\n .output(billingSessionUrlOutputSchema),\n cancelScheduledChange: billingProcedure\n .route({\n method: \"POST\",\n path: \"/billing/scheduled-change/cancel\",\n summary: \"Cancel a scheduled subscription change\",\n tags: [\"Billing\"],\n })\n .output(billingCancelScheduledChangeOutputSchema),\n};\n","import type { Route } from \"@orpc/contract\";\nimport { oc } from \"@orpc/contract\";\n\n/**\n * A documented business route shared by OpenAPI and agent-facing adapters.\n * Both prose fields are required so adapters can reuse them without a second\n * copy or an undefined fallback.\n */\nexport type AgentRoute = Route & { summary: string; description: string };\n\n/**\n * Declares a procedure that is exposed to agents as an MCP tool, not only to\n * the REST/OpenAPI surface.\n *\n * oRPC types `~orpc.route` as the widened `Route`, so `route.summary` reads back\n * as `string | undefined` whatever is passed in. `$meta` is the only channel it\n * keeps generic, so the prose is mirrored there and stays a required `string`\n * for tool definitions. OpenAPI keeps reading `route`.\n */\nexport function defineAgentProcedure(route: AgentRoute) {\n return oc.$meta({ summary: route.summary, description: route.description }).route(route);\n}\n","import { z } from \"zod\";\nexport const paginationShape = {\n // Existing callers omit pagination to read all matching records.\n limit: z.number().int().min(1).max(500).optional(),\n offset: z.number().int().min(0).optional(),\n};\nexport function pageSchema<T extends z.ZodType>(itemSchema: T) {\n return z.object({ items: z.array(itemSchema), hasMore: z.boolean() });\n}\n","import { z } from \"zod\";\nexport const expectedUpdatedAtSchema = z.iso.datetime({ offset: true });\nexport const deletionResultSchema = z.object({\n id: z.uuid(),\n txid: z.number(),\n});\n","import { paginationShape, pageSchema } from \"./pagination\";\nimport { deletionResultSchema, expectedUpdatedAtSchema } from \"./resource-mutation\";\nimport {\n cardIdentityShape,\n cardMemoryStateShape,\n cardStateSchema,\n cardTemplateConfigSchema,\n scheduleStatusSchema,\n} from \"@read-frog/definitions\";\nimport { z } from \"zod\";\n\nexport { cardStateSchema, scheduleStatusSchema };\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 ...paginationShape,\n notebaseId: z.uuid().optional(),\n});\nexport type CardTemplateListInput = z.infer<typeof CardTemplateListInputSchema>;\n\nexport const CardTemplateListOutputSchema = pageSchema(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\n .object({\n id: z.uuid().optional(),\n notebaseId: z.uuid(),\n name: z.string().min(1),\n config: cardTemplateConfigSchema,\n })\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\n .object({\n expectedUpdatedAt: expectedUpdatedAtSchema.optional(),\n id: z.uuid(),\n name: z.string().min(1).optional(),\n config: cardTemplateConfigSchema.optional(),\n })\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 = deletionResultSchema;\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().optional(),\n templateId: z.uuid().optional(),\n scheduleStatus: scheduleStatusSchema.optional(),\n ...paginationShape,\n});\nexport type CardListInput = z.infer<typeof CardListInputSchema>;\n\nexport const CardListOutputSchema = pageSchema(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 { defineAgentProcedure } from \"./shared\";\nimport { oc } from \"@orpc/contract\";\nimport { pickPublicErrorMap } from \"#/public-errors\";\nimport {\n CardGenerateInputSchema,\n CardGenerateOutputSchema,\n CardGetInputSchema,\n CardGetOutputSchema,\n CardListInputSchema,\n CardListOutputSchema,\n} from \"#/schemas/card\";\n\nexport const cardContract = {\n list: defineAgentProcedure({\n method: \"GET\",\n path: \"/cards\",\n summary: \"List cards\",\n description:\n \"Browse owned cards with rendered fronts, backs, source IDs and learning state. Optionally filter by notebase, template or scheduleStatus. Supports limit and offset pagination.\",\n tags: [\"Cards\"],\n })\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\"))\n .input(CardListInputSchema)\n .output(CardListOutputSchema),\n\n get: defineAgentProcedure({\n method: \"GET\",\n path: \"/cards/{id}\",\n summary: \"Get card\",\n description:\n \"Read one owned card with its rendered front, back, source IDs and learning state.\",\n tags: [\"Cards\"],\n })\n .errors(pickPublicErrorMap(\"CARD_NOT_FOUND\"))\n .input(CardGetInputSchema)\n .output(CardGetOutputSchema),\n\n generate: oc\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 { defineAgentProcedure } from \"./shared\";\nimport { 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\";\n\nexport const cardTemplateContract = {\n list: defineAgentProcedure({\n method: \"GET\",\n path: \"/card-templates\",\n summary: \"List card templates\",\n description:\n \"List owned card templates, optionally filtered by notebase. Supports limit and offset pagination.\",\n tags: [\"Card Templates\"],\n })\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\"))\n .input(CardTemplateListInputSchema)\n .output(CardTemplateListOutputSchema),\n\n get: defineAgentProcedure({\n method: \"GET\",\n path: \"/card-templates/{id}\",\n summary: \"Get card template\",\n description: \"Read the complete definition and updatedAt timestamp of an owned card template.\",\n tags: [\"Card Templates\"],\n })\n .errors(pickPublicErrorMap(\"CARD_TEMPLATE_NOT_FOUND\"))\n .input(CardTemplateGetInputSchema)\n .output(CardTemplateGetOutputSchema),\n\n create: defineAgentProcedure({\n method: \"POST\",\n path: \"/card-templates\",\n summary: \"Create card template\",\n description:\n \"Create a template in an owned notebase using existing field IDs in its patterns. This generates cards for existing notes.\",\n tags: [\"Card Templates\"],\n })\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\", \"CARD_TEMPLATE_INVALID_NOTEBASE_COLUMNS\"))\n .errors(pickPublicErrorMap(\"RESOURCE_ALREADY_EXISTS\"))\n .input(CardTemplateCreateInputSchema)\n .output(CardTemplateCreateOutputSchema),\n\n update: defineAgentProcedure({\n method: \"PATCH\",\n path: \"/card-templates/{id}\",\n summary: \"Update card template\",\n description:\n \"Change an owned template name or definition. Rendered cards reflect the saved template. expectedUpdatedAt guards against editing stale data.\",\n tags: [\"Card Templates\"],\n })\n .errors(pickPublicErrorMap(\"CARD_TEMPLATE_NOT_FOUND\", \"CARD_TEMPLATE_INVALID_NOTEBASE_COLUMNS\"))\n .errors(pickPublicErrorMap(\"RESOURCE_UPDATE_CONFLICT\"))\n .input(CardTemplateUpdateInputSchema)\n .output(CardTemplateUpdateOutputSchema),\n\n delete: defineAgentProcedure({\n method: \"DELETE\",\n path: \"/card-templates/{id}\",\n summary: \"Delete card template\",\n description:\n \"Permanently delete an owned template and its generated cards and review records. Source notes are preserved.\",\n tags: [\"Card Templates\"],\n })\n .errors(pickPublicErrorMap(\"CARD_TEMPLATE_NOT_FOUND\"))\n .input(CardTemplateDeleteInputSchema)\n .output(CardTemplateDeleteOutputSchema),\n};\n","import { EBOOK_ALLOWED_COVER_CONTENT_TYPES } from \"@read-frog/definitions\";\nimport { z } from \"zod\";\n\nexport const ebookStatusSchema = z.enum([\"pending\", \"ready\"]);\nexport type EbookStatus = z.infer<typeof ebookStatusSchema>;\n\nexport const ebookCoverContentTypeSchema = z.enum(EBOOK_ALLOWED_COVER_CONTENT_TYPES);\nexport type EbookCoverContentType = z.infer<typeof ebookCoverContentTypeSchema>;\n\nexport const ebookListItemSchema = z\n .object({\n id: z.uuid(),\n title: z.string(),\n author: z.string().nullable(),\n language: z.string().nullable(),\n fileByteSize: z.number().int(),\n status: ebookStatusSchema,\n progressFraction: z.number(),\n lastReadAt: z.coerce.date().nullable(),\n coverUrl: z.url().nullable(),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n })\n .strict();\nexport type EbookListItem = z.infer<typeof ebookListItemSchema>;\n\nexport const ebookDetailSchema = ebookListItemSchema.extend({\n progressCfi: z.string().nullable(),\n});\nexport type EbookDetail = z.infer<typeof ebookDetailSchema>;\n\nexport const ebookQuotaSchema = z\n .object({\n count: z.number().int().min(0),\n // 0 is a valid limit: uploading is a paid feature, so free plans get no quota.\n limit: z.number().int().min(0),\n })\n .strict();\nexport type EbookQuota = z.infer<typeof ebookQuotaSchema>;\n\nexport const ebookListInputSchema = z.object({}).strict();\nexport type EbookListInput = z.infer<typeof ebookListInputSchema>;\n\nexport const ebookListOutputSchema = z\n .object({\n items: z.array(ebookListItemSchema),\n quota: ebookQuotaSchema,\n })\n .strict();\nexport type EbookListOutput = z.infer<typeof ebookListOutputSchema>;\n\nexport const ebookGetInputSchema = z\n .object({\n id: z.uuid(),\n })\n .strict();\nexport type EbookGetInput = z.infer<typeof ebookGetInputSchema>;\n\nexport const ebookGetOutputSchema = z\n .object({\n ebook: ebookDetailSchema,\n })\n .strict();\nexport type EbookGetOutput = z.infer<typeof ebookGetOutputSchema>;\n\nexport const ebookRequestUploadInputSchema = z\n .object({\n title: z.string().min(1).max(500),\n author: z.string().max(500).optional(),\n language: z.string().max(35).optional(),\n coverContentType: ebookCoverContentTypeSchema.optional(),\n })\n .strict();\nexport type EbookRequestUploadInput = z.infer<typeof ebookRequestUploadInputSchema>;\n\n/**\n * S3 POST form policy. `fields` must be appended to the form in iteration order\n * with the file last; S3 ignores anything sent after the `file` part.\n */\nexport const ebookPresignedPostSchema = z\n .object({\n url: z.url(),\n fields: z.record(z.string(), z.string()),\n })\n .strict();\nexport type EbookPresignedPost = z.infer<typeof ebookPresignedPostSchema>;\n\nexport const ebookRequestUploadOutputSchema = z\n .object({\n ebookId: z.uuid(),\n upload: ebookPresignedPostSchema,\n coverUpload: ebookPresignedPostSchema.nullable(),\n expiresAt: z.coerce.date(),\n })\n .strict();\nexport type EbookRequestUploadOutput = z.infer<typeof ebookRequestUploadOutputSchema>;\n\nexport const ebookFinalizeUploadInputSchema = z\n .object({\n ebookId: z.uuid(),\n })\n .strict();\nexport type EbookFinalizeUploadInput = z.infer<typeof ebookFinalizeUploadInputSchema>;\n\nexport const ebookFinalizeUploadOutputSchema = z\n .object({\n ebook: ebookListItemSchema,\n })\n .strict();\nexport type EbookFinalizeUploadOutput = z.infer<typeof ebookFinalizeUploadOutputSchema>;\n\nexport const ebookGetDownloadUrlInputSchema = z\n .object({\n id: z.uuid(),\n })\n .strict();\nexport type EbookGetDownloadUrlInput = z.infer<typeof ebookGetDownloadUrlInputSchema>;\n\nexport const ebookGetDownloadUrlOutputSchema = z\n .object({\n url: z.url(),\n expiresAt: z.coerce.date(),\n })\n .strict();\nexport type EbookGetDownloadUrlOutput = z.infer<typeof ebookGetDownloadUrlOutputSchema>;\n\nexport const ebookUpdateProgressDataSchema = z\n .object({\n cfi: z.string().max(2000),\n fraction: z.number().min(0).max(1),\n })\n .strict();\nexport type EbookUpdateProgressData = z.infer<typeof ebookUpdateProgressDataSchema>;\n\nexport const ebookUpdateProgressInputSchema = ebookUpdateProgressDataSchema.extend({\n id: z.uuid(),\n});\nexport type EbookUpdateProgressInput = z.infer<typeof ebookUpdateProgressInputSchema>;\n\nexport const ebookUpdateProgressOutputSchema = z\n .object({\n lastReadAt: z.coerce.date(),\n })\n .strict();\nexport type EbookUpdateProgressOutput = z.infer<typeof ebookUpdateProgressOutputSchema>;\n\nexport const ebookRenameDataSchema = z\n .object({\n title: z.string().min(1).max(500),\n author: z.string().max(500).nullable().optional(),\n })\n .strict();\nexport type EbookRenameData = z.infer<typeof ebookRenameDataSchema>;\n\nexport const ebookRenameInputSchema = ebookRenameDataSchema.extend({\n id: z.uuid(),\n});\nexport type EbookRenameInput = z.infer<typeof ebookRenameInputSchema>;\n\nexport const ebookRenameOutputSchema = z\n .object({\n ebook: ebookListItemSchema,\n })\n .strict();\nexport type EbookRenameOutput = z.infer<typeof ebookRenameOutputSchema>;\n\nexport const ebookDeleteInputSchema = z\n .object({\n id: z.uuid(),\n })\n .strict();\nexport type EbookDeleteInput = z.infer<typeof ebookDeleteInputSchema>;\n\nexport const ebookDeleteOutputSchema = z\n .object({\n id: z.uuid(),\n })\n .strict();\nexport type EbookDeleteOutput = z.infer<typeof ebookDeleteOutputSchema>;\n","import { oc } from \"@orpc/contract\";\nimport { pickPublicErrorMap } from \"#/public-errors\";\nimport {\n ebookDeleteInputSchema,\n ebookDeleteOutputSchema,\n ebookFinalizeUploadInputSchema,\n ebookFinalizeUploadOutputSchema,\n ebookGetDownloadUrlInputSchema,\n ebookGetDownloadUrlOutputSchema,\n ebookGetInputSchema,\n ebookGetOutputSchema,\n ebookListInputSchema,\n ebookListOutputSchema,\n ebookRenameInputSchema,\n ebookRenameOutputSchema,\n ebookRequestUploadInputSchema,\n ebookRequestUploadOutputSchema,\n ebookUpdateProgressInputSchema,\n ebookUpdateProgressOutputSchema,\n} from \"#/schemas/ebook\";\n\nconst ebookProcedure = oc;\n\nexport const ebookContract = {\n list: ebookProcedure\n .errors(pickPublicErrorMap(\"EBOOK_BETA_RESTRICTED\"))\n .route({\n method: \"GET\",\n path: \"/ebooks\",\n summary: \"List ebooks with quota\",\n tags: [\"Ebooks\"],\n })\n .input(ebookListInputSchema)\n .output(ebookListOutputSchema),\n\n get: ebookProcedure\n .errors(pickPublicErrorMap(\"EBOOK_BETA_RESTRICTED\", \"EBOOK_NOT_FOUND\"))\n .route({\n method: \"GET\",\n path: \"/ebooks/{id}\",\n summary: \"Get an ebook with reading progress\",\n tags: [\"Ebooks\"],\n })\n .input(ebookGetInputSchema)\n .output(ebookGetOutputSchema),\n\n requestUpload: ebookProcedure\n .errors(pickPublicErrorMap(\"EBOOK_BETA_RESTRICTED\", \"EBOOK_LIMIT_EXCEEDED\"))\n .route({\n method: \"POST\",\n path: \"/ebooks/uploads\",\n summary: \"Request presigned upload URLs for a new ebook\",\n tags: [\"Ebooks\"],\n })\n .input(ebookRequestUploadInputSchema)\n .output(ebookRequestUploadOutputSchema),\n\n finalizeUpload: ebookProcedure\n .errors(\n pickPublicErrorMap(\n \"EBOOK_BETA_RESTRICTED\",\n \"EBOOK_NOT_FOUND\",\n \"EBOOK_UPLOAD_NOT_COMPLETED\",\n \"EBOOK_FILE_TOO_LARGE\",\n ),\n )\n .route({\n method: \"POST\",\n path: \"/ebooks/{ebookId}/finalize\",\n summary: \"Finalize an ebook upload\",\n tags: [\"Ebooks\"],\n })\n .input(ebookFinalizeUploadInputSchema)\n .output(ebookFinalizeUploadOutputSchema),\n\n getDownloadUrl: ebookProcedure\n .errors(pickPublicErrorMap(\"EBOOK_BETA_RESTRICTED\", \"EBOOK_NOT_FOUND\"))\n .route({\n method: \"GET\",\n path: \"/ebooks/{id}/download-url\",\n summary: \"Get a presigned download URL for an ebook\",\n tags: [\"Ebooks\"],\n })\n .input(ebookGetDownloadUrlInputSchema)\n .output(ebookGetDownloadUrlOutputSchema),\n\n updateProgress: ebookProcedure\n .errors(pickPublicErrorMap(\"EBOOK_BETA_RESTRICTED\", \"EBOOK_NOT_FOUND\"))\n .route({\n method: \"PATCH\",\n path: \"/ebooks/{id}/progress\",\n summary: \"Update ebook reading progress\",\n tags: [\"Ebooks\"],\n })\n .input(ebookUpdateProgressInputSchema)\n .output(ebookUpdateProgressOutputSchema),\n\n rename: ebookProcedure\n .errors(pickPublicErrorMap(\"EBOOK_BETA_RESTRICTED\", \"EBOOK_NOT_FOUND\"))\n .route({\n method: \"PATCH\",\n path: \"/ebooks/{id}\",\n summary: \"Rename an ebook\",\n tags: [\"Ebooks\"],\n })\n .input(ebookRenameInputSchema)\n .output(ebookRenameOutputSchema),\n\n delete: ebookProcedure\n .errors(pickPublicErrorMap(\"EBOOK_BETA_RESTRICTED\", \"EBOOK_NOT_FOUND\"))\n .route({\n method: \"DELETE\",\n path: \"/ebooks/{id}\",\n summary: \"Delete an ebook\",\n tags: [\"Ebooks\"],\n })\n .input(ebookDeleteInputSchema)\n .output(ebookDeleteOutputSchema),\n};\n","import { eventIterator, oc } from \"@orpc/contract\";\nimport { pickPublicErrorMap } from \"#/public-errors\";\nimport {\n HostedAiNoteSuggestionStreamInputSchema,\n HostedAiStatusInputSchema,\n HostedAiStatusOutputSchema,\n HostedAiStreamPartSchema,\n HostedAiStreamStructuredObjectInputSchema,\n HostedAiStreamTextInputSchema,\n} from \"#/schemas/hosted-ai\";\n\nconst hostedAiStreamErrors = pickPublicErrorMap(\n \"HOSTED_AI_TIER_RESTRICTED\",\n \"HOSTED_AI_QUOTA_EXHAUSTED\",\n);\n\nexport const hostedAiContract = {\n status: oc\n .route({\n method: \"GET\",\n path: \"/hosted-ai/status\",\n summary: \"Get Built-in AI availability and quota status\",\n tags: [\"Hosted AI\"],\n })\n .input(HostedAiStatusInputSchema)\n .output(HostedAiStatusOutputSchema),\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 .errors(hostedAiStreamErrors),\n },\n selectionTranslation: {\n streamText: oc\n .route({\n method: \"POST\",\n path: \"/hosted-ai/selection-translation/stream-text\",\n summary: \"Stream hosted selection translation text output\",\n tags: [\"Hosted AI\"],\n })\n .input(HostedAiStreamTextInputSchema)\n .output(eventIterator(HostedAiStreamPartSchema))\n .errors(hostedAiStreamErrors),\n },\n videoSubtitles: {\n // Subtitle lines and the video summary share this route: both are short\n // text and both bill against `videoSubtitles`.\n streamText: oc\n .route({\n method: \"POST\",\n path: \"/hosted-ai/video-subtitles/stream-text\",\n summary: \"Stream hosted subtitle translation or video summary text output\",\n tags: [\"Hosted AI\"],\n })\n .input(HostedAiStreamTextInputSchema)\n .output(eventIterator(HostedAiStreamPartSchema))\n .errors(hostedAiStreamErrors),\n /**\n * Segmentation shares the `videoSubtitles` feature but not its route,\n * because `endpointMaxOutputTokens` sizes the credit reservation: emitting\n * a WebVTT block needs several times a subtitle line's budget, and folding\n * both into one route would make every line reserve — and, near the end of\n * a credit window, fail to afford — what only segmentation needs.\n */\n streamSegmentation: oc\n .route({\n method: \"POST\",\n path: \"/hosted-ai/video-subtitles/stream-segmentation\",\n summary: \"Stream hosted subtitle segmentation output\",\n tags: [\"Hosted AI\"],\n })\n .input(HostedAiStreamTextInputSchema)\n .output(eventIterator(HostedAiStreamPartSchema))\n .errors(hostedAiStreamErrors),\n },\n inputTranslation: {\n streamText: oc\n .route({\n method: \"POST\",\n path: \"/hosted-ai/input-translation/stream-text\",\n summary: \"Stream hosted input box translation text output\",\n tags: [\"Hosted AI\"],\n })\n .input(HostedAiStreamTextInputSchema)\n .output(eventIterator(HostedAiStreamPartSchema))\n .errors(hostedAiStreamErrors),\n },\n languageDetection: {\n // Detection wants one short string back, not a stream, but the quota\n // reserve/settle path is stream-shaped end to end. Reusing it keeps one\n // metering implementation; the client collects the deltas.\n streamText: oc\n .route({\n method: \"POST\",\n path: \"/hosted-ai/language-detection/stream-text\",\n summary: \"Stream hosted language detection output\",\n tags: [\"Hosted AI\"],\n })\n .input(HostedAiStreamTextInputSchema)\n .output(eventIterator(HostedAiStreamPartSchema))\n .errors(hostedAiStreamErrors),\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 .errors(hostedAiStreamErrors),\n },\n noteSuggestion: {\n streamStructuredObject: oc\n .route({\n method: \"POST\",\n path: \"/hosted-ai/note-suggestions/stream-structured-object\",\n summary: \"Stream hosted note suggestion structured output\",\n tags: [\"Hosted AI\"],\n })\n .input(HostedAiNoteSuggestionStreamInputSchema)\n .output(eventIterator(HostedAiStreamPartSchema))\n .errors(hostedAiStreamErrors),\n },\n};\n","import { deletionResultSchema, expectedUpdatedAtSchema } from \"./resource-mutation\";\nimport {\n NOTEBASE_COLUMN_MAX_WIDTH,\n NOTEBASE_COLUMN_MIN_WIDTH,\n notebaseColumnConfigSchema,\n} from \"@read-frog/definitions\";\nimport { z } from \"zod\";\n\nexport const notebaseColumnWidthSchema = z\n .number()\n .int()\n .min(NOTEBASE_COLUMN_MIN_WIDTH)\n .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 wrap: z.boolean(),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n});\nexport type NotebaseColumn = z.infer<typeof notebaseColumnSchema>;\n\nexport const notebaseColumnCreateDataSchema = z\n .object({\n id: z.uuid().optional(),\n name: z.string().min(1),\n config: notebaseColumnConfigSchema,\n })\n .strict();\nexport type NotebaseColumnCreateData = z.infer<typeof notebaseColumnCreateDataSchema>;\n\nexport const notebaseColumnUpdateDataSchema = z\n .object({\n expectedUpdatedAt: expectedUpdatedAtSchema.optional(),\n name: z.string().min(1).optional(),\n config: notebaseColumnConfigSchema.optional(),\n width: notebaseColumnWidthSchema.nullable().optional(),\n wrap: z.boolean().optional(),\n })\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 field: notebaseColumnSchema,\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 field: notebaseColumnSchema,\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 = deletionResultSchema;\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 { paginationShape, pageSchema } from \"./pagination\";\nimport { deletionResultSchema, expectedUpdatedAtSchema } from \"./resource-mutation\";\nimport { 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\n .object({\n id: z.uuid().optional(),\n cells: notebaseRowCellsSchema.optional(),\n })\n .strict();\nexport type NotebaseRowCreateData = z.infer<typeof notebaseRowCreateDataSchema>;\n\nexport const notebaseRowUpdateDataSchema = z\n .object({\n cells: notebaseRowCellsSchema.optional(),\n expectedUpdatedAt: expectedUpdatedAtSchema.optional(),\n })\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 note: notebaseRowSchema,\n txid: z.number(),\n});\nexport type NotebaseRowCreateOutput = z.infer<typeof NotebaseRowCreateOutputSchema>;\n\nexport const NOTEBASE_ROW_CREATE_MANY_MAX_ROWS = 50;\n\nexport const NotebaseRowCreateManyInputSchema = z\n .object({\n notebaseId: z.uuid(),\n rows: z.array(notebaseRowCreateDataSchema).min(1).max(NOTEBASE_ROW_CREATE_MANY_MAX_ROWS),\n })\n .superRefine((input, ctx) => {\n const seenIds = new Set<string>();\n\n input.rows.forEach((row, index) => {\n if (row.id === undefined) {\n return;\n }\n\n if (seenIds.has(row.id)) {\n ctx.addIssue({\n code: \"custom\",\n message: `Duplicate row id \"${row.id}\".`,\n path: [\"rows\", index, \"id\"],\n });\n return;\n }\n\n seenIds.add(row.id);\n });\n });\nexport type NotebaseRowCreateManyInput = z.infer<typeof NotebaseRowCreateManyInputSchema>;\n\nexport const NotebaseRowCreateManyOutputSchema = z.object({\n items: z.array(notebaseRowSchema),\n txid: z.number(),\n});\nexport type NotebaseRowCreateManyOutput = z.infer<typeof NotebaseRowCreateManyOutputSchema>;\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 = deletionResultSchema;\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\nexport const NotebaseRowListInputSchema = z\n .object({\n notebaseId: z.uuid().optional(),\n // Two characters is already a meaningful CJK query; one matches nearly\n // every note while costing the same full scan, so the floor is a cost\n // control rather than an ergonomic preference.\n query: z.string().trim().min(2).max(200).optional(),\n ...paginationShape,\n })\n // Listing without a notebase is a plain indexed read. Searching is not: it\n // expands every candidate row's cells and cannot use an index, so it stays\n // scoped to one notebase, where `notebase_rows_notebase_id_idx` bounds the\n // candidate set. Searching everything means iterating over notebases.\n .refine((input) => input.query === undefined || input.notebaseId !== undefined, {\n error: \"notebaseId is required when query is set\",\n path: [\"notebaseId\"],\n });\nexport type NotebaseRowListInput = z.infer<typeof NotebaseRowListInputSchema>;\nexport const NotebaseRowListOutputSchema = pageSchema(notebaseRowSchema);\nexport const NotebaseRowGetInputSchema = z.object({ id: z.uuid() });\nexport const NotebaseRowGetOutputSchema = notebaseRowSchema;\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\n .object({\n notebaseColumnWidths: z.record(z.string(), z.number()).optional(),\n hiddenNotebaseColumns: z.array(z.string()).optional(),\n groupByNotebaseColumnId: z.string().optional(),\n })\n .catchall(z.unknown());\nexport type NotebaseViewConfig = z.infer<typeof notebaseViewConfigSchema>;\n\nexport const notebaseViewFilterSchema = z\n .object({\n notebaseColumnId: z.string(),\n operator: z.string(),\n value: z.unknown(),\n })\n .strict();\nexport type NotebaseViewFilter = z.infer<typeof notebaseViewFilterSchema>;\n\nexport const notebaseViewFiltersSchema = z.array(notebaseViewFilterSchema);\n\nexport const notebaseViewSortSchema = z\n .object({\n notebaseColumnId: z.string(),\n direction: z.enum([\"asc\", \"desc\"]),\n })\n .strict();\nexport type NotebaseViewSort = z.infer<typeof notebaseViewSortSchema>;\n\nexport const notebaseViewSortsSchema = z.array(notebaseViewSortSchema);\n\nexport const notebaseViewCreateDataSchema = z\n .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 })\n .strict();\nexport type NotebaseViewCreateData = z.infer<typeof notebaseViewCreateDataSchema>;\n\nexport const notebaseViewUpdateDataSchema = z\n .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 })\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 { deletionResultSchema } from \"./resource-mutation\";\nimport {\n notebaseColumnConfigSchema,\n schedulingParamsShape,\n srsWeightsSchema,\n} from \"@read-frog/definitions\";\nimport { z } from \"zod\";\nimport { notebaseColumnSchema } from \"./notebase-column\";\nimport { NOTEBASE_ROW_CREATE_MANY_MAX_ROWS, 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 notebaseSummarySchema = z.object({\n id: z.string(),\n name: z.string(),\n});\nexport type NotebaseSummary = z.infer<typeof notebaseSummarySchema>;\n\nexport const NotebaseListItemSchema = notebaseSummarySchema;\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\nconst notebaseInitialRowSchema = z\n .object({\n id: z.uuid().optional(),\n cells: z.record(z.string(), z.unknown()),\n })\n .strict();\n\nexport const notebaseCreateDataSchema = z\n .object({\n id: z.uuid().optional(),\n name: z.string().min(1),\n options: z\n .object({\n initialColumns: z\n .array(\n z\n .object({\n id: z.uuid(),\n name: z.string().min(1),\n config: notebaseColumnConfigSchema,\n })\n .strict(),\n )\n .min(1),\n initialRow: notebaseInitialRowSchema.optional(),\n initialRows: z\n .array(notebaseInitialRowSchema)\n .min(1)\n .max(NOTEBASE_ROW_CREATE_MANY_MAX_ROWS)\n .optional(),\n })\n .strict()\n .superRefine((options, ctx) => {\n if (options.initialRow && options.initialRows) {\n ctx.addIssue({\n code: \"custom\",\n message: \"Provide either initialRow or initialRows, not both.\",\n path: [\"initialRows\"],\n });\n }\n\n if (!options.initialRows) {\n return;\n }\n\n const seenIds = new Set<string>();\n options.initialRows.forEach((row, index) => {\n if (row.id === undefined) {\n return;\n }\n\n if (seenIds.has(row.id)) {\n ctx.addIssue({\n code: \"custom\",\n message: `Duplicate row id \"${row.id}\".`,\n path: [\"initialRows\", index, \"id\"],\n });\n return;\n }\n\n seenIds.add(row.id);\n });\n })\n .optional(),\n })\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 notebase: notebaseSchema,\n txid: z.number(),\n});\nexport type NotebaseCreateOutput = z.infer<typeof NotebaseCreateOutputSchema>;\n\nexport const notebaseUpdateDataSchema = z\n .object({\n name: z.string().min(1).optional(),\n srsNewPerDay: schedulingParamsShape.newPerDay.optional(),\n srsReviewsPerDay: schedulingParamsShape.reviewsPerDay.optional(),\n srsDesiredRetention: schedulingParamsShape.desiredRetention.optional(),\n })\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 notebase: notebaseSchema,\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 = deletionResultSchema;\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 NotebaseGetSummaryInputSchema = z.object({\n id: z.uuid(),\n});\nexport type NotebaseGetSummaryInput = z.infer<typeof NotebaseGetSummaryInputSchema>;\n\nexport const NotebaseGetSummaryOutputSchema = notebaseSummarySchema.extend({\n srsNewPerDay: schedulingParamsShape.newPerDay,\n srsReviewsPerDay: schedulingParamsShape.reviewsPerDay,\n srsDesiredRetention: schedulingParamsShape.desiredRetention,\n});\nexport type NotebaseGetSummaryOutput = z.infer<typeof NotebaseGetSummaryOutputSchema>;\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 { oc } from \"@orpc/contract\";\nimport { pickPublicErrorMap } from \"#/public-errors\";\nimport {\n NotebaseCreateInputSchema,\n NotebaseCreateOutputSchema,\n NotebaseDeleteInputSchema,\n NotebaseDeleteOutputSchema,\n NotebaseGetInputSchema,\n NotebaseGetOutputSchema,\n NotebaseGetSchemaInputSchema,\n NotebaseGetSchemaOutputSchema,\n NotebaseGetSummaryInputSchema,\n NotebaseGetSummaryOutputSchema,\n NotebaseListInputSchema,\n NotebaseListOutputSchema,\n NotebaseUpdateInputSchema,\n NotebaseUpdateOutputSchema,\n} from \"#/schemas/notebase\";\nimport { defineAgentProcedure } from \"./shared\";\n\nexport const notebaseContract = {\n list: defineAgentProcedure({\n method: \"GET\",\n path: \"/notebases\",\n summary: \"List notebases\",\n description: \"List the notebases (word books) owned by the current user.\",\n tags: [\"Notebases\"],\n })\n .input(NotebaseListInputSchema)\n .output(NotebaseListOutputSchema),\n\n getSummary: defineAgentProcedure({\n method: \"GET\",\n path: \"/notebases/{id}/summary\",\n summary: \"Get notebase summary\",\n description:\n \"Read the name and public study settings of an owned notebase without loading note content.\",\n tags: [\"Notebases\"],\n })\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\"))\n .input(NotebaseGetSummaryInputSchema)\n .output(NotebaseGetSummaryOutputSchema),\n\n get: oc\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: defineAgentProcedure({\n method: \"GET\",\n path: \"/notebases/{id}/schema\",\n summary: \"Get notebase schema\",\n description:\n \"Read an owned notebase name and field definitions, including field IDs, types and updatedAt timestamps. Does not return note content.\",\n tags: [\"Notebases\"],\n })\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\"))\n .input(NotebaseGetSchemaInputSchema)\n .output(NotebaseGetSchemaOutputSchema),\n\n create: defineAgentProcedure({\n method: \"POST\",\n path: \"/notebases\",\n summary: \"Create notebase\",\n description:\n \"Create an owned notebase with optional initial fields and notes. Client-provided entity IDs are supported; duplicate IDs produce a conflict.\",\n tags: [\"Notebases\"],\n })\n .errors(pickPublicErrorMap(\"NOTE_LIMIT_EXCEEDED\", \"CELL_VALIDATION_FAILED\"))\n .errors(pickPublicErrorMap(\"RESOURCE_ALREADY_EXISTS\"))\n .input(NotebaseCreateInputSchema)\n .output(NotebaseCreateOutputSchema),\n\n update: defineAgentProcedure({\n method: \"PUT\",\n path: \"/notebases/{id}\",\n summary: \"Update notebase\",\n description:\n \"Update the supplied name or public study settings of an owned notebase, preserving omitted properties.\",\n tags: [\"Notebases\"],\n })\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\"))\n .input(NotebaseUpdateInputSchema)\n .output(NotebaseUpdateOutputSchema),\n\n delete: defineAgentProcedure({\n method: \"DELETE\",\n path: \"/notebases/{id}\",\n summary: \"Delete notebase\",\n description:\n \"Permanently delete an owned notebase and its fields, notes, templates, cards and review records. Return the deleted notebase ID.\",\n tags: [\"Notebases\"],\n })\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\"))\n .input(NotebaseDeleteInputSchema)\n .output(NotebaseDeleteOutputSchema),\n};\n","import { defineAgentProcedure } from \"./shared\";\nimport { oc } from \"@orpc/contract\";\nimport { 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\";\n\nexport const notebaseColumnContract = {\n create: defineAgentProcedure({\n method: \"POST\",\n path: \"/notebase-columns\",\n summary: \"Create notebase field\",\n description:\n \"Create a field in an owned notebase. The returned field ID is used as a key in note cells.\",\n tags: [\"Notebase Columns\"],\n })\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\", \"CONCURRENT_POSITION_CONFLICT\"))\n .errors(pickPublicErrorMap(\"RESOURCE_ALREADY_EXISTS\"))\n .input(NotebaseColumnCreateInputSchema)\n .output(NotebaseColumnCreateOutputSchema),\n\n update: defineAgentProcedure({\n method: \"PATCH\",\n path: \"/notebase-columns/{notebaseColumnId}\",\n summary: \"Update notebase field\",\n description:\n \"Update an owned field without changing its type. Removing select options clears affected note values. expectedUpdatedAt guards against editing stale data.\",\n tags: [\"Notebase Columns\"],\n })\n .errors(pickPublicErrorMap(\"NOTEBASE_COLUMN_NOT_FOUND\"))\n .errors(pickPublicErrorMap(\"RESOURCE_UPDATE_CONFLICT\", \"FIELD_TYPE_CHANGE_UNSUPPORTED\"))\n .input(NotebaseColumnUpdateInputSchema)\n .output(NotebaseColumnUpdateOutputSchema),\n\n delete: defineAgentProcedure({\n method: \"DELETE\",\n path: \"/notebase-columns/{notebaseColumnId}\",\n summary: \"Delete notebase field\",\n description:\n \"Delete an owned field and remove its values from notes. Primary fields and fields referenced by templates cannot be deleted.\",\n tags: [\"Notebase Columns\"],\n })\n .errors(\n 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 )\n .input(NotebaseColumnDeleteInputSchema)\n .output(NotebaseColumnDeleteOutputSchema),\n\n reorder: oc\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 { defineAgentProcedure } from \"./shared\";\nimport {\n NotebaseRowListInputSchema,\n NotebaseRowListOutputSchema,\n NotebaseRowGetInputSchema,\n NotebaseRowGetOutputSchema,\n} from \"#/schemas/notebase-row\";\nimport { oc } from \"@orpc/contract\";\nimport { pickPublicErrorMap } from \"#/public-errors\";\nimport {\n NotebaseRowCreateInputSchema,\n NotebaseRowCreateManyInputSchema,\n NotebaseRowCreateManyOutputSchema,\n NotebaseRowCreateOutputSchema,\n NotebaseRowDeleteInputSchema,\n NotebaseRowDeleteOutputSchema,\n NotebaseRowReorderInputSchema,\n NotebaseRowReorderOutputSchema,\n NotebaseRowUpdateInputSchema,\n NotebaseRowUpdateOutputSchema,\n} from \"#/schemas/notebase-row\";\n\nexport const notebaseRowContract = {\n list: defineAgentProcedure({\n method: \"GET\",\n path: \"/notebase-rows\",\n summary: \"List or search notes\",\n description:\n \"List or search owned notes, optionally within one notebase. Supply query to search; omit it to browse, which returns every note in scope rather than a filtered set. Searching requires notebaseId and covers that one notebase, so cover several by listing them first and calling this once per notebase. The query filter is at least two characters, matches a literal case-insensitive substring, and only searches fields of type string, so values in number, boolean, date and select fields are never matched. Supports limit and offset pagination.\",\n tags: [\"Notebase Rows\"],\n })\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\"))\n .input(NotebaseRowListInputSchema)\n .output(NotebaseRowListOutputSchema),\n get: defineAgentProcedure({\n method: \"GET\",\n path: \"/notebase-rows/{id}\",\n summary: \"Get note\",\n description:\n \"Read one owned note with field-ID values and the updatedAt timestamp used for modification checks.\",\n tags: [\"Notebase Rows\"],\n })\n .errors(pickPublicErrorMap(\"NOTEBASE_ROW_NOT_FOUND\"))\n .input(NotebaseRowGetInputSchema)\n .output(NotebaseRowGetOutputSchema),\n create: defineAgentProcedure({\n method: \"POST\",\n path: \"/notebase-rows\",\n summary: \"Create note\",\n description:\n \"Create a note in an owned notebase using field IDs and their declared value types. Existing templates generate cards. A duplicate entity ID produces a conflict.\",\n tags: [\"Notebase Rows\"],\n })\n .errors(\n pickPublicErrorMap(\n \"NOTEBASE_NOT_FOUND\",\n \"CELL_VALIDATION_FAILED\",\n \"CONCURRENT_POSITION_CONFLICT\",\n \"NOTE_LIMIT_EXCEEDED\",\n ),\n )\n .errors(pickPublicErrorMap(\"RESOURCE_ALREADY_EXISTS\"))\n .input(NotebaseRowCreateInputSchema)\n .output(NotebaseRowCreateOutputSchema),\n\n createMany: defineAgentProcedure({\n method: \"POST\",\n path: \"/notebase-rows/batch\",\n summary: \"Create notes\",\n description:\n \"Create 1–50 notes atomically in one owned notebase. Cells use field IDs and declared value types. Existing templates generate cards. Duplicate entity IDs roll back the whole batch.\",\n tags: [\"Notebase Rows\"],\n })\n .errors(\n pickPublicErrorMap(\n \"NOTEBASE_NOT_FOUND\",\n \"CELL_VALIDATION_FAILED\",\n \"CONCURRENT_POSITION_CONFLICT\",\n \"NOTE_LIMIT_EXCEEDED\",\n ),\n )\n .errors(pickPublicErrorMap(\"RESOURCE_ALREADY_EXISTS\"))\n .input(NotebaseRowCreateManyInputSchema)\n .output(NotebaseRowCreateManyOutputSchema),\n\n update: defineAgentProcedure({\n method: \"PATCH\",\n path: \"/notebase-rows/{notebaseRowId}\",\n summary: \"Update note\",\n description:\n \"Merge supplied fields into an owned note, preserving omitted fields. Use null to clear a field. expectedUpdatedAt guards against editing stale data; reread on a modification conflict.\",\n tags: [\"Notebase Rows\"],\n })\n .errors(pickPublicErrorMap(\"NOTEBASE_ROW_NOT_FOUND\", \"CELL_VALIDATION_FAILED\"))\n .errors(pickPublicErrorMap(\"RESOURCE_UPDATE_CONFLICT\"))\n .input(NotebaseRowUpdateInputSchema)\n .output(NotebaseRowUpdateOutputSchema),\n\n delete: defineAgentProcedure({\n method: \"DELETE\",\n path: \"/notebase-rows/{notebaseRowId}\",\n summary: \"Delete note\",\n description:\n \"Permanently delete an owned note and its derived cards and review records. Return the deleted note ID.\",\n tags: [\"Notebase Rows\"],\n })\n .errors(pickPublicErrorMap(\"NOTEBASE_ROW_NOT_FOUND\", \"CONCURRENT_POSITION_CONFLICT\"))\n .input(NotebaseRowDeleteInputSchema)\n .output(NotebaseRowDeleteOutputSchema),\n\n reorder: oc\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\n .string()\n .trim()\n .min(1)\n .refine((timezone) => {\n try {\n createTimezoneFormatter(timezone).format(new Date());\n return true;\n } catch {\n return false;\n }\n }, \"Invalid timezone\");\nexport type Timezone = z.infer<typeof timezoneSchema>;\n","import { paginationShape } from \"./pagination\";\nimport {\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 { reviewRatingSchema, schedulingParamsSchema, SRS_REVIEW_DURATION_MS_MAX };\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\n .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 })\n .strict();\nexport type SrsReviewInput = z.infer<typeof srsReviewInputSchema>;\n\nexport const srsRollbackReviewInputSchema = z\n .object({\n expectedReviewId: z.uuid().optional(),\n cardId: z.uuid(),\n })\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\n .object({\n notebaseIds: z.array(z.uuid()).optional(),\n timezone: timezoneSchema,\n })\n .strict();\nexport type SrsScheduleStatusStatsInput = z.infer<typeof srsScheduleStatusStatsInputSchema>;\n\nexport const srsScheduleStatusStatsOutputSchema = z.record(z.uuid(), srsScheduleStatusStatsSchema);\nexport type SrsScheduleStatusStatsOutput = z.infer<typeof srsScheduleStatusStatsOutputSchema>;\n\nexport const srsManualCardStatusInputSchema = z\n .object({\n cardId: z.uuid(),\n enabled: z.boolean(),\n })\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 stability: z.number(),\n afterScheduleStatus: scheduleStatusSchema,\n afterStability: z.number(),\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 srsListCardRevlogsInputSchema = z\n .object({\n ...paginationShape,\n notebaseId: z.uuid().optional(),\n cardId: z.uuid().optional(),\n })\n .strict();\nexport type SrsListCardRevlogsInput = z.infer<typeof srsListCardRevlogsInputSchema>;\n\nexport const srsListCardRevlogsOutputSchema = z\n .object({\n items: z.array(srsRevlogWithoutSnapshotSchema),\n hasMore: z.boolean(),\n })\n .strict();\nexport type SrsListCardRevlogsOutput = z.infer<typeof srsListCardRevlogsOutputSchema>;\n\nexport const srsReviewOutputSchema = z.object({\n card: cardSchema,\n revlog: srsRevlogSchema,\n txid: z.number(),\n // False when an idempotent replay returned an existing revlog instead of creating one.\n created: z.boolean(),\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\nexport const srsListUnreadOptimizerResultsInputSchema = z.object({}).strict();\n\nexport const srsOptimizerUnreadResultSchema = z\n .object({\n runId: z.uuid(),\n notebaseName: z.string().min(1),\n revlogCount: z.number().int().positive(),\n improvement: z.number().nonnegative().nullable(),\n })\n .strict();\nexport type SrsOptimizerUnreadResult = z.infer<typeof srsOptimizerUnreadResultSchema>;\n\nexport const srsListUnreadOptimizerResultsOutputSchema = z.array(srsOptimizerUnreadResultSchema);\nexport type SrsListUnreadOptimizerResultsOutput = z.infer<\n typeof srsListUnreadOptimizerResultsOutputSchema\n>;\n\nexport const srsAcknowledgeOptimizerResultsInputSchema = z\n .object({\n runIds: z.array(z.uuid()).min(1),\n })\n .strict();\nexport type SrsAcknowledgeOptimizerResultsInput = z.infer<\n typeof srsAcknowledgeOptimizerResultsInputSchema\n>;\n\nexport const srsAcknowledgeOptimizerResultsOutputSchema = z\n .object({\n acknowledgedCount: z.number().int().nonnegative(),\n })\n .strict();\nexport type SrsAcknowledgeOptimizerResultsOutput = z.infer<\n typeof srsAcknowledgeOptimizerResultsOutputSchema\n>;\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}\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 { defineAgentProcedure } from \"./shared\";\nimport { oc } from \"@orpc/contract\";\nimport { pickPublicErrorMap } from \"#/public-errors\";\nimport {\n srsAcknowledgeOptimizerResultsInputSchema,\n srsAcknowledgeOptimizerResultsOutputSchema,\n srsListCardRevlogsInputSchema,\n srsListCardRevlogsOutputSchema,\n srsListUnreadOptimizerResultsInputSchema,\n srsListUnreadOptimizerResultsOutputSchema,\n srsReviewInputSchema,\n srsReviewOutputSchema,\n srsRollbackReviewInputSchema,\n srsRollbackReviewOutputSchema,\n srsScheduleStatusStatsInputSchema,\n srsScheduleStatusStatsOutputSchema,\n srsSetCardBuriedInputSchema,\n srsSetCardBuriedOutputSchema,\n srsSetCardSuspendedInputSchema,\n srsSetCardSuspendedOutputSchema,\n} from \"#/schemas/srs\";\n\nexport const srsContract = {\n scheduleStatusStats: defineAgentProcedure({\n method: \"GET\",\n path: \"/srs/schedule-status-stats\",\n summary: \"Get study statistics\",\n description:\n \"Read existing study queue counts for owned notebases in the supplied timezone. Does not return note content or card faces.\",\n tags: [\"SRS\"],\n })\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\"))\n .input(srsScheduleStatusStatsInputSchema)\n .output(srsScheduleStatusStatsOutputSchema),\n listUnreadOptimizerResults: oc\n .route({\n method: \"GET\",\n path: \"/srs/optimizer-results/unread\",\n summary: \"List unread applied SRS optimizer results\",\n tags: [\"SRS\"],\n })\n .input(srsListUnreadOptimizerResultsInputSchema)\n .output(srsListUnreadOptimizerResultsOutputSchema),\n\n acknowledgeOptimizerResults: oc\n .route({\n method: \"POST\",\n path: \"/srs/optimizer-results/acknowledge\",\n summary: \"Acknowledge current SRS optimizer results\",\n tags: [\"SRS\"],\n })\n .input(srsAcknowledgeOptimizerResultsInputSchema)\n .output(srsAcknowledgeOptimizerResultsOutputSchema),\n\n listCardRevlogs: defineAgentProcedure({\n method: \"GET\",\n path: \"/srs/revlogs\",\n summary: \"List review history\",\n description:\n \"Read owned review records, optionally filtered by notebase or card. Supports limit and offset pagination. Note content, card faces and rollback snapshots are excluded.\",\n tags: [\"SRS\"],\n })\n .errors(pickPublicErrorMap(\"CARD_NOT_FOUND\", \"NOTEBASE_NOT_FOUND\"))\n .input(srsListCardRevlogsInputSchema)\n .output(srsListCardRevlogsOutputSchema),\n\n review: defineAgentProcedure({\n method: \"POST\",\n path: \"/srs/review\",\n summary: \"Record review\",\n description:\n \"Submit one rating for a known owned card without a queue, session or prerequisite read. Existing SRS eligibility, scheduling and sibling rules apply. The optional id is the existing state-derived review ID, not an arbitrary UUID; calls without a stable id are not guaranteed to deduplicate.\",\n tags: [\"SRS\"],\n })\n .errors(pickPublicErrorMap(\"CARD_NOT_FOUND\", \"CARD_NOT_REVIEWABLE\", \"CARD_REVIEW_STATE_STALE\"))\n .input(srsReviewInputSchema)\n .output(srsReviewOutputSchema),\n rollbackReview: defineAgentProcedure({\n method: \"POST\",\n path: \"/srs/review/rollback\",\n summary: \"Undo review\",\n description:\n \"Undo the latest eligible review of one owned card, preserving existing SRS restrictions and sibling restoration. expectedReviewId guards against undoing an earlier review on a retry.\",\n tags: [\"SRS\"],\n })\n .errors(\n pickPublicErrorMap(\n \"CARD_NOT_FOUND\",\n \"CARD_REVIEW_ROLLBACK_UNAVAILABLE\",\n \"CARD_REVIEW_STATE_STALE\",\n ),\n )\n .input(srsRollbackReviewInputSchema)\n .output(srsRollbackReviewOutputSchema),\n setCardBuried: defineAgentProcedure({\n method: \"POST\",\n path: \"/srs/card/bury\",\n summary: \"Set card buried\",\n description:\n \"Bury or unbury one owned card. enabled=true buries and enabled=false unburies it. Existing state-change rules apply.\",\n tags: [\"SRS\"],\n })\n .errors(\n pickPublicErrorMap(\n \"CARD_NOT_FOUND\",\n \"CARD_ALREADY_BURIED\",\n \"CARD_NOT_BURIED\",\n \"CARD_STATUS_CHANGE_UNAVAILABLE\",\n ),\n )\n .input(srsSetCardBuriedInputSchema)\n .output(srsSetCardBuriedOutputSchema),\n setCardSuspended: defineAgentProcedure({\n method: \"POST\",\n path: \"/srs/card/suspend\",\n summary: \"Set card suspended\",\n description:\n \"Suspend or resume one owned card. enabled=true suspends and enabled=false resumes it. Existing state-change rules apply.\",\n tags: [\"SRS\"],\n })\n .errors(\n pickPublicErrorMap(\n \"CARD_NOT_FOUND\",\n \"CARD_ALREADY_SUSPENDED\",\n \"CARD_NOT_SUSPENDED\",\n \"CARD_STATUS_CHANGE_UNAVAILABLE\",\n ),\n )\n .input(srsSetCardSuspendedInputSchema)\n .output(srsSetCardSuspendedOutputSchema),\n};\n","import { z } from \"zod\";\n\nexport const notebaseActivityStatsItemSchema = z\n .object({\n date: z.iso.date(),\n notes: z.number().int().nonnegative(),\n })\n .strict();\nexport type NotebaseActivityStatsItem = z.infer<typeof notebaseActivityStatsItemSchema>;\n\nexport const notebaseActivityStatsOutputSchema = z\n .object({\n daily: z.array(notebaseActivityStatsItemSchema),\n })\n .strict();\nexport type NotebaseActivityStatsOutput = z.infer<typeof notebaseActivityStatsOutputSchema>;\n\nexport const notebaseRowGrowthStatsItemSchema = z\n .object({\n date: z.iso.date(),\n delta: z.number().int(),\n })\n .strict();\nexport type NotebaseRowGrowthStatsItem = z.infer<typeof notebaseRowGrowthStatsItemSchema>;\n\nexport const notebaseRowGrowthStatsOutputSchema = z\n .object({\n baseTotal: z.number().int().nonnegative(),\n daily: z.array(notebaseRowGrowthStatsItemSchema),\n })\n .strict();\nexport type NotebaseRowGrowthStatsOutput = z.infer<typeof notebaseRowGrowthStatsOutputSchema>;\n","import { z } from \"zod\";\n\nexport const srsActivityStatsItemSchema = z\n .object({\n date: z.iso.date(),\n answers: z.number().int().nonnegative(),\n durationMs: z.number().int().nonnegative(),\n })\n .strict();\nexport type SrsActivityStatsItem = z.infer<typeof srsActivityStatsItemSchema>;\n\nexport const srsActivityStatsOutputSchema = z\n .object({\n learnedCards: z.number().int().nonnegative(),\n daily: z.array(srsActivityStatsItemSchema),\n })\n .strict();\nexport type SrsActivityStatsOutput = z.infer<typeof srsActivityStatsOutputSchema>;\n\nexport const srsMemoryGrowthStatsItemSchema = z\n .object({\n date: z.iso.date(),\n delta: z.number().int(),\n })\n .strict();\nexport type SrsMemoryGrowthStatsItem = z.infer<typeof srsMemoryGrowthStatsItemSchema>;\n\nexport const srsMemoryGrowthStatsOutputSchema = z\n .object({\n baseTotal: z.number().int().nonnegative(),\n daily: z.array(srsMemoryGrowthStatsItemSchema),\n })\n .strict();\nexport type SrsMemoryGrowthStatsOutput = z.infer<typeof srsMemoryGrowthStatsOutputSchema>;\n","import { z } from \"zod\";\nimport { notebaseActivityStatsOutputSchema } from \"./notebase-stats\";\nimport { srsActivityStatsOutputSchema } from \"./srs-stats\";\nimport { timezoneSchema } from \"./timezone\";\n\nconst statsNotebaseIdsSchema = z\n .array(z.uuid())\n .min(1)\n .transform((ids) => Array.from(new Set(ids)));\n\nexport const statsInputSchema = z\n .object({\n notebaseIds: statsNotebaseIdsSchema.optional(),\n from: z.iso.date().optional(),\n to: z.iso.date(),\n timezone: timezoneSchema,\n })\n .strict()\n .refine((input) => !input.from || input.from <= input.to, {\n message: \"from must be before or equal to to\",\n path: [\"from\"],\n });\nexport type StatsInput = z.infer<typeof statsInputSchema>;\n\nexport const activityStatsOutputSchema = z\n .object({\n srs: srsActivityStatsOutputSchema,\n notebase: notebaseActivityStatsOutputSchema,\n })\n .strict();\nexport type ActivityStatsOutput = z.infer<typeof activityStatsOutputSchema>;\n","import { oc } from \"@orpc/contract\";\nimport { pickPublicErrorMap } from \"#/public-errors\";\nimport { notebaseRowGrowthStatsOutputSchema } from \"#/schemas/notebase-stats\";\nimport { srsMemoryGrowthStatsOutputSchema } from \"#/schemas/srs-stats\";\nimport { activityStatsOutputSchema, statsInputSchema } from \"#/schemas/stats\";\n\nexport const statsContract = {\n activity: oc\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\"))\n .route({\n method: \"GET\",\n path: \"/stats/activity\",\n summary: \"Get SRS and notebase activity statistics\",\n tags: [\"Statistics\"],\n })\n .input(statsInputSchema)\n .output(activityStatsOutputSchema),\n\n srsMemoryGrowth: oc\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\"))\n .route({\n method: \"GET\",\n path: \"/srs/stats/memory-growth\",\n summary: \"Get SRS long-term memory growth statistics\",\n tags: [\"Statistics\"],\n })\n .input(statsInputSchema)\n .output(srsMemoryGrowthStatsOutputSchema),\n\n notebaseRowGrowth: oc\n .errors(pickPublicErrorMap(\"NOTEBASE_NOT_FOUND\"))\n .route({\n method: \"GET\",\n path: \"/notebases/stats/row-growth\",\n summary: \"Get notebase row growth statistics\",\n tags: [\"Statistics\"],\n })\n .input(statsInputSchema)\n .output(notebaseRowGrowthStatsOutputSchema),\n};\n","import { z } from \"zod\";\nimport { timezoneSchema } from \"./timezone\";\n\nexport const userEnsureTimezoneInputSchema = z\n .object({\n timezone: timezoneSchema,\n })\n .strict();\nexport type UserEnsureTimezoneInput = z.infer<typeof userEnsureTimezoneInputSchema>;\n\nexport const userEnsureTimezoneOutputSchema = z\n .object({\n timezone: timezoneSchema,\n updated: z.boolean(),\n })\n .strict();\nexport type UserEnsureTimezoneOutput = z.infer<typeof userEnsureTimezoneOutputSchema>;\n\nexport const userUpdateTimezoneInputSchema = z\n .object({\n timezone: timezoneSchema,\n })\n .strict();\nexport type UserUpdateTimezoneInput = z.infer<typeof userUpdateTimezoneInputSchema>;\n\nexport const userUpdateTimezoneOutputSchema = z\n .object({\n timezone: timezoneSchema,\n })\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 { getVideoIdFromUrl, transcriptSegmentSchema } from \"@read-frog/definitions\";\nimport { z } from \"zod\";\nimport { billingPlanSchema } from \"./billing\";\n\nexport const videoTranscriptStatusSchema = z.enum([\"pending\", \"processing\", \"completed\", \"failed\"]);\nexport type VideoTranscriptStatus = z.infer<typeof videoTranscriptStatusSchema>;\n\n// The transcript \"job\" resource: status + metadata, without the (heavy) segments payload.\nexport const videoTranscriptResourceSchema = z.object({\n id: z.string(),\n platform: z.string(),\n videoId: z.string(),\n url: z.string(),\n status: videoTranscriptStatusSchema,\n title: z.string().nullable(),\n durationSec: z.number().nullable(),\n detectedLanguage: z.string().nullable(),\n error: z.string().nullable(),\n createdAt: z.date(),\n updatedAt: z.date(),\n});\nexport type VideoTranscriptResource = z.infer<typeof videoTranscriptResourceSchema>;\n\n// The subtitles sub-resource: the segments + model-detected language, only available once completed.\nexport const videoTranscriptSubtitlesSchema = z.object({\n id: z.string(),\n detectedLanguage: z.string().nullable(),\n segments: z.array(transcriptSegmentSchema),\n});\nexport type VideoTranscriptSubtitles = z.infer<typeof videoTranscriptSubtitlesSchema>;\n\nexport const videoTranscriptCreateInputSchema = z\n .object({\n url: z.url().refine((url) => getVideoIdFromUrl(url) !== null, {\n message: \"url must be a supported video URL\",\n }),\n // The player's own duration, read from the media element. REQUIRED, and an\n // untrusted UX hint only: admission uses it to reject an over-quota request\n // instantly, but every reservation and charge is made against the\n // server-measured duration in the worker — lying here changes nothing about\n // what gets billed.\n durationSec: z.number().int().positive(),\n })\n .strict();\nexport type VideoTranscriptCreateInput = z.infer<typeof videoTranscriptCreateInputSchema>;\n\nexport const videoTranscriptGetInputSchema = z\n .object({\n id: z.uuid(),\n })\n .strict();\nexport type VideoTranscriptGetInput = z.infer<typeof videoTranscriptGetInputSchema>;\n\n// One quota pool as shown to the user. `resetAt` is null for a one-time grant\n// (it never resets); `expiresAt` is null for a monthly pool (its end is the\n// reset). Minutes are display units: `usedMinutes` rounds up and\n// `limitMinutes` rounds down, so the UI can never show headroom that\n// admission (which compares raw seconds) would deny.\nexport const videoTranscriptUsagePoolSchema = z.object({\n id: z.string(),\n usedMinutes: z.number().int(),\n limitMinutes: z.number().int(),\n remainingMinutes: z.number().int(),\n resetAt: z.iso.datetime().nullable(),\n expiresAt: z.iso.datetime().nullable(),\n});\nexport type VideoTranscriptUsagePool = z.infer<typeof videoTranscriptUsagePoolSchema>;\n\n// The caller's transcription quota usage. Totals aggregate across pools;\n// `remainingMinutes` nets out in-flight reservations (committed), while each\n// pool's `usedMinutes` shows settled spend only, so a progress bar cannot run\n// forward and then backwards when a job is released. Deliberately a non-strict\n// object: old clients strip the keys they don't know.\nexport const videoTranscriptUsageSchema = z.object({\n usedMinutes: z.number().int(),\n limitMinutes: z.number().int(),\n remainingMinutes: z.number().int(),\n plan: billingPlanSchema,\n pools: z.array(videoTranscriptUsagePoolSchema),\n});\nexport type VideoTranscriptUsage = z.infer<typeof videoTranscriptUsageSchema>;\n","import { oc } from \"@orpc/contract\";\nimport { pickPublicErrorMap } from \"#/public-errors\";\nimport {\n videoTranscriptCreateInputSchema,\n videoTranscriptGetInputSchema,\n videoTranscriptResourceSchema,\n videoTranscriptSubtitlesSchema,\n videoTranscriptUsageSchema,\n} from \"#/schemas/video-transcript\";\n\nexport const videoTranscriptContract = {\n create: oc\n .errors(\n pickPublicErrorMap(\n \"VIDEO_TRANSCRIPTION_QUOTA_EXCEEDED\",\n \"VIDEO_TRANSCRIPTION_SUBSCRIPTION_REQUIRED\",\n \"VIDEO_TRANSCRIPTION_PAYMENT_REQUIRED\",\n \"VIDEO_TRANSCRIPTION_UNSUPPORTED_LENGTH\",\n ),\n )\n .route({\n method: \"POST\",\n path: \"/video-transcripts\",\n summary: \"Create or reuse a video transcription job\",\n tags: [\"Video Transcription\"],\n })\n .input(videoTranscriptCreateInputSchema)\n .output(videoTranscriptResourceSchema),\n getUsage: oc\n .route({\n method: \"GET\",\n path: \"/video-transcripts/usage\",\n summary: \"Get the caller's monthly transcription quota usage\",\n tags: [\"Video Transcription\"],\n })\n .output(videoTranscriptUsageSchema),\n get: oc\n .errors(\n pickPublicErrorMap(\"VIDEO_TRANSCRIPT_NOT_FOUND\", \"VIDEO_TRANSCRIPTION_SUBSCRIPTION_REQUIRED\"),\n )\n .route({\n method: \"GET\",\n path: \"/video-transcripts/{id}\",\n summary: \"Get a video transcription job's status\",\n tags: [\"Video Transcription\"],\n })\n .input(videoTranscriptGetInputSchema)\n .output(videoTranscriptResourceSchema),\n getSubtitles: oc\n .errors(\n pickPublicErrorMap(\n \"VIDEO_TRANSCRIPT_NOT_FOUND\",\n \"VIDEO_TRANSCRIPT_NOT_READY\",\n \"VIDEO_TRANSCRIPTION_SUBSCRIPTION_REQUIRED\",\n ),\n )\n .route({\n method: \"GET\",\n path: \"/video-transcripts/{id}/subtitles\",\n summary: \"Get a completed video transcript's subtitles\",\n tags: [\"Video Transcription\"],\n })\n .input(videoTranscriptGetInputSchema)\n .output(videoTranscriptSubtitlesSchema),\n};\n","import type { ContractRouterClient } from \"@orpc/contract\";\nimport { betaAccessContract } from \"./contracts/beta-access\";\nimport { billingContract } from \"./contracts/billing\";\nimport { cardContract } from \"./contracts/card\";\nimport { cardTemplateContract } from \"./contracts/card-template\";\nimport { ebookContract } from \"./contracts/ebook\";\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 { statsContract } from \"./contracts/stats\";\nimport { userContract } from \"./contracts/user\";\nimport { videoTranscriptContract } from \"./contracts/video-transcript\";\n\nexport const contract = {\n betaAccess: betaAccessContract,\n billing: billingContract,\n card: cardContract,\n cardTemplate: cardTemplateContract,\n ebook: ebookContract,\n hostedAi: hostedAiContract,\n notebase: notebaseContract,\n notebaseColumn: notebaseColumnContract,\n notebaseRow: notebaseRowContract,\n srs: srsContract,\n stats: statsContract,\n user: userContract,\n videoTranscript: videoTranscriptContract,\n};\n\nexport type ORPCRouterClient = ContractRouterClient<typeof contract>;\n\nexport { type AgentRoute, defineAgentProcedure } from \"./contracts/shared\";\nexport * from \"./public-errors\";\nexport * from \"./schemas/beta-access\";\nexport * from \"./schemas/billing\";\nexport * from \"./schemas/card\";\nexport * from \"./schemas/ebook\";\nexport * from \"./schemas/hosted-ai\";\nexport * from \"./schemas/notebase\";\nexport * from \"./schemas/notebase-column\";\nexport * from \"./schemas/notebase-row\";\nexport * from \"./schemas/notebase-stats\";\nexport * from \"./schemas/notebase-view\";\nexport * from \"./schemas/srs\";\nexport * from \"./schemas/srs-stats\";\nexport * from \"./schemas/stats\";\nexport * from \"./schemas/timezone\";\nexport * from \"./schemas/user\";\nexport * from \"./schemas/video-transcript\";\n\nexport * from \"./schemas/pagination\";\nexport * from \"./schemas/resource-mutation\";\n"],"mappings":";;;;AAGA,MAAa,uBAAuB,EAAE,KAAK,iBAAiB;AAG5D,MAAa,8BAA8B,EACxC,OAAO,EACN,YAAY,qBACd,CAAC,CAAC,CACD,OAAO;AAGV,MAAa,+BAA+B,EAAE,OAAO;CACnD,YAAY;CACZ,SAAS,EAAE,QAAQ;AACrB,CAAC;;;ACbD,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;;;ACXA,MAAa,gCAAgC,EAAE,KAAK,CAAC,UAAU,QAAQ,CAAC;AAExE,MAAa,4BAA4B,EAAE,aAAa;CACtD,MAAM,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE;CACrC,MAAM;AACR,CAAC;AAED,MAAM,6BAA6B,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAK;;;;;;AAOrE,MAAa,0BAA0B,EAAE,KAAK,CAAC,UAAU,SAAS,CAAC;;;;;;;;;AASnE,MAAa,wBAAwB,EAAE,KAAK;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AACD,MAAa,0BAA0B,EAAE,KAAK;AAE9C,MAAM,gCAAgC;;;;;;;;;;;CAWpC,WAAW,wBAAwB,QAAQ,QAAQ;CACnD,WAAW,wBAAwB,SAAS;AAC9C;AAEA,MAAa,gCAAgC,EAAE,aAAa;CAC1D,GAA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