@bernierllc/social-media-manager 1.0.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.
Files changed (46) hide show
  1. package/README.md +407 -0
  2. package/dist/SocialMediaManager.d.ts +95 -0
  3. package/dist/SocialMediaManager.d.ts.map +1 -0
  4. package/dist/SocialMediaManager.js +265 -0
  5. package/dist/SocialMediaManager.js.map +1 -0
  6. package/dist/content-type/ContentTypeMatching.d.ts +26 -0
  7. package/dist/content-type/ContentTypeMatching.d.ts.map +1 -0
  8. package/dist/content-type/ContentTypeMatching.js +113 -0
  9. package/dist/content-type/ContentTypeMatching.js.map +1 -0
  10. package/dist/content-type/ContentTypeRegistry.d.ts +25 -0
  11. package/dist/content-type/ContentTypeRegistry.d.ts.map +1 -0
  12. package/dist/content-type/ContentTypeRegistry.js +113 -0
  13. package/dist/content-type/ContentTypeRegistry.js.map +1 -0
  14. package/dist/content-type/TransformationPipeline.d.ts +50 -0
  15. package/dist/content-type/TransformationPipeline.d.ts.map +1 -0
  16. package/dist/content-type/TransformationPipeline.js +169 -0
  17. package/dist/content-type/TransformationPipeline.js.map +1 -0
  18. package/dist/index.d.ts +12 -0
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +17 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/orchestration/MultiPlatformOrchestrator.d.ts +37 -0
  23. package/dist/orchestration/MultiPlatformOrchestrator.d.ts.map +1 -0
  24. package/dist/orchestration/MultiPlatformOrchestrator.js +167 -0
  25. package/dist/orchestration/MultiPlatformOrchestrator.js.map +1 -0
  26. package/dist/platforms/ConnectionManager.d.ts +31 -0
  27. package/dist/platforms/ConnectionManager.d.ts.map +1 -0
  28. package/dist/platforms/ConnectionManager.js +136 -0
  29. package/dist/platforms/ConnectionManager.js.map +1 -0
  30. package/dist/platforms/PlatformRegistry.d.ts +73 -0
  31. package/dist/platforms/PlatformRegistry.d.ts.map +1 -0
  32. package/dist/platforms/PlatformRegistry.js +93 -0
  33. package/dist/platforms/PlatformRegistry.js.map +1 -0
  34. package/dist/scheduling/JitterCalculator.d.ts +37 -0
  35. package/dist/scheduling/JitterCalculator.d.ts.map +1 -0
  36. package/dist/scheduling/JitterCalculator.js +93 -0
  37. package/dist/scheduling/JitterCalculator.js.map +1 -0
  38. package/dist/scheduling/ScheduleManager.d.ts +48 -0
  39. package/dist/scheduling/ScheduleManager.d.ts.map +1 -0
  40. package/dist/scheduling/ScheduleManager.js +125 -0
  41. package/dist/scheduling/ScheduleManager.js.map +1 -0
  42. package/dist/types.d.ts +214 -0
  43. package/dist/types.d.ts.map +1 -0
  44. package/dist/types.js +9 -0
  45. package/dist/types.js.map +1 -0
  46. package/package.json +92 -0
