import { z } from "zod"; import { CollectionPermission, type ImportableIntegrationService, IntegrationService, ProsemirrorDoc, } from "./types"; import { PageType } from "plugins/notion/shared/types"; const BaseImportInputItemSchema = z.object({ permission: z.nativeEnum(CollectionPermission).optional(), }); export type BaseImportInput = z.infer[]; export const NotionImportInputItemSchema = BaseImportInputItemSchema.extend({ type: z.nativeEnum(PageType).optional(), externalId: z.string().optional(), }); export type NotionImportInput = z.infer[]; export type ImportInput = T extends IntegrationService.Notion ? NotionImportInput : BaseImportInput; export const BaseImportTaskInputItemSchema = z.object({ externalId: z.string(), parentExternalId: z.string().optional(), collectionExternalId: z.string().optional(), }); export type BaseImportTaskInput = z.infer< typeof BaseImportTaskInputItemSchema >[]; export const NotionImportTaskInputItemSchema = BaseImportTaskInputItemSchema.extend({ type: z.nativeEnum(PageType), }); export type NotionImportTaskInput = z.infer< typeof NotionImportTaskInputItemSchema >[]; export type ImportTaskInput = T extends IntegrationService.Notion ? NotionImportTaskInput : BaseImportTaskInput; // No reason to be here except for co-location with import task input. export type ImportTaskOutput = { externalId: string; title: string; emoji?: string; author?: string; content: ProsemirrorDoc; createdAt?: Date; updatedAt?: Date; }[];