@classytic/social 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +65 -0
- package/LICENSE +21 -0
- package/README.md +368 -0
- package/dist/base-Bw7e52V8.mjs +246 -0
- package/dist/base-Bw7e52V8.mjs.map +1 -0
- package/dist/base-DBtKFiSX.d.mts +226 -0
- package/dist/base-DBtKFiSX.d.mts.map +1 -0
- package/dist/chunk-DQk6qfdC.mjs +18 -0
- package/dist/client/index.d.mts +44 -0
- package/dist/client/index.d.mts.map +1 -0
- package/dist/client/index.mjs +154 -0
- package/dist/client/index.mjs.map +1 -0
- package/dist/common/index.d.mts +3 -0
- package/dist/common/index.mjs +7 -0
- package/dist/contracts-Cdwa4zlg.d.mts +121 -0
- package/dist/contracts-Cdwa4zlg.d.mts.map +1 -0
- package/dist/contracts-lCa069IK.mjs +221 -0
- package/dist/contracts-lCa069IK.mjs.map +1 -0
- package/dist/env-Bl0cwwjC.mjs +955 -0
- package/dist/env-Bl0cwwjC.mjs.map +1 -0
- package/dist/env-DxOZHf0p.d.mts +394 -0
- package/dist/env-DxOZHf0p.d.mts.map +1 -0
- package/dist/errors-Cm6LeKf7.mjs +32 -0
- package/dist/errors-Cm6LeKf7.mjs.map +1 -0
- package/dist/facebook-l_4CghaA.mjs +95 -0
- package/dist/facebook-l_4CghaA.mjs.map +1 -0
- package/dist/http-DpcLSR1M.mjs +197 -0
- package/dist/http-DpcLSR1M.mjs.map +1 -0
- package/dist/index.d.mts +42 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +71 -0
- package/dist/index.mjs.map +1 -0
- package/dist/instagram-BGaeUFU2.mjs +90 -0
- package/dist/instagram-BGaeUFU2.mjs.map +1 -0
- package/dist/linkedin-70whtVKa.mjs +101 -0
- package/dist/linkedin-70whtVKa.mjs.map +1 -0
- package/dist/meta-D3vcJU1c.mjs +126 -0
- package/dist/meta-D3vcJU1c.mjs.map +1 -0
- package/dist/pkce-jq5II68b.mjs +72 -0
- package/dist/pkce-jq5II68b.mjs.map +1 -0
- package/dist/polling-DZ1apXtA.mjs +25 -0
- package/dist/polling-DZ1apXtA.mjs.map +1 -0
- package/dist/providers/facebook.d.mts +135 -0
- package/dist/providers/facebook.d.mts.map +1 -0
- package/dist/providers/facebook.mjs +450 -0
- package/dist/providers/facebook.mjs.map +1 -0
- package/dist/providers/instagram.d.mts +122 -0
- package/dist/providers/instagram.d.mts.map +1 -0
- package/dist/providers/instagram.mjs +496 -0
- package/dist/providers/instagram.mjs.map +1 -0
- package/dist/providers/linkedin.d.mts +145 -0
- package/dist/providers/linkedin.d.mts.map +1 -0
- package/dist/providers/linkedin.mjs +574 -0
- package/dist/providers/linkedin.mjs.map +1 -0
- package/dist/providers/reddit.d.mts +102 -0
- package/dist/providers/reddit.d.mts.map +1 -0
- package/dist/providers/reddit.mjs +657 -0
- package/dist/providers/reddit.mjs.map +1 -0
- package/dist/providers/telegram.d.mts +139 -0
- package/dist/providers/telegram.d.mts.map +1 -0
- package/dist/providers/telegram.mjs +517 -0
- package/dist/providers/telegram.mjs.map +1 -0
- package/dist/providers/tiktok.d.mts +116 -0
- package/dist/providers/tiktok.d.mts.map +1 -0
- package/dist/providers/tiktok.mjs +676 -0
- package/dist/providers/tiktok.mjs.map +1 -0
- package/dist/providers/twitter.d.mts +150 -0
- package/dist/providers/twitter.d.mts.map +1 -0
- package/dist/providers/twitter.mjs +628 -0
- package/dist/providers/twitter.mjs.map +1 -0
- package/dist/providers/whatsapp.d.mts +79 -0
- package/dist/providers/whatsapp.d.mts.map +1 -0
- package/dist/providers/whatsapp.mjs +376 -0
- package/dist/providers/whatsapp.mjs.map +1 -0
- package/dist/providers/youtube.d.mts +153 -0
- package/dist/providers/youtube.d.mts.map +1 -0
- package/dist/providers/youtube.mjs +902 -0
- package/dist/providers/youtube.mjs.map +1 -0
- package/dist/reddit-B10kS4Se.mjs +126 -0
- package/dist/reddit-B10kS4Se.mjs.map +1 -0
- package/dist/schemas/index.d.mts +819 -0
- package/dist/schemas/index.d.mts.map +1 -0
- package/dist/schemas/index.mjs +31 -0
- package/dist/schemas/index.mjs.map +1 -0
- package/dist/security-BXhfebWm.d.mts +338 -0
- package/dist/security-BXhfebWm.d.mts.map +1 -0
- package/dist/shared-Fvc6xQku.mjs +100 -0
- package/dist/shared-Fvc6xQku.mjs.map +1 -0
- package/dist/telegram-FaUHpZgB.mjs +107 -0
- package/dist/telegram-FaUHpZgB.mjs.map +1 -0
- package/dist/tiktok-B_bMk4G-.mjs +94 -0
- package/dist/tiktok-B_bMk4G-.mjs.map +1 -0
- package/dist/twitter-BC22zfuc.mjs +98 -0
- package/dist/twitter-BC22zfuc.mjs.map +1 -0
- package/dist/types-BFE4psYI.d.mts +102 -0
- package/dist/types-BFE4psYI.d.mts.map +1 -0
- package/dist/types-Bv27tcT0.d.mts +230 -0
- package/dist/types-Bv27tcT0.d.mts.map +1 -0
- package/dist/types-BwkKyqpi.d.mts +253 -0
- package/dist/types-BwkKyqpi.d.mts.map +1 -0
- package/dist/types-CJrHMDV9.mjs +27 -0
- package/dist/types-CJrHMDV9.mjs.map +1 -0
- package/dist/types-ClbVc2rc.d.mts +117 -0
- package/dist/types-ClbVc2rc.d.mts.map +1 -0
- package/dist/types-D91N16Ym.d.mts +242 -0
- package/dist/types-D91N16Ym.d.mts.map +1 -0
- package/dist/types-DfLp_ibQ.d.mts +178 -0
- package/dist/types-DfLp_ibQ.d.mts.map +1 -0
- package/dist/types-DfjDgEoJ.d.mts +88 -0
- package/dist/types-DfjDgEoJ.d.mts.map +1 -0
- package/dist/types-Dp5Z9VBr.mjs +23 -0
- package/dist/types-Dp5Z9VBr.mjs.map +1 -0
- package/dist/types-hriBJTsU.d.mts +129 -0
- package/dist/types-hriBJTsU.d.mts.map +1 -0
- package/dist/types-rn6UuLL8.d.mts +184 -0
- package/dist/types-rn6UuLL8.d.mts.map +1 -0
- package/dist/whatsapp-CFp7ryR4.mjs +101 -0
- package/dist/whatsapp-CFp7ryR4.mjs.map +1 -0
- package/dist/youtube-Bs0fdY7H.mjs +98 -0
- package/dist/youtube-Bs0fdY7H.mjs.map +1 -0
- package/package.json +148 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-Bw7e52V8.mjs","names":[],"sources":["../src/base.ts"],"sourcesContent":["/**\n * Platform Provider Base Class\n * =============================\n * Abstract base class for social media platform integrations.\n *\n * All platform providers (YouTube, TikTok, Instagram, etc.) must extend this class\n * and implement the required methods.\n */\n\nimport type { z } from 'zod';\n\n// ---------------------------------------------------------------------------\n// Credential Schema (for UI form rendering)\n// ---------------------------------------------------------------------------\n\nexport type CredentialFieldType = 'text' | 'password' | 'url' | 'select' | 'textarea';\n\nexport interface CredentialField {\n name: string;\n displayName: string;\n type: CredentialFieldType;\n required: boolean;\n placeholder?: string;\n description?: string;\n options?: { label: string; value: string }[];\n}\n\n// ---------------------------------------------------------------------------\n// Auth\n// ---------------------------------------------------------------------------\n\nexport interface AuthUrlOptions {\n /** Per-request environment override (affects scopes for providers that support it) */\n environment?: 'sandbox' | 'production';\n}\n\nexport type AuthType = 'oauth2' | 'token' | 'api_key';\n\n// ---------------------------------------------------------------------------\n// Provider Metadata\n// ---------------------------------------------------------------------------\n\nexport interface SetupGuideStep {\n step: number;\n title: string;\n description: string;\n}\n\nexport interface ProviderMetadata {\n name: string;\n displayName: string;\n authType: string;\n icon: string;\n brandColor: string | null;\n description: string;\n scopes: string[];\n scopeDescriptions: Record<string, string>;\n setupGuide: SetupGuideStep[];\n supportsScheduling: boolean;\n /** Whether this provider supports sandbox/production environment modes */\n supportsEnvironment: boolean;\n redirectUriPattern: string | null;\n credentialSchema: CredentialField[];\n}\n\n// ---------------------------------------------------------------------------\n// Account Info\n// ---------------------------------------------------------------------------\n\nexport interface AccountInfo {\n id: string;\n name: string;\n email?: string;\n profileImage?: string | null;\n /** Platform-specific extra fields (username, bio, etc.) */\n [key: string]: unknown;\n}\n\n// ---------------------------------------------------------------------------\n// OAuth Tokens\n// ---------------------------------------------------------------------------\n\nexport interface OAuthTokens {\n access_token: string;\n refresh_token?: string;\n expires_in?: number;\n token_type?: string;\n scope?: string;\n /** Platform-specific extra token fields (open_id, refresh_token_expires_in, etc.) */\n [key: string]: unknown;\n}\n\n// ---------------------------------------------------------------------------\n// Upload (base contracts — providers extend these)\n// ---------------------------------------------------------------------------\n\nexport type PrivacyLevel = 'public' | 'private' | 'unlisted';\n\nexport interface UploadParams {\n filePath?: string;\n videoUrl?: string;\n title?: string;\n description?: string;\n caption?: string;\n tags?: string[];\n privacy?: PrivacyLevel;\n categoryId?: string;\n credentials: Record<string, string>;\n tokens: OAuthTokens;\n scheduledAt?: string | Date;\n onProgress?: (progress: number) => void;\n}\n\nexport interface UploadResult {\n platformVideoId?: string;\n platformPostId?: string;\n platformUrl?: string | null;\n status: string;\n scheduledAt?: string | Date | null;\n uploadedAt?: Date;\n metadata?: Record<string, unknown>;\n}\n\n// ---------------------------------------------------------------------------\n// Validation & Testing\n// ---------------------------------------------------------------------------\n\nexport interface ValidationResult {\n valid: boolean;\n errors: string[];\n}\n\nexport type TestStatus = 'OK' | 'Error' | 'Pending' | 'Warning';\n\nexport interface TestResult {\n status: TestStatus;\n message?: string;\n data?: Record<string, unknown>;\n authUrl?: string;\n}\n\n// ---------------------------------------------------------------------------\n// Provider Config\n// ---------------------------------------------------------------------------\n\nexport type ProviderEnvironment = 'sandbox' | 'production';\n\nexport interface ProviderConfig {\n port?: number;\n redirectUri?: string;\n /** Provider environment — controls scope selection and API behavior */\n environment?: ProviderEnvironment;\n}\n\nexport class PlatformProvider {\n public name: string;\n public displayName: string;\n public config: ProviderConfig;\n public authType: string;\n\n constructor(config: ProviderConfig = {}) {\n this.name = '';\n this.displayName = '';\n this.config = config;\n this.authType = 'oauth2'; // 'oauth2' | 'api_key' | 'token'\n }\n\n /**\n * Get OAuth authorization URL\n * @param state - State parameter for CSRF protection\n * @param credData - Decrypted credential data (client ID, redirect URI, etc.)\n * @returns Authorization URL\n */\n getAuthUrl(state: string, credData?: Record<string, any>, options?: AuthUrlOptions): string {\n throw new Error(`${this.name}: getAuthUrl() not implemented`);\n }\n\n /**\n * Exchange authorization code for access token\n * @param code - Authorization code from OAuth callback\n * @param credData - Decrypted credential data\n * @returns Token data { access_token, refresh_token, expires_in, ... }\n */\n async exchangeCode(code: string, credData?: Record<string, any>, state?: string): Promise<OAuthTokens> {\n throw new Error(`${this.name}: exchangeCode() not implemented`);\n }\n\n /**\n * Refresh access token using refresh token\n * @param refreshToken - Refresh token\n * @param credData - Decrypted credential data\n * @returns New token data\n */\n async refreshToken(refreshToken: string, credData?: Record<string, any>): Promise<OAuthTokens> {\n throw new Error(`${this.name}: refreshToken() not implemented`);\n }\n\n /**\n * Get account information using access token\n * @param accessToken - Access token\n * @param credData - Decrypted credential data\n * @returns Account info { id, name, email, profileImage, ... }\n */\n async getAccountInfo(accessToken: string, credData?: Record<string, any>): Promise<AccountInfo> {\n throw new Error(`${this.name}: getAccountInfo() not implemented`);\n }\n\n /**\n * Revoke an OAuth access token. Forces the provider to show a fresh consent\n * screen on next authorization (ensures newly enabled scopes are granted).\n * Default: no-op. Override in providers that support token revocation.\n */\n async revokeToken(accessToken: string, credData?: Record<string, any>): Promise<void> {\n // No-op by default — not all providers support revocation\n }\n\n /**\n * Test credential validity\n * @param credentialData - Decrypted credential data\n * @returns Test result { status: 'OK' | 'Error', message, ... }\n */\n async testCredential(credentialData: Record<string, any>): Promise<TestResult> {\n throw new Error(`${this.name}: testCredential() not implemented`);\n }\n\n /**\n * Upload video to platform.\n * Each provider defines its own parameter type — the base accepts any shape.\n * @param params - Platform-specific upload parameters\n * @returns Upload result\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n async uploadVideo(params: any): Promise<UploadResult> {\n throw new Error(`${this.name}: uploadVideo() not implemented`);\n }\n\n /**\n * Upload photo(s) to platform.\n * Each provider defines its own parameter type.\n * @param params - Platform-specific upload parameters\n * @returns Upload result\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n async uploadPhoto(params: any): Promise<UploadResult> {\n throw new Error(`${this.name}: uploadPhoto() not implemented`);\n }\n\n /**\n * Upload carousel (multi-media) post.\n * Each provider defines its own parameter type.\n * @param params - Platform-specific carousel parameters\n * @returns Upload result\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n async uploadCarousel(params: any): Promise<UploadResult> {\n throw new Error(`${this.name}: uploadCarousel() not implemented`);\n }\n\n /**\n * Send a message via the platform (Telegram, WhatsApp)\n * @param args - Platform-specific arguments\n */\n async sendMessage(...args: unknown[]): Promise<unknown> {\n throw new Error(`${this.name}: sendMessage() not implemented`);\n }\n\n /**\n * Delete/unpublish a post from the platform\n * @param args - Platform-specific arguments (token, postId, etc.)\n */\n async deletePost(...args: unknown[]): Promise<unknown> {\n throw new Error(`${this.name}: deletePost() not implemented`);\n }\n\n /**\n * Delete a message (Telegram-specific)\n * @param botToken - Bot token\n * @param chatId - Chat ID\n * @param messageId - Message ID\n */\n async deleteMessage(botToken: string, chatId: string | number, messageId: string | number): Promise<unknown> {\n throw new Error(`${this.name}: deleteMessage() not implemented`);\n }\n\n /**\n * Get credential schema for UI form rendering.\n *\n * Default implementation derives fields from the zod schema returned by\n * `getCredentialZodSchema()`. Providers may override either method —\n * overriding `getCredentialZodSchema()` is preferred so consumers also get\n * runtime validation, JSON Schema generation, and TypeScript inference.\n */\n getCredentialSchema(): CredentialField[] {\n const zodSchema = this.getCredentialZodSchema();\n if (!zodSchema) return [];\n return deriveCredentialFields(zodSchema);\n }\n\n /**\n * Return the zod schema for this provider's credentials. Providers should\n * override this to enable runtime validation and form schema derivation.\n *\n * @returns A zod object schema, or `null` if the provider doesn't expose\n * credentials via this interface yet.\n */\n getCredentialZodSchema(): z.ZodType | null {\n return null;\n }\n\n /**\n * Get provider metadata for frontend display and dynamic form rendering.\n * Subclasses should override to provide platform-specific details.\n *\n * @returns Provider metadata\n */\n getMetadata(): ProviderMetadata {\n return {\n name: this.name,\n displayName: this.displayName,\n authType: this.authType,\n icon: this.name,\n brandColor: null,\n description: '',\n scopes: [],\n scopeDescriptions: {},\n setupGuide: [],\n supportsScheduling: false,\n supportsEnvironment: false,\n redirectUriPattern: `/api/oauth/${this.name}/callback`,\n credentialSchema: this.getCredentialSchema(),\n };\n }\n\n /**\n * Validate credential data using the provider's zod schema if available,\n * falling back to a presence check on the UI schema.\n */\n validateCredentials(data: Record<string, any>): ValidationResult {\n const zodSchema = this.getCredentialZodSchema();\n if (zodSchema) {\n const result = zodSchema.safeParse(data);\n if (result.success) return { valid: true, errors: [] };\n return {\n valid: false,\n errors: result.error.issues.map(issue => {\n const path = issue.path.length ? issue.path.join('.') + ': ' : '';\n return `${path}${issue.message}`;\n }),\n };\n }\n\n const schema = this.getCredentialSchema();\n const errors: string[] = [];\n for (const field of schema) {\n if (field.required && !data[field.name]) {\n errors.push(`${field.displayName || field.name} is required`);\n }\n }\n return { valid: errors.length === 0, errors };\n }\n}\n\n// ─── Helpers ────────────────────────────────────────────────────────────────\n\nconst SECRET_NAME = /token|secret|password|key|credential/i;\n\n/**\n * Derive UI form fields from a zod object schema. Heuristics:\n * - secret-named fields → `password`\n * - z.url() → `url`\n * - z.enum([...]) → `select`\n * - everything else → `text`\n */\nexport function deriveCredentialFields(schema: z.ZodType): CredentialField[] {\n // Defensively unwrap to a ZodObject. Non-objects yield an empty list.\n const def = (schema as { def?: { type?: string; shape?: Record<string, z.ZodType> } }).def;\n if (!def || def.type !== 'object' || !def.shape) return [];\n const out: CredentialField[] = [];\n for (const [name, fieldSchema] of Object.entries(def.shape)) {\n const inner = unwrap(fieldSchema);\n const innerDef = (inner as { def?: { type?: string; format?: string; entries?: Record<string, string> } }).def;\n let type: CredentialField['type'] = 'text';\n let options: CredentialField['options'];\n\n if (SECRET_NAME.test(name)) {\n type = 'password';\n } else if (innerDef?.type === 'url' || innerDef?.format === 'url') {\n type = 'url';\n } else if (innerDef?.type === 'enum' && innerDef.entries) {\n type = 'select';\n options = Object.values(innerDef.entries).map(v => ({ label: String(v), value: String(v) }));\n }\n\n out.push({\n name,\n displayName: humanize(name),\n type,\n required: !isOptional(fieldSchema),\n description: (fieldSchema as { description?: string }).description,\n options,\n });\n }\n return out;\n}\n\nfunction unwrap(t: z.ZodType): z.ZodType {\n let cur: z.ZodType = t;\n for (let i = 0; i < 8; i++) {\n const def = (cur as { def?: { type?: string; innerType?: z.ZodType } }).def;\n if (!def?.innerType) return cur;\n if (def.type === 'optional' || def.type === 'nullable' || def.type === 'default') {\n cur = def.innerType;\n continue;\n }\n return cur;\n }\n return cur;\n}\n\nfunction isOptional(t: z.ZodType): boolean {\n const def = (t as { def?: { type?: string } }).def;\n return def?.type === 'optional' || def?.type === 'default' || def?.type === 'nullable';\n}\n\nfunction humanize(name: string): string {\n return name\n .replace(/([A-Z])/g, ' $1')\n .replace(/^./, c => c.toUpperCase())\n .replace(/\\bId\\b/g, 'ID')\n .replace(/\\bUrl\\b/g, 'URL')\n .trim();\n}\n"],"mappings":";AA0JA,IAAa,mBAAb,MAA8B;CAC5B,AAAO;CACP,AAAO;CACP,AAAO;CACP,AAAO;CAEP,YAAY,SAAyB,EAAE,EAAE;AACvC,OAAK,OAAO;AACZ,OAAK,cAAc;AACnB,OAAK,SAAS;AACd,OAAK,WAAW;;;;;;;;CASlB,WAAW,OAAe,UAAgC,SAAkC;AAC1F,QAAM,IAAI,MAAM,GAAG,KAAK,KAAK,gCAAgC;;;;;;;;CAS/D,MAAM,aAAa,MAAc,UAAgC,OAAsC;AACrG,QAAM,IAAI,MAAM,GAAG,KAAK,KAAK,kCAAkC;;;;;;;;CASjE,MAAM,aAAa,cAAsB,UAAsD;AAC7F,QAAM,IAAI,MAAM,GAAG,KAAK,KAAK,kCAAkC;;;;;;;;CASjE,MAAM,eAAe,aAAqB,UAAsD;AAC9F,QAAM,IAAI,MAAM,GAAG,KAAK,KAAK,oCAAoC;;;;;;;CAQnE,MAAM,YAAY,aAAqB,UAA+C;;;;;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E,MAAI,CAAC,KAAK,UAAW,QAAO;AAC5B,MAAI,IAAI,SAAS,cAAc,IAAI,SAAS,cAAc,IAAI,SAAS,WAAW;AAChF,SAAM,IAAI;AACV;;AAEF,SAAO;;AAET,QAAO;;AAGT,SAAS,WAAW,GAAuB;CACzC,MAAM,MAAO,EAAkC;AAC/C,QAAO,KAAK,SAAS,cAAc,KAAK,SAAS,aAAa,KAAK,SAAS;;AAG9E,SAAS,SAAS,MAAsB;AACtC,QAAO,KACJ,QAAQ,YAAY,MAAM,CAC1B,QAAQ,OAAM,MAAK,EAAE,aAAa,CAAC,CACnC,QAAQ,WAAW,KAAK,CACxB,QAAQ,YAAY,MAAM,CAC1B,MAAM"}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/base.d.ts
|
|
4
|
+
type CredentialFieldType = 'text' | 'password' | 'url' | 'select' | 'textarea';
|
|
5
|
+
interface CredentialField {
|
|
6
|
+
name: string;
|
|
7
|
+
displayName: string;
|
|
8
|
+
type: CredentialFieldType;
|
|
9
|
+
required: boolean;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
options?: {
|
|
13
|
+
label: string;
|
|
14
|
+
value: string;
|
|
15
|
+
}[];
|
|
16
|
+
}
|
|
17
|
+
interface AuthUrlOptions {
|
|
18
|
+
/** Per-request environment override (affects scopes for providers that support it) */
|
|
19
|
+
environment?: 'sandbox' | 'production';
|
|
20
|
+
}
|
|
21
|
+
type AuthType = 'oauth2' | 'token' | 'api_key';
|
|
22
|
+
interface SetupGuideStep {
|
|
23
|
+
step: number;
|
|
24
|
+
title: string;
|
|
25
|
+
description: string;
|
|
26
|
+
}
|
|
27
|
+
interface ProviderMetadata {
|
|
28
|
+
name: string;
|
|
29
|
+
displayName: string;
|
|
30
|
+
authType: string;
|
|
31
|
+
icon: string;
|
|
32
|
+
brandColor: string | null;
|
|
33
|
+
description: string;
|
|
34
|
+
scopes: string[];
|
|
35
|
+
scopeDescriptions: Record<string, string>;
|
|
36
|
+
setupGuide: SetupGuideStep[];
|
|
37
|
+
supportsScheduling: boolean;
|
|
38
|
+
/** Whether this provider supports sandbox/production environment modes */
|
|
39
|
+
supportsEnvironment: boolean;
|
|
40
|
+
redirectUriPattern: string | null;
|
|
41
|
+
credentialSchema: CredentialField[];
|
|
42
|
+
}
|
|
43
|
+
interface AccountInfo {
|
|
44
|
+
id: string;
|
|
45
|
+
name: string;
|
|
46
|
+
email?: string;
|
|
47
|
+
profileImage?: string | null;
|
|
48
|
+
/** Platform-specific extra fields (username, bio, etc.) */
|
|
49
|
+
[key: string]: unknown;
|
|
50
|
+
}
|
|
51
|
+
interface OAuthTokens {
|
|
52
|
+
access_token: string;
|
|
53
|
+
refresh_token?: string;
|
|
54
|
+
expires_in?: number;
|
|
55
|
+
token_type?: string;
|
|
56
|
+
scope?: string;
|
|
57
|
+
/** Platform-specific extra token fields (open_id, refresh_token_expires_in, etc.) */
|
|
58
|
+
[key: string]: unknown;
|
|
59
|
+
}
|
|
60
|
+
type PrivacyLevel = 'public' | 'private' | 'unlisted';
|
|
61
|
+
interface UploadParams {
|
|
62
|
+
filePath?: string;
|
|
63
|
+
videoUrl?: string;
|
|
64
|
+
title?: string;
|
|
65
|
+
description?: string;
|
|
66
|
+
caption?: string;
|
|
67
|
+
tags?: string[];
|
|
68
|
+
privacy?: PrivacyLevel;
|
|
69
|
+
categoryId?: string;
|
|
70
|
+
credentials: Record<string, string>;
|
|
71
|
+
tokens: OAuthTokens;
|
|
72
|
+
scheduledAt?: string | Date;
|
|
73
|
+
onProgress?: (progress: number) => void;
|
|
74
|
+
}
|
|
75
|
+
interface UploadResult {
|
|
76
|
+
platformVideoId?: string;
|
|
77
|
+
platformPostId?: string;
|
|
78
|
+
platformUrl?: string | null;
|
|
79
|
+
status: string;
|
|
80
|
+
scheduledAt?: string | Date | null;
|
|
81
|
+
uploadedAt?: Date;
|
|
82
|
+
metadata?: Record<string, unknown>;
|
|
83
|
+
}
|
|
84
|
+
interface ValidationResult {
|
|
85
|
+
valid: boolean;
|
|
86
|
+
errors: string[];
|
|
87
|
+
}
|
|
88
|
+
type TestStatus = 'OK' | 'Error' | 'Pending' | 'Warning';
|
|
89
|
+
interface TestResult {
|
|
90
|
+
status: TestStatus;
|
|
91
|
+
message?: string;
|
|
92
|
+
data?: Record<string, unknown>;
|
|
93
|
+
authUrl?: string;
|
|
94
|
+
}
|
|
95
|
+
type ProviderEnvironment = 'sandbox' | 'production';
|
|
96
|
+
interface ProviderConfig {
|
|
97
|
+
port?: number;
|
|
98
|
+
redirectUri?: string;
|
|
99
|
+
/** Provider environment — controls scope selection and API behavior */
|
|
100
|
+
environment?: ProviderEnvironment;
|
|
101
|
+
}
|
|
102
|
+
declare class PlatformProvider {
|
|
103
|
+
name: string;
|
|
104
|
+
displayName: string;
|
|
105
|
+
config: ProviderConfig;
|
|
106
|
+
authType: string;
|
|
107
|
+
constructor(config?: ProviderConfig);
|
|
108
|
+
/**
|
|
109
|
+
* Get OAuth authorization URL
|
|
110
|
+
* @param state - State parameter for CSRF protection
|
|
111
|
+
* @param credData - Decrypted credential data (client ID, redirect URI, etc.)
|
|
112
|
+
* @returns Authorization URL
|
|
113
|
+
*/
|
|
114
|
+
getAuthUrl(state: string, credData?: Record<string, any>, options?: AuthUrlOptions): string;
|
|
115
|
+
/**
|
|
116
|
+
* Exchange authorization code for access token
|
|
117
|
+
* @param code - Authorization code from OAuth callback
|
|
118
|
+
* @param credData - Decrypted credential data
|
|
119
|
+
* @returns Token data { access_token, refresh_token, expires_in, ... }
|
|
120
|
+
*/
|
|
121
|
+
exchangeCode(code: string, credData?: Record<string, any>, state?: string): Promise<OAuthTokens>;
|
|
122
|
+
/**
|
|
123
|
+
* Refresh access token using refresh token
|
|
124
|
+
* @param refreshToken - Refresh token
|
|
125
|
+
* @param credData - Decrypted credential data
|
|
126
|
+
* @returns New token data
|
|
127
|
+
*/
|
|
128
|
+
refreshToken(refreshToken: string, credData?: Record<string, any>): Promise<OAuthTokens>;
|
|
129
|
+
/**
|
|
130
|
+
* Get account information using access token
|
|
131
|
+
* @param accessToken - Access token
|
|
132
|
+
* @param credData - Decrypted credential data
|
|
133
|
+
* @returns Account info { id, name, email, profileImage, ... }
|
|
134
|
+
*/
|
|
135
|
+
getAccountInfo(accessToken: string, credData?: Record<string, any>): Promise<AccountInfo>;
|
|
136
|
+
/**
|
|
137
|
+
* Revoke an OAuth access token. Forces the provider to show a fresh consent
|
|
138
|
+
* screen on next authorization (ensures newly enabled scopes are granted).
|
|
139
|
+
* Default: no-op. Override in providers that support token revocation.
|
|
140
|
+
*/
|
|
141
|
+
revokeToken(accessToken: string, credData?: Record<string, any>): Promise<void>;
|
|
142
|
+
/**
|
|
143
|
+
* Test credential validity
|
|
144
|
+
* @param credentialData - Decrypted credential data
|
|
145
|
+
* @returns Test result { status: 'OK' | 'Error', message, ... }
|
|
146
|
+
*/
|
|
147
|
+
testCredential(credentialData: Record<string, any>): Promise<TestResult>;
|
|
148
|
+
/**
|
|
149
|
+
* Upload video to platform.
|
|
150
|
+
* Each provider defines its own parameter type — the base accepts any shape.
|
|
151
|
+
* @param params - Platform-specific upload parameters
|
|
152
|
+
* @returns Upload result
|
|
153
|
+
*/
|
|
154
|
+
uploadVideo(params: any): Promise<UploadResult>;
|
|
155
|
+
/**
|
|
156
|
+
* Upload photo(s) to platform.
|
|
157
|
+
* Each provider defines its own parameter type.
|
|
158
|
+
* @param params - Platform-specific upload parameters
|
|
159
|
+
* @returns Upload result
|
|
160
|
+
*/
|
|
161
|
+
uploadPhoto(params: any): Promise<UploadResult>;
|
|
162
|
+
/**
|
|
163
|
+
* Upload carousel (multi-media) post.
|
|
164
|
+
* Each provider defines its own parameter type.
|
|
165
|
+
* @param params - Platform-specific carousel parameters
|
|
166
|
+
* @returns Upload result
|
|
167
|
+
*/
|
|
168
|
+
uploadCarousel(params: any): Promise<UploadResult>;
|
|
169
|
+
/**
|
|
170
|
+
* Send a message via the platform (Telegram, WhatsApp)
|
|
171
|
+
* @param args - Platform-specific arguments
|
|
172
|
+
*/
|
|
173
|
+
sendMessage(...args: unknown[]): Promise<unknown>;
|
|
174
|
+
/**
|
|
175
|
+
* Delete/unpublish a post from the platform
|
|
176
|
+
* @param args - Platform-specific arguments (token, postId, etc.)
|
|
177
|
+
*/
|
|
178
|
+
deletePost(...args: unknown[]): Promise<unknown>;
|
|
179
|
+
/**
|
|
180
|
+
* Delete a message (Telegram-specific)
|
|
181
|
+
* @param botToken - Bot token
|
|
182
|
+
* @param chatId - Chat ID
|
|
183
|
+
* @param messageId - Message ID
|
|
184
|
+
*/
|
|
185
|
+
deleteMessage(botToken: string, chatId: string | number, messageId: string | number): Promise<unknown>;
|
|
186
|
+
/**
|
|
187
|
+
* Get credential schema for UI form rendering.
|
|
188
|
+
*
|
|
189
|
+
* Default implementation derives fields from the zod schema returned by
|
|
190
|
+
* `getCredentialZodSchema()`. Providers may override either method —
|
|
191
|
+
* overriding `getCredentialZodSchema()` is preferred so consumers also get
|
|
192
|
+
* runtime validation, JSON Schema generation, and TypeScript inference.
|
|
193
|
+
*/
|
|
194
|
+
getCredentialSchema(): CredentialField[];
|
|
195
|
+
/**
|
|
196
|
+
* Return the zod schema for this provider's credentials. Providers should
|
|
197
|
+
* override this to enable runtime validation and form schema derivation.
|
|
198
|
+
*
|
|
199
|
+
* @returns A zod object schema, or `null` if the provider doesn't expose
|
|
200
|
+
* credentials via this interface yet.
|
|
201
|
+
*/
|
|
202
|
+
getCredentialZodSchema(): z.ZodType | null;
|
|
203
|
+
/**
|
|
204
|
+
* Get provider metadata for frontend display and dynamic form rendering.
|
|
205
|
+
* Subclasses should override to provide platform-specific details.
|
|
206
|
+
*
|
|
207
|
+
* @returns Provider metadata
|
|
208
|
+
*/
|
|
209
|
+
getMetadata(): ProviderMetadata;
|
|
210
|
+
/**
|
|
211
|
+
* Validate credential data using the provider's zod schema if available,
|
|
212
|
+
* falling back to a presence check on the UI schema.
|
|
213
|
+
*/
|
|
214
|
+
validateCredentials(data: Record<string, any>): ValidationResult;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Derive UI form fields from a zod object schema. Heuristics:
|
|
218
|
+
* - secret-named fields → `password`
|
|
219
|
+
* - z.url() → `url`
|
|
220
|
+
* - z.enum([...]) → `select`
|
|
221
|
+
* - everything else → `text`
|
|
222
|
+
*/
|
|
223
|
+
declare function deriveCredentialFields(schema: z.ZodType): CredentialField[];
|
|
224
|
+
//#endregion
|
|
225
|
+
export { ValidationResult as _, CredentialFieldType as a, PrivacyLevel as c, ProviderMetadata as d, SetupGuideStep as f, UploadResult as g, UploadParams as h, CredentialField as i, ProviderConfig as l, TestStatus as m, AuthType as n, OAuthTokens as o, TestResult as p, AuthUrlOptions as r, PlatformProvider as s, AccountInfo as t, ProviderEnvironment as u, deriveCredentialFields as v };
|
|
226
|
+
//# sourceMappingURL=base-DBtKFiSX.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-DBtKFiSX.d.mts","names":[],"sources":["../src/base.ts"],"mappings":";;;KAeY,mBAAA;AAAA,UAEK,eAAA;EACf,IAAA;EACA,WAAA;EACA,IAAA,EAAM,mBAAA;EACN,QAAA;EACA,WAAA;EACA,WAAA;EACA,OAAA;IAAY,KAAA;IAAe,KAAA;EAAA;AAAA;AAAA,UAOZ,cAAA;EAPiB;EAShC,WAAA;AAAA;AAAA,KAGU,QAAA;AAAA,UAMK,cAAA;EACf,IAAA;EACA,KAAA;EACA,WAAA;AAAA;AAAA,UAGe,gBAAA;EACf,IAAA;EACA,WAAA;EACA,QAAA;EACA,IAAA;EACA,UAAA;EACA,WAAA;EACA,MAAA;EACA,iBAAA,EAAmB,MAAA;EACnB,UAAA,EAAY,cAAA;EACZ,kBAAA;EAVe;EAYf,mBAAA;EACA,kBAAA;EACA,gBAAA,EAAkB,eAAA;AAAA;AAAA,UAOH,WAAA;EACf,EAAA;EACA,IAAA;EACA,KA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AA,gBAAsB,OAAA,CAAQ,WAAA;EAnFnF;;;;AAOF;EAqFQ,WAAA,CAAY,WAAA,UAAqB,QAAA,GAAW,MAAA,gBAAsB,OAAA;;;;AAhF1E;;EAyFQ,cAAA,CAAe,cAAA,EAAgB,MAAA,gBAAsB,OAAA,CAAQ,UAAA;EAzF/C;;AAEtB;;;;EAkGQ,WAAA,CAAY,MAAA,QAAc,OAAA,CAAQ,YAAA;EAjGhC;;;;;;EA4GF,WAAA,CAAY,MAAA,QAAc,OAAA,CAAQ,YAAA;EAlG9B;;;;;AAEZ;EA2GQ,cAAA,CAAe,MAAA,QAAc,OAAA,CAAQ,YAAA;;;;;EAQrC,WAAA,CAAA,GAAe,IAAA,cAAkB,OAAA;EA/GzB;;;AAGhB;EAoHQ,UAAA,CAAA,GAAc,IAAA,cAAkB,OAAA;;;;;;;EAUhC,aAAA,CAAc,QAAA,UAAkB,MAAA,mBAAyB,SAAA,oBAA6B,OAAA;EAjGV;;;;;;;;EA6GlF,mBAAA,CAAA,GAAuB,eAAA;EAvEc;;;;;;;EAoFrC,sBAAA,CAAA,GAA0B,CAAA,CAAE,OAAA;EAnDO;;;;;;EA6DnC,WAAA,CAAA,GAAe,gBAAA;EAsBW;;;;EAA1B,mBAAA,CAAoB,IAAA,EAAM,MAAA,gBAAsB,gBAAA;AAAA;;;;;;;;iBAoClC,sBAAA,CAAuB,MAAA,EAAQ,CAAA,CAAE,OAAA,GAAU,eAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __exportAll = (all, no_symbols) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) {
|
|
6
|
+
__defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
if (!no_symbols) {
|
|
12
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
13
|
+
}
|
|
14
|
+
return target;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { __exportAll as t };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { A as WhatsAppClientConfig, C as SocialClientOptions, D as UnifiedMedia, E as TwitterClientConfig, O as UnifiedPostInput, S as RedditClientConfig, T as TikTokClientConfig, _ as MultiPostResult, a as YouTubeClient, b as ProviderConfigMap, c as LinkedInClient, d as FacebookClientConfig, f as InstagramClientConfig, g as MultiPostInput, h as MessageResult, i as TikTokClient, j as YouTubeClientConfig, k as UnifiedUploadInput, l as FacebookClient, m as MessageInput, n as WhatsAppClient, o as InstagramClient, p as LinkedInClientConfig, r as TelegramClient, s as RedditClient, t as fromEnv, u as TwitterClient, v as MultiUploadInput, w as TelegramClientConfig, x as ProviderName, y as PostResult } from "../env-DxOZHf0p.mjs";
|
|
2
|
+
import { a as ProviderCapabilities } from "../contracts-Cdwa4zlg.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/client/index.d.ts
|
|
5
|
+
declare class SocialClient {
|
|
6
|
+
readonly youtube?: YouTubeClient;
|
|
7
|
+
readonly twitter?: TwitterClient;
|
|
8
|
+
readonly facebook?: FacebookClient;
|
|
9
|
+
readonly instagram?: InstagramClient;
|
|
10
|
+
readonly linkedin?: LinkedInClient;
|
|
11
|
+
readonly reddit?: RedditClient;
|
|
12
|
+
readonly tiktok?: TikTokClient;
|
|
13
|
+
readonly telegram?: TelegramClient;
|
|
14
|
+
readonly whatsapp?: WhatsAppClient;
|
|
15
|
+
constructor(config: ProviderConfigMap, opts?: SocialClientOptions);
|
|
16
|
+
/** Convenience factory — equivalent to `new SocialClient(...)`. */
|
|
17
|
+
static create(config: ProviderConfigMap, opts?: SocialClientOptions): SocialClient;
|
|
18
|
+
/** Names of platforms with credentials configured. */
|
|
19
|
+
enabledPlatforms(): ProviderName[];
|
|
20
|
+
/** Capability metadata for a platform. */
|
|
21
|
+
capabilities(platform: ProviderName): ProviderCapabilities | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Publish to one or more text-friendly platforms.
|
|
24
|
+
*
|
|
25
|
+
* Defaults to all configured platforms whose capabilities include `posting`.
|
|
26
|
+
* Each platform fan-out is independent — failures don't block others.
|
|
27
|
+
*/
|
|
28
|
+
post(input: MultiPostInput): Promise<MultiPostResult>;
|
|
29
|
+
/**
|
|
30
|
+
* Upload a video to one or more video platforms (YouTube, TikTok, Instagram).
|
|
31
|
+
*/
|
|
32
|
+
upload(input: MultiUploadInput): Promise<MultiPostResult>;
|
|
33
|
+
/**
|
|
34
|
+
* Send a message via Telegram or WhatsApp.
|
|
35
|
+
*/
|
|
36
|
+
message(input: MessageInput): Promise<MessageResult>;
|
|
37
|
+
private postOne;
|
|
38
|
+
private uploadOne;
|
|
39
|
+
private postingTargets;
|
|
40
|
+
private uploadTargets;
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { FacebookClient, type FacebookClientConfig, InstagramClient, type InstagramClientConfig, LinkedInClient, type LinkedInClientConfig, type MessageInput, type MessageResult, type MultiPostInput, type MultiPostResult, type MultiUploadInput, type PostResult, type ProviderConfigMap, type ProviderName, RedditClient, type RedditClientConfig, SocialClient, type SocialClientOptions, TelegramClient, type TelegramClientConfig, TikTokClient, type TikTokClientConfig, TwitterClient, type TwitterClientConfig, type UnifiedMedia, type UnifiedPostInput, type UnifiedUploadInput, WhatsAppClient, type WhatsAppClientConfig, YouTubeClient, type YouTubeClientConfig, fromEnv };
|
|
44
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/client/index.ts"],"mappings":";;;;cA2Ca,YAAA;EAAA,SACF,OAAA,GAAU,aAAA;EAAA,SACV,OAAA,GAAU,aAAA;EAAA,SACV,QAAA,GAAW,cAAA;EAAA,SACX,SAAA,GAAY,eAAA;EAAA,SACZ,QAAA,GAAW,cAAA;EAAA,SACX,MAAA,GAAS,YAAA;EAAA,SACT,MAAA,GAAS,YAAA;EAAA,SACT,QAAA,GAAW,cAAA;EAAA,SACX,QAAA,GAAW,cAAA;cAER,MAAA,EAAQ,iBAAA,EAAmB,IAAA,GAAM,mBAAA;EARzB;EAAA,OAqBb,MAAA,CAAO,MAAA,EAAQ,iBAAA,EAAmB,IAAA,GAAO,mBAAA,GAAsB,YAAA;EApBjD;EAyBrB,gBAAA,CAAA,GAAoB,YAAA;EAxBA;EAuCpB,YAAA,CAAa,QAAA,EAAU,YAAA,GAAe,oBAAA;EAtCpB;;;;;;EAgDZ,IAAA,CAAK,KAAA,EAAO,cAAA,GAAiB,OAAA,CAAQ,eAAA;;;;EASrC,MAAA,CAAO,KAAA,EAAO,gBAAA,GAAmB,OAAA,CAAQ,eAAA;EApDR;;;EA6DjC,OAAA,CAAQ,KAAA,EAAO,YAAA,GAAe,OAAA,CAAQ,aAAA;EAAA,QAY9B,OAAA;EAAA,QAWA,SAAA;EAAA,QAeN,cAAA;EAAA,QAIA,aAAA;AAAA"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { a as YouTubeClient, c as LinkedInClient, i as TikTokClient, l as FacebookClient, n as WhatsAppClient, o as InstagramClient, r as TelegramClient, s as RedditClient, t as fromEnv, u as TwitterClient } from "../env-Bl0cwwjC.mjs";
|
|
2
|
+
import { allCapabilities } from "../schemas/index.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/client/index.ts
|
|
5
|
+
/**
|
|
6
|
+
* SocialClient — the unified façade.
|
|
7
|
+
*
|
|
8
|
+
* Wraps every provider with bound credentials and exposes:
|
|
9
|
+
* - `client.<platform>` — strongly typed sub-client per platform
|
|
10
|
+
* - `client.post(input)` — fan out to all configured posting platforms
|
|
11
|
+
* - `client.upload(input)` — fan out to all configured upload platforms
|
|
12
|
+
* - `client.message(input)` — send via Telegram or WhatsApp
|
|
13
|
+
*
|
|
14
|
+
* Construction:
|
|
15
|
+
* const client = SocialClient.create({
|
|
16
|
+
* twitter: { clientId, clientSecret, tokens },
|
|
17
|
+
* telegram: { botToken, chatId: '@my-channel' },
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* await client.post({ text: 'Hello' }); // → all configured posters
|
|
21
|
+
* await client.twitter!.post({ text: 'Tweet' }); // → just Twitter
|
|
22
|
+
*/
|
|
23
|
+
var SocialClient = class SocialClient {
|
|
24
|
+
youtube;
|
|
25
|
+
twitter;
|
|
26
|
+
facebook;
|
|
27
|
+
instagram;
|
|
28
|
+
linkedin;
|
|
29
|
+
reddit;
|
|
30
|
+
tiktok;
|
|
31
|
+
telegram;
|
|
32
|
+
whatsapp;
|
|
33
|
+
constructor(config, opts = {}) {
|
|
34
|
+
if (config.youtube) this.youtube = new YouTubeClient(config.youtube, opts);
|
|
35
|
+
if (config.twitter) this.twitter = new TwitterClient(config.twitter, opts);
|
|
36
|
+
if (config.facebook) this.facebook = new FacebookClient(config.facebook, opts);
|
|
37
|
+
if (config.instagram) this.instagram = new InstagramClient(config.instagram, opts);
|
|
38
|
+
if (config.linkedin) this.linkedin = new LinkedInClient(config.linkedin, opts);
|
|
39
|
+
if (config.reddit) this.reddit = new RedditClient(config.reddit, opts);
|
|
40
|
+
if (config.tiktok) this.tiktok = new TikTokClient(config.tiktok, opts);
|
|
41
|
+
if (config.telegram) this.telegram = new TelegramClient(config.telegram, opts);
|
|
42
|
+
if (config.whatsapp) this.whatsapp = new WhatsAppClient(config.whatsapp, opts);
|
|
43
|
+
}
|
|
44
|
+
/** Convenience factory — equivalent to `new SocialClient(...)`. */
|
|
45
|
+
static create(config, opts) {
|
|
46
|
+
return new SocialClient(config, opts);
|
|
47
|
+
}
|
|
48
|
+
/** Names of platforms with credentials configured. */
|
|
49
|
+
enabledPlatforms() {
|
|
50
|
+
const names = [];
|
|
51
|
+
if (this.youtube) names.push("youtube");
|
|
52
|
+
if (this.twitter) names.push("twitter");
|
|
53
|
+
if (this.facebook) names.push("facebook");
|
|
54
|
+
if (this.instagram) names.push("instagram");
|
|
55
|
+
if (this.linkedin) names.push("linkedin");
|
|
56
|
+
if (this.reddit) names.push("reddit");
|
|
57
|
+
if (this.tiktok) names.push("tiktok");
|
|
58
|
+
if (this.telegram) names.push("telegram");
|
|
59
|
+
if (this.whatsapp) names.push("whatsapp");
|
|
60
|
+
return names;
|
|
61
|
+
}
|
|
62
|
+
/** Capability metadata for a platform. */
|
|
63
|
+
capabilities(platform) {
|
|
64
|
+
return allCapabilities[platform];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Publish to one or more text-friendly platforms.
|
|
68
|
+
*
|
|
69
|
+
* Defaults to all configured platforms whose capabilities include `posting`.
|
|
70
|
+
* Each platform fan-out is independent — failures don't block others.
|
|
71
|
+
*/
|
|
72
|
+
async post(input) {
|
|
73
|
+
const targets = (input.platforms ?? this.postingTargets()).filter((p) => allCapabilities[p]?.posting);
|
|
74
|
+
const results = await Promise.all(targets.map((p) => this.postOne(p, input)));
|
|
75
|
+
return {
|
|
76
|
+
results,
|
|
77
|
+
allOk: results.every((r) => r.ok)
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Upload a video to one or more video platforms (YouTube, TikTok, Instagram).
|
|
82
|
+
*/
|
|
83
|
+
async upload(input) {
|
|
84
|
+
const targets = (input.platforms ?? this.uploadTargets()).filter((p) => allCapabilities[p]?.upload);
|
|
85
|
+
const results = await Promise.all(targets.map((p) => this.uploadOne(p, input)));
|
|
86
|
+
return {
|
|
87
|
+
results,
|
|
88
|
+
allOk: results.every((r) => r.ok)
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Send a message via Telegram or WhatsApp.
|
|
93
|
+
*/
|
|
94
|
+
async message(input) {
|
|
95
|
+
if (input.platform === "telegram") {
|
|
96
|
+
if (!this.telegram) throw new Error("Telegram is not configured");
|
|
97
|
+
return this.telegram.send(input.text, input.to);
|
|
98
|
+
}
|
|
99
|
+
if (!this.whatsapp) throw new Error("WhatsApp is not configured");
|
|
100
|
+
if (input.to === void 0) throw new Error("WhatsApp messages require `to` (E.164 phone number)");
|
|
101
|
+
return this.whatsapp.send(input.text, String(input.to));
|
|
102
|
+
}
|
|
103
|
+
async postOne(platform, input) {
|
|
104
|
+
switch (platform) {
|
|
105
|
+
case "twitter": return this.twitter ? this.twitter.post(input) : notConfigured(platform);
|
|
106
|
+
case "facebook": return this.facebook ? this.facebook.post(input) : notConfigured(platform);
|
|
107
|
+
case "linkedin": return this.linkedin ? this.linkedin.post(input) : notConfigured(platform);
|
|
108
|
+
case "instagram": return this.instagram ? this.instagram.post(input) : notConfigured(platform);
|
|
109
|
+
case "reddit": return this.reddit ? this.reddit.post(input) : notConfigured(platform);
|
|
110
|
+
default: return {
|
|
111
|
+
platform,
|
|
112
|
+
ok: false,
|
|
113
|
+
error: { message: `${platform} does not support post()` }
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
async uploadOne(platform, input) {
|
|
118
|
+
switch (platform) {
|
|
119
|
+
case "youtube": return this.youtube ? this.youtube.upload(input) : notConfigured(platform);
|
|
120
|
+
case "tiktok": return this.tiktok ? this.tiktok.upload(input) : notConfigured(platform);
|
|
121
|
+
case "instagram":
|
|
122
|
+
if (!this.instagram) return notConfigured("instagram");
|
|
123
|
+
return this.instagram.post({
|
|
124
|
+
text: input.caption ?? input.description,
|
|
125
|
+
media: input.videoUrl ? [{
|
|
126
|
+
type: "video",
|
|
127
|
+
url: input.videoUrl
|
|
128
|
+
}] : []
|
|
129
|
+
});
|
|
130
|
+
default: return {
|
|
131
|
+
platform,
|
|
132
|
+
ok: false,
|
|
133
|
+
error: { message: `${platform} does not support upload()` }
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
postingTargets() {
|
|
138
|
+
return this.enabledPlatforms().filter((p) => allCapabilities[p]?.posting);
|
|
139
|
+
}
|
|
140
|
+
uploadTargets() {
|
|
141
|
+
return this.enabledPlatforms().filter((p) => allCapabilities[p]?.upload);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
function notConfigured(platform) {
|
|
145
|
+
return {
|
|
146
|
+
platform,
|
|
147
|
+
ok: false,
|
|
148
|
+
error: { message: `${platform} is not configured on this client` }
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
//#endregion
|
|
153
|
+
export { FacebookClient, InstagramClient, LinkedInClient, RedditClient, SocialClient, TelegramClient, TikTokClient, TwitterClient, WhatsAppClient, YouTubeClient, fromEnv };
|
|
154
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/client/index.ts"],"sourcesContent":["/**\n * SocialClient — the unified façade.\n *\n * Wraps every provider with bound credentials and exposes:\n * - `client.<platform>` — strongly typed sub-client per platform\n * - `client.post(input)` — fan out to all configured posting platforms\n * - `client.upload(input)` — fan out to all configured upload platforms\n * - `client.message(input)` — send via Telegram or WhatsApp\n *\n * Construction:\n * const client = SocialClient.create({\n * twitter: { clientId, clientSecret, tokens },\n * telegram: { botToken, chatId: '@my-channel' },\n * });\n *\n * await client.post({ text: 'Hello' }); // → all configured posters\n * await client.twitter!.post({ text: 'Tweet' }); // → just Twitter\n */\n\nimport { TwitterClient } from './twitter.js';\nimport { FacebookClient } from './facebook.js';\nimport { LinkedInClient } from './linkedin.js';\nimport { RedditClient } from './reddit.js';\nimport { InstagramClient } from './instagram.js';\nimport { YouTubeClient } from './youtube.js';\nimport { TikTokClient } from './tiktok.js';\nimport { TelegramClient } from './telegram.js';\nimport { WhatsAppClient } from './whatsapp.js';\n\nimport { allCapabilities } from '../schemas/index.js';\nimport type { ProviderCapabilities } from '../common/contracts.js';\n\nimport type {\n ProviderConfigMap,\n ProviderName,\n SocialClientOptions,\n MultiPostInput,\n MultiUploadInput,\n MultiPostResult,\n MessageInput,\n MessageResult,\n} from './types.js';\n\nexport class SocialClient {\n readonly youtube?: YouTubeClient;\n readonly twitter?: TwitterClient;\n readonly facebook?: FacebookClient;\n readonly instagram?: InstagramClient;\n readonly linkedin?: LinkedInClient;\n readonly reddit?: RedditClient;\n readonly tiktok?: TikTokClient;\n readonly telegram?: TelegramClient;\n readonly whatsapp?: WhatsAppClient;\n\n constructor(config: ProviderConfigMap, opts: SocialClientOptions = {}) {\n if (config.youtube) this.youtube = new YouTubeClient(config.youtube, opts);\n if (config.twitter) this.twitter = new TwitterClient(config.twitter, opts);\n if (config.facebook) this.facebook = new FacebookClient(config.facebook, opts);\n if (config.instagram) this.instagram = new InstagramClient(config.instagram, opts);\n if (config.linkedin) this.linkedin = new LinkedInClient(config.linkedin, opts);\n if (config.reddit) this.reddit = new RedditClient(config.reddit, opts);\n if (config.tiktok) this.tiktok = new TikTokClient(config.tiktok, opts);\n if (config.telegram) this.telegram = new TelegramClient(config.telegram, opts);\n if (config.whatsapp) this.whatsapp = new WhatsAppClient(config.whatsapp, opts);\n }\n\n /** Convenience factory — equivalent to `new SocialClient(...)`. */\n static create(config: ProviderConfigMap, opts?: SocialClientOptions): SocialClient {\n return new SocialClient(config, opts);\n }\n\n /** Names of platforms with credentials configured. */\n enabledPlatforms(): ProviderName[] {\n const names: ProviderName[] = [];\n if (this.youtube) names.push('youtube');\n if (this.twitter) names.push('twitter');\n if (this.facebook) names.push('facebook');\n if (this.instagram) names.push('instagram');\n if (this.linkedin) names.push('linkedin');\n if (this.reddit) names.push('reddit');\n if (this.tiktok) names.push('tiktok');\n if (this.telegram) names.push('telegram');\n if (this.whatsapp) names.push('whatsapp');\n return names;\n }\n\n /** Capability metadata for a platform. */\n capabilities(platform: ProviderName): ProviderCapabilities | undefined {\n return allCapabilities[platform];\n }\n\n /**\n * Publish to one or more text-friendly platforms.\n *\n * Defaults to all configured platforms whose capabilities include `posting`.\n * Each platform fan-out is independent — failures don't block others.\n */\n async post(input: MultiPostInput): Promise<MultiPostResult> {\n const targets = (input.platforms ?? this.postingTargets()).filter(p => allCapabilities[p]?.posting);\n const results = await Promise.all(targets.map(p => this.postOne(p, input)));\n return { results, allOk: results.every(r => r.ok) };\n }\n\n /**\n * Upload a video to one or more video platforms (YouTube, TikTok, Instagram).\n */\n async upload(input: MultiUploadInput): Promise<MultiPostResult> {\n const targets = (input.platforms ?? this.uploadTargets()).filter(p => allCapabilities[p]?.upload);\n const results = await Promise.all(targets.map(p => this.uploadOne(p, input)));\n return { results, allOk: results.every(r => r.ok) };\n }\n\n /**\n * Send a message via Telegram or WhatsApp.\n */\n async message(input: MessageInput): Promise<MessageResult> {\n if (input.platform === 'telegram') {\n if (!this.telegram) throw new Error('Telegram is not configured');\n return this.telegram.send(input.text, input.to);\n }\n if (!this.whatsapp) throw new Error('WhatsApp is not configured');\n if (input.to === undefined) throw new Error('WhatsApp messages require `to` (E.164 phone number)');\n return this.whatsapp.send(input.text, String(input.to));\n }\n\n // ─── Internal ───────────────────────────────────────────────────────\n\n private async postOne(platform: ProviderName, input: MultiPostInput): Promise<MultiPostResult['results'][number]> {\n switch (platform) {\n case 'twitter': return this.twitter ? this.twitter.post(input) : notConfigured(platform);\n case 'facebook': return this.facebook ? this.facebook.post(input) : notConfigured(platform);\n case 'linkedin': return this.linkedin ? this.linkedin.post(input) : notConfigured(platform);\n case 'instagram': return this.instagram ? this.instagram.post(input) : notConfigured(platform);\n case 'reddit': return this.reddit ? this.reddit.post(input) : notConfigured(platform);\n default: return { platform, ok: false, error: { message: `${platform} does not support post()` } };\n }\n }\n\n private async uploadOne(platform: ProviderName, input: MultiUploadInput): Promise<MultiPostResult['results'][number]> {\n switch (platform) {\n case 'youtube': return this.youtube ? this.youtube.upload(input) : notConfigured(platform);\n case 'tiktok': return this.tiktok ? this.tiktok.upload(input) : notConfigured(platform);\n case 'instagram': {\n if (!this.instagram) return notConfigured('instagram');\n return this.instagram.post({\n text: input.caption ?? input.description,\n media: input.videoUrl ? [{ type: 'video', url: input.videoUrl }] : [],\n });\n }\n default: return { platform, ok: false, error: { message: `${platform} does not support upload()` } };\n }\n }\n\n private postingTargets(): ProviderName[] {\n return this.enabledPlatforms().filter(p => allCapabilities[p]?.posting);\n }\n\n private uploadTargets(): ProviderName[] {\n return this.enabledPlatforms().filter(p => allCapabilities[p]?.upload);\n }\n}\n\nfunction notConfigured(platform: ProviderName): MultiPostResult['results'][number] {\n return { platform, ok: false, error: { message: `${platform} is not configured on this client` } };\n}\n\n// Re-export everything useful from this subpath\nexport type {\n ProviderConfigMap,\n ProviderName,\n SocialClientOptions,\n MultiPostInput,\n MultiPostResult,\n MultiUploadInput,\n UnifiedPostInput,\n UnifiedUploadInput,\n UnifiedMedia,\n PostResult,\n MessageInput,\n MessageResult,\n YouTubeClientConfig,\n TwitterClientConfig,\n FacebookClientConfig,\n InstagramClientConfig,\n LinkedInClientConfig,\n RedditClientConfig,\n TikTokClientConfig,\n TelegramClientConfig,\n WhatsAppClientConfig,\n} from './types.js';\n\nexport { TwitterClient } from './twitter.js';\nexport { FacebookClient } from './facebook.js';\nexport { LinkedInClient } from './linkedin.js';\nexport { RedditClient } from './reddit.js';\nexport { InstagramClient } from './instagram.js';\nexport { YouTubeClient } from './youtube.js';\nexport { TikTokClient } from './tiktok.js';\nexport { TelegramClient } from './telegram.js';\nexport { WhatsAppClient } from './whatsapp.js';\n\nexport { fromEnv } from './env.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA2CA,IAAa,eAAb,MAAa,aAAa;CACxB,AAAS;CACT,AAAS;CACT,AAAS;CACT,AAAS;CACT,AAAS;CACT,AAAS;CACT,AAAS;CACT,AAAS;CACT,AAAS;CAET,YAAY,QAA2B,OAA4B,EAAE,EAAE;AACrE,MAAI,OAAO,QAAS,MAAK,UAAU,IAAI,cAAc,OAAO,SAAS,KAAK;AAC1E,MAAI,OAAO,QAAS,MAAK,UAAU,IAAI,cAAc,OAAO,SAAS,KAAK;AAC1E,MAAI,OAAO,SAAU,MAAK,WAAW,IAAI,eAAe,OAAO,UAAU,KAAK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AAR;GACE,KAAK,UAAa,QAAO,KAAK,UAAY,KAAK,QAAQ,OAAO,MAAM,GAAI,cAAc,SAAS;GAC/F,KAAK,SAAa,QAAO,KAAK,SAAY,KAAK,OAAO,OAAO,MAAM,GAAK,cAAc,SAAS;GAC/F,KAAK;AACH,QAAI,CAAC,KAAK,UAAW,QAAO,cAAc,YAAY;AACtD,WAAO,KAAK,UAAU,KAAK;KACzB,MAAM,MAAM,WAAW,MAAM;KAC7B,OAAO,MAAM,WAAW,CAAC;MAAE,MAAM;MAAS,KAAK,MAAM;MAAU,CAAC,GAAG,EAAE;KACtE,CAAC;GAEJ,QAAS,QAAO;IAAE;IAAU,IAAI;IAAO,OAAO,EAAE,SAAS,GAAG,SAAS,6BAA6B;IAAE;;;CAIxG,AAAQ,iBAAiC;AACvC,SAAO,KAAK,kBAAkB,CAAC,QAAO,MAAK,gBAAgB,IAAI,QAAQ;;CAGzE,AAAQ,gBAAgC;AACtC,SAAO,KAAK,kBAAkB,CAAC,QAAO,MAAK,gBAAgB,IAAI,OAAO;;;AAI1E,SAAS,cAAc,UAA4D;AACjF,QAAO;EAAE;EAAU,IAAI;EAAO,OAAO,EAAE,SAAS,GAAG,SAAS,oCAAoC;EAAE"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as ProviderCapabilities, c as UnifiedPostInput, d as isPostingProvider, f as isUploadingProvider, i as ProviderAuth, l as UploadingProvider, n as MessagingProvider, o as UnifiedMedia, r as PostingProvider, s as UnifiedPost, t as ListPostsOptions, u as isMessagingProvider } from "../contracts-Cdwa4zlg.mjs";
|
|
2
|
+
import { C as HttpMethod, D as RetryConfig, E as ParseError, F as META_TOKEN_URL, M as META_GRAPH_BASE, N as META_GRAPH_VERSION, O as httpRequest, P as META_GRAPH_VIDEO_BASE, S as generateCodeVerifier, T as HttpResponse, _ as buildAuthUrl, a as Page, b as PkceStore, c as paginate, d as metaExchangeLongLived, f as metaRefreshLongLivedFacebook, g as OAuth2RefreshParams, h as OAuth2ExchangeParams, i as pollUntilComplete, j as META_AUTH_URL, l as IG_REFRESH_URL, m as parseGraphError, n as redactSecrets, o as PaginateOptions, p as metaRefreshLongLivedInstagram, r as PollOptions, s as PaginatedIterable, t as assertPublicHttpUrl, u as MetaExchangeParams, v as oauth2ExchangeCode, w as HttpRequestOptions, x as generateCodeChallenge, y as oauth2RefreshToken } from "../security-BXhfebWm.mjs";
|
|
3
|
+
export { type HttpMethod, type HttpRequestOptions, type HttpResponse, IG_REFRESH_URL, type ListPostsOptions, META_AUTH_URL, META_GRAPH_BASE, META_GRAPH_VERSION, META_GRAPH_VIDEO_BASE, META_TOKEN_URL, type MessagingProvider, type MetaExchangeParams, type OAuth2ExchangeParams, type OAuth2RefreshParams, type Page, type PaginateOptions, type PaginatedIterable, type ParseError, PkceStore, type PollOptions, type PostingProvider, type ProviderAuth, type ProviderCapabilities, type RetryConfig, type UnifiedMedia, type UnifiedPost, type UnifiedPostInput, type UploadingProvider, assertPublicHttpUrl, buildAuthUrl, generateCodeChallenge, generateCodeVerifier, httpRequest, isMessagingProvider, isPostingProvider, isUploadingProvider, metaExchangeLongLived, metaRefreshLongLivedFacebook, metaRefreshLongLivedInstagram, oauth2ExchangeCode, oauth2RefreshToken, paginate, parseGraphError, pollUntilComplete, redactSecrets };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { a as parseGraphError, c as META_GRAPH_VERSION, i as metaRefreshLongLivedInstagram, l as META_GRAPH_VIDEO_BASE, n as metaExchangeLongLived, o as META_AUTH_URL, r as metaRefreshLongLivedFacebook, s as META_GRAPH_BASE, t as IG_REFRESH_URL, u as META_TOKEN_URL } from "../meta-D3vcJU1c.mjs";
|
|
2
|
+
import { t as httpRequest } from "../http-DpcLSR1M.mjs";
|
|
3
|
+
import { n as generateCodeChallenge, r as generateCodeVerifier, t as PkceStore } from "../pkce-jq5II68b.mjs";
|
|
4
|
+
import { a as redactSecrets, c as oauth2ExchangeCode, i as assertPublicHttpUrl, l as oauth2RefreshToken, n as isPostingProvider, o as paginate, r as isUploadingProvider, s as buildAuthUrl, t as isMessagingProvider } from "../contracts-lCa069IK.mjs";
|
|
5
|
+
import { t as pollUntilComplete } from "../polling-DZ1apXtA.mjs";
|
|
6
|
+
|
|
7
|
+
export { IG_REFRESH_URL, META_AUTH_URL, META_GRAPH_BASE, META_GRAPH_VERSION, META_GRAPH_VIDEO_BASE, META_TOKEN_URL, PkceStore, assertPublicHttpUrl, buildAuthUrl, generateCodeChallenge, generateCodeVerifier, httpRequest, isMessagingProvider, isPostingProvider, isUploadingProvider, metaExchangeLongLived, metaRefreshLongLivedFacebook, metaRefreshLongLivedInstagram, oauth2ExchangeCode, oauth2RefreshToken, paginate, parseGraphError, pollUntilComplete, redactSecrets };
|