@@ -0,0 +1,265 @@
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 { v4 as uuidv4 } from 'uuid';
9
+ import { PlatformRegistry } from './platforms/PlatformRegistry.js';
10
+ import { ConnectionManager } from './platforms/ConnectionManager.js';
11
+ import { ContentTransformationPipeline } from './content-type/TransformationPipeline.js';
12
+ import { JitterCalculator } from './scheduling/JitterCalculator.js';
13
+ import { ScheduleManager } from './scheduling/ScheduleManager.js';
14
+ import { MultiPlatformOrchestrator } from './orchestration/MultiPlatformOrchestrator.js';
15
+ export class SocialMediaManager {
16
+ platformRegistry;
17
+ connectionManager;
18
+ transformationPipeline;
19
+ jitterCalculator;
20
+ scheduleManager;
21
+ orchestrator;
22
+ config;
23
+ constructor(config) {
24
+ this.config = config;
25
+ this.platformRegistry = new PlatformRegistry();
26
+ this.connectionManager = new ConnectionManager(this.platformRegistry);
27
+ this.transformationPipeline = new ContentTransformationPipeline();
28
+ this.jitterCalculator = new JitterCalculator();
29
+ this.scheduleManager = new ScheduleManager();
30
+ this.orchestrator = new MultiPlatformOrchestrator(this.platformRegistry, this.transformationPipeline);
31
+ // Initialize platforms from config
32
+ this.initializePlatforms();
33
+ }
34
+ /**
35
+ * Initialize platforms from configuration
36
+ */
37
+ initializePlatforms() {
38
+ // In a real implementation, this would create actual platform adapters
39
+ // For now, we just store the configs
40
+ const platformNames = ['twitter', 'linkedin', 'facebook', 'instagram', 'mastodon', 'bluesky'];
41
+ for (const name of platformNames) {
42
+ const platformConfig = this.config.platforms[name];
43
+ if (platformConfig) {
44
+ // Store config for later use
45
+ // Actual adapter registration would happen here
46
+ }
47
+ }
48
+ }
49
+ /**
50
+ * Post to all connected platforms
51
+ */
52
+ async postToAll(request) {
53
+ return this.orchestrator.postToAll(request);
54
+ }
55
+ /**
56
+ * Post to specific platforms
57
+ */
58
+ async postToPlatforms(platforms, request) {
59
+ return this.orchestrator.postToPlatforms(platforms, request);
60
+ }
61
+ /**
62
+ * Schedule a post
63
+ */
64
+ async schedulePost(request) {
65
+ const jitter = request.jitter || this.config.schedulerConfig?.defaultJitter;
66
+ // Calculate scheduled times with jitter
67
+ const scheduledTimes = {};
68
+ const platformScheduleIds = {};
69
+ for (const platform of request.platforms) {
70
+ if (jitter?.enabled) {
71
+ scheduledTimes[platform] = this.jitterCalculator.calculateJitteredTime(request.scheduledTime, jitter);
72
+ }
73
+ else {
74
+ scheduledTimes[platform] = request.scheduledTime;
75
+ }
76
+ platformScheduleIds[platform] = uuidv4();
77
+ }
78
+ // Add to schedule manager
79
+ const scheduleId = this.scheduleManager.addScheduledPost({
80
+ platforms: request.platforms,
81
+ content: request.content,
82
+ scheduledTime: request.scheduledTime,
83
+ actualScheduledTimes: scheduledTimes,
84
+ status: 'pending',
85
+ });
86
+ return {
87
+ success: true,
88
+ scheduleId,
89
+ scheduledTimes,
90
+ platformScheduleIds,
91
+ };
92
+ }
93
+ /**
94
+ * Schedule post with jitter
95
+ */
96
+ async scheduleWithJitter(request, jitter) {
97
+ return this.schedulePost({
98
+ ...request,
99
+ jitter,
100
+ });
101
+ }
102
+ /**
103
+ * Cancel a scheduled post
104
+ */
105
+ async cancelScheduledPost(scheduleId) {
106
+ return this.scheduleManager.cancelScheduledPost(scheduleId);
107
+ }
108
+ /**
109
+ * List scheduled posts
110
+ */
111
+ async listScheduledPosts(filters) {
112
+ return this.scheduleManager.listScheduledPosts(filters);
113
+ }
114
+ /**
115
+ * Connect to a platform
116
+ */
117
+ async connectPlatform(platform, credentials) {
118
+ return this.connectionManager.connectPlatform(platform, credentials);
119
+ }
120
+ /**
121
+ * Disconnect from a platform
122
+ */
123
+ async disconnectPlatform(platform) {
124
+ return this.connectionManager.disconnectPlatform(platform);
125
+ }
126
+ /**
127
+ * List connected platforms
128
+ */
129
+ async listConnectedPlatforms() {
130
+ return this.connectionManager.listConnectedPlatforms();
131
+ }
132
+ /**
133
+ * Test platform connection
134
+ */
135
+ async testPlatformConnection(platform) {
136
+ return this.connectionManager.testPlatformConnection(platform);
137
+ }
138
+ /**
139
+ * Transform generic content to platform-specific format
140
+ */
141
+ async transformContent(sourceContent, targetPlatform) {
142
+ return this.transformationPipeline.transform(sourceContent, targetPlatform);
143
+ }
144
+ /**
145
+ * Validate content for a platform
146
+ */
147
+ async validateContentForPlatform(content, platform) {
148
+ return this.transformationPipeline.validate(content, platform);
149
+ }
150
+ /**
151
+ * Optimize content for a platform
152
+ */
153
+ async optimizeForPlatform(content, platform) {
154
+ // Transform and validate
155
+ return this.transformationPipeline.transform(content, platform);
156
+ }
157
+ /**
158
+ * Post batch of requests
159
+ */
160
+ async postBatch(request) {
161
+ const results = [];
162
+ if (request.parallelExecution) {
163
+ // Execute in parallel with concurrency limit
164
+ const maxConcurrency = request.maxConcurrency || 5;
165
+ const chunks = [];
166
+ for (let i = 0; i < request.requests.length; i += maxConcurrency) {
167
+ chunks.push(request.requests.slice(i, i + maxConcurrency));
168
+ }
169
+ for (const chunk of chunks) {
170
+ const chunkResults = await Promise.all(chunk.map((req) => this.postToPlatforms(req.platforms, req)));
171
+ results.push(...chunkResults);
172
+ }
173
+ }
174
+ else {
175
+ // Execute sequentially
176
+ for (const req of request.requests) {
177
+ const result = await this.postToPlatforms(req.platforms, req);
178
+ results.push(result);
179
+ }
180
+ }
181
+ // Calculate summary
182
+ const summary = {
183
+ total: results.length,
184
+ successful: results.filter((r) => r.success).length,
185
+ failed: results.filter((r) => !r.success).length,
186
+ };
187
+ return {
188
+ success: summary.failed === 0,
189
+ results,
190
+ summary,
191
+ };
192
+ }
193
+ /**
194
+ * Schedule batch of posts
195
+ */
196
+ async scheduleBatch(requests) {
197
+ const results = [];
198
+ for (const request of requests) {
199
+ try {
200
+ const result = await this.schedulePost(request);
201
+ results.push(result);
202
+ }
203
+ catch (error) {
204
+ results.push({
205
+ success: false,
206
+ scheduleId: '',
207
+ scheduledTimes: {},
208
+ platformScheduleIds: {},
209
+ errors: {
210
+ general: error instanceof Error ? error.message : 'Unknown error',
211
+ },
212
+ });
213
+ }
214
+ }
215
+ const summary = {
216
+ total: results.length,
217
+ successful: results.filter((r) => r.success).length,
218
+ failed: results.filter((r) => !r.success).length,
219
+ };
220
+ return {
221
+ success: summary.failed === 0,
222
+ results,
223
+ summary,
224
+ };
225
+ }
226
+ /**
227
+ * Get platform status
228
+ */
229
+ async getPlatformStatus() {
230
+ const platforms = this.platformRegistry.getRegisteredPlatforms();
231
+ const status = {};
232
+ for (const platform of platforms) {
233
+ const connection = this.platformRegistry.getConnection(platform);
234
+ const adapter = this.platformRegistry.getPlatform(platform);
235
+ let healthy = false;
236
+ if (adapter && connection?.connected) {
237
+ try {
238
+ const testResult = await adapter.testConnection();
239
+ healthy = testResult.healthy;
240
+ }
241
+ catch {
242
+ healthy = false;
243
+ }
244
+ }
245
+ status[platform] = {
246
+ connected: connection?.connected ?? false,
247
+ healthy,
248
+ };
249
+ }
250
+ return status;
251
+ }
252
+ /**
253
+ * Get schedule statistics
254
+ */
255
+ getScheduleStatistics() {
256
+ return this.scheduleManager.getStatistics();
257
+ }
258
+ /**
259
+ * Clean up old scheduled posts
260
+ */
261
+ cleanupOldScheduledPosts(olderThanDays = 30) {
262
+ return this.scheduleManager.cleanupOldPosts(olderThanDays);
263
+ }
264
+ }
265
+ //# sourceMappingURL=SocialMediaManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SocialMediaManager.js","sourceRoot":"","sources":["../src/SocialMediaManager.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AAmBzF,MAAM,OAAO,kBAAkB;IACrB,gBAAgB,CAAmB;IACnC,iBAAiB,CAAoB;IACrC,sBAAsB,CAAgC;IACtD,gBAAgB,CAAmB;IACnC,eAAe,CAAkB;IACjC,YAAY,CAA4B;IACxC,MAAM,CAA2B;IAEzC,YAAY,MAAgC;QAC1C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,CAAC;QAC/C,IAAI,CAAC,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACtE,IAAI,CAAC,sBAAsB,GAAG,IAAI,6BAA6B,EAAE,CAAC;QAClE,IAAI,CAAC,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,CAAC;QAC/C,IAAI,CAAC,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;QAC7C,IAAI,CAAC,YAAY,GAAG,IAAI,yBAAyB,CAC/C,IAAI,CA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,CAAC;gBACrC,IAAI,CAAC;oBACH,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,cAAc,EAAE,CAAC;oBAClD,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;gBAC/B,CAAC;gBAAC,MAAM,CAAC;oBACP,OAAO,GAAG,KAAK,CAAC;gBAClB,CAAC;YACH,CAAC;YAED,MAAM,CAAC,QAAQ,CAAC,GAAG;gBACjB,SAAS,EAAE,UAAU,EAAE,SAAS,IAAI,KAAK;gBACzC,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"}
@@ -0,0 +1,26 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,113 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentTypeMatching.js","sourceRoot":"","sources":["../../src/content-type/ContentTypeMatching.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAGtF,MAAM,OAAO,mBAAmB;IACtB,QAAQ,CAAsB;IAEtC;QACE,IAAI,CAAC,QAAQ,GAAG,IAAI,mBAAmB,EAAE,CAAC;IAC5C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,mBAAmB,CAAC,UAAkB;QAC1C,MAAM,eAAe,GAAa,EAAE,CAAC;QAErC,KAAK,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,qBAAqB,CAAC,EAAE,CAAC;YACzE,IAAI,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;gBAClD,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACnC,CAAC;QACH,CAAC;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;IAED;;OAEG;IACK,YAAY,CAAC,UAAkB,EAAE,OAAiB;QACx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I,CACX,mCAAmC,WAAW,CAAC,WAAW,cAAc,UAAU,CAAC,QAAQ,CAAC,MAAM,GAAG,CACtG,CAAC;YACJ,CAAC;QACH,CAAC;QAED,yCAAyC;QACzC,IAAI,WAAW,CAAC,aAAa,KAAK,IAAI,EAAE,CAAC;YACvC,MAAM,QAAQ,GACZ,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;gBAClE,UAAU,CAAC,KAAK,KAAK,SAAS,CAAC;YAEjC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,uCAAuC,CAAC,CAAC;YAClE,CAAC;QACH,CAAC;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"}
@@ -0,0 +1,25 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,113 @@
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
+ export const CONTENT_TYPE_REGISTRY = {
9
+ 'generic-social-content': {
10
+ accepts: ['blog-post-content', 'article-content', 'text-content'],
11
+ produces: ['social-media-content:*'],
12
+ transformations: ['text-extraction', 'media-optimization', 'link-shortening'],
13
+ },
14
+ 'social-media-content:twitter': {
15
+ accepts: ['generic-social-content', 'blog-post-content'],
16
+ produces: ['social-media-content:twitter'],
17
+ constraints: {
18
+ maxTextLength: 280,
19
+ maxImages: 4,
20
+ maxVideos: 1,
21
+ maxHashtags: 10,
22
+ },
23
+ transformations: ['thread-splitting', 'character-counting', 'media-resize'],
24
+ },
25
+ 'social-media-content:linkedin': {
26
+ accepts: ['generic-social-content', 'blog-post-content', 'article-content'],
27
+ produces: ['social-media-content:linkedin'],
28
+ constraints: {
29
+ maxTextLength: 3000,
30
+ maxImages: 20,
31
+ maxVideos: 1,
32
+ maxHashtags: 30,
33
+ },
34
+ transformations: ['article-conversion', 'professional-tone', 'hashtag-optimization'],
35
+ },
36
+ 'social-media-content:facebook': {
37
+ accepts: ['generic-social-content', 'blog-post-content'],
38
+ produces: ['social-media-content:facebook'],
39
+ constraints: {
40
+ maxTextLength: 63206,
41
+ maxImages: 10,
42
+ maxVideos: 1,
43
+ },
44
+ transformations: ['text-formatting', 'link-preview'],
45
+ },
46
+ 'social-media-content:instagram': {
47
+ accepts: ['generic-social-content'],
48
+ produces: ['social-media-content:instagram'],
49
+ constraints: {
50
+ maxTextLength: 2200,
51
+ maxImages: 10,
52
+ maxVideos: 1,
53
+ maxHashtags: 30,
54
+ requiresMedia: true,
55
+ },
56
+ transformations: ['media-resize', 'hashtag-optimization'],
57
+ },
58
+ 'social-media-content:mastodon': {
59
+ accepts: ['generic-social-content', 'blog-post-content'],
60
+ produces: ['social-media-content:mastodon'],
61
+ constraints: {
62
+ maxTextLength: 500,
63
+ maxImages: 4,
64
+ maxVideos: 1,
65
+ },
66
+ transformations: ['character-counting', 'media-resize'],
67
+ },
68
+ 'social-media-content:bluesky': {
69
+ accepts: ['generic-social-content', 'blog-post-content'],
70
+ produces: ['social-media-content:bluesky'],
71
+ constraints: {
72
+ maxTextLength: 300,
73
+ maxImages: 4,
74
+ maxVideos: 1,
75
+ },
76
+ transformations: ['character-counting', 'media-resize'],
77
+ },
78
+ };
79
+ export class ContentTypeRegistry {
80
+ /**
81
+ * Get registry entry for a content type
82
+ */
83
+ getEntry(contentType) {
84
+ return CONTENT_TYPE_REGISTRY[contentType];
85
+ }
86
+ /**
87
+ * Get all registered content types
88
+ */
89
+ getAllTypes() {
90
+ return Object.keys(CONTENT_TYPE_REGISTRY);
91
+ }
92
+ /**
93
+ * Check if a content type exists in the registry
94
+ */
95
+ hasType(contentType) {
96
+ return contentType in CONTENT_TYPE_REGISTRY;
97
+ }
98
+ /**
99
+ * Get constraints for a platform
100
+ */
101
+ getConstraints(platform) {
102
+ const contentType = `social-media-content:${platform}`;
103
+ return CONTENT_TYPE_REGISTRY[contentType]?.constraints;
104
+ }
105
+ /**
106
+ * Get transformations for a platform
107
+ */
108
+ getTransformations(platform) {
109
+ const contentType = `social-media-content:${platform}`;
110
+ return CONTENT_TYPE_REGISTRY[contentType]?.transformations || [];
111
+ }
112
+ }
113
+ //# sourceMappingURL=ContentTypeRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentTypeRegistry.js","sourceRoot":"","sources":["../../src/content-type/ContentTypeRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAIF,MAAM,CAAC,MAAM,qBAAqB,GAA6C;IAC7E,wBAAwB,EAAE;QACxB,OAAO,EAAE,CAAC,mBAAmB,EAAE,iBAAiB,EAAE,cAAc,CAAC;QACjE,QAAQ,EAAE,CAAC,wBAAwB,CAAC;QACpC,eAAe,EAAE,CAAC,iBAAiB,EAAE,oBAAoB,EAAE,iBAAiB,CAAC;KAC9E;IACD,8BAA8B,EAAE;QAC9B,OAAO,EAAE,CAAC,wBAAwB,EAAE,mBAAmB,CAAC;QACxD,QAAQ,EAAE,CAAC,8BAA8B,CAAC;QAC1C,WAAW,EAAE;YACX,aAAa,EAAE,GAAG;YAClB,SAAS,EAAE,CAAC;YACZ,SAAS,EAAE,CAAC;YACZ,WAAW,EAAE,EAAE;SAChB;QACD,eAAe,EAAE,CAAC,kBAAkB,EAAE,oBAAoB,EAAE,cAAc,CAAC;KAC5E;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E,CAAC,8BAA8B,CAAC;QAC1C,WAAW,EAAE;YACX,aAAa,EAAE,GAAG;YAClB,SAAS,EAAE,CAAC;YACZ,SAAS,EAAE,CAAC;SACb;QACD,eAAe,EAAE,CAAC,oBAAoB,EAAE,cAAc,CAAC;KACxD;CACF,CAAC;AAEF,MAAM,OAAO,mBAAmB;IAC9B;;OAEG;IACH,QAAQ,CAAC,WAAmB;QAC1B,OAAO,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAC5C,CAAC;IAED;;OAEG;IACH,WAAW;QACT,OAAO,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IAC5C,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,WAAmB;QACzB,OAAO,WAAW,IAAI,qBAAqB,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,cAAc,CAAC,QAAgB;QAC7B,MAAM,WAAW,GAAG,wBAAwB,QAAQ,EAAE,CAAC;QACvD,OAAO,qBAAqB,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IACzD,CAAC;IAED;;OAEG;IACH,kBAAkB,CAAC,QAAgB;QACjC,MAAM,WAAW,GAAG,wBAAwB,QAAQ,EAAE,CAAC;QACvD,OAAO,qBAAqB,CAAC,WAAW,CAAC,EAAE,eAAe,IAAI,EAAE,CAAC;IACnE,CAAC;CACF"}
@@ -0,0 +1,50 @@
1
+ import type { GenericSocialContent, ValidationResult } from '../types.js';
2
+ export declare class ContentTransformationPipeline {
3
+ private contentTypeMatching;
4
+ constructor();
5
+ /**
6
+ * Transform generic content to platform-specific format
7
+ */
8
+ transform(source: GenericSocialContent, targetPlatform: string): Promise<unknown>;
9
+ /**
10
+ * Apply a single transformation to content
11
+ */
12
+ private applyTransformation;
13
+ /**
14
+ * Split long text into a thread (Twitter)
15
+ */
16
+ private splitIntoThread;
17
+ /**
18
+ * Convert to article format (LinkedIn)
19
+ */
20
+ private convertToArticle;
21
+ /**
22
+ * Resize media for platform requirements
23
+ */
24
+ private resizeMedia;
25
+ /**
26
+ * Optimize hashtags for platform
27
+ */
28
+ private optimizeHashtags;
29
+ /**
30
+ * Enforce character limit for platform
31
+ */
32
+ private enforceCharacterLimit;
33
+ /**
34
+ * Format text for better readability
35
+ */
36
+ private formatText;
37
+ /**
38
+ * Enable link preview (Facebook)
39
+ */
40
+ private enableLinkPreview;
41
+ /**
42
+ * Adjust tone to be more professional (LinkedIn)
43
+ */
44
+ private adjustToProfessionalTone;
45
+ /**
46
+ * Validate content for platform without transforming
47
+ */
48
+ validate(content: GenericSocialContent, platform: string): Promise<ValidationResult>;
49
+ }
50
+ //# sourceMappingURL=TransformationPipeline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TransformationPipeline.d.ts","sourceRoot":"","sources":["../../src/content-type/TransformationPipeline.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE1E,qBAAa,6BAA6B;IACxC,OAAO,CAAC,mBAAmB,CAAsB;;IAMjD;;OAEG;IACG,SAAS,CAAC,MAAM,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IA4BvF;;OAEG;YACW,mBAAmB;IAkCjC;;OAEG;YACW,eAAe;IAqB7B;;OAEG;YACW,gBAAgB;IAO9B;;OAEG;YACW,WAAW;IAYzB;;OAEG;YACW,gBAAgB;IAiB9B;;OAEG;YACW,qBAAqB;IAyBnC;;OAEG;YACW,UAAU;IAOxB;;OAEG;YACW,iBAAiB;IAO/B;;OAEG;YACW,wBAAwB;IAOtC;;OAEG;IACG,QAAQ,CAAC,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAG3F"}