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"]
|
||||
}
|
||||
5
plugins/social-accounts/README.md
Normal file
5
plugins/social-accounts/README.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# LogicSRC Social Accounts Plugin
|
||||
|
||||
First-party LogicSRC plugin for connecting and governing social/network accounts.
|
||||
|
||||
Initial provider manifests are intentionally contract-only. Live provider adapters should be added behind `SocialAccountProvider` from `@logicsrc/account-core` after credential broker, approval, and audit persistence are available.
|
||||
19
plugins/social-accounts/package.json
Normal file
19
plugins/social-accounts/package.json
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"name": "@logicsrc/plugin-social-accounts",
|
||||
"version": "0.1.0",
|
||||
"description": "LogicSRC social account management plugin for provider-agnostic profile, drafting, publishing, sync, 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"
|
||||
}
|
||||
}
|
||||
41
plugins/social-accounts/src/index.ts
Normal file
41
plugins/social-accounts/src/index.ts
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import { createProviderRegistry } from "@logicsrc/account-core";
|
||||
import type { PluginDefinition } from "@logicsrc/plugin-core";
|
||||
import { socialAccountsManifest } from "./manifest.js";
|
||||
import { socialAccountProviderManifests } from "./providers/index.js";
|
||||
|
||||
export const socialAccountsPlugin: PluginDefinition = {
|
||||
manifest: socialAccountsManifest,
|
||||
configDefaults: {
|
||||
enabled: true,
|
||||
default_publish_policy: "approval_required",
|
||||
credential_broker: "${LOGICSRC_CREDENTIAL_BROKER}"
|
||||
},
|
||||
routes: [
|
||||
{ method: "GET", path: "/api/social/providers", capability: "social.providers.list" },
|
||||
{ method: "GET", path: "/api/social/accounts", capability: "accounts.list" },
|
||||
{ method: "GET", path: "/api/social/accounts/:id/profile", capability: "social.profile.read" },
|
||||
{ method: "POST", path: "/api/social/accounts/:id/drafts", capability: "social.post.draft" },
|
||||
{ method: "POST", path: "/api/social/accounts/:id/posts", capability: "social.post.publish" },
|
||||
{ method: "GET", path: "/api/social/accounts/:id/mentions", capability: "social.mentions.read" },
|
||||
{ method: "GET", path: "/api/social/accounts/:id/analytics", capability: "social.analytics.read" }
|
||||
],
|
||||
permissions: [
|
||||
"accounts:list",
|
||||
"accounts:read_metadata",
|
||||
"accounts:audit:read",
|
||||
"social:profile:read",
|
||||
"social:post:draft",
|
||||
"social:post:publish",
|
||||
"social:mentions:read",
|
||||
"social:analytics:read"
|
||||
],
|
||||
tuiPanels: [{ id: "social-accounts", title: "Social Accounts" }]
|
||||
};
|
||||
|
||||
const registry = createProviderRegistry(socialAccountProviderManifests);
|
||||
|
||||
export function listSocialAccountProviders() {
|
||||
return registry.list("social");
|
||||
}
|
||||
|
||||
export { socialAccountsManifest, socialAccountProviderManifests };
|
||||
37
plugins/social-accounts/src/manifest.ts
Normal file
37
plugins/social-accounts/src/manifest.ts
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import type { PluginManifest } from "@logicsrc/plugin-core";
|
||||
|
||||
export const socialAccountsManifest: PluginManifest = {
|
||||
id: "social-accounts",
|
||||
name: "Social Accounts",
|
||||
version: "0.1.0",
|
||||
type: ["communication", "accounts", "social"],
|
||||
default: true,
|
||||
capabilities: [
|
||||
"accounts.connect",
|
||||
"accounts.list",
|
||||
"accounts.read_metadata",
|
||||
"accounts.test",
|
||||
"accounts.revoke",
|
||||
"accounts.sync",
|
||||
"accounts.audit.read",
|
||||
"social.providers.list",
|
||||
"social.profile.read",
|
||||
"social.post.draft",
|
||||
"social.post.publish",
|
||||
"social.media.upload",
|
||||
"social.mentions.read",
|
||||
"social.analytics.read"
|
||||
],
|
||||
commands: ["accounts", "social"],
|
||||
env: [
|
||||
"MASTODON_CLIENT_ID",
|
||||
"MASTODON_CLIENT_SECRET",
|
||||
"BLUESKY_APP_PASSWORD",
|
||||
"GITHUB_CLIENT_ID",
|
||||
"GITHUB_CLIENT_SECRET",
|
||||
"X_CLIENT_ID",
|
||||
"X_CLIENT_SECRET",
|
||||
"REDDIT_CLIENT_ID",
|
||||
"REDDIT_CLIENT_SECRET"
|
||||
]
|
||||
};
|
||||
49
plugins/social-accounts/src/providers/index.ts
Normal file
49
plugins/social-accounts/src/providers/index.ts
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
import type { LogicSrcAccountProviderManifest } from "@logicsrc/account-core";
|
||||
|
||||
export const socialAccountProviderManifests: LogicSrcAccountProviderManifest[] = [
|
||||
{
|
||||
id: "mastodon",
|
||||
name: "Mastodon",
|
||||
kind: "social",
|
||||
authMethods: ["oauth2"],
|
||||
capabilities: ["social.profile.read", "social.post.draft", "social.post.publish", "social.mentions.read"],
|
||||
defaultScopes: ["read:accounts", "read:statuses", "write:statuses"],
|
||||
status: "planned"
|
||||
},
|
||||
{
|
||||
id: "bluesky",
|
||||
name: "Bluesky",
|
||||
kind: "social",
|
||||
authMethods: ["api_key"],
|
||||
capabilities: ["social.profile.read", "social.post.draft", "social.post.publish"],
|
||||
defaultScopes: ["atproto.session", "atproto.repo.read", "atproto.repo.write"],
|
||||
status: "planned"
|
||||
},
|
||||
{
|
||||
id: "github",
|
||||
name: "GitHub",
|
||||
kind: "social",
|
||||
authMethods: ["oauth2", "api_key"],
|
||||
capabilities: ["social.profile.read", "social.post.draft", "social.post.publish"],
|
||||
defaultScopes: ["read:user", "repo"],
|
||||
status: "planned"
|
||||
},
|
||||
{
|
||||
id: "x",
|
||||
name: "X / Twitter",
|
||||
kind: "social",
|
||||
authMethods: ["oauth2", "api_key"],
|
||||
capabilities: ["social.profile.read", "social.post.draft", "social.post.publish", "social.mentions.read", "social.analytics.read"],
|
||||
defaultScopes: ["tweet.read", "tweet.write", "users.read", "offline.access"],
|
||||
status: "planned"
|
||||
},
|
||||
{
|
||||
id: "reddit",
|
||||
name: "Reddit",
|
||||
kind: "social",
|
||||
authMethods: ["oauth2"],
|
||||
capabilities: ["social.profile.read", "social.post.draft", "social.post.publish", "social.comments.read"],
|
||||
defaultScopes: ["identity", "read", "submit"],
|
||||
status: "planned"
|
||||
}
|
||||
];
|
||||
8
plugins/social-accounts/tsconfig.json
Normal file
8
plugins/social-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