mirror of
https://github.com/outline/outline.git
synced 2026-11-25 15:15:15 +03:00
An import with no input, or a Notion import with no shared pages, stayed in an active state with no tasks. This blocked new imports for the team until the creator canceled it.
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import { z } from "zod";
|
|
import { IntegrationService } from "@shared/types";
|
|
import { IntegrationImportBodySchema } from "@server/routes/api/imports/schema";
|
|
import { Hook, PluginManager } from "@server/utils/PluginManager";
|
|
import config from "../plugin.json";
|
|
import router from "./api/notion";
|
|
import { NotionImportInputItemSchema } from "../shared/schema";
|
|
import env from "./env";
|
|
import { NotionImportsProcessor } from "./processors/NotionImportsProcessor";
|
|
import NotionAPIImportTask from "./tasks/NotionAPIImportTask";
|
|
|
|
PluginManager.add({
|
|
type: Hook.ImportSchema,
|
|
value: IntegrationImportBodySchema.extend({
|
|
service: z.literal(IntegrationService.Notion),
|
|
input: z.array(NotionImportInputItemSchema).min(1),
|
|
}),
|
|
});
|
|
|
|
const enabled = !!env.NOTION_CLIENT_ID && !!env.NOTION_CLIENT_SECRET;
|
|
|
|
if (enabled) {
|
|
PluginManager.add([
|
|
{
|
|
...config,
|
|
type: Hook.API,
|
|
value: router,
|
|
},
|
|
{
|
|
type: Hook.Processor,
|
|
value: NotionImportsProcessor,
|
|
},
|
|
{
|
|
type: Hook.Task,
|
|
value: NotionAPIImportTask,
|
|
},
|
|
]);
|
|
}
|