mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-08-14 06:47:28 +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
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"
|
||||
}
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue