@bernierllc/social-media-manager 1.7.2 → 1.7.3
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/package.json +10 -10
- package/dist/SocialMediaManager.d.ts +0 -104
- package/dist/SocialMediaManager.d.ts.map +0 -1
- package/dist/SocialMediaManager.js +0 -296
- package/dist/SocialMediaManager.js.map +0 -1
- package/dist/content-type/ContentTypeMatching.d.ts +0 -26
- package/dist/content-type/ContentTypeMatching.d.ts.map +0 -1
- package/dist/content-type/ContentTypeMatching.js +0 -113
- package/dist/content-type/ContentTypeMatching.js.map +0 -1
- package/dist/content-type/ContentTypeRegistry.d.ts +0 -25
- package/dist/content-type/ContentTypeRegistry.d.ts.map +0 -1
- package/dist/content-type/ContentTypeRegistry.js +0 -113
- package/dist/content-type/ContentTypeRegistry.js.map +0 -1
- package/dist/content-type/TransformationPipeline.d.ts +0 -50
- package/dist/content-type/TransformationPipeline.d.ts.map +0 -1
- package/dist/content-type/TransformationPipeline.js +0 -169
- package/dist/content-type/TransformationPipeline.js.map +0 -1
- package/dist/errors.d.ts +0 -12
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -21
- package/dist/errors.js.map +0 -1
- package/dist/index.d.ts +0 -13
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -18
- package/dist/index.js.map +0 -1
- package/dist/orchestration/MultiPlatformOrchestrator.d.ts +0 -37
- package/dist/orchestration/MultiPlatformOrchestrator.d.ts.map +0 -1
- package/dist/orchestration/MultiPlatformOrchestrator.js +0 -167
- package/dist/orchestration/MultiPlatformOrchestrator.js.map +0 -1
- package/dist/platforms/ConnectionManager.d.ts +0 -31
- package/dist/platforms/ConnectionManager.d.ts.map +0 -1
- package/dist/platforms/ConnectionManager.js +0 -136
- package/dist/platforms/ConnectionManager.js.map +0 -1
- package/dist/platforms/PlatformRegistry.d.ts +0 -73
- package/dist/platforms/PlatformRegistry.d.ts.map +0 -1
- package/dist/platforms/PlatformRegistry.js +0 -93
- package/dist/platforms/PlatformRegistry.js.map +0 -1
- package/dist/scheduling/JitterCalculator.d.ts +0 -37
- package/dist/scheduling/JitterCalculator.d.ts.map +0 -1
- package/dist/scheduling/JitterCalculator.js +0 -93
- package/dist/scheduling/JitterCalculator.js.map +0 -1
- package/dist/scheduling/ScheduleManager.d.ts +0 -48
- package/dist/scheduling/ScheduleManager.d.ts.map +0 -1
- package/dist/scheduling/ScheduleManager.js +0 -125
- package/dist/scheduling/ScheduleManager.js.map +0 -1
- package/dist/types.d.ts +0 -214
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -9
- package/dist/types.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bernierllc/social-media-manager",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.3",
|
|
4
4
|
"description": "Platform-agnostic social media orchestration service for multi-platform posting with content transformation and scheduling",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -50,22 +50,22 @@
|
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"date-fns": "^3.6.0",
|
|
52
52
|
"uuid": "^11.1.1",
|
|
53
|
+
"@bernierllc/logger": "^2.0.0",
|
|
53
54
|
"@bernierllc/neverhub-adapter": "^0.4.1",
|
|
54
|
-
"@bernierllc/retry-manager": "^3.0.
|
|
55
|
-
"@bernierllc/scheduler-service": "^3.0.4",
|
|
56
|
-
"@bernierllc/social-media-bluesky": "^2.0.1",
|
|
57
|
-
"@bernierllc/social-media-content-type-bluesky": "^1.4.0",
|
|
55
|
+
"@bernierllc/retry-manager": "^3.0.4",
|
|
58
56
|
"@bernierllc/social-media-content-type-facebook": "^1.4.0",
|
|
57
|
+
"@bernierllc/scheduler-service": "^3.0.5",
|
|
59
58
|
"@bernierllc/social-media-content-type-instagram": "^1.6.0",
|
|
59
|
+
"@bernierllc/social-media-bluesky": "^2.0.1",
|
|
60
|
+
"@bernierllc/social-media-content-type-bluesky": "^1.4.0",
|
|
60
61
|
"@bernierllc/social-media-content-type-linkedin": "^1.6.0",
|
|
61
62
|
"@bernierllc/social-media-content-type-mastodon": "^1.4.0",
|
|
62
|
-
"@bernierllc/
|
|
63
|
+
"@bernierllc/social-media-content-type-twitter": "^1.4.0",
|
|
63
64
|
"@bernierllc/social-media-instagram": "^2.0.1",
|
|
64
|
-
"@bernierllc/social-media-linkedin": "^2.0.1",
|
|
65
|
-
"@bernierllc/social-media-twitter": "^2.0.1",
|
|
66
65
|
"@bernierllc/social-media-facebook": "^2.0.1",
|
|
67
|
-
"@bernierllc/social-media-
|
|
68
|
-
"@bernierllc/social-media-mastodon": "^2.0.1"
|
|
66
|
+
"@bernierllc/social-media-linkedin": "^2.0.1",
|
|
67
|
+
"@bernierllc/social-media-mastodon": "^2.0.1",
|
|
68
|
+
"@bernierllc/social-media-twitter": "^2.0.1"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@jest/globals": "^29.7.0",
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import type { SocialMediaManagerConfig, MultiPlatformPostRequest, MultiPlatformPostResult, SchedulePostRequest, SchedulePostResult, ScheduledPost, ScheduleFilters, PlatformConnection, PlatformConnectionTest, ValidationResult, GenericSocialContent, PlatformStatus, BatchPostRequest, BatchPostResult, BatchScheduleResult } from './types.js';
|
|
2
|
-
export declare class SocialMediaManager {
|
|
3
|
-
private platformRegistry;
|
|
4
|
-
private connectionManager;
|
|
5
|
-
private transformationPipeline;
|
|
6
|
-
private jitterCalculator;
|
|
7
|
-
private scheduleManager;
|
|
8
|
-
private orchestrator;
|
|
9
|
-
private config;
|
|
10
|
-
private readonly neverhub;
|
|
11
|
-
constructor(config: SocialMediaManagerConfig);
|
|
12
|
-
/**
|
|
13
|
-
* Register this manager with NeverHub service discovery.
|
|
14
|
-
*
|
|
15
|
-
* Optional to call — every method below works without it. Skips entirely when
|
|
16
|
-
* `neverhubConfig.enabled` is false, and no-ops when NeverHub is unreachable,
|
|
17
|
-
* so this never throws for a missing NeverHub.
|
|
18
|
-
*/
|
|
19
|
-
initialize(): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* Initialize platforms from configuration
|
|
22
|
-
*/
|
|
23
|
-
private initializePlatforms;
|
|
24
|
-
/**
|
|
25
|
-
* Post to all connected platforms
|
|
26
|
-
*/
|
|
27
|
-
postToAll(request: MultiPlatformPostRequest): Promise<MultiPlatformPostResult>;
|
|
28
|
-
/**
|
|
29
|
-
* Post to specific platforms
|
|
30
|
-
*/
|
|
31
|
-
postToPlatforms(platforms: string[], request: MultiPlatformPostRequest): Promise<MultiPlatformPostResult>;
|
|
32
|
-
/**
|
|
33
|
-
* Schedule a post
|
|
34
|
-
*/
|
|
35
|
-
schedulePost(request: SchedulePostRequest): Promise<SchedulePostResult>;
|
|
36
|
-
/**
|
|
37
|
-
* Schedule post with jitter
|
|
38
|
-
*/
|
|
39
|
-
scheduleWithJitter(request: SchedulePostRequest, jitter: SchedulePostRequest['jitter']): Promise<SchedulePostResult>;
|
|
40
|
-
/**
|
|
41
|
-
* Cancel a scheduled post
|
|
42
|
-
*/
|
|
43
|
-
cancelScheduledPost(scheduleId: string): Promise<boolean>;
|
|
44
|
-
/**
|
|
45
|
-
* List scheduled posts
|
|
46
|
-
*/
|
|
47
|
-
listScheduledPosts(filters?: ScheduleFilters): Promise<ScheduledPost[]>;
|
|
48
|
-
/**
|
|
49
|
-
* Connect to a platform
|
|
50
|
-
*/
|
|
51
|
-
connectPlatform(platform: string, credentials: unknown): Promise<PlatformConnection>;
|
|
52
|
-
/**
|
|
53
|
-
* Disconnect from a platform
|
|
54
|
-
*/
|
|
55
|
-
disconnectPlatform(platform: string): Promise<boolean>;
|
|
56
|
-
/**
|
|
57
|
-
* List connected platforms
|
|
58
|
-
*/
|
|
59
|
-
listConnectedPlatforms(): Promise<PlatformConnection[]>;
|
|
60
|
-
/**
|
|
61
|
-
* Test platform connection
|
|
62
|
-
*/
|
|
63
|
-
testPlatformConnection(platform: string): Promise<PlatformConnectionTest>;
|
|
64
|
-
/**
|
|
65
|
-
* Transform generic content to platform-specific format
|
|
66
|
-
*/
|
|
67
|
-
transformContent(sourceContent: GenericSocialContent, targetPlatform: string): Promise<unknown>;
|
|
68
|
-
/**
|
|
69
|
-
* Validate content for a platform
|
|
70
|
-
*/
|
|
71
|
-
validateContentForPlatform(content: GenericSocialContent, platform: string): Promise<ValidationResult>;
|
|
72
|
-
/**
|
|
73
|
-
* Optimize content for a platform
|
|
74
|
-
*/
|
|
75
|
-
optimizeForPlatform(content: GenericSocialContent, platform: string): Promise<unknown>;
|
|
76
|
-
/**
|
|
77
|
-
* Post batch of requests
|
|
78
|
-
*/
|
|
79
|
-
postBatch(request: BatchPostRequest): Promise<BatchPostResult>;
|
|
80
|
-
/**
|
|
81
|
-
* Schedule batch of posts
|
|
82
|
-
*/
|
|
83
|
-
scheduleBatch(requests: SchedulePostRequest[]): Promise<BatchScheduleResult>;
|
|
84
|
-
/**
|
|
85
|
-
* Get platform status
|
|
86
|
-
*/
|
|
87
|
-
getPlatformStatus(): Promise<Record<string, PlatformStatus>>;
|
|
88
|
-
/**
|
|
89
|
-
* Get schedule statistics
|
|
90
|
-
*/
|
|
91
|
-
getScheduleStatistics(): {
|
|
92
|
-
total: number;
|
|
93
|
-
pending: number;
|
|
94
|
-
posted: number;
|
|
95
|
-
partial: number;
|
|
96
|
-
failed: number;
|
|
97
|
-
cancelled: number;
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* Clean up old scheduled posts
|
|
101
|
-
*/
|
|
102
|
-
cleanupOldScheduledPosts(olderThanDays?: number): number;
|
|
103
|
-
}
|
|
104
|
-
//# sourceMappingURL=SocialMediaManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SocialMediaManager.d.ts","sourceRoot":"","sources":["../src/SocialMediaManager.ts"],"names":[],"mappings":"AAiBA,OAAO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O,CAAC,aAAa,EAAE,CAAC;IAI7E;;OAEG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAI1F;;OAEG;IACG,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAI5D;;OAEG;IACG,sBAAsB,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAI7D;;OAEG;IACG,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAI/E;;OAEG;IACG,gBAAgB,CACpB,aAAa,EAAE,oBAAoB,EACnC,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,OAAO,CAAC;IAInB;;OAEG;IACG,0BAA0B,CAC9B,OAAO,EAAE,oBAAoB,EAC7B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,gBAAgB,CAAC;IAI5B;;OAEG;IACG,mBAAmB,CACvB,OAAO,EAAE,oBAAoB,EAC7B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,CAAC;IAKnB;;OAEG;IACG,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;IAwCpE;;OAEG;IACG,aAAa,CAAC,QAAQ,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAiClF;;OAEG;IACG,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IA2BlE;;OAEG;IACH,qBAAqB;;;;;;;;IAIrB;;OAEG;IACH,wBAAwB,CAAC,aAAa,SAAK,GAAG,MAAM;CAGrD"}
|
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (c) 2025 Bernier LLC
|
|
3
|
-
|
|
4
|
-
This file is licensed to the client under a limited-use license.
|
|
5
|
-
The client may use and modify this code *only within the scope of the project it was delivered for*.
|
|
6
|
-
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
7
|
-
*/
|
|
8
|
-
import { createRequire } from 'node:module';
|
|
9
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
10
|
-
import { NeverHubAdapter } from '@bernierllc/neverhub-adapter';
|
|
11
|
-
import { PlatformRegistry } from './platforms/PlatformRegistry.js';
|
|
12
|
-
import { ConnectionManager } from './platforms/ConnectionManager.js';
|
|
13
|
-
import { ContentTransformationPipeline } from './content-type/TransformationPipeline.js';
|
|
14
|
-
import { JitterCalculator } from './scheduling/JitterCalculator.js';
|
|
15
|
-
import { ScheduleManager } from './scheduling/ScheduleManager.js';
|
|
16
|
-
import { MultiPlatformOrchestrator } from './orchestration/MultiPlatformOrchestrator.js';
|
|
17
|
-
// ponytail: read the version at runtime instead of hardcoding it — lerna bumps
|
|
18
|
-
// package.json from conventional commits, so any literal here drifts silently.
|
|
19
|
-
const { version: PACKAGE_VERSION } = createRequire(import.meta.url)('../package.json');
|
|
20
|
-
export class SocialMediaManager {
|
|
21
|
-
platformRegistry;
|
|
22
|
-
connectionManager;
|
|
23
|
-
transformationPipeline;
|
|
24
|
-
jitterCalculator;
|
|
25
|
-
scheduleManager;
|
|
26
|
-
orchestrator;
|
|
27
|
-
config;
|
|
28
|
-
neverhub;
|
|
29
|
-
constructor(config) {
|
|
30
|
-
this.config = config;
|
|
31
|
-
this.platformRegistry = new PlatformRegistry();
|
|
32
|
-
this.connectionManager = new ConnectionManager(this.platformRegistry);
|
|
33
|
-
this.transformationPipeline = new ContentTransformationPipeline();
|
|
34
|
-
this.jitterCalculator = new JitterCalculator();
|
|
35
|
-
this.scheduleManager = new ScheduleManager();
|
|
36
|
-
this.orchestrator = new MultiPlatformOrchestrator(this.platformRegistry, this.transformationPipeline);
|
|
37
|
-
// `neverhubConfig.baseUrl` is the caller's override; the adapter falls back to
|
|
38
|
-
// its own env/default resolution when it is absent.
|
|
39
|
-
this.neverhub = new NeverHubAdapter(config.neverhubConfig?.baseUrl ? { apiUrl: config.neverhubConfig.baseUrl } : {});
|
|
40
|
-
// Initialize platforms from config
|
|
41
|
-
this.initializePlatforms();
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Register this manager with NeverHub service discovery.
|
|
45
|
-
*
|
|
46
|
-
* Optional to call — every method below works without it. Skips entirely when
|
|
47
|
-
* `neverhubConfig.enabled` is false, and no-ops when NeverHub is unreachable,
|
|
48
|
-
* so this never throws for a missing NeverHub.
|
|
49
|
-
*/
|
|
50
|
-
async initialize() {
|
|
51
|
-
if (this.config.neverhubConfig?.enabled === false) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
await this.neverhub.register({
|
|
55
|
-
type: 'service',
|
|
56
|
-
name: '@bernierllc/social-media-manager',
|
|
57
|
-
version: PACKAGE_VERSION,
|
|
58
|
-
capabilities: [
|
|
59
|
-
{ type: 'social', name: 'multi-platform-publishing', version: '1.0.0' },
|
|
60
|
-
{ type: 'social', name: 'post-scheduling', version: '1.0.0' },
|
|
61
|
-
],
|
|
62
|
-
dependencies: ['@bernierllc/neverhub-adapter'],
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Initialize platforms from configuration
|
|
67
|
-
*/
|
|
68
|
-
initializePlatforms() {
|
|
69
|
-
// In a real implementation, this would create actual platform adapters
|
|
70
|
-
// For now, we just store the configs
|
|
71
|
-
const platformNames = ['twitter', 'linkedin', 'facebook', 'instagram', 'mastodon', 'bluesky'];
|
|
72
|
-
for (const name of platformNames) {
|
|
73
|
-
const platformConfig = this.config.platforms[name];
|
|
74
|
-
if (platformConfig) {
|
|
75
|
-
// Store config for later use
|
|
76
|
-
// Actual adapter registration would happen here
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Post to all connected platforms
|
|
82
|
-
*/
|
|
83
|
-
async postToAll(request) {
|
|
84
|
-
return this.orchestrator.postToAll(request);
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Post to specific platforms
|
|
88
|
-
*/
|
|
89
|
-
async postToPlatforms(platforms, request) {
|
|
90
|
-
return this.orchestrator.postToPlatforms(platforms, request);
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Schedule a post
|
|
94
|
-
*/
|
|
95
|
-
async schedulePost(request) {
|
|
96
|
-
const jitter = request.jitter || this.config.schedulerConfig?.defaultJitter;
|
|
97
|
-
// Calculate scheduled times with jitter
|
|
98
|
-
const scheduledTimes = {};
|
|
99
|
-
const platformScheduleIds = {};
|
|
100
|
-
for (const platform of request.platforms) {
|
|
101
|
-
if (jitter?.enabled) {
|
|
102
|
-
scheduledTimes[platform] = this.jitterCalculator.calculateJitteredTime(request.scheduledTime, jitter);
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
scheduledTimes[platform] = request.scheduledTime;
|
|
106
|
-
}
|
|
107
|
-
platformScheduleIds[platform] = uuidv4();
|
|
108
|
-
}
|
|
109
|
-
// Add to schedule manager
|
|
110
|
-
const scheduleId = this.scheduleManager.addScheduledPost({
|
|
111
|
-
platforms: request.platforms,
|
|
112
|
-
content: request.content,
|
|
113
|
-
scheduledTime: request.scheduledTime,
|
|
114
|
-
actualScheduledTimes: scheduledTimes,
|
|
115
|
-
status: 'pending',
|
|
116
|
-
});
|
|
117
|
-
return {
|
|
118
|
-
success: true,
|
|
119
|
-
scheduleId,
|
|
120
|
-
scheduledTimes,
|
|
121
|
-
platformScheduleIds,
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Schedule post with jitter
|
|
126
|
-
*/
|
|
127
|
-
async scheduleWithJitter(request, jitter) {
|
|
128
|
-
return this.schedulePost({
|
|
129
|
-
...request,
|
|
130
|
-
jitter,
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Cancel a scheduled post
|
|
135
|
-
*/
|
|
136
|
-
async cancelScheduledPost(scheduleId) {
|
|
137
|
-
return this.scheduleManager.cancelScheduledPost(scheduleId);
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* List scheduled posts
|
|
141
|
-
*/
|
|
142
|
-
async listScheduledPosts(filters) {
|
|
143
|
-
return this.scheduleManager.listScheduledPosts(filters);
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Connect to a platform
|
|
147
|
-
*/
|
|
148
|
-
async connectPlatform(platform, credentials) {
|
|
149
|
-
return this.connectionManager.connectPlatform(platform, credentials);
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Disconnect from a platform
|
|
153
|
-
*/
|
|
154
|
-
async disconnectPlatform(platform) {
|
|
155
|
-
return this.connectionManager.disconnectPlatform(platform);
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* List connected platforms
|
|
159
|
-
*/
|
|
160
|
-
async listConnectedPlatforms() {
|
|
161
|
-
return this.connectionManager.listConnectedPlatforms();
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Test platform connection
|
|
165
|
-
*/
|
|
166
|
-
async testPlatformConnection(platform) {
|
|
167
|
-
return this.connectionManager.testPlatformConnection(platform);
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Transform generic content to platform-specific format
|
|
171
|
-
*/
|
|
172
|
-
async transformContent(sourceContent, targetPlatform) {
|
|
173
|
-
return this.transformationPipeline.transform(sourceContent, targetPlatform);
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Validate content for a platform
|
|
177
|
-
*/
|
|
178
|
-
async validateContentForPlatform(content, platform) {
|
|
179
|
-
return this.transformationPipeline.validate(content, platform);
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Optimize content for a platform
|
|
183
|
-
*/
|
|
184
|
-
async optimizeForPlatform(content, platform) {
|
|
185
|
-
// Transform and validate
|
|
186
|
-
return this.transformationPipeline.transform(content, platform);
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Post batch of requests
|
|
190
|
-
*/
|
|
191
|
-
async postBatch(request) {
|
|
192
|
-
const results = [];
|
|
193
|
-
if (request.parallelExecution) {
|
|
194
|
-
// Execute in parallel with concurrency limit
|
|
195
|
-
const maxConcurrency = request.maxConcurrency || 5;
|
|
196
|
-
const chunks = [];
|
|
197
|
-
for (let i = 0; i < request.requests.length; i += maxConcurrency) {
|
|
198
|
-
chunks.push(request.requests.slice(i, i + maxConcurrency));
|
|
199
|
-
}
|
|
200
|
-
for (const chunk of chunks) {
|
|
201
|
-
const chunkResults = await Promise.all(chunk.map((req) => this.postToPlatforms(req.platforms, req)));
|
|
202
|
-
results.push(...chunkResults);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
// Execute sequentially
|
|
207
|
-
for (const req of request.requests) {
|
|
208
|
-
const result = await this.postToPlatforms(req.platforms, req);
|
|
209
|
-
results.push(result);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
// Calculate summary
|
|
213
|
-
const summary = {
|
|
214
|
-
total: results.length,
|
|
215
|
-
successful: results.filter((r) => r.success).length,
|
|
216
|
-
failed: results.filter((r) => !r.success).length,
|
|
217
|
-
};
|
|
218
|
-
return {
|
|
219
|
-
success: summary.failed === 0,
|
|
220
|
-
results,
|
|
221
|
-
summary,
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Schedule batch of posts
|
|
226
|
-
*/
|
|
227
|
-
async scheduleBatch(requests) {
|
|
228
|
-
const results = [];
|
|
229
|
-
for (const request of requests) {
|
|
230
|
-
try {
|
|
231
|
-
const result = await this.schedulePost(request);
|
|
232
|
-
results.push(result);
|
|
233
|
-
}
|
|
234
|
-
catch (error) {
|
|
235
|
-
results.push({
|
|
236
|
-
success: false,
|
|
237
|
-
scheduleId: '',
|
|
238
|
-
scheduledTimes: {},
|
|
239
|
-
platformScheduleIds: {},
|
|
240
|
-
errors: {
|
|
241
|
-
general: error instanceof Error ? error.message : 'Unknown error',
|
|
242
|
-
},
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
const summary = {
|
|
247
|
-
total: results.length,
|
|
248
|
-
successful: results.filter((r) => r.success).length,
|
|
249
|
-
failed: results.filter((r) => !r.success).length,
|
|
250
|
-
};
|
|
251
|
-
return {
|
|
252
|
-
success: summary.failed === 0,
|
|
253
|
-
results,
|
|
254
|
-
summary,
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Get platform status
|
|
259
|
-
*/
|
|
260
|
-
async getPlatformStatus() {
|
|
261
|
-
const platforms = this.platformRegistry.getRegisteredPlatforms();
|
|
262
|
-
const status = {};
|
|
263
|
-
for (const platform of platforms) {
|
|
264
|
-
const connection = this.platformRegistry.getConnection(platform);
|
|
265
|
-
const adapter = this.platformRegistry.getPlatform(platform);
|
|
266
|
-
let healthy = false;
|
|
267
|
-
if (adapter && connection?.connected) {
|
|
268
|
-
try {
|
|
269
|
-
const testResult = await adapter.testConnection();
|
|
270
|
-
healthy = testResult.healthy;
|
|
271
|
-
}
|
|
272
|
-
catch {
|
|
273
|
-
healthy = false;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
status[platform] = {
|
|
277
|
-
connected: connection?.connected ?? false,
|
|
278
|
-
healthy,
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
return status;
|
|
282
|
-
}
|
|
283
|
-
/**
|
|
284
|
-
* Get schedule statistics
|
|
285
|
-
*/
|
|
286
|
-
getScheduleStatistics() {
|
|
287
|
-
return this.scheduleManager.getStatistics();
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Clean up old scheduled posts
|
|
291
|
-
*/
|
|
292
|
-
cleanupOldScheduledPosts(olderThanDays = 30) {
|
|
293
|
-
return this.scheduleManager.cleanupOldPosts(olderThanDays);
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
//# sourceMappingURL=SocialM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zC,OAAO;aACR,CAAC;QACJ,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,qBAAqB;QACnB,OAAO,IAAI,CAAC,eAAe,CAAC,aAAa,EAAE,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,wBAAwB,CAAC,aAAa,GAAG,EAAE;QACzC,OAAO,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;IAC7D,CAAC;CACF"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { ValidationResult } from '../types.js';
|
|
2
|
-
export declare class ContentTypeMatching {
|
|
3
|
-
private registry;
|
|
4
|
-
constructor();
|
|
5
|
-
/**
|
|
6
|
-
* Find compatible target types for a source type
|
|
7
|
-
*/
|
|
8
|
-
findCompatibleTypes(sourceType: string): Promise<string[]>;
|
|
9
|
-
/**
|
|
10
|
-
* Check if source type is compatible with accepted types
|
|
11
|
-
*/
|
|
12
|
-
private isCompatible;
|
|
13
|
-
/**
|
|
14
|
-
* Get transformation pipeline for converting source to target
|
|
15
|
-
*/
|
|
16
|
-
getTransformationPipeline(sourceType: string, targetType: string): Promise<string[]>;
|
|
17
|
-
/**
|
|
18
|
-
* Validate content against platform constraints
|
|
19
|
-
*/
|
|
20
|
-
validateForPlatform(content: unknown, platform: string): Promise<ValidationResult>;
|
|
21
|
-
/**
|
|
22
|
-
* Get supported platforms for a source type
|
|
23
|
-
*/
|
|
24
|
-
getSupportedPlatforms(sourceType: string): Promise<string[]>;
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=ContentTypeMatching.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ContentTypeMatching.d.ts","sourceRoot":"","sources":["../../src/content-type/ContentTypeMatching.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAsB;;IAMtC;;OAEG;IACG,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAYhE;;OAEG;IACH,OAAO,CAAC,YAAY;IAIpB;;OAEG;IACG,yBAAyB,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAe1F;;OAEG;IACG,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA4ExF;;OAEG;IACG,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAMnE"}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (c) 2025 Bernier LLC
|
|
3
|
-
|
|
4
|
-
This file is licensed to the client under a limited-use license.
|
|
5
|
-
The client may use and modify this code *only within the scope of the project it was delivered for*.
|
|
6
|
-
Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
|
|
7
|
-
*/
|
|
8
|
-
import { ContentTypeRegistry, CONTENT_TYPE_REGISTRY } from './ContentTypeRegistry.js';
|
|
9
|
-
export class ContentTypeMatching {
|
|
10
|
-
registry;
|
|
11
|
-
constructor() {
|
|
12
|
-
this.registry = new ContentTypeRegistry();
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Find compatible target types for a source type
|
|
16
|
-
*/
|
|
17
|
-
async findCompatibleTypes(sourceType) {
|
|
18
|
-
const compatibleTypes = [];
|
|
19
|
-
for (const [targetType, config] of Object.entries(CONTENT_TYPE_REGISTRY)) {
|
|
20
|
-
if (this.isCompatible(sourceType, config.accepts)) {
|
|
21
|
-
compatibleTypes.push(targetType);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return compatibleTypes;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Check if source type is compatible with accepted types
|
|
28
|
-
*/
|
|
29
|
-
isCompatible(sourceType, accepts) {
|
|
30
|
-
return accepts.includes(sourceType) || accepts.includes('*');
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Get transformation pipeline for converting source to target
|
|
34
|
-
*/
|
|
35
|
-
async getTransformationPipeline(sourceType, targetType) {
|
|
36
|
-
const targetConfig = CONTENT_TYPE_REGISTRY[targetType];
|
|
37
|
-
if (!targetConfig) {
|
|
38
|
-
return [];
|
|
39
|
-
}
|
|
40
|
-
if (!this.isCompatible(sourceType, targetConfig.accepts)) {
|
|
41
|
-
throw new Error(`Source type '${sourceType}' is not compatible with target type '${targetType}'`);
|
|
42
|
-
}
|
|
43
|
-
return targetConfig.transformations || [];
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Validate content against platform constraints
|
|
47
|
-
*/
|
|
48
|
-
async validateForPlatform(content, platform) {
|
|
49
|
-
const constraints = this.registry.getConstraints(platform);
|
|
50
|
-
if (!constraints) {
|
|
51
|
-
return {
|
|
52
|
-
valid: true,
|
|
53
|
-
errors: [],
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
const errors = [];
|
|
57
|
-
const warnings = [];
|
|
58
|
-
// Type guard to ensure content is an object
|
|
59
|
-
if (typeof content !== 'object' || content === null) {
|
|
60
|
-
errors.push('Content must be an object');
|
|
61
|
-
return { valid: false, errors, warnings };
|
|
62
|
-
}
|
|
63
|
-
const contentObj = content;
|
|
64
|
-
// Validate text length
|
|
65
|
-
if (typeof constraints.maxTextLength === 'number' && typeof contentObj.text === 'string') {
|
|
66
|
-
if (contentObj.text.length > constraints.maxTextLength) {
|
|
67
|
-
errors.push(`Text exceeds maximum length of ${constraints.maxTextLength} characters (current: ${contentObj.text.length})`);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
// Validate image count
|
|
71
|
-
if (typeof constraints.maxImages === 'number' && Array.isArray(contentObj.images)) {
|
|
72
|
-
if (contentObj.images.length > constraints.maxImages) {
|
|
73
|
-
errors.push(`Too many images (max: ${constraints.maxImages}, current: ${contentObj.images.length})`);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
// Validate video count
|
|
77
|
-
if (typeof constraints.maxVideos === 'number' && contentObj.video) {
|
|
78
|
-
const videoCount = Array.isArray(contentObj.video) ? contentObj.video.length : 1;
|
|
79
|
-
if (videoCount > constraints.maxVideos) {
|
|
80
|
-
errors.push(`Too many videos (max: ${constraints.maxVideos}, current: ${videoCount})`);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
// Validate hashtag count
|
|
84
|
-
if (typeof constraints.maxHashtags === 'number' && Array.isArray(contentObj.hashtags)) {
|
|
85
|
-
if (contentObj.hashtags.length > constraints.maxHashtags) {
|
|
86
|
-
warnings.push(`Many hashtags (max recommended: ${constraints.maxHashtags}, current: ${contentObj.hashtags.length})`);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
// Check if media is required (Instagram)
|
|
90
|
-
if (constraints.requiresMedia === true) {
|
|
91
|
-
const hasMedia = (Array.isArray(contentObj.images) && contentObj.images.length > 0) ||
|
|
92
|
-
contentObj.video !== undefined;
|
|
93
|
-
if (!hasMedia) {
|
|
94
|
-
errors.push(`${platform} requires at least one image or video`);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return {
|
|
98
|
-
valid: errors.length === 0,
|
|
99
|
-
errors,
|
|
100
|
-
warnings,
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Get supported platforms for a source type
|
|
105
|
-
*/
|
|
106
|
-
async getSupportedPlatforms(sourceType) {
|
|
107
|
-
const compatibleTypes = await this.findCompatibleTypes(sourceType);
|
|
108
|
-
return compatibleTypes
|
|
109
|
-
.filter((type) => type.startsWith('social-media-content:'))
|
|
110
|
-
.map((type) => type.replace('social-media-content:', ''));
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
//# sourceMappingURL=ContentTypeMatching.js.map
|
|
@@ -1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C;QAED,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;YAC1B,MAAM;YACN,QAAQ;SACT,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,qBAAqB,CAAC,UAAkB;QAC5C,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;QACnE,OAAO,eAAe;aACnB,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAC;aAC1D,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAC,CAAC;IAC9D,CAAC;CACF"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { ContentTypeRegistryEntry } from '../types.js';
|
|
2
|
-
export declare const CONTENT_TYPE_REGISTRY: Record<string, ContentTypeRegistryEntry>;
|
|
3
|
-
export declare class ContentTypeRegistry {
|
|
4
|
-
/**
|
|
5
|
-
* Get registry entry for a content type
|
|
6
|
-
*/
|
|
7
|
-
getEntry(contentType: string): ContentTypeRegistryEntry | undefined;
|
|
8
|
-
/**
|
|
9
|
-
* Get all registered content types
|
|
10
|
-
*/
|
|
11
|
-
getAllTypes(): string[];
|
|
12
|
-
/**
|
|
13
|
-
* Check if a content type exists in the registry
|
|
14
|
-
*/
|
|
15
|
-
hasType(contentType: string): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Get constraints for a platform
|
|
18
|
-
*/
|
|
19
|
-
getConstraints(platform: string): Record<string, unknown> | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* Get transformations for a platform
|
|
22
|
-
*/
|
|
23
|
-
getTransformations(platform: string): string[];
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=ContentTypeRegistry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ContentTypeRegistry.d.ts","sourceRoot":"","sources":["../../src/content-type/ContentTypeRegistry.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAE5D,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAsE1E,CAAC;AAEF,qBAAa,mBAAmB;IAC9B;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,wBAAwB,GAAG,SAAS;IAInE;;OAEG;IACH,WAAW,IAAI,MAAM,EAAE;IAIvB;;OAEG;IACH,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO;IAIrC;;OAEG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;IAKrE;;OAEG;IACH,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE;CAI/C"}
|