新增六边形架构核心代码包,包含: 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
"""Microsoft 365 厂商集成元数据。
|
||
|
||
定义 ``IntegrationMetadata(key="microsoft365", ...)``,由 ``__init__.py`` 自注册到
|
||
``IntegrationRegistry``。元数据为内存态,不持久化到数据库。
|
||
|
||
``connection_extra_schema`` 声明 ``cloud`` 与 ``api_version`` 两个连接配置额外字段:
|
||
- ``cloud``:影响 Graph 与 Login Endpoint(见 ``cloud_endpoints.py``)。
|
||
- ``api_version``:Graph API 版本,默认 ``v1.0``。
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
from yuxi.external_systems.integrations.schemas import IntegrationMetadata
|
||
|
||
MICROSOFT365_METADATA = IntegrationMetadata(
|
||
key="microsoft365",
|
||
display_name="Microsoft 365",
|
||
description="Microsoft Graph 邮件/日历/OneDrive/用户目录/Teams 集成",
|
||
adapter_type="http",
|
||
source_types=["microsoft365"],
|
||
supported_auth_types=[
|
||
"microsoft365_client_credentials",
|
||
"microsoft365_authorization_code",
|
||
],
|
||
tags=["协作", "文档", "邮件", "日历", "Teams", "P0", "P2"],
|
||
icon="microsoft365",
|
||
docs_url="https://learn.microsoft.com/en-us/graph/overview",
|
||
connection_extra_schema={
|
||
"type": "object",
|
||
"properties": {
|
||
"cloud": {
|
||
"type": "string",
|
||
"enum": ["global", "china", "usgov", "dod"],
|
||
"default": "global",
|
||
"description": "Microsoft 365 云域,影响 Graph 与 Login Endpoint",
|
||
},
|
||
"api_version": {"type": "string", "default": "v1.0"},
|
||
},
|
||
},
|
||
example_config={
|
||
"cloud": "global",
|
||
"api_version": "v1.0",
|
||
"base_url": "https://graph.microsoft.com",
|
||
},
|
||
dependency_note=(
|
||
"需在 Entra ID 注册应用并完成管理员同意;"
|
||
"client_secret 加密存储;"
|
||
"client_credentials 模式需管理员同意 Application 权限;"
|
||
"authorization_code 模式需前端完成 PKCE 授权码交换后回填 refresh_token;"
|
||
"Teams 资源需额外授予 ChannelMessage.Read.All / OnlineMeetings.ReadWrite.All 等权限"
|
||
),
|
||
)
|