mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-08-13 22:37:29 +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/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