mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-08-13 14:37:26 +00:00
Add communication account plugin scaffolds
This commit is contained in:
parent
5cfeea6b57
commit
c23ce42948
48 changed files with 1949 additions and 13 deletions
5
plugins/email-accounts/README.md
Normal file
5
plugins/email-accounts/README.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# LogicSRC Email Accounts Plugin
|
||||
|
||||
First-party LogicSRC plugin for connecting and governing email inboxes and outbound sending identities.
|
||||
|
||||
Initial provider manifests are intentionally contract-only. Live IMAP/SMTP, Gmail, and Microsoft Graph providers should be added behind `EmailAccountProvider` from `@logicsrc/account-core` after credential broker, approval, and audit persistence are available.
|
||||
19
plugins/email-accounts/package.json
Normal file
19
plugins/email-accounts/package.json
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"name": "@logicsrc/plugin-email-accounts",
|
||||
"version": "0.1.0",
|
||||
"description": "LogicSRC email account management plugin for inbox, sending identity, provider, policy, and audit flows.",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "tsc -p tsconfig.json",
|
||||
"test": "vitest run src --passWithNoTests"
|
||||
},
|
||||
"dependencies": {
|
||||
"@logicsrc/account-core": "file:../../packages/account-core",
|
||||
"@logicsrc/plugin-core": "file:../../packages/plugin-core"
|
||||
},
|
||||
"devDependencies": {
|
||||
"vitest": "^4.0.8"
|
||||
}
|
||||
}
|
||||
43
plugins/email-accounts/src/index.ts
Normal file
43
plugins/email-accounts/src/index.ts
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import { createProviderRegistry } from "@logicsrc/account-core";
|
||||
import type { PluginDefinition } from "@logicsrc/plugin-core";
|
||||
import { emailAccountsManifest } from "./manifest.js";
|
||||
import { emailAccountProviderManifests } from "./providers/index.js";
|
||||
|
||||
export const emailAccountsPlugin: PluginDefinition = {
|
||||
manifest: emailAccountsManifest,
|
||||
configDefaults: {
|
||||
enabled: true,
|
||||
default_send_policy: "approval_required",
|
||||
credential_broker: "${LOGICSRC_CREDENTIAL_BROKER}"
|
||||
},
|
||||
routes: [
|
||||
{ method: "GET", path: "/api/email/providers", capability: "email.providers.list" },
|
||||
{ method: "GET", path: "/api/email/accounts", capability: "accounts.list" },
|
||||
{ method: "POST", path: "/api/email/accounts/:id/search", capability: "email.search" },
|
||||
{ method: "GET", path: "/api/email/messages/:messageId", capability: "email.headers.read" },
|
||||
{ method: "POST", path: "/api/email/accounts/:id/drafts", capability: "email.draft" },
|
||||
{ method: "POST", path: "/api/email/drafts/:draftId/send", capability: "email.send" },
|
||||
{ method: "POST", path: "/api/email/messages/:messageId/labels", capability: "email.labels.modify" },
|
||||
{ method: "DELETE", path: "/api/email/messages/:messageId", capability: "email.delete" }
|
||||
],
|
||||
permissions: [
|
||||
"accounts:list",
|
||||
"accounts:read_metadata",
|
||||
"accounts:audit:read",
|
||||
"email:headers:read",
|
||||
"email:search",
|
||||
"email:draft",
|
||||
"email:send",
|
||||
"email:labels:modify",
|
||||
"email:delete"
|
||||
],
|
||||
tuiPanels: [{ id: "email-accounts", title: "Email Accounts" }]
|
||||
};
|
||||
|
||||
const registry = createProviderRegistry(emailAccountProviderManifests);
|
||||
|
||||
export function listEmailAccountProviders() {
|
||||
return registry.list("email");
|
||||
}
|
||||
|
||||
export { emailAccountsManifest, emailAccountProviderManifests };
|
||||
39
plugins/email-accounts/src/manifest.ts
Normal file
39
plugins/email-accounts/src/manifest.ts
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import type { PluginManifest } from "@logicsrc/plugin-core";
|
||||
|
||||
export const emailAccountsManifest: PluginManifest = {
|
||||
id: "email-accounts",
|
||||
name: "Email Accounts",
|
||||
version: "0.1.0",
|
||||
type: ["communication", "accounts", "email"],
|
||||
default: true,
|
||||
capabilities: [
|
||||
"accounts.connect",
|
||||
"accounts.list",
|
||||
"accounts.read_metadata",
|
||||
"accounts.test",
|
||||
"accounts.revoke",
|
||||
"accounts.sync",
|
||||
"accounts.audit.read",
|
||||
"email.providers.list",
|
||||
"email.headers.read",
|
||||
"email.body.read",
|
||||
"email.attachments.read",
|
||||
"email.search",
|
||||
"email.draft",
|
||||
"email.send",
|
||||
"email.labels.modify",
|
||||
"email.delete",
|
||||
"email.sync"
|
||||
],
|
||||
commands: ["accounts", "email"],
|
||||
env: [
|
||||
"GMAIL_CLIENT_ID",
|
||||
"GMAIL_CLIENT_SECRET",
|
||||
"MICROSOFT_CLIENT_ID",
|
||||
"MICROSOFT_CLIENT_SECRET",
|
||||
"IMAP_HOST",
|
||||
"IMAP_PORT",
|
||||
"SMTP_HOST",
|
||||
"SMTP_PORT"
|
||||
]
|
||||
};
|
||||
40
plugins/email-accounts/src/providers/index.ts
Normal file
40
plugins/email-accounts/src/providers/index.ts
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import type { LogicSrcAccountProviderManifest } from "@logicsrc/account-core";
|
||||
|
||||
export const emailAccountProviderManifests: LogicSrcAccountProviderManifest[] = [
|
||||
{
|
||||
id: "imap-smtp",
|
||||
name: "IMAP + SMTP",
|
||||
kind: "email",
|
||||
authMethods: ["imap_smtp"],
|
||||
capabilities: ["email.headers.read", "email.search", "email.draft", "email.send"],
|
||||
defaultScopes: ["imap.read", "smtp.send"],
|
||||
status: "planned"
|
||||
},
|
||||
{
|
||||
id: "gmail",
|
||||
name: "Gmail",
|
||||
kind: "email",
|
||||
authMethods: ["oauth2"],
|
||||
capabilities: ["email.headers.read", "email.search", "email.body.read", "email.draft", "email.send", "email.labels.modify"],
|
||||
defaultScopes: ["https://www.googleapis.com/auth/gmail.metadata"],
|
||||
status: "planned"
|
||||
},
|
||||
{
|
||||
id: "microsoft-graph",
|
||||
name: "Microsoft Graph / Outlook",
|
||||
kind: "email",
|
||||
authMethods: ["oauth2"],
|
||||
capabilities: ["email.headers.read", "email.search", "email.body.read", "email.draft", "email.send"],
|
||||
defaultScopes: ["Mail.ReadBasic", "Mail.Send", "offline_access"],
|
||||
status: "planned"
|
||||
},
|
||||
{
|
||||
id: "forwardemail",
|
||||
name: "ForwardEmail.net",
|
||||
kind: "email",
|
||||
authMethods: ["imap_smtp", "api_key"],
|
||||
capabilities: ["email.headers.read", "email.search", "email.draft", "email.send"],
|
||||
defaultScopes: ["imap.read", "smtp.send"],
|
||||
status: "planned"
|
||||
}
|
||||
];
|
||||
8
plugins/email-accounts/tsconfig.json
Normal file
8
plugins/email-accounts/tsconfig.json
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue