fix: pdf export (#8564)

* feat: pdf export

* fix: tests

* fix: tests

---------

Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
This commit is contained in:
M. Palanikannan 2026-01-26 22:08:10 +05:30 committed by GitHub
parent 20e266c9bb
commit b31c0195bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 4287 additions and 62 deletions

View file

@ -0,0 +1,61 @@
import { Schema } from "effect";
export const PdfExportRequestBody = Schema.Struct({
pageId: Schema.NonEmptyTrimmedString,
workspaceSlug: Schema.NonEmptyTrimmedString,
projectId: Schema.optional(Schema.NonEmptyTrimmedString),
title: Schema.optional(Schema.String),
author: Schema.optional(Schema.String),
subject: Schema.optional(Schema.String),
pageSize: Schema.optional(Schema.Literal("A4", "A3", "A2", "LETTER", "LEGAL", "TABLOID")),
pageOrientation: Schema.optional(Schema.Literal("portrait", "landscape")),
fileName: Schema.optional(Schema.String),
noAssets: Schema.optional(Schema.Boolean),
});
export type TPdfExportRequestBody = Schema.Schema.Type<typeof PdfExportRequestBody>;
export class PdfValidationError extends Schema.TaggedError<PdfValidationError>()("PdfValidationError", {
message: Schema.NonEmptyTrimmedString,
cause: Schema.optional(Schema.Unknown),
}) {}
export class PdfAuthenticationError extends Schema.TaggedError<PdfAuthenticationError>()("PdfAuthenticationError", {
message: Schema.NonEmptyTrimmedString,
}) {}
export class PdfContentFetchError extends Schema.TaggedError<PdfContentFetchError>()("PdfContentFetchError", {
message: Schema.NonEmptyTrimmedString,
cause: Schema.optional(Schema.Unknown),
}) {}
export class PdfMetadataFetchError extends Schema.TaggedError<PdfMetadataFetchError>()("PdfMetadataFetchError", {
message: Schema.NonEmptyTrimmedString,
source: Schema.Literal("user-mentions"),
cause: Schema.optional(Schema.Unknown),
}) {}
export class PdfImageProcessingError extends Schema.TaggedError<PdfImageProcessingError>()("PdfImageProcessingError", {
message: Schema.NonEmptyTrimmedString,
assetId: Schema.NonEmptyTrimmedString,
cause: Schema.optional(Schema.Unknown),
}) {}
export class PdfGenerationError extends Schema.TaggedError<PdfGenerationError>()("PdfGenerationError", {
message: Schema.NonEmptyTrimmedString,
cause: Schema.optional(Schema.Unknown),
}) {}
export class PdfTimeoutError extends Schema.TaggedError<PdfTimeoutError>()("PdfTimeoutError", {
message: Schema.NonEmptyTrimmedString,
operation: Schema.NonEmptyTrimmedString,
}) {}
export type PdfExportError =
| PdfValidationError
| PdfAuthenticationError
| PdfContentFetchError
| PdfMetadataFetchError
| PdfImageProcessingError
| PdfGenerationError
| PdfTimeoutError;