新增六边形架构核心代码包,包含: 1. 协议适配器层:HTTP/SMTP/IMAP/SSH/GRPC等多协议适配器实现 2. 认证插件体系:基础认证、API密钥、HMAC等多类型认证插件 3. 执行编排框架:工具执行器、上下文构建、运行时治理组件 4. 用例端口与DTO:定义领域服务端口与数据传输对象 5. 厂商集成包框架:支持第三方系统集成扩展 6. 基础设施装配层:实现依赖注入与服务装配 所有代码遵循六边形架构设计原则,实现端口与适配器解耦,支持动态扩展与自动发现。
53 lines
2.0 KiB
Python
53 lines
2.0 KiB
Python
"""Notion 厂商集成元数据。
|
||
|
||
定义 ``IntegrationMetadata(key="notion", ...)``,由 ``__init__.py`` 自注册到
|
||
``IntegrationRegistry``。元数据为内存态,不持久化到数据库。
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
from yuxi.external_systems.integrations.schemas import IntegrationMetadata
|
||
|
||
NOTION_METADATA = IntegrationMetadata(
|
||
key="notion",
|
||
display_name="Notion",
|
||
description="Notion 知识库集成,支持数据库查询、页面/块 CRUD、用户与工作区元数据发现",
|
||
adapter_type="http",
|
||
source_types=["notion"],
|
||
supported_auth_types=[
|
||
"notion_integration_token",
|
||
"oauth2_authorization_code",
|
||
"bearer", # 首期降级方案
|
||
],
|
||
tags=["document", "knowledge_base", "collaboration"],
|
||
icon="notion",
|
||
docs_url="https://developers.notion.com/reference/intro",
|
||
connection_extra_schema={
|
||
"type": "object",
|
||
"properties": {
|
||
"base_url": {
|
||
"type": "string",
|
||
"default": "https://api.notion.com/v1",
|
||
"description": "Notion API 基础 URL",
|
||
},
|
||
"notion_version": {
|
||
"type": "string",
|
||
"default": "2022-06-28",
|
||
"description": "Notion-Version 头部值",
|
||
},
|
||
},
|
||
"required": ["base_url"],
|
||
},
|
||
example_config={
|
||
"base_url": "https://api.notion.com/v1",
|
||
"notion_version": "2022-06-28",
|
||
},
|
||
dependency_note=(
|
||
"1. 至少配置一种认证方式(notion_integration_token / oauth2_authorization_code / bearer);"
|
||
"2. Internal Integration Token 需在 Notion App 设置页创建并勾选所需能力"
|
||
"(read_content / update_content / insert_content / read_users);"
|
||
"3. 数据库查询工具需通过 discover 阶段拉取数据库结构后生成专属参数 schema;"
|
||
"4. 块内容解析仅支持常见块类型(paragraph / heading / list / to_do / toggle / quote / code / divider)。"
|
||
),
|
||
)
|