Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

composer-image-schema.ts

28 lines829 Bytes

1import * as Schema from "effect/Schema";
2import { EnvironmentId } from "@t3tools/contracts";
3​
4export const DraftComposerImageAttachmentSchema = Schema.Struct({
5 id: Schema.String,
6 previewUri: Schema.String,
7 type: Schema.Literal("image"),
8 name: Schema.String,
9 mimeType: Schema.String,
10 sizeBytes: Schema.Number,
11 dataUrl: Schema.String,
12});
13​
14export const DraftComposerFileAttachmentSchema = Schema.Struct({
15 id: Schema.String,
16 type: Schema.Literal("file"),
17 name: Schema.String,
18 mimeType: Schema.String,
19 sizeBytes: Schema.Number,
20 fileUri: Schema.String,
21 uploadedAttachmentId: Schema.optional(Schema.String),
22 uploadEnvironmentId: Schema.optional(EnvironmentId),
23});
24​
25export const DraftComposerAttachmentSchema = Schema.Union([
26 DraftComposerImageAttachmentSchema,
27 DraftComposerFileAttachmentSchema,
28]);