@bernierllc/content-management-suite 0.4.2 → 0.7.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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts","../src/index.ts","../src/content-management-suite.ts"],"sourcesContent":["/*\nCopyright (c) 2025 Bernier LLC\n\nThis file is licensed to the client under a limited-use license.\nThe client may use and modify this code *only within the scope of the project it was delivered for*.\nRedistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.\n*/\n\nimport { z } from 'zod';\n\n// Content Management Suite Configuration Schema\nexport const ContentManagementConfigSchema = z.object({\n // Server Configuration\n server: z.object({\n port: z.number().default(3000),\n host: z.string().default('localhost'),\n cors: z.object({\n origin: z.union([z.string(), z.array(z.string())]).default('*'),\n credentials: z.boolean().default(true)\n }).default({}),\n security: z.object({\n helmet: z.boolean().default(true),\n rateLimit: z.object({\n enabled: z.boolean().default(true),\n windowMs: z.number().default(15 * 60 * 1000), // 15 minutes\n max: z.number().default(100) // limit each IP to 100 requests per windowMs\n }).default({})\n }).default({})\n }).default({}),\n\n // Database Configuration\n database: z.object({\n type: z.enum(['sqlite', 'postgresql', 'mysql', 'mongodb']).default('sqlite'),\n url: z.string().optional(),\n host: z.string().default('localhost'),\n port: z.number().optional(),\n name: z.string().default('content_management'),\n username: z.string().optional(),\n password: z.string().optional(),\n ssl: z.boolean().default(false),\n pool: z.object({\n min: z.number().default(2),\n max: z.number().default(10)\n }).default({})\n }).default({}),\n\n // Content Configuration\n content: z.object({\n // Default editorial workflow\n defaultWorkflow: z.object({\n id: z.string().default('standard'),\n name: z.string().default('Standard Workflow'),\n description: z.string().default('Standard editorial workflow'),\n stages: z.array(z.object({\n id: z.string(),\n name: z.string(),\n order: z.number(),\n isPublishStage: z.boolean().default(false),\n allowsScheduling: z.boolean().default(false),\n description: z.string().optional(),\n permissions: z.array(z.string()).default([])\n })).default([\n {\n id: 'write',\n name: 'Write',\n order: 1,\n isPublishStage: false,\n allowsScheduling: false,\n description: 'Write content',\n permissions: ['content.edit']\n },\n {\n id: 'publish',\n name: 'Publish',\n order: 2,\n isPublishStage: true,\n allowsScheduling: true,\n description: 'Publish content',\n permissions: ['content.publish']\n }\n ]),\n transitions: z.array(z.object({\n id: z.string(),\n from: z.string(),\n to: z.string(),\n description: z.string().optional(),\n permissions: z.array(z.string()).default([])\n })).default([\n {\n id: 'write-to-publish',\n from: 'write',\n to: 'publish',\n description: 'Move from write to publish',\n permissions: ['content.publish']\n }\n ])\n }).default({}),\n\n // Content types\n contentTypes: z.array(z.string()).default(['text', 'image', 'audio', 'video']),\n\n // Auto-save configuration\n autoSave: z.object({\n enabled: z.boolean().default(true),\n debounceMs: z.number().default(1000),\n maxRetries: z.number().default(3),\n backoffMs: z.number().default(1000)\n }).default({}),\n\n // Soft delete configuration\n softDelete: z.object({\n enabled: z.boolean().default(true),\n showDeletedToUsers: z.boolean().default(false),\n retentionDays: z.number().default(30)\n }).default({}),\n\n // File upload configuration\n upload: z.object({\n maxFileSize: z.number().default(104857600), // 100MB\n allowedTypes: z.array(z.string()).default([\n 'image/jpeg',\n 'image/png',\n 'image/webp',\n 'image/gif',\n 'audio/mpeg',\n 'audio/wav',\n 'audio/ogg',\n 'video/mp4',\n 'video/webm',\n 'video/ogg'\n ]),\n storage: z.object({\n type: z.enum(['local', 's3', 'gcs', 'azure']).default('local'),\n path: z.string().default('./uploads'),\n bucket: z.string().optional(),\n region: z.string().optional(),\n accessKey: z.string().optional(),\n secretKey: z.string().optional()\n }).default({})\n }).default({})\n }).default({}),\n\n // UI Configuration\n ui: z.object({\n theme: z.object({\n mode: z.enum(['light', 'dark', 'auto']).default('auto'),\n primaryColor: z.string().default('#007bff'),\n secondaryColor: z.string().default('#6c757d'),\n accentColor: z.string().default('#17a2b8')\n }).default({}),\n editor: z.object({\n showToolbar: z.boolean().default(true),\n showStatusBar: z.boolean().default(true),\n showWordCount: z.boolean().default(true),\n showCharacterCount: z.boolean().default(true),\n autoSave: z.boolean().default(true),\n placeholder: z.string().default('Start writing your content...')\n }).default({}),\n list: z.object({\n defaultView: z.enum(['table', 'list', 'grid', 'kanban']).default('table'),\n pageSize: z.number().default(20),\n showSearch: z.boolean().default(true),\n showFilters: z.boolean().default(true),\n showSorting: z.boolean().default(true),\n showPagination: z.boolean().default(true)\n }).default({})\n }).default({}),\n\n // Integration Configuration\n integrations: z.object({\n neverAdmin: z.object({\n enabled: z.boolean().default(false),\n url: z.string().optional(),\n apiKey: z.string().optional(),\n syncInterval: z.number().default(300000) // 5 minutes\n }).default({}),\n neverHub: z.object({\n enabled: z.boolean().default(false),\n url: z.string().optional(),\n apiKey: z.string().optional(),\n packageDiscovery: z.boolean().default(true)\n }).default({}),\n analytics: z.object({\n enabled: z.boolean().default(false),\n provider: z.enum(['google', 'mixpanel', 'amplitude', 'custom']).optional(),\n trackingId: z.string().optional(),\n config: z.record(z.any()).default({})\n }).default({})\n }).default({}),\n\n // Security Configuration\n security: z.object({\n jwt: z.object({\n secret: z.string().default('your-secret-key'),\n expiresIn: z.string().default('24h'),\n issuer: z.string().default('content-management-suite')\n }).default({}),\n permissions: z.object({\n enabled: z.boolean().default(true),\n defaultRole: z.string().default('user'),\n roles: z.array(z.object({\n name: z.string(),\n permissions: z.array(z.string()),\n description: z.string().optional()\n })).default([\n {\n name: 'admin',\n permissions: ['*'],\n description: 'Full administrative access'\n },\n {\n name: 'editor',\n permissions: ['content.edit', 'content.publish', 'content.schedule'],\n description: 'Content editing and publishing'\n },\n {\n name: 'author',\n permissions: ['content.edit'],\n description: 'Content creation and editing'\n },\n {\n name: 'user',\n permissions: ['content.view'],\n description: 'Content viewing only'\n }\n ])\n }).default({})\n }).default({}),\n\n // Logging Configuration\n logging: z.object({\n level: z.enum(['error', 'warn', 'info', 'debug']).default('info'),\n format: z.enum(['json', 'text']).default('json'),\n file: z.object({\n enabled: z.boolean().default(true),\n path: z.string().default('./logs'),\n maxSize: z.string().default('10MB'),\n maxFiles: z.number().default(5)\n }).default({}),\n console: z.object({\n enabled: z.boolean().default(true),\n colorize: z.boolean().default(true)\n }).default({})\n }).default({}),\n\n // Performance Configuration\n performance: z.object({\n cache: z.object({\n enabled: z.boolean().default(true),\n ttl: z.number().default(300), // 5 minutes\n maxSize: z.number().default(1000)\n }).default({}),\n compression: z.object({\n enabled: z.boolean().default(true),\n level: z.number().min(1).max(9).default(6)\n }).default({}),\n rateLimit: z.object({\n enabled: z.boolean().default(true),\n windowMs: z.number().default(15 * 60 * 1000), // 15 minutes\n max: z.number().default(100)\n }).default({})\n }).default({})\n});\n\nexport type ContentManagementConfig = z.infer<typeof ContentManagementConfigSchema>;\n\n// Content Management Suite Types\nexport interface ContentManagementSuite {\n // Core Services\n configManager: any;\n workflowService: any;\n editorService: any;\n \n // Content Types\n contentTypes: Map<string, any>;\n \n // UI Components\n editor: any;\n workflow: any;\n list: any;\n \n // Admin Interface\n admin: any;\n \n // Server\n server: any;\n \n // Methods\n start(): Promise<void>;\n stop(): Promise<void>;\n getConfig(): ContentManagementConfig;\n updateConfig(config: Partial<ContentManagementConfig>): Promise<void>;\n registerContentType(contentType: any): void;\n unregisterContentType(contentTypeId: string): void;\n getContentType(contentTypeId: string): any;\n listContentTypes(): any[];\n registerPlugin(plugin: ContentManagementSuitePlugin): void;\n unregisterPlugin(pluginName: string): void;\n addMiddleware(middleware: ContentManagementSuiteMiddleware): void;\n addHook(hook: ContentManagementSuiteHook): void;\n}\n\n// Content Management Suite Options\nexport interface ContentManagementSuiteOptions {\n config?: Partial<ContentManagementConfig>;\n configFile?: string;\n database?: any;\n logger?: any;\n plugins?: any[];\n}\n\n// Content Management Suite Events\nexport interface ContentManagementSuiteEvents {\n 'content:created': (content: any) => void;\n 'content:updated': (content: any) => void;\n 'content:deleted': (content: any) => void;\n 'content:published': (content: any) => void;\n 'content:scheduled': (content: any, date: Date) => void;\n 'workflow:transition': (content: any, from: string, to: string) => void;\n 'config:updated': (config: ContentManagementConfig) => void;\n 'error': (error: Error) => void;\n}\n\n// Content Management Suite API\nexport interface ContentManagementSuiteAPI {\n // Content Management\n createContent(type: string, data: any): Promise<any>;\n getContent(id: string): Promise<any>;\n updateContent(id: string, data: any): Promise<any>;\n deleteContent(id: string, soft?: boolean): Promise<void>;\n listContent(filters?: any): Promise<any[]>;\n searchContent(query: string, options?: any): Promise<any[]>;\n \n // Workflow Management\n getWorkflow(id: string): Promise<any>;\n createWorkflow(data: any): Promise<any>;\n updateWorkflow(id: string, data: any): Promise<any>;\n deleteWorkflow(id: string): Promise<void>;\n listWorkflows(): Promise<any[]>;\n \n // Content Type Management\n getContentType(id: string): Promise<any>;\n createContentType(data: any): Promise<any>;\n updateContentType(id: string, data: any): Promise<any>;\n deleteContentType(id: string): Promise<void>;\n listContentTypes(): Promise<any[]>;\n \n // Configuration Management\n getConfig(): Promise<ContentManagementConfig>;\n updateConfig(config: Partial<ContentManagementConfig>): Promise<void>;\n \n // User Management\n createUser(data: any): Promise<any>;\n getUser(id: string): Promise<any>;\n updateUser(id: string, data: any): Promise<any>;\n deleteUser(id: string): Promise<void>;\n listUsers(): Promise<any[]>;\n \n // Permission Management\n checkPermission(userId: string, permission: string): Promise<boolean>;\n grantPermission(userId: string, permission: string): Promise<void>;\n revokePermission(userId: string, permission: string): Promise<void>;\n}\n\n// Content Management Suite Plugin\nexport interface ContentManagementSuitePlugin {\n name: string;\n version: string;\n description: string;\n dependencies?: string[];\n install(suite: ContentManagementSuite): Promise<void>;\n uninstall(suite: ContentManagementSuite): Promise<void>;\n enable(suite: ContentManagementSuite): Promise<void>;\n disable(suite: ContentManagementSuite): Promise<void>;\n}\n\n// Content Management Suite Middleware\nexport interface ContentManagementSuiteMiddleware {\n name: string;\n handler: (req: any, res: any, next: any) => void;\n order?: number;\n}\n\n// Content Management Suite Hook\nexport interface ContentManagementSuiteHook {\n name: string;\n handler: (...args: any[]) => Promise<any> | any;\n priority?: number;\n}\n\n// Content Management Suite Validation\nexport interface ContentManagementSuiteValidation {\n validateConfig(config: any): boolean;\n validateContent(content: any, type: string): boolean;\n validateWorkflow(workflow: any): boolean;\n validateUser(user: any): boolean;\n}\n\n// Content Management Suite Storage\nexport interface ContentManagementSuiteStorage {\n // Content Storage\n saveContent(content: any): Promise<void>;\n loadContent(id: string): Promise<any>;\n deleteContent(id: string): Promise<void>;\n listContent(filters?: any): Promise<any[]>;\n searchContent(query: string, options?: any): Promise<any[]>;\n \n // Workflow Storage\n saveWorkflow(workflow: any): Promise<void>;\n loadWorkflow(id: string): Promise<any>;\n deleteWorkflow(id: string): Promise<void>;\n listWorkflows(): Promise<any[]>;\n \n // Configuration Storage\n saveConfig(config: ContentManagementConfig): Promise<void>;\n loadConfig(): Promise<ContentManagementConfig>;\n \n // User Storage\n saveUser(user: any): Promise<void>;\n loadUser(id: string): Promise<any>;\n deleteUser(id: string): Promise<void>;\n listUsers(): Promise<any[]>;\n}\n\n// Content Management Suite Cache\nexport interface ContentManagementSuiteCache {\n get(key: string): Promise<any>;\n set(key: string, value: any, ttl?: number): Promise<void>;\n delete(key: string): Promise<void>;\n clear(): Promise<void>;\n has(key: string): Promise<boolean>;\n}\n\n// Content Management Suite Logger\nexport interface ContentManagementSuiteLogger {\n error(message: string, meta?: any): void;\n warn(message: string, meta?: any): void;\n info(message: string, meta?: any): void;\n debug(message: string, meta?: any): void;\n}\n\n// Content Management Suite Metrics\nexport interface ContentManagementSuiteMetrics {\n increment(name: string, value?: number): void;\n decrement(name: string, value?: number): void;\n gauge(name: string, value: number): void;\n histogram(name: string, value: number): void;\n counter(name: string, value?: number): void;\n}\n\n// Content Management Suite Health Check\nexport interface ContentManagementSuiteHealthCheck {\n name: string;\n check(): Promise<boolean>;\n timeout?: number;\n interval?: number;\n}\n\n// Content Management Suite Error\nexport class ContentManagementSuiteError extends Error {\n public code: string;\n public statusCode: number;\n public details?: any;\n\n constructor(message: string, code: string, statusCode: number = 500, details?: any) {\n super(message);\n this.name = 'ContentManagementSuiteError';\n this.code = code;\n this.statusCode = statusCode;\n this.details = details;\n }\n}\n\n// Content Management Suite Validation Error\nexport class ContentManagementSuiteValidationError extends ContentManagementSuiteError {\n constructor(message: string, details?: any) {\n super(message, 'VALIDATION_ERROR', 400, details);\n this.name = 'ContentManagementSuiteValidationError';\n }\n}\n\n// Content Management Suite Not Found Error\nexport class ContentManagementSuiteNotFoundError extends ContentManagementSuiteError {\n constructor(message: string, details?: any) {\n super(message, 'NOT_FOUND', 404, details);\n this.name = 'ContentManagementSuiteNotFoundError';\n }\n}\n\n// Content Management Suite Unauthorized Error\nexport class ContentManagementSuiteUnauthorizedError extends ContentManagementSuiteError {\n constructor(message: string, details?: any) {\n super(message, 'UNAUTHORIZED', 401, details);\n this.name = 'ContentManagementSuiteUnauthorizedError';\n }\n}\n\n// Content Management Suite Forbidden Error\nexport class ContentManagementSuiteForbiddenError extends ContentManagementSuiteError {\n constructor(message: string, details?: any) {\n super(message, 'FORBIDDEN', 403, details);\n this.name = 'ContentManagementSuiteForbiddenError';\n }\n}\n\n// Content Management Suite Conflict Error\nexport class ContentManagementSuiteConflictError extends ContentManagementSuiteError {\n constructor(message: string, details?: any) {\n super(message, 'CONFLICT', 409, details);\n this.name = 'ContentManagementSuiteConflictError';\n }\n}\n\n// Content Management Suite Internal Error\nexport class ContentManagementSuiteInternalError extends ContentManagementSuiteError {\n constructor(message: string, details?: any) {\n super(message, 'INTERNAL_ERROR', 500, details);\n this.name = 'ContentManagementSuiteInternalError';\n }\n}\n","/*\nCopyright (c) 2025 Bernier LLC\n\nThis file is licensed to the client under a limited-use license.\nThe client may use and modify this code *only within the scope of the project it was delivered for*.\nRedistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.\n*/\n\n// Export types separately to avoid duplicate export issues\nexport type {\n ContentManagementConfig,\n ContentManagementSuiteOptions,\n ContentManagementSuiteEvents,\n ContentManagementSuiteAPI,\n ContentManagementSuitePlugin,\n ContentManagementSuiteMiddleware,\n ContentManagementSuiteHook,\n ContentManagementSuiteValidation,\n ContentManagementSuiteStorage,\n ContentManagementSuiteCache,\n ContentManagementSuiteLogger,\n ContentManagementSuiteMetrics,\n ContentManagementSuiteHealthCheck\n} from './types';\n\n// Export schema and interface (non-type exports)\nexport { ContentManagementConfigSchema } from './types';\nexport type { ContentManagementSuite } from './types';\n\n// Export error classes\nexport {\n ContentManagementSuiteError,\n ContentManagementSuiteValidationError,\n ContentManagementSuiteNotFoundError,\n ContentManagementSuiteUnauthorizedError,\n ContentManagementSuiteForbiddenError,\n ContentManagementSuiteConflictError,\n ContentManagementSuiteInternalError\n} from './types';\n\n// Re-export UI components (only published packages)\nexport {\n WorkflowStepper,\n StageActionButtons,\n WorkflowTimeline,\n WorkflowAdminConfig\n} from '@bernierllc/content-workflow-ui';\n\n// Re-export all content types for convenience\nexport { TextContentType } from '@bernierllc/content-type-text';\nexport { ImageContentType } from '@bernierllc/content-type-image';\nexport { AudioContentTypeManager } from '@bernierllc/content-type-audio';\nexport { VideoContentType } from '@bernierllc/content-type-video';\n\n// Re-export core services for advanced usage (only published packages)\nexport { ContentTypeRegistry } from '@bernierllc/content-type-registry';\nexport { EditorialWorkflowEngine, WorkflowBuilder, WorkflowTemplates, WorkflowFactory } from '@bernierllc/content-editorial-workflow';\nexport { AutosaveManager } from '@bernierllc/content-autosave-manager';\nexport { ContentSoftDelete } from '@bernierllc/content-soft-delete';\n\n// Main suite export\nexport { createContentManagementSuite } from './content-management-suite';\n","/*\nCopyright (c) 2025 Bernier LLC\n\nThis file is licensed to the client under a limited-use license.\nThe client may use and modify this code *only within the scope of the project it was delivered for*.\nRedistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.\n*/\n\nimport { EventEmitter } from 'events';\nimport express from 'express';\nimport cors from 'cors';\nimport helmet from 'helmet';\nimport morgan from 'morgan';\nimport compression from 'compression';\nimport { v4 as uuidv4 } from 'uuid';\n\n// Import published packages only\nimport { ContentTypeRegistry } from '@bernierllc/content-type-registry';\nimport { EditorialWorkflowEngine, WorkflowBuilder as _WorkflowBuilder } from '@bernierllc/content-editorial-workflow';\nimport { AutosaveManager } from '@bernierllc/content-autosave-manager';\nimport { ContentSoftDelete } from '@bernierllc/content-soft-delete';\n\n// Import content types\nimport { TextContentType } from '@bernierllc/content-type-text';\nimport { ImageContentType } from '@bernierllc/content-type-image';\nimport { AudioContentTypeManager } from '@bernierllc/content-type-audio';\nimport { VideoContentType } from '@bernierllc/content-type-video';\n\n// Import UI components (only published packages)\nimport {\n WorkflowStepper,\n StageActionButtons,\n WorkflowTimeline,\n WorkflowAdminConfig\n} from '@bernierllc/content-workflow-ui';\n\nimport {\n ContentManagementConfig,\n ContentManagementConfigSchema,\n ContentManagementSuite,\n ContentManagementSuiteOptions,\n ContentManagementSuitePlugin,\n ContentManagementSuiteMiddleware,\n ContentManagementSuiteHook,\n ContentManagementSuiteError,\n ContentManagementSuiteValidationError,\n ContentManagementSuiteNotFoundError,\n ContentManagementSuiteConflictError,\n ContentManagementSuiteInternalError\n} from './types';\n\nexport class ContentManagementSuiteImpl extends EventEmitter implements ContentManagementSuite {\n // Core Services (using published packages)\n public configManager: any; // Stub until @bernierllc/content-config-manager is published\n public workflowService: any; // Stub until @bernierllc/content-workflow-service is updated\n public editorService: any; // Stub until @bernierllc/content-editor-service is published\n public autosaveManager: AutosaveManager | null = null;\n public softDelete: ContentSoftDelete | null = null;\n public workflowEngine: EditorialWorkflowEngine | null = null;\n public contentTypeRegistry: ContentTypeRegistry;\n\n // Content Types\n public contentTypes: Map<string, any> = new Map();\n\n // UI Components (only published packages)\n public workflow: {\n stepper: typeof WorkflowStepper;\n actions: typeof StageActionButtons;\n timeline: typeof WorkflowTimeline;\n admin: typeof WorkflowAdminConfig;\n };\n\n // Editor Interface (stub until @bernierllc/content-editor-ui is published)\n public editor: any;\n\n // List Interface (stub until @bernierllc/content-list-ui is published)\n public list: any;\n\n // Admin Interface\n public admin: any;\n\n // Server\n public server: express.Application;\n\n // Configuration\n private config: ContentManagementConfig;\n private options: ContentManagementSuiteOptions;\n\n // Plugins and Middleware\n private plugins: Map<string, ContentManagementSuitePlugin> = new Map();\n private middleware: ContentManagementSuiteMiddleware[] = [];\n private hooks: Map<string, ContentManagementSuiteHook[]> = new Map();\n\n // State\n private isStarted: boolean = false;\n private isStopped: boolean = false;\n private httpServer: any = null;\n\n constructor(options: ContentManagementSuiteOptions = {}) {\n super();\n\n this.options = options;\n this.config = this.loadConfiguration();\n\n // Initialize content type registry\n this.contentTypeRegistry = new ContentTypeRegistry();\n\n // Initialize stub services (will be replaced when packages are published)\n this.configManager = this.createConfigManagerStub();\n this.workflowService = this.createWorkflowServiceStub();\n this.editorService = this.createEditorServiceStub();\n\n // Initialize UI components (only published packages)\n this.workflow = {\n stepper: WorkflowStepper,\n actions: StageActionButtons,\n timeline: WorkflowTimeline,\n admin: WorkflowAdminConfig\n };\n\n // Initialize Express server\n this.server = express();\n this.setupMiddleware();\n this.setupRoutes();\n\n // Initialize stub editor interface (until @bernierllc/content-editor-ui is published)\n this.editor = this.createEditorStub();\n\n // Initialize stub list interface (until @bernierllc/content-list-ui is published)\n this.list = this.createListStub();\n\n // Register default content types\n this.registerDefaultContentTypes();\n\n // Register plugins\n if (options.plugins) {\n options.plugins.forEach((plugin: ContentManagementSuitePlugin) => this.registerPlugin(plugin));\n }\n }\n\n // Stub creators for services not yet published\n private createConfigManagerStub(): any {\n return {\n getConfig: () => this.config,\n updateConfig: async (config: any) => { this.config = { ...this.config, ...config }; },\n start: async () => {},\n stop: async () => {}\n };\n }\n\n private createWorkflowServiceStub(): any {\n return {\n listWorkflows: async () => [],\n getWorkflow: async (id: string) => ({ id, name: 'Default Workflow' }),\n createWorkflow: async (data: any) => ({ id: uuidv4(), ...data }),\n updateWorkflow: async (id: string, data: any) => ({ id, ...data }),\n deleteWorkflow: async (_id: string) => {},\n publishContent: async (id: string) => ({ id, status: 'published' }),\n scheduleContent: async (id: string, date: Date) => ({ id, scheduledFor: date }),\n unpublishContent: async (id: string) => ({ id, status: 'draft' }),\n start: async () => {},\n stop: async () => {}\n };\n }\n\n private createEditorServiceStub(): any {\n const contentStore = new Map<string, any>();\n return {\n listContent: async (_filters: any) => ({ items: Array.from(contentStore.values()), total: contentStore.size }),\n getContent: async (id: string) => contentStore.get(id) || null,\n createContent: async (type: string, data: any) => {\n const content = { id: uuidv4(), type, ...data, createdAt: new Date().toISOString() };\n contentStore.set(content.id, content);\n return content;\n },\n updateContent: async (id: string, data: any) => {\n const existing = contentStore.get(id);\n if (!existing) throw new Error('Content not found');\n const updated = { ...existing, ...data, updatedAt: new Date().toISOString() };\n contentStore.set(id, updated);\n return updated;\n },\n deleteContent: async (id: string, _soft: boolean) => {\n contentStore.delete(id);\n },\n start: async () => {},\n stop: async () => {}\n };\n }\n\n // Stub for editor interface (until @bernierllc/content-editor-ui is published)\n private createEditorStub(): any {\n return {\n render: () => null,\n getValue: () => '',\n setValue: (_value: string) => {},\n focus: () => {},\n blur: () => {},\n on: (_event: string, _callback: (...args: any[]) => void) => {},\n off: (_event: string, _callback: (...args: any[]) => void) => {}\n };\n }\n\n // Stub for list interface (until @bernierllc/content-list-ui is published)\n private createListStub(): any {\n return {\n render: () => null,\n getItems: () => [],\n setItems: (_items: any[]) => {},\n getSelectedItems: () => [],\n setSelectedItems: (_items: any[]) => {},\n on: (_event: string, _callback: (...args: any[]) => void) => {},\n off: (_event: string, _callback: (...args: any[]) => void) => {}\n };\n }\n\n private loadConfiguration(): ContentManagementConfig {\n try {\n // Load from options first\n if (this.options.config) {\n return ContentManagementConfigSchema.parse(this.options.config);\n }\n \n // Load from config manager\n const config = this.configManager?.getConfig() || {};\n return ContentManagementConfigSchema.parse(config);\n } catch (error) {\n console.error('Failed to load configuration:', error);\n return ContentManagementConfigSchema.parse({});\n }\n }\n\n private setupMiddleware(): void {\n // Security middleware\n if (this.config.server.security.helmet) {\n this.server.use(helmet());\n }\n \n // CORS middleware\n this.server.use(cors(this.config.server.cors));\n \n // Compression middleware\n if (this.config.performance.compression.enabled) {\n this.server.use(compression({\n level: this.config.performance.compression.level\n }));\n }\n \n // Logging middleware\n if (this.options.logger) {\n this.server.use(morgan('combined', {\n stream: {\n write: (message: string) => {\n this.options.logger?.info(message.trim());\n }\n }\n }));\n }\n \n // Body parsing middleware\n this.server.use(express.json({ limit: '10mb' }));\n this.server.use(express.urlencoded({ extended: true, limit: '10mb' }));\n \n // Custom middleware\n this.middleware\n .sort((a, b) => (a.order || 0) - (b.order || 0))\n .forEach(middleware => {\n this.server.use(middleware.handler);\n });\n }\n\n private setupRoutes(): void {\n // Health check endpoint\n this.server.get('/health', (req, res) => {\n res.json({\n status: 'healthy',\n timestamp: new Date().toISOString(),\n version: '0.1.0',\n uptime: process.uptime()\n });\n });\n \n // API routes\n this.server.use('/api', this.createAPIRoutes());\n \n // Admin routes\n this.server.use('/admin', this.createAdminRoutes());\n \n // Static files\n this.server.use('/static', express.static('public'));\n \n // Error handling middleware\n this.server.use(this.errorHandler.bind(this));\n }\n\n private createAPIRoutes(): express.Router {\n const router = express.Router();\n \n // Content routes\n router.get('/content', this.getContentList.bind(this));\n router.get('/content/:id', this.getContent.bind(this));\n router.post('/content', this.createContent.bind(this));\n router.put('/content/:id', this.updateContent.bind(this));\n router.delete('/content/:id', this.deleteContent.bind(this));\n router.post('/content/:id/publish', this.publishContent.bind(this));\n router.post('/content/:id/schedule', this.scheduleContent.bind(this));\n router.post('/content/:id/unpublish', this.unpublishContent.bind(this));\n \n // Workflow routes\n router.get('/workflows', this.getWorkflows.bind(this));\n router.get('/workflows/:id', this.getWorkflow.bind(this));\n router.post('/workflows', this.createWorkflow.bind(this));\n router.put('/workflows/:id', this.updateWorkflow.bind(this));\n router.delete('/workflows/:id', this.deleteWorkflow.bind(this));\n \n // Content type routes\n router.get('/content-types', this.getContentTypes.bind(this));\n router.get('/content-types/:id', this.handleGetContentType.bind(this));\n router.post('/content-types', this.createContentType.bind(this));\n router.put('/content-types/:id', this.updateContentType.bind(this));\n router.delete('/content-types/:id', this.deleteContentType.bind(this));\n \n // Configuration routes\n router.get('/config', this.handleGetConfig.bind(this));\n router.put('/config', this.handleUpdateConfig.bind(this));\n \n // User routes\n router.get('/users', this.getUsers.bind(this));\n router.get('/users/:id', this.getUser.bind(this));\n router.post('/users', this.createUser.bind(this));\n router.put('/users/:id', this.updateUser.bind(this));\n router.delete('/users/:id', this.deleteUser.bind(this));\n \n return router;\n }\n\n private createAdminRoutes(): express.Router {\n const router = express.Router();\n \n // Admin dashboard\n router.get('/', (req, res) => {\n res.json({\n message: 'Content Management Suite Admin',\n version: '0.1.0',\n endpoints: [\n '/workflows',\n '/content-types',\n '/config',\n '/users'\n ]\n });\n });\n \n // Workflow management\n router.get('/workflows', this.getWorkflows.bind(this));\n router.post('/workflows', this.createWorkflow.bind(this));\n router.put('/workflows/:id', this.updateWorkflow.bind(this));\n router.delete('/workflows/:id', this.deleteWorkflow.bind(this));\n \n // Content type management\n router.get('/content-types', this.getContentTypes.bind(this));\n router.post('/content-types', this.createContentType.bind(this));\n router.put('/content-types/:id', this.updateContentType.bind(this));\n router.delete('/content-types/:id', this.deleteContentType.bind(this));\n \n // Configuration management\n router.get('/config', this.handleGetConfig.bind(this));\n router.put('/config', this.handleUpdateConfig.bind(this));\n \n return router;\n }\n\n private errorHandler(error: Error, _req: express.Request, res: express.Response, _next: express.NextFunction): void {\n this.emit('error', error);\n \n if (error instanceof ContentManagementSuiteError) {\n res.status(error.statusCode).json({\n error: {\n code: error.code,\n message: error.message,\n details: error.details\n }\n });\n } else {\n res.status(500).json({\n error: {\n code: 'INTERNAL_ERROR',\n message: 'An unexpected error occurred',\n details: process.env.NODE_ENV === 'development' ? error.message : undefined\n }\n });\n }\n }\n\n private registerDefaultContentTypes(): void {\n // Register all content types (using correct export names)\n // Note: These content type packages export managers/classes, not static definitions\n // We store references for use in content creation/validation\n this.contentTypes.set('text', TextContentType);\n this.contentTypes.set('image', ImageContentType);\n this.contentTypes.set('audio', AudioContentTypeManager);\n this.contentTypes.set('video', VideoContentType);\n }\n\n // Public API Methods\n async start(): Promise<void> {\n if (this.isStarted) {\n throw new ContentManagementSuiteError('Suite is already started', 'ALREADY_STARTED');\n }\n\n try {\n // Start stub services\n await this.configManager.start();\n await this.workflowService.start();\n await this.editorService.start();\n\n // Start server\n const port = this.config.server.port;\n const host = this.config.server.host;\n\n return new Promise((resolve, reject) => {\n this.httpServer = this.server.listen(port, host, () => {\n console.log(`Content Management Suite started on http://${host}:${port}`);\n this.isStarted = true;\n this.emit('started');\n resolve();\n });\n\n this.httpServer.on('error', (err: Error) => {\n this.emit('error', err);\n reject(new ContentManagementSuiteInternalError('Failed to start server', err));\n });\n });\n } catch (error) {\n this.emit('error', error);\n throw new ContentManagementSuiteInternalError('Failed to start suite', error);\n }\n }\n\n async stop(): Promise<void> {\n if (this.isStopped) {\n throw new ContentManagementSuiteError('Suite is already stopped', 'ALREADY_STOPPED');\n }\n\n try {\n // Stop stub services\n await this.configManager.stop();\n await this.workflowService.stop();\n await this.editorService.stop();\n\n // Stop server\n if (this.httpServer) {\n return new Promise((resolve) => {\n this.httpServer.close(() => {\n console.log('Content Management Suite stopped');\n this.isStopped = true;\n this.emit('stopped');\n resolve();\n });\n });\n }\n\n this.isStopped = true;\n } catch (error) {\n this.emit('error', error);\n throw new ContentManagementSuiteInternalError('Failed to stop suite', error);\n }\n }\n\n getConfig(): ContentManagementConfig {\n return this.config;\n }\n\n async updateConfig(config: Partial<ContentManagementConfig>): Promise<void> {\n try {\n const newConfig = ContentManagementConfigSchema.parse({\n ...this.config,\n ...config\n });\n \n this.config = newConfig;\n await this.configManager.updateConfig(newConfig);\n \n this.emit('config:updated', newConfig);\n } catch (error) {\n throw new ContentManagementSuiteValidationError('Invalid configuration', error);\n }\n }\n\n registerContentType(contentType: any): void {\n const id = contentType?.id || contentType?.name || 'unknown';\n this.contentTypes.set(id, contentType);\n this.emit('contentType:registered', contentType);\n }\n\n unregisterContentType(contentTypeId: string): void {\n if (!this.contentTypes.has(contentTypeId)) {\n throw new ContentManagementSuiteNotFoundError('Content type not found');\n }\n\n this.contentTypes.delete(contentTypeId);\n this.emit('contentType:unregistered', contentTypeId);\n }\n\n getContentType(contentTypeId: string): any {\n const contentType = this.contentTypes.get(contentTypeId);\n if (!contentType) {\n throw new ContentManagementSuiteNotFoundError('Content type not found');\n }\n return contentType;\n }\n\n listContentTypes(): any[] {\n return Array.from(this.contentTypes.entries()).map(([id, contentType]) => ({\n id,\n contentType,\n ...contentType\n }));\n }\n\n // Plugin Management\n registerPlugin(plugin: ContentManagementSuitePlugin): void {\n if (this.plugins.has(plugin.name)) {\n throw new ContentManagementSuiteConflictError('Plugin already registered');\n }\n \n this.plugins.set(plugin.name, plugin);\n plugin.install(this);\n \n this.emit('plugin:registered', plugin);\n }\n\n unregisterPlugin(pluginName: string): void {\n const plugin = this.plugins.get(pluginName);\n if (!plugin) {\n throw new ContentManagementSuiteNotFoundError('Plugin not found');\n }\n \n plugin.uninstall(this);\n this.plugins.delete(pluginName);\n \n this.emit('plugin:unregistered', pluginName);\n }\n\n // Middleware Management\n addMiddleware(middleware: ContentManagementSuiteMiddleware): void {\n this.middleware.push(middleware);\n this.emit('middleware:added', middleware);\n }\n\n removeMiddleware(middlewareName: string): void {\n const index = this.middleware.findIndex(m => m.name === middlewareName);\n if (index === -1) {\n throw new ContentManagementSuiteNotFoundError('Middleware not found');\n }\n \n this.middleware.splice(index, 1);\n this.emit('middleware:removed', middlewareName);\n }\n\n // Hook Management\n addHook(hook: ContentManagementSuiteHook): void {\n if (!this.hooks.has(hook.name)) {\n this.hooks.set(hook.name, []);\n }\n \n this.hooks.get(hook.name)!.push(hook);\n this.hooks.get(hook.name)!.sort((a, b) => (a.priority || 0) - (b.priority || 0));\n \n this.emit('hook:added', hook);\n }\n\n removeHook(hookName: string, handler?: (...args: any[]) => void): void {\n const hooks = this.hooks.get(hookName);\n if (!hooks) {\n throw new ContentManagementSuiteNotFoundError('Hook not found');\n }\n \n if (handler) {\n const index = hooks.findIndex(h => h.handler === handler);\n if (index === -1) {\n throw new ContentManagementSuiteNotFoundError('Hook handler not found');\n }\n hooks.splice(index, 1);\n } else {\n this.hooks.delete(hookName);\n }\n \n this.emit('hook:removed', hookName);\n }\n\n // API Route Handlers\n private async getContentList(req: express.Request, res: express.Response): Promise<void> {\n try {\n const { type, status, page = 1, limit = 20 } = req.query;\n const filters = { type, status, page: parseInt(page as string), limit: parseInt(limit as string) };\n \n const content = await this.editorService.listContent(filters);\n res.json(content);\n } catch (error) {\n throw new ContentManagementSuiteInternalError('Failed to get content list', error);\n }\n }\n\n private async getContent(req: express.Request, res: express.Response): Promise<void> {\n try {\n const { id } = req.params;\n const content = await this.editorService.getContent(id);\n res.json(content);\n } catch (error) {\n throw new ContentManagementSuiteNotFoundError('Content not found', error);\n }\n }\n\n private async createContent(req: express.Request, res: express.Response): Promise<void> {\n try {\n const { type, data } = req.body;\n const content = await this.editorService.createContent(type, data);\n this.emit('content:created', content);\n res.status(201).json(content);\n } catch (error) {\n throw new ContentManagementSuiteInternalError('Failed to create content', error);\n }\n }\n\n private async updateContent(req: express.Request, res: express.Response): Promise<void> {\n try {\n const { id } = req.params;\n const { data } = req.body;\n const content = await this.editorService.updateContent(id, data);\n this.emit('content:updated', content);\n res.json(content);\n } catch (error) {\n throw new ContentManagementSuiteInternalError('Failed to update content', error);\n }\n }\n\n private async deleteContent(req: express.Request, res: express.Response): Promise<void> {\n try {\n const { id } = req.params;\n const { soft = true } = req.query;\n await this.editorService.deleteContent(id, soft === 'true');\n this.emit('content:deleted', { id });\n res.status(204).send();\n } catch (error) {\n throw new ContentManagementSuiteInternalError('Failed to delete content', error);\n }\n }\n\n private async publishContent(req: express.Request, res: express.Response): Promise<void> {\n try {\n const { id } = req.params;\n const content = await this.workflowService.publishContent(id);\n this.emit('content:published', content);\n res.json(content);\n } catch (error) {\n throw new ContentManagementSuiteInternalError('Failed to publish content', error);\n }\n }\n\n private async scheduleContent(req: express.Request, res: express.Response): Promise<void> {\n try {\n const { id } = req.params;\n const { date } = req.body;\n const content = await this.workflowService.scheduleContent(id, new Date(date));\n this.emit('content:scheduled', content, new Date(date));\n res.json(content);\n } catch (error) {\n throw new ContentManagementSuiteInternalError('Failed to schedule content', error);\n }\n }\n\n private async unpublishContent(req: express.Request, res: express.Response): Promise<void> {\n try {\n const { id } = req.params;\n const content = await this.workflowService.unpublishContent(id);\n res.json(content);\n } catch (error) {\n throw new ContentManagementSuiteInternalError('Failed to unpublish content', error);\n }\n }\n\n private async getWorkflows(req: express.Request, res: express.Response): Promise<void> {\n try {\n const workflows = await this.workflowService.listWorkflows();\n res.json(workflows);\n } catch (error) {\n throw new ContentManagementSuiteInternalError('Failed to get workflows', error);\n }\n }\n\n private async getWorkflow(req: express.Request, res: express.Response): Promise<void> {\n try {\n const { id } = req.params;\n const workflow = await this.workflowService.getWorkflow(id);\n res.json(workflow);\n } catch (error) {\n throw new ContentManagementSuiteNotFoundError('Workflow not found', error);\n }\n }\n\n private async createWorkflow(req: express.Request, res: express.Response): Promise<void> {\n try {\n const { data } = req.body;\n const workflow = await this.workflowService.createWorkflow(data);\n res.status(201).json(workflow);\n } catch (error) {\n throw new ContentManagementSuiteInternalError('Failed to create workflow', error);\n }\n }\n\n private async updateWorkflow(req: express.Request, res: express.Response): Promise<void> {\n try {\n const { id } = req.params;\n const { data } = req.body;\n const workflow = await this.workflowService.updateWorkflow(id, data);\n res.json(workflow);\n } catch (error) {\n throw new ContentManagementSuiteInternalError('Failed to update workflow', error);\n }\n }\n\n private async deleteWorkflow(req: express.Request, res: express.Response): Promise<void> {\n try {\n const { id } = req.params;\n await this.workflowService.deleteWorkflow(id);\n res.status(204).send();\n } catch (error) {\n throw new ContentManagementSuiteInternalError('Failed to delete workflow', error);\n }\n }\n\n private async getContentTypes(req: express.Request, res: express.Response): Promise<void> {\n try {\n const contentTypes = this.listContentTypes();\n res.json(contentTypes);\n } catch (error) {\n throw new ContentManagementSuiteInternalError('Failed to get content types', error);\n }\n }\n\n private async handleGetContentType(req: express.Request, res: express.Response): Promise<void> {\n try {\n const id = req.params.id;\n if (!id) {\n throw new ContentManagementSuiteNotFoundError('Content type ID required');\n }\n const contentType = this.contentTypes.get(id);\n if (!contentType) {\n throw new ContentManagementSuiteNotFoundError('Content type not found');\n }\n res.json(contentType);\n } catch (error) {\n throw new ContentManagementSuiteNotFoundError('Content type not found', error);\n }\n }\n\n private async createContentType(req: express.Request, res: express.Response): Promise<void> {\n try {\n const { data } = req.body;\n this.registerContentType(data);\n res.status(201).json(data);\n } catch (error) {\n throw new ContentManagementSuiteInternalError('Failed to create content type', error);\n }\n }\n\n private async updateContentType(req: express.Request, res: express.Response): Promise<void> {\n try {\n const id = req.params.id;\n if (!id) {\n throw new ContentManagementSuiteNotFoundError('Content type ID required');\n }\n const { data } = req.body;\n this.unregisterContentType(id);\n this.registerContentType(data);\n res.json(data);\n } catch (error) {\n throw new ContentManagementSuiteInternalError('Failed to update content type', error);\n }\n }\n\n private async deleteContentType(req: express.Request, res: express.Response): Promise<void> {\n try {\n const id = req.params.id;\n if (!id) {\n throw new ContentManagementSuiteNotFoundError('Content type ID required');\n }\n this.unregisterContentType(id);\n res.status(204).send();\n } catch (error) {\n throw new ContentManagementSuiteInternalError('Failed to delete content type', error);\n }\n }\n\n private async handleGetConfig(req: express.Request, res: express.Response): Promise<void> {\n try {\n res.json(this.config);\n } catch (error) {\n throw new ContentManagementSuiteInternalError('Failed to get config', error);\n }\n }\n\n private async handleUpdateConfig(req: express.Request, res: express.Response): Promise<void> {\n try {\n const { config } = req.body;\n const newConfig = ContentManagementConfigSchema.parse({\n ...this.config,\n ...config\n });\n this.config = newConfig;\n await this.configManager.updateConfig(newConfig);\n this.emit('config:updated', newConfig);\n res.json(this.config);\n } catch (error) {\n throw new ContentManagementSuiteValidationError('Invalid configuration', error);\n }\n }\n\n private async getUsers(req: express.Request, res: express.Response): Promise<void> {\n try {\n // Placeholder for user management\n res.json([]);\n } catch (error) {\n throw new ContentManagementSuiteInternalError('Failed to get users', error);\n }\n }\n\n private async getUser(req: express.Request, res: express.Response): Promise<void> {\n try {\n const { id } = req.params;\n // Placeholder for user management\n res.json({ id, name: 'User' });\n } catch (error) {\n throw new ContentManagementSuiteNotFoundError('User not found', error);\n }\n }\n\n private async createUser(req: express.Request, res: express.Response): Promise<void> {\n try {\n const { data } = req.body;\n // Placeholder for user management\n res.status(201).json({ id: uuidv4(), ...data });\n } catch (error) {\n throw new ContentManagementSuiteInternalError('Failed to create user', error);\n }\n }\n\n private async updateUser(req: express.Request, res: express.Response): Promise<void> {\n try {\n const { id } = req.params;\n const { data } = req.body;\n // Placeholder for user management\n res.json({ id, ...data });\n } catch (error) {\n throw new ContentManagementSuiteInternalError('Failed to update user', error);\n }\n }\n\n private async deleteUser(req: express.Request, res: express.Response): Promise<void> {\n try {\n const { id: _id } = req.params;\n // Placeholder for user management\n res.status(204).send();\n } catch (error) {\n throw new ContentManagementSuiteInternalError('Failed to delete user', error);\n }\n }\n}\n\n// Factory function\nexport function createContentManagementSuite(options: ContentManagementSuiteOptions = {}): ContentManagementSuite {\n return new ContentManagementSuiteImpl(options);\n}\n"],"mappings":";;;AAQA,SAAS,SAAS;AAGX,IAAM,gCAAgC,EAAE,OAAO;AAAA;AAAA,EAEpD,QAAQ,EAAE,OAAO;AAAA,IACf,MAAM,EAAE,OAAO,EAAE,QAAQ,GAAI;AAAA,IAC7B,MAAM,EAAE,OAAO,EAAE,QAAQ,WAAW;AAAA,IACpC,MAAM,EAAE,OAAO;AAAA,MACb,QAAQ,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,QAAQ,GAAG;AAAA,MAC9D,aAAa,EAAE,QAAQ,EAAE,QAAQ,IAAI;AAAA,IACvC,CAAC,EAAE,QAAQ,CAAC,CAAC;AAAA,IACb,UAAU,EAAE,OAAO;AAAA,MACjB,QAAQ,EAAE,QAAQ,EAAE,QAAQ,IAAI;AAAA,MAChC,WAAW,EAAE,OAAO;AAAA,QAClB,SAAS,EAAE,QAAQ,EAAE,QAAQ,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AAAA,IAChD,SAAS,OAAO;AACd,YAAM,IAAI,oCAAoC,yBAAyB,KAAK;AAAA,IAC9E;AAAA,EACF;AAAA,EAEA,MAAc,WAAW,KAAsB,KAAsC;AACnF,QAAI;AACF,YAAM,EAAE,GAAG,IAAI,IAAI;AACnB,YAAM,EAAE,KAAK,IAAI,IAAI;AAErB,UAAI,KAAK,EAAE,IAAI,GAAG,KAAK,CAAC;AAAA,IAC1B,SAAS,OAAO;AACd,YAAM,IAAI,oCAAoC,yBAAyB,KAAK;AAAA,IAC9E;AAAA,EACF;AAAA,EAEA,MAAc,WAAW,KAAsB,KAAsC;AACnF,QAAI;AACF,YAAM,EAAE,IAAI,IAAI,IAAI,IAAI;AAExB,UAAI,OAAO,GAAG,EAAE,KAAK;AAAA,IACvB,SAAS,OAAO;AACd,YAAM,IAAI,oCAAoC,yBAAyB,KAAK;AAAA,IAC9E;AAAA,EACF;AACF;AAGO,SAAS,6BAA6B,UAAyC,CAAC,GAA2B;AAChH,SAAO,IAAI,2BAA2B,OAAO;AAC/C;","names":["WorkflowStepper","StageActionButtons","WorkflowTimeline","WorkflowAdminConfig","TextContentType","ImageContentType","AudioContentTypeManager","VideoContentType","ContentTypeRegistry"]}
1
+ {"version":3,"sources":["../src/content-management-suite.ts","../src/config.ts","../src/errors.ts","../src/in-memory-adapter.ts","../src/namespaces/content.ts","../src/namespaces/content-types.ts","../src/namespaces/workflows.ts","../src/namespaces/users.ts","../src/namespaces/config.ts","../src/namespaces/plugins.ts","../src/namespaces/publishers.ts","../src/namespaces/sources.ts","../src/namespaces/ai.ts","../src/namespaces/social.ts"],"sourcesContent":["/*\nCopyright (c) 2025 Bernier LLC\n\nThis file is licensed to the client under a limited-use license.\nThe client may use and modify this code *only within the scope of the project it was delivered for*.\nRedistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.\n*/\n\nimport { EventEmitter } from 'events';\n\nimport { ContentManagementConfigSchema } from './config';\nimport type { ContentManagementConfig } from './config';\nimport { InternalError } from './errors';\nimport type {\n ContentManagementSuite,\n ContentManagementSuiteOptions,\n ContentManagementLogger,\n ContentNamespace,\n ContentTypesNamespace,\n WorkflowsNamespace,\n UsersNamespace,\n PermissionsNamespace,\n ConfigNamespace,\n PluginsNamespace,\n PublishersNamespace,\n SourcesNamespace,\n AINamespace,\n SocialNamespace,\n SuiteEventMap,\n} from './types';\nimport type { ContentStorageAdapter } from './storage';\nimport { createInMemoryAdapter } from './in-memory-adapter';\n\nimport { ContentNamespaceImpl } from './namespaces/content';\nimport { ContentTypesNamespaceImpl } from './namespaces/content-types';\nimport { WorkflowsNamespaceImpl } from './namespaces/workflows';\nimport { UsersNamespaceImpl, PermissionsNamespaceImpl } from './namespaces/users';\nimport { ConfigNamespaceImpl } from './namespaces/config';\nimport { PluginsNamespaceImpl } from './namespaces/plugins';\nimport { PublishersNamespaceImpl } from './namespaces/publishers';\nimport { SourcesNamespaceImpl } from './namespaces/sources';\nimport { AINamespaceImpl } from './namespaces/ai';\nimport { SocialNamespaceImpl } from './namespaces/social';\n\nexport class ContentManagementSuiteImpl extends EventEmitter implements ContentManagementSuite {\n readonly content: ContentNamespace;\n readonly contentTypes: ContentTypesNamespace;\n readonly workflows: WorkflowsNamespace;\n readonly users: UsersNamespace;\n readonly permissions: PermissionsNamespace;\n readonly config: ConfigNamespace;\n readonly plugins: PluginsNamespace;\n readonly publishers: PublishersNamespace;\n readonly sources: SourcesNamespace;\n readonly ai: AINamespace;\n readonly social: SocialNamespace;\n\n private readonly _logger: ContentManagementLogger | undefined;\n private readonly _options: ContentManagementSuiteOptions;\n private readonly _storage: ContentStorageAdapter;\n private _initialized = false;\n\n constructor(options?: ContentManagementSuiteOptions) {\n super();\n\n this._options = options ?? {};\n this._logger = this._options.logger;\n this._storage = this._options.storage ?? createInMemoryAdapter();\n\n const parsedConfig: ContentManagementConfig = ContentManagementConfigSchema.parse(\n this._options.config ?? {}\n );\n\n const workflowDefaults = this._options.workflows?.defaults ?? {};\n\n // Create namespace instances\n this.contentTypes = new ContentTypesNamespaceImpl();\n this.publishers = new PublishersNamespaceImpl(this);\n this.content = new ContentNamespaceImpl(\n this,\n this._storage,\n () => this.contentTypes,\n () => this.publishers,\n );\n this.workflows = new WorkflowsNamespaceImpl(this._storage);\n this.users = new UsersNamespaceImpl(this);\n this.permissions = new PermissionsNamespaceImpl();\n this.config = new ConfigNamespaceImpl(parsedConfig, this);\n this.plugins = new PluginsNamespaceImpl(this);\n this.sources = new SourcesNamespaceImpl(this, this._storage, workflowDefaults);\n const aiOpts: {\n reviewService?: import('./interfaces').AIReviewService;\n socialGeneratorService?: import('./interfaces').AISocialGeneratorService;\n enhanceService?: import('./interfaces').AIEnhanceService;\n workflowDefaults?: Record<string, string>;\n } = {};\n if (this._options.ai?.reviewService) {\n aiOpts.reviewService = this._options.ai.reviewService;\n }\n if (this._options.ai?.socialGeneratorService) {\n aiOpts.socialGeneratorService = this._options.ai.socialGeneratorService;\n }\n if (this._options.ai?.enhanceService) {\n aiOpts.enhanceService = this._options.ai.enhanceService;\n }\n if (Object.keys(workflowDefaults).length > 0) {\n aiOpts.workflowDefaults = workflowDefaults;\n }\n this.ai = new AINamespaceImpl(this, this._storage, aiOpts);\n this.social = new SocialNamespaceImpl(this, this._storage);\n }\n\n async initialize(): Promise<void> {\n if (this._initialized) {\n throw new InternalError('Suite is already initialized');\n }\n\n // Register default content types\n this.contentTypes.register({ id: 'text', name: 'text' });\n this.contentTypes.register({ id: 'image', name: 'image' });\n this.contentTypes.register({ id: 'audio', name: 'audio' });\n this.contentTypes.register({ id: 'video', name: 'video' });\n\n // Load workflows from storage\n const workflowsImpl = this.workflows as WorkflowsNamespaceImpl;\n if (typeof workflowsImpl.loadFromStorage === 'function') {\n await workflowsImpl.loadFromStorage();\n }\n\n // Register plugins from options\n if (this._options.plugins) {\n for (const plugin of this._options.plugins) {\n await this.plugins.register(plugin);\n }\n }\n\n // Wire auto-advance on ai:review:completed\n this.on('ai:review:completed', async ({ contentId, review }) => {\n try {\n const content = await this._storage.content.get(contentId);\n if (!content || !content.workflowId || !content.workflowStage) {\n return;\n }\n\n const workflow = await this._storage.workflows.get(content.workflowId);\n if (!workflow || !workflow.stages) {\n return;\n }\n\n const currentStage = workflow.stages.find((s) => s.id === content.workflowStage);\n if (!currentStage || !currentStage.conditions) {\n return;\n }\n\n const { autoAdvance, minScore, requiresHumanReview } = currentStage.conditions;\n\n // If human review required, skip auto-advance\n if (requiresHumanReview) {\n return;\n }\n\n // Check auto-advance conditions\n if (autoAdvance && review.passesThreshold && (minScore === undefined || review.score >= minScore)) {\n // Find next stage\n const sortedStages = [...workflow.stages].sort((a, b) => a.order - b.order);\n const currentIndex = sortedStages.findIndex((s) => s.id === currentStage.id);\n const nextStage = sortedStages[currentIndex + 1];\n\n if (nextStage) {\n const fromStage = content.workflowStage;\n await this._storage.content.update(contentId, {\n workflowStage: nextStage.id,\n });\n this.emit('workflow:stage:changed', {\n contentId,\n workflowId: content.workflowId,\n from: fromStage,\n to: nextStage.id,\n });\n }\n }\n } catch {\n // Silently handle errors in auto-advance to avoid breaking the event chain\n }\n });\n\n this._initialized = true;\n this.emit('initialized', undefined as unknown as void);\n }\n\n async dispose(): Promise<void> {\n if (!this._initialized) {\n throw new InternalError('Suite is not initialized');\n }\n\n this._initialized = false;\n this.emit('disposed', undefined as unknown as void);\n }\n\n // Typed event overrides to satisfy the ContentManagementSuite interface\n on<K extends keyof SuiteEventMap>(event: K, listener: (payload: SuiteEventMap[K]) => void): this;\n on(event: string | symbol, listener: (...args: unknown[]) => void): this;\n on(event: string | symbol, listener: (...args: unknown[]) => void): this {\n return super.on(event, listener);\n }\n\n emit<K extends keyof SuiteEventMap>(event: K, payload: SuiteEventMap[K]): boolean;\n emit(event: string | symbol, ...args: unknown[]): boolean;\n emit(event: string | symbol, ...args: unknown[]): boolean {\n return super.emit(event, ...args);\n }\n}\n\n/**\n * Factory function to create a new ContentManagementSuite instance.\n */\nexport function createContentManagementSuite(options?: ContentManagementSuiteOptions): ContentManagementSuite {\n return new ContentManagementSuiteImpl(options);\n}\n","/*\nCopyright (c) 2025 Bernier LLC\n\nThis file is licensed to the client under a limited-use license.\nThe client may use and modify this code *only within the scope of the project it was delivered for*.\nRedistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.\n*/\n\nimport { z } from 'zod';\n\nexport const ContentManagementConfigSchema = z.object({\n content: z.object({\n defaultWorkflow: z.object({\n id: z.string().default('standard'),\n name: z.string().default('Standard Workflow'),\n description: z.string().default('Standard editorial workflow'),\n stages: z.array(z.object({\n id: z.string(),\n name: z.string(),\n order: z.number(),\n isPublishStage: z.boolean().default(false),\n allowsScheduling: z.boolean().default(false),\n description: z.string().optional(),\n permissions: z.array(z.string()).default([]),\n })).default([\n { id: 'write', name: 'Write', order: 1, isPublishStage: false, allowsScheduling: false, description: 'Write content', permissions: ['content.edit'] },\n { id: 'publish', name: 'Publish', order: 2, isPublishStage: true, allowsScheduling: true, description: 'Publish content', permissions: ['content.publish'] },\n ]),\n transitions: z.array(z.object({\n id: z.string(),\n from: z.string(),\n to: z.string(),\n description: z.string().optional(),\n permissions: z.array(z.string()).default([]),\n })).default([\n { id: 'write-to-publish', from: 'write', to: 'publish', description: 'Move from write to publish', permissions: ['content.publish'] },\n ]),\n }).default({}),\n contentTypes: z.array(z.string()).default(['text', 'image', 'audio', 'video']),\n autoSave: z.object({\n enabled: z.boolean().default(true),\n debounceMs: z.number().default(1000),\n maxRetries: z.number().default(3),\n backoffMs: z.number().default(1000),\n }).default({}),\n softDelete: z.object({\n enabled: z.boolean().default(true),\n showDeletedToUsers: z.boolean().default(false),\n retentionDays: z.number().default(30),\n }).default({}),\n upload: z.object({\n maxFileSize: z.number().default(104857600),\n allowedTypes: z.array(z.string()).default([\n 'image/jpeg', 'image/png', 'image/webp', 'image/gif',\n 'audio/mpeg', 'audio/wav', 'audio/ogg',\n 'video/mp4', 'video/webm', 'video/ogg',\n ]),\n storage: z.object({\n type: z.enum(['local', 's3']).default('local'),\n path: z.string().default('./uploads'),\n bucket: z.string().optional(),\n region: z.string().optional(),\n }).default({}).optional(),\n }).default({}),\n }).default({}),\n\n database: z.object({\n type: z.enum(['sqlite', 'postgresql', 'mysql', 'mongodb']).default('sqlite'),\n url: z.string().optional(),\n host: z.string().default('localhost'),\n port: z.number().optional(),\n name: z.string().default('content_management'),\n username: z.string().optional(),\n password: z.string().optional(),\n ssl: z.boolean().default(false),\n pool: z.object({\n min: z.number().default(2),\n max: z.number().default(10),\n idleTimeoutMs: z.number().optional(),\n }).default({}),\n }).default({}),\n\n integrations: z.object({\n neverAdmin: z.object({\n enabled: z.boolean().default(false),\n endpoint: z.string().optional(),\n }).default({}),\n neverHub: z.object({\n enabled: z.boolean().default(false),\n endpoint: z.string().optional(),\n }).default({}),\n analytics: z.object({\n enabled: z.boolean().default(false),\n provider: z.string().optional(),\n }).default({}),\n }).default({}),\n\n security: z.object({\n permissions: z.object({\n enabled: z.boolean().default(true),\n defaultRole: z.string().default('user'),\n }).default({}),\n roles: z.array(z.object({\n name: z.string(),\n permissions: z.array(z.string()),\n description: z.string().optional(),\n })).default([\n { name: 'admin', permissions: ['*'], description: 'Full administrative access' },\n { name: 'editor', permissions: ['content.edit', 'content.publish', 'content.schedule'], description: 'Content editing and publishing' },\n { name: 'author', permissions: ['content.edit'], description: 'Content creation and editing' },\n { name: 'user', permissions: ['content.view'], description: 'Content viewing only' },\n ]),\n }).default({}),\n\n workflows: z.object({\n defaults: z.record(z.string(), z.string()).default({}),\n }).default({}),\n\n logging: z.object({\n level: z.enum(['error', 'warn', 'info', 'debug']).default('info'),\n }).default({}),\n\n performance: z.object({\n cache: z.object({\n enabled: z.boolean().default(true),\n ttl: z.number().default(300),\n maxSize: z.number().default(1000),\n }).default({}),\n }).default({}),\n});\n\nexport type ContentManagementConfig = z.infer<typeof ContentManagementConfigSchema>;\n","/*\nCopyright (c) 2025 Bernier LLC\n\nThis file is licensed to the client under a limited-use license.\nThe client may use and modify this code *only within the scope of the project it was delivered for*.\nRedistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.\n*/\n\nexport class ContentManagementError extends Error {\n readonly code: string;\n readonly details?: Record<string, unknown>;\n\n constructor(message: string, options?: {\n cause?: Error;\n code?: string;\n details?: Record<string, unknown>;\n }) {\n super(message);\n // Attach cause manually (ES2022 feature; tsconfig targets ES2020 so we set it post-construction)\n if (options?.cause !== undefined) {\n (this as unknown as { cause: Error }).cause = options.cause;\n }\n this.name = this.constructor.name;\n this.code = options?.code ?? 'CONTENT_MANAGEMENT_ERROR';\n if (options?.details !== undefined) {\n this.details = options.details;\n }\n }\n}\n\nexport class ValidationError extends ContentManagementError {\n constructor(message: string, options?: { cause?: Error; details?: Record<string, unknown> }) {\n super(message, { ...options, code: 'VALIDATION_ERROR' });\n }\n}\n\nexport class NotFoundError extends ContentManagementError {\n constructor(message: string, options?: { cause?: Error; details?: Record<string, unknown> }) {\n super(message, { ...options, code: 'NOT_FOUND' });\n }\n}\n\nexport class UnauthorizedError extends ContentManagementError {\n constructor(message: string, options?: { cause?: Error; details?: Record<string, unknown> }) {\n super(message, { ...options, code: 'UNAUTHORIZED' });\n }\n}\n\nexport class ForbiddenError extends ContentManagementError {\n constructor(message: string, options?: { cause?: Error; details?: Record<string, unknown> }) {\n super(message, { ...options, code: 'FORBIDDEN' });\n }\n}\n\nexport class ConflictError extends ContentManagementError {\n constructor(message: string, options?: { cause?: Error; details?: Record<string, unknown> }) {\n super(message, { ...options, code: 'CONFLICT' });\n }\n}\n\nexport class InternalError extends ContentManagementError {\n constructor(message: string, options?: { cause?: Error; details?: Record<string, unknown> }) {\n super(message, { ...options, code: 'INTERNAL_ERROR' });\n }\n}\n","/*\nCopyright (c) 2025 Bernier LLC\n\nThis file is licensed to the client under a limited-use license.\nThe client may use and modify this code *only within the scope of the project it was delivered for*.\nRedistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.\n*/\n\nimport type {\n ContentItem,\n ContentFilters,\n SearchOptions,\n PaginatedResult,\n Workflow,\n SocialPost,\n AIReview,\n} from './types';\n\nimport type {\n ContentStorageAdapter,\n ContentStorageNamespace,\n WorkflowStorageNamespace,\n ContentTypeStorageNamespace,\n SocialPostStorageNamespace,\n AIReviewStorageNamespace,\n StoredContentTypeDefinition,\n} from './storage';\n\n// --- In-Memory Content Storage ---\n\nclass InMemoryContentStorage implements ContentStorageNamespace {\n private readonly store = new Map<string, ContentItem>();\n\n async list(filters?: ContentFilters): Promise<PaginatedResult<ContentItem>> {\n let items = Array.from(this.store.values());\n\n if (filters?.type) {\n items = items.filter((item) => item.type === filters.type);\n }\n if (filters?.status) {\n items = items.filter((item) => item.status === filters.status);\n }\n\n const total = items.length;\n const page = filters?.page ?? 1;\n const limit = filters?.limit ?? items.length;\n const start = (page - 1) * limit;\n const paged = items.slice(start, start + limit);\n\n return { items: paged, total, page, limit };\n }\n\n async get(id: string): Promise<ContentItem | null> {\n return this.store.get(id) ?? null;\n }\n\n async create(item: ContentItem): Promise<ContentItem> {\n this.store.set(item.id, item);\n return item;\n }\n\n async update(id: string, partial: Partial<ContentItem>): Promise<ContentItem> {\n const existing = this.store.get(id);\n if (!existing) {\n throw new Error(`Content item not found: ${id}`);\n }\n const updated: ContentItem = { ...existing, ...partial };\n this.store.set(id, updated);\n return updated;\n }\n\n async delete(id: string): Promise<void> {\n this.store.delete(id);\n }\n\n async findBySource(sourceType: string, sourceId: string): Promise<ContentItem | null> {\n for (const item of this.store.values()) {\n if (item.sourceType === sourceType && item.sourceId === sourceId) {\n return item;\n }\n }\n return null;\n }\n\n async search(query: string, options?: SearchOptions): Promise<PaginatedResult<ContentItem>> {\n const lowerQuery = query.toLowerCase();\n let items = Array.from(this.store.values()).filter((item) => {\n const titleMatch = item.title && item.title.toLowerCase().includes(lowerQuery);\n const bodyMatch = item.body && item.body.toLowerCase().includes(lowerQuery);\n const dataMatch = item.data && Object.values(item.data).some(\n (value) => typeof value === 'string' && value.toLowerCase().includes(lowerQuery)\n );\n return titleMatch || bodyMatch || dataMatch;\n });\n\n if (options?.type) {\n items = items.filter((item) => item.type === options.type);\n }\n if (options?.status) {\n items = items.filter((item) => item.status === options.status);\n }\n\n const total = items.length;\n const page = options?.page ?? 1;\n const limit = options?.limit ?? items.length;\n const start = (page - 1) * limit;\n const paged = items.slice(start, start + limit);\n\n return { items: paged, total, page, limit };\n }\n}\n\n// --- In-Memory Workflow Storage ---\n\nclass InMemoryWorkflowStorage implements WorkflowStorageNamespace {\n private readonly store = new Map<string, Workflow>();\n private readonly contentTypeMap = new Map<string, string>(); // contentType -> workflowId\n\n async list(): Promise<Workflow[]> {\n return Array.from(this.store.values());\n }\n\n async get(id: string): Promise<Workflow | null> {\n return this.store.get(id) ?? null;\n }\n\n async create(workflow: Workflow): Promise<Workflow> {\n this.store.set(workflow.id, workflow);\n return workflow;\n }\n\n async update(id: string, partial: Partial<Workflow>): Promise<Workflow> {\n const existing = this.store.get(id);\n if (!existing) {\n throw new Error(`Workflow not found: ${id}`);\n }\n const updated: Workflow = { ...existing, ...partial };\n this.store.set(id, updated);\n return updated;\n }\n\n async delete(id: string): Promise<void> {\n this.store.delete(id);\n // Remove content type mappings pointing to this workflow\n for (const [ct, wId] of this.contentTypeMap.entries()) {\n if (wId === id) {\n this.contentTypeMap.delete(ct);\n }\n }\n }\n\n async findByContentType(contentType: string): Promise<Workflow | null> {\n const workflowId = this.contentTypeMap.get(contentType);\n if (!workflowId) {\n return null;\n }\n return this.store.get(workflowId) ?? null;\n }\n\n setContentTypeMapping(contentType: string, workflowId: string): void {\n this.contentTypeMap.set(contentType, workflowId);\n }\n}\n\n// --- In-Memory Content Type Storage ---\n\nclass InMemoryContentTypeStorage implements ContentTypeStorageNamespace {\n private readonly store = new Map<string, StoredContentTypeDefinition>();\n\n async list(): Promise<StoredContentTypeDefinition[]> {\n return Array.from(this.store.values());\n }\n\n async get(id: string): Promise<StoredContentTypeDefinition | null> {\n return this.store.get(id) ?? null;\n }\n\n async create(def: StoredContentTypeDefinition): Promise<StoredContentTypeDefinition> {\n this.store.set(def.id, def);\n return def;\n }\n\n async update(id: string, partial: Partial<StoredContentTypeDefinition>): Promise<StoredContentTypeDefinition> {\n const existing = this.store.get(id);\n if (!existing) {\n throw new Error(`Content type not found: ${id}`);\n }\n const updated: StoredContentTypeDefinition = { ...existing, ...partial };\n this.store.set(id, updated);\n return updated;\n }\n\n async delete(id: string): Promise<void> {\n this.store.delete(id);\n }\n}\n\n// --- In-Memory Social Post Storage ---\n\nclass InMemorySocialPostStorage implements SocialPostStorageNamespace {\n private readonly store = new Map<string, SocialPost>();\n\n async list(filters?: { contentId?: string; platform?: string; status?: string }): Promise<SocialPost[]> {\n let items = Array.from(this.store.values());\n\n if (filters?.contentId) {\n items = items.filter((p) => p.contentId === filters.contentId);\n }\n if (filters?.platform) {\n items = items.filter((p) => p.platform === filters.platform);\n }\n if (filters?.status) {\n items = items.filter((p) => p.status === filters.status);\n }\n\n return items;\n }\n\n async get(id: string): Promise<SocialPost | null> {\n return this.store.get(id) ?? null;\n }\n\n async create(post: SocialPost): Promise<SocialPost> {\n this.store.set(post.id, post);\n return post;\n }\n\n async update(id: string, partial: Partial<SocialPost>): Promise<SocialPost> {\n const existing = this.store.get(id);\n if (!existing) {\n throw new Error(`Social post not found: ${id}`);\n }\n const updated: SocialPost = { ...existing, ...partial };\n this.store.set(id, updated);\n return updated;\n }\n\n async delete(id: string): Promise<void> {\n this.store.delete(id);\n }\n\n async findByContent(contentId: string): Promise<SocialPost[]> {\n return Array.from(this.store.values()).filter((p) => p.contentId === contentId);\n }\n}\n\n// --- In-Memory AI Review Storage ---\n\nclass InMemoryAIReviewStorage implements AIReviewStorageNamespace {\n private readonly store = new Map<string, AIReview>();\n\n async list(filters?: { contentId?: string }): Promise<AIReview[]> {\n let items = Array.from(this.store.values());\n\n if (filters?.contentId) {\n items = items.filter((r) => r.contentId === filters.contentId);\n }\n\n return items;\n }\n\n async get(id: string): Promise<AIReview | null> {\n return this.store.get(id) ?? null;\n }\n\n async create(review: AIReview): Promise<AIReview> {\n this.store.set(review.id, review);\n return review;\n }\n\n async findByContent(contentId: string): Promise<AIReview[]> {\n return Array.from(this.store.values()).filter((r) => r.contentId === contentId);\n }\n\n async getLatestForContent(contentId: string): Promise<AIReview | null> {\n const reviews = await this.findByContent(contentId);\n if (reviews.length === 0) {\n return null;\n }\n // Sort by createdAt descending and return the first\n reviews.sort((a, b) => b.createdAt.localeCompare(a.createdAt));\n return reviews[0] ?? null;\n }\n}\n\n// --- Factory Function ---\n\nexport function createInMemoryAdapter(): ContentStorageAdapter {\n return {\n content: new InMemoryContentStorage(),\n workflows: new InMemoryWorkflowStorage(),\n contentTypes: new InMemoryContentTypeStorage(),\n socialPosts: new InMemorySocialPostStorage(),\n aiReviews: new InMemoryAIReviewStorage(),\n };\n}\n","/*\nCopyright (c) 2025 Bernier LLC\n\nThis file is licensed to the client under a limited-use license.\nThe client may use and modify this code *only within the scope of the project it was delivered for*.\nRedistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.\n*/\n\nimport { EventEmitter } from 'events';\nimport * as crypto from 'crypto';\nimport type {\n ContentNamespace,\n ContentItem,\n CreateContentInput,\n UpdateContentInput,\n ContentFilters,\n SearchOptions,\n PaginatedResult,\n ContentTypesNamespace,\n PublishersNamespace,\n} from '../types';\nimport type { ContentPublishResult, PublishResult } from '../interfaces';\nimport type { ContentStorageAdapter } from '../storage';\nimport { NotFoundError, ValidationError } from '../errors';\n\nexport class ContentNamespaceImpl implements ContentNamespace {\n private readonly emitter: EventEmitter;\n private readonly storage: ContentStorageAdapter;\n private readonly getContentTypes: () => ContentTypesNamespace;\n private readonly getPublishers: () => PublishersNamespace;\n\n constructor(\n emitter: EventEmitter,\n storage: ContentStorageAdapter,\n getContentTypes: () => ContentTypesNamespace,\n getPublishers: () => PublishersNamespace,\n ) {\n this.emitter = emitter;\n this.storage = storage;\n this.getContentTypes = getContentTypes;\n this.getPublishers = getPublishers;\n }\n\n async create(input: CreateContentInput): Promise<ContentItem> {\n // Validate against content type schema if registered\n const contentTypes = this.getContentTypes();\n const typeDef = contentTypes.get(input.type);\n if (typeDef && typeDef.schema) {\n const dataToValidate: Record<string, unknown> = {\n ...(input.title !== undefined ? { title: input.title } : {}),\n ...(input.body !== undefined ? { body: input.body } : {}),\n ...(input.data ?? {}),\n };\n const result = contentTypes.validate(input.type, dataToValidate);\n if (!result.valid) {\n throw new ValidationError('Content type schema validation failed', {\n details: { errors: result.errors },\n });\n }\n }\n\n const item: ContentItem = {\n id: crypto.randomUUID(),\n type: input.type,\n createdAt: new Date().toISOString(),\n status: 'draft',\n ...(input.title !== undefined ? { title: input.title } : {}),\n ...(input.body !== undefined ? { body: input.body } : {}),\n ...(input.data !== undefined ? { data: { ...input.data } } : {}),\n ...(input.channels !== undefined ? { channels: input.channels } : {}),\n ...(input.metadata !== undefined ? { metadata: input.metadata } : {}),\n };\n\n const created = await this.storage.content.create(item);\n this.emitter.emit('content:created', created);\n return created;\n }\n\n async get(id: string): Promise<ContentItem> {\n const item = await this.storage.content.get(id);\n if (!item) {\n throw new NotFoundError(`Content item not found: ${id}`);\n }\n return item;\n }\n\n async list(filters?: ContentFilters): Promise<PaginatedResult<ContentItem>> {\n return this.storage.content.list(filters);\n }\n\n async update(id: string, input: UpdateContentInput): Promise<ContentItem> {\n const existing = await this.storage.content.get(id);\n if (!existing) {\n throw new NotFoundError(`Content item not found: ${id}`);\n }\n\n const partial: Partial<ContentItem> = {\n updatedAt: new Date().toISOString(),\n ...(input.title !== undefined ? { title: input.title } : {}),\n ...(input.body !== undefined ? { body: input.body } : {}),\n ...(input.status !== undefined ? { status: input.status } : {}),\n ...(input.channels !== undefined ? { channels: input.channels } : {}),\n ...(input.metadata !== undefined ? { metadata: input.metadata } : {}),\n };\n\n if (input.data !== undefined) {\n partial.data = { ...(existing.data ?? {}), ...input.data };\n }\n\n const updated = await this.storage.content.update(id, partial);\n this.emitter.emit('content:updated', updated);\n return updated;\n }\n\n async delete(id: string): Promise<void> {\n const existing = await this.storage.content.get(id);\n if (!existing) {\n throw new NotFoundError(`Content item not found: ${id}`);\n }\n await this.storage.content.delete(id);\n this.emitter.emit('content:deleted', { id });\n }\n\n async publish(id: string, options?: { channels?: string[] }): Promise<ContentPublishResult> {\n const existing = await this.storage.content.get(id);\n if (!existing) {\n throw new NotFoundError(`Content item not found: ${id}`);\n }\n\n // Check publish-stage gating\n if (existing.workflowId) {\n const workflow = await this.storage.workflows.get(existing.workflowId);\n if (workflow && workflow.stages && workflow.stages.length > 0) {\n const currentStage = workflow.stages.find((s) => s.id === existing.workflowStage);\n const publishStage = workflow.stages.find((s) => s.isPublishStage);\n if (publishStage && (!currentStage || !currentStage.isPublishStage)) {\n throw new ValidationError(\n `Content is not at a publish-eligible stage. Current stage: \"${existing.workflowStage ?? 'none'}\", ` +\n `required publish stage: \"${publishStage.id}\"`,\n {\n details: {\n currentStage: existing.workflowStage ?? null,\n requiredStage: publishStage.id,\n },\n },\n );\n }\n }\n }\n\n const publishers = this.getPublishers();\n const allPublishers = publishers.list();\n\n // Determine which channels to publish to\n const channelIds = options?.channels ?? existing.channels;\n\n let targetPublishers;\n if (channelIds && channelIds.length > 0) {\n targetPublishers = allPublishers.filter((p) => channelIds.includes(p.id));\n } else {\n // Publish to all publishers that accept this content type\n targetPublishers = allPublishers.filter((p) => p.acceptedTypes.includes(existing.type));\n }\n\n const results: PublishResult[] = [];\n\n for (const publisher of targetPublishers) {\n // Type check\n if (!publisher.acceptedTypes.includes(existing.type)) {\n results.push({\n channelId: publisher.id,\n success: false,\n error: `Content type \"${existing.type}\" not accepted by publisher \"${publisher.id}\". Accepted: ${publisher.acceptedTypes.join(', ')}`,\n });\n continue;\n }\n\n // Validate if publisher provides validate method\n if (publisher.validate) {\n const validationErrors = await publisher.validate(existing);\n if (validationErrors.length > 0) {\n results.push({\n channelId: publisher.id,\n success: false,\n error: `Validation failed: ${validationErrors.map((e) => e.message).join(', ')}`,\n });\n continue;\n }\n }\n\n try {\n const result = await publisher.publish(existing);\n results.push(result);\n } catch (error) {\n results.push({\n channelId: publisher.id,\n success: false,\n error: error instanceof Error ? error.message : String(error),\n });\n }\n }\n\n // Update content status\n const now = new Date().toISOString();\n const updated = await this.storage.content.update(id, {\n status: 'published',\n publishedAt: now,\n updatedAt: now,\n });\n\n const publishResult: ContentPublishResult = { item: updated, results };\n this.emitter.emit('content:published', publishResult);\n return publishResult;\n }\n\n async unpublish(id: string): Promise<ContentItem> {\n const existing = await this.storage.content.get(id);\n if (!existing) {\n throw new NotFoundError(`Content item not found: ${id}`);\n }\n const updated = await this.storage.content.update(id, {\n status: 'draft',\n updatedAt: new Date().toISOString(),\n });\n this.emitter.emit('content:unpublished', updated);\n return updated;\n }\n\n async schedule(id: string, date: Date): Promise<ContentItem> {\n const existing = await this.storage.content.get(id);\n if (!existing) {\n throw new NotFoundError(`Content item not found: ${id}`);\n }\n const updated = await this.storage.content.update(id, {\n scheduledFor: date,\n updatedAt: new Date().toISOString(),\n });\n this.emitter.emit('content:scheduled', { item: updated, date });\n return updated;\n }\n\n async search(query: string, options?: SearchOptions): Promise<PaginatedResult<ContentItem>> {\n return this.storage.content.search(query, options);\n }\n}\n","/*\nCopyright (c) 2025 Bernier LLC\n\nThis file is licensed to the client under a limited-use license.\nThe client may use and modify this code *only within the scope of the project it was delivered for*.\nRedistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.\n*/\n\nimport { z } from 'zod';\nimport type { ContentTypesNamespace } from '../types';\nimport type { ContentTypeDefinition, SchemaValidationResult } from '../interfaces';\nimport { NotFoundError } from '../errors';\n\nexport class ContentTypesNamespaceImpl implements ContentTypesNamespace {\n private readonly store = new Map<string, ContentTypeDefinition>();\n\n register(definition: ContentTypeDefinition | { id?: string; name?: string }): void {\n // Support both legacy { id, name } and new ContentTypeDefinition\n if ('schema' in definition && definition.schema) {\n const def = definition as ContentTypeDefinition;\n this.store.set(def.id, def);\n } else {\n const id = definition.id ?? definition.name;\n if (!id) {\n throw new Error('Content type must have an id or name');\n }\n const name = definition.name ?? definition.id ?? id;\n // Legacy registration without schema - store with no schema\n this.store.set(id, {\n id,\n name,\n schema: null as unknown,\n });\n }\n }\n\n unregister(id: string): void {\n if (!this.store.has(id)) {\n throw new NotFoundError(`Content type not found: ${id}`);\n }\n this.store.delete(id);\n }\n\n get(id: string): ContentTypeDefinition | undefined {\n return this.store.get(id);\n }\n\n list(): ContentTypeDefinition[] {\n return Array.from(this.store.values());\n }\n\n validate(type: string, data: Record<string, unknown>): SchemaValidationResult {\n const def = this.store.get(type);\n if (!def || !def.schema) {\n // No schema registered - pass through\n return { valid: true };\n }\n\n try {\n // Assume schema is a Zod schema\n const schema = def.schema as z.ZodType;\n schema.parse(data);\n return { valid: true };\n } catch (error) {\n if (error instanceof z.ZodError) {\n return {\n valid: false,\n errors: error.issues.map((issue) => ({\n message: issue.message,\n path: issue.path.map(String),\n })),\n };\n }\n return {\n valid: false,\n errors: [{ message: error instanceof Error ? error.message : String(error) }],\n };\n }\n }\n}\n","/*\nCopyright (c) 2025 Bernier LLC\n\nThis file is licensed to the client under a limited-use license.\nThe client may use and modify this code *only within the scope of the project it was delivered for*.\nRedistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.\n*/\n\nimport * as crypto from 'crypto';\nimport type {\n WorkflowsNamespace,\n Workflow,\n CreateWorkflowInput,\n UpdateWorkflowInput,\n} from '../types';\nimport type { ContentStorageAdapter } from '../storage';\nimport { NotFoundError, ConflictError } from '../errors';\n\nexport class WorkflowsNamespaceImpl implements WorkflowsNamespace {\n private readonly cache = new Map<string, Workflow>();\n private readonly storage: ContentStorageAdapter | undefined;\n\n constructor(storage?: ContentStorageAdapter) {\n this.storage = storage;\n }\n\n /** Load workflows from storage into cache. Called during suite initialization. */\n async loadFromStorage(): Promise<void> {\n if (!this.storage) {\n return;\n }\n const workflows = await this.storage.workflows.list();\n for (const w of workflows) {\n this.cache.set(w.id, w);\n }\n }\n\n async create(input: CreateWorkflowInput): Promise<Workflow> {\n const workflow: Workflow = {\n id: crypto.randomUUID(),\n name: input.name,\n ...(input.description !== undefined ? { description: input.description } : {}),\n ...(input.stages !== undefined ? { stages: input.stages } : {}),\n ...(input.transitions !== undefined ? { transitions: input.transitions } : {}),\n };\n\n // Persist to storage\n if (this.storage) {\n await this.storage.workflows.create(workflow);\n }\n\n this.cache.set(workflow.id, workflow);\n return workflow;\n }\n\n async get(id: string): Promise<Workflow> {\n const workflow = this.cache.get(id);\n if (!workflow) {\n throw new NotFoundError(`Workflow not found: ${id}`);\n }\n return workflow;\n }\n\n async list(): Promise<Workflow[]> {\n return Array.from(this.cache.values());\n }\n\n async update(id: string, input: UpdateWorkflowInput): Promise<Workflow> {\n const existing = this.cache.get(id);\n if (!existing) {\n throw new NotFoundError(`Workflow not found: ${id}`);\n }\n\n const updated: Workflow = {\n ...existing,\n ...(input.name !== undefined ? { name: input.name } : {}),\n ...(input.description !== undefined ? { description: input.description } : {}),\n ...(input.stages !== undefined ? { stages: input.stages } : {}),\n ...(input.transitions !== undefined ? { transitions: input.transitions } : {}),\n };\n\n // Persist to storage\n if (this.storage) {\n await this.storage.workflows.update(id, updated);\n }\n\n this.cache.set(id, updated);\n return updated;\n }\n\n async delete(id: string): Promise<void> {\n if (!this.cache.has(id)) {\n throw new NotFoundError(`Workflow not found: ${id}`);\n }\n\n // Check if any content references this workflow\n if (this.storage) {\n const contentResult = await this.storage.content.list();\n const assignedContent = contentResult.items.filter((item) => item.workflowId === id);\n if (assignedContent.length > 0) {\n throw new ConflictError(\n `Cannot delete workflow \"${id}\": ${assignedContent.length} content item(s) are assigned to it. Reassign or archive them first.`,\n { details: { assignedCount: assignedContent.length } },\n );\n }\n await this.storage.workflows.delete(id);\n }\n\n this.cache.delete(id);\n }\n}\n","/*\nCopyright (c) 2025 Bernier LLC\n\nThis file is licensed to the client under a limited-use license.\nThe client may use and modify this code *only within the scope of the project it was delivered for*.\nRedistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.\n*/\n\nimport { EventEmitter } from 'events';\nimport * as crypto from 'crypto';\nimport type {\n UsersNamespace,\n PermissionsNamespace,\n User,\n CreateUserInput,\n UpdateUserInput,\n PaginatedResult,\n} from '../types';\nimport { NotFoundError } from '../errors';\n\nexport class UsersNamespaceImpl implements UsersNamespace {\n private readonly store = new Map<string, User>();\n private readonly emitter: EventEmitter;\n\n constructor(emitter: EventEmitter) {\n this.emitter = emitter;\n }\n\n async create(input: CreateUserInput): Promise<User> {\n const user: User = {\n id: crypto.randomUUID(),\n name: input.name,\n ...(input.email !== undefined ? { email: input.email } : {}),\n ...(input.role !== undefined ? { role: input.role } : {}),\n createdAt: new Date().toISOString(),\n };\n this.store.set(user.id, user);\n this.emitter.emit('user:created', user);\n return user;\n }\n\n async get(id: string): Promise<User> {\n const user = this.store.get(id);\n if (!user) {\n throw new NotFoundError(`User not found: ${id}`);\n }\n return user;\n }\n\n async list(): Promise<PaginatedResult<User>> {\n const items = Array.from(this.store.values());\n return { items, total: items.length };\n }\n\n async update(id: string, input: UpdateUserInput): Promise<User> {\n const existing = this.store.get(id);\n if (!existing) {\n throw new NotFoundError(`User not found: ${id}`);\n }\n const updated: User = {\n ...existing,\n ...input,\n updatedAt: new Date().toISOString(),\n };\n this.store.set(id, updated);\n this.emitter.emit('user:updated', updated);\n return updated;\n }\n\n async delete(id: string): Promise<void> {\n if (!this.store.has(id)) {\n throw new NotFoundError(`User not found: ${id}`);\n }\n this.store.delete(id);\n this.emitter.emit('user:deleted', { id });\n }\n}\n\nexport class PermissionsNamespaceImpl implements PermissionsNamespace {\n private readonly store = new Map<string, Set<string>>();\n\n async check(userId: string, permission: string): Promise<boolean> {\n const perms = this.store.get(userId);\n return perms?.has(permission) ?? false;\n }\n\n async grant(userId: string, permission: string): Promise<void> {\n let perms = this.store.get(userId);\n if (!perms) {\n perms = new Set();\n this.store.set(userId, perms);\n }\n perms.add(permission);\n }\n\n async revoke(userId: string, permission: string): Promise<void> {\n const perms = this.store.get(userId);\n if (perms) {\n perms.delete(permission);\n }\n }\n}\n","/*\nCopyright (c) 2025 Bernier LLC\n\nThis file is licensed to the client under a limited-use license.\nThe client may use and modify this code *only within the scope of the project it was delivered for*.\nRedistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.\n*/\n\nimport { EventEmitter } from 'events';\nimport type { ConfigNamespace } from '../types';\nimport type { ContentManagementConfig } from '../config';\nimport { ContentManagementConfigSchema } from '../config';\nimport { ValidationError } from '../errors';\n\nfunction deepMerge<T extends Record<string, unknown>>(target: T, source: Partial<T>): T {\n const result = { ...target } as Record<string, unknown>;\n for (const key of Object.keys(source)) {\n const sourceVal = (source as Record<string, unknown>)[key];\n const targetVal = result[key];\n if (\n sourceVal !== null &&\n sourceVal !== undefined &&\n typeof sourceVal === 'object' &&\n !Array.isArray(sourceVal) &&\n targetVal !== null &&\n targetVal !== undefined &&\n typeof targetVal === 'object' &&\n !Array.isArray(targetVal)\n ) {\n result[key] = deepMerge(\n targetVal as Record<string, unknown>,\n sourceVal as Record<string, unknown>\n );\n } else {\n result[key] = sourceVal;\n }\n }\n return result as T;\n}\n\nexport class ConfigNamespaceImpl implements ConfigNamespace {\n private config: ContentManagementConfig;\n private readonly emitter: EventEmitter;\n\n constructor(initialConfig: ContentManagementConfig, emitter: EventEmitter) {\n this.config = initialConfig;\n this.emitter = emitter;\n }\n\n get(): ContentManagementConfig {\n return this.config;\n }\n\n update(partial: Partial<ContentManagementConfig>): ContentManagementConfig {\n const merged = deepMerge(this.config, partial);\n try {\n this.config = ContentManagementConfigSchema.parse(merged);\n } catch (err) {\n throw new ValidationError('Invalid configuration',\n err instanceof Error ? { cause: err } : undefined,\n );\n }\n this.emitter.emit('config:updated', this.config);\n return this.config;\n }\n}\n","/*\nCopyright (c) 2025 Bernier LLC\n\nThis file is licensed to the client under a limited-use license.\nThe client may use and modify this code *only within the scope of the project it was delivered for*.\nRedistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.\n*/\n\nimport type { PluginsNamespace, SuitePlugin, ContentManagementSuite } from '../types';\nimport { ConflictError, NotFoundError } from '../errors';\n\nexport class PluginsNamespaceImpl implements PluginsNamespace {\n private readonly store = new Map<string, SuitePlugin>();\n private readonly suite: ContentManagementSuite;\n\n constructor(suite: ContentManagementSuite) {\n this.suite = suite;\n }\n\n async register(plugin: SuitePlugin): Promise<void> {\n if (this.store.has(plugin.name)) {\n throw new ConflictError(`Plugin already registered: ${plugin.name}`);\n }\n await plugin.setup(this.suite);\n this.store.set(plugin.name, plugin);\n }\n\n async unregister(name: string): Promise<void> {\n const plugin = this.store.get(name);\n if (!plugin) {\n throw new NotFoundError(`Plugin not found: ${name}`);\n }\n if (plugin.teardown) {\n await plugin.teardown(this.suite);\n }\n this.store.delete(name);\n }\n}\n","/*\nCopyright (c) 2025 Bernier LLC\n\nThis file is licensed to the client under a limited-use license.\nThe client may use and modify this code *only within the scope of the project it was delivered for*.\nRedistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.\n*/\n\nimport { EventEmitter } from 'events';\nimport type { PublishersNamespace, ContentItem } from '../types';\nimport type { ContentPublisher, PublishResult } from '../interfaces';\nimport { NotFoundError } from '../errors';\n\n// --- Built-in Website Publisher ---\n\nclass WebsitePublisher implements ContentPublisher {\n readonly id = 'website';\n readonly name = 'Website';\n readonly acceptedTypes = ['blog-post', 'article', 'page', 'generic', 'text'];\n\n async publish(content: ContentItem): Promise<PublishResult> {\n const slug = content.title\n ? content.title.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '')\n : content.id;\n return {\n channelId: this.id,\n success: true,\n url: `/content/${slug}`,\n };\n }\n}\n\n// --- Built-in RSS Publisher ---\n\nclass RSSPublisher implements ContentPublisher {\n readonly id = 'rss';\n readonly name = 'RSS Feed';\n readonly acceptedTypes = ['blog-post', 'article', 'rss-article', 'generic', 'text'];\n\n async publish(content: ContentItem): Promise<PublishResult> {\n return {\n channelId: this.id,\n success: true,\n url: `/feed/rss/${content.id}`,\n };\n }\n}\n\n// --- Publishers Namespace Implementation ---\n\nexport class PublishersNamespaceImpl implements PublishersNamespace {\n private readonly store = new Map<string, ContentPublisher>();\n private readonly emitter: EventEmitter;\n\n constructor(emitter: EventEmitter) {\n this.emitter = emitter;\n\n // Register built-in publishers\n this.store.set('website', new WebsitePublisher());\n this.store.set('rss', new RSSPublisher());\n }\n\n register(publisher: ContentPublisher): void {\n this.store.set(publisher.id, publisher);\n this.emitter.emit('publisher:registered', { publisher });\n }\n\n unregister(id: string): void {\n if (!this.store.has(id)) {\n throw new NotFoundError(`Publisher not found: ${id}`);\n }\n this.store.delete(id);\n }\n\n list(): ContentPublisher[] {\n return Array.from(this.store.values());\n }\n\n get(id: string): ContentPublisher | undefined {\n return this.store.get(id);\n }\n}\n","/*\nCopyright (c) 2025 Bernier LLC\n\nThis file is licensed to the client under a limited-use license.\nThe client may use and modify this code *only within the scope of the project it was delivered for*.\nRedistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.\n*/\n\nimport { EventEmitter } from 'events';\nimport * as crypto from 'crypto';\nimport type { SourcesNamespace, ContentItem } from '../types';\nimport type { ContentSource, IngestResult } from '../interfaces';\nimport type { ContentStorageAdapter } from '../storage';\nimport { NotFoundError, ValidationError } from '../errors';\n\nexport class SourcesNamespaceImpl implements SourcesNamespace {\n private readonly store = new Map<string, ContentSource>();\n private readonly emitter: EventEmitter;\n private readonly storage: ContentStorageAdapter;\n private readonly workflowDefaults: Record<string, string>;\n\n constructor(\n emitter: EventEmitter,\n storage: ContentStorageAdapter,\n workflowDefaults: Record<string, string>,\n ) {\n this.emitter = emitter;\n this.storage = storage;\n this.workflowDefaults = workflowDefaults;\n }\n\n register(source: ContentSource): void {\n this.store.set(source.id, source);\n this.emitter.emit('source:registered', { source });\n }\n\n unregister(id: string): void {\n if (!this.store.has(id)) {\n throw new NotFoundError(`Source not found: ${id}`);\n }\n this.store.delete(id);\n }\n\n list(): ContentSource[] {\n return Array.from(this.store.values());\n }\n\n get(id: string): ContentSource | undefined {\n return this.store.get(id);\n }\n\n async ingest(sourceId: string, rawPayload: unknown): Promise<IngestResult> {\n const source = this.store.get(sourceId);\n if (!source) {\n throw new NotFoundError(`Source not found: ${sourceId}`);\n }\n\n // Validate if the source provides a validate method\n if (source.validate) {\n const validationErrors = await source.validate(rawPayload);\n if (validationErrors.length > 0) {\n throw new ValidationError('Source validation failed', {\n details: { errors: validationErrors },\n });\n }\n }\n\n // Ingest the payload\n const rawItem = await source.ingest(rawPayload);\n\n // Dedup check: if sourceId is set on the item, check for existing\n if (rawItem.sourceId) {\n const existing = await this.storage.content.findBySource(source.id, rawItem.sourceId);\n if (existing) {\n return { created: false, content: existing };\n }\n }\n\n // Build the content item\n const now = new Date().toISOString();\n const workflowId = this.workflowDefaults[rawItem.type] ?? this.workflowDefaults['generic'];\n\n const item: ContentItem = {\n id: crypto.randomUUID(),\n type: rawItem.type,\n createdAt: now,\n status: 'review',\n sourceType: source.id,\n sourceId: rawItem.sourceId ?? null,\n ...(rawItem.title !== undefined ? { title: rawItem.title } : {}),\n ...(rawItem.body !== undefined ? { body: rawItem.body } : {}),\n ...(rawItem.data !== undefined ? { data: rawItem.data } : {}),\n ...(rawItem.metadata !== undefined ? { metadata: rawItem.metadata } : {}),\n ...(workflowId !== undefined ? { workflowId } : {}),\n };\n\n // Persist\n const created = await this.storage.content.create(item);\n\n // Emit events\n this.emitter.emit('content:ingested', { item: created, sourceType: source.id });\n this.emitter.emit('content:created', created);\n\n return { created: true, content: created };\n }\n}\n","/*\nCopyright (c) 2025 Bernier LLC\n\nThis file is licensed to the client under a limited-use license.\nThe client may use and modify this code *only within the scope of the project it was delivered for*.\nRedistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.\n*/\n\nimport { EventEmitter } from 'events';\nimport * as crypto from 'crypto';\nimport type { AINamespace, AIReview, SocialPost } from '../types';\nimport type {\n AIReviewService,\n AISocialGeneratorService,\n AIEnhanceService,\n EnhancedContent,\n EnhanceOptions,\n Suggestion,\n AIReviewSuggestion,\n} from '../interfaces';\nimport type { ContentStorageAdapter } from '../storage';\nimport { NotFoundError, InternalError } from '../errors';\n\nexport class AINamespaceImpl implements AINamespace {\n private readonly emitter: EventEmitter;\n private readonly storage: ContentStorageAdapter;\n private readonly reviewService: AIReviewService | undefined;\n private readonly socialGeneratorService: AISocialGeneratorService | undefined;\n private readonly enhanceService: AIEnhanceService | undefined;\n private readonly workflowDefaults: Record<string, string>;\n\n constructor(\n emitter: EventEmitter,\n storage: ContentStorageAdapter,\n options: {\n reviewService?: AIReviewService;\n socialGeneratorService?: AISocialGeneratorService;\n enhanceService?: AIEnhanceService;\n workflowDefaults?: Record<string, string>;\n },\n ) {\n this.emitter = emitter;\n this.storage = storage;\n this.reviewService = options.reviewService;\n this.socialGeneratorService = options.socialGeneratorService;\n this.enhanceService = options.enhanceService;\n this.workflowDefaults = options.workflowDefaults ?? {};\n }\n\n async review(contentId: string): Promise<AIReview> {\n if (!this.reviewService) {\n throw new InternalError('AI review service not configured');\n }\n\n const content = await this.storage.content.get(contentId);\n if (!content) {\n throw new NotFoundError(`Content item not found: ${contentId}`);\n }\n\n // Build text to review from available content fields\n const textToReview = [content.title, content.body].filter(Boolean).join('\\n\\n')\n || JSON.stringify(content.data ?? {});\n\n const result = await this.reviewService.review(textToReview);\n\n // Map result to AIReview\n const suggestions: AIReviewSuggestion[] = result.issues.map((issue) => ({\n category: issue.category,\n severity: (issue.severity === 'info' || issue.severity === 'warning' || issue.severity === 'error')\n ? issue.severity\n : 'info' as const,\n message: issue.message,\n ...(issue.originalText !== undefined ? { originalText: issue.originalText } : {}),\n ...(issue.suggestedFix !== undefined ? { suggestedFix: issue.suggestedFix } : {}),\n }));\n\n const review: AIReview = {\n id: crypto.randomUUID(),\n contentId,\n score: result.overallScore,\n suggestions,\n passesThreshold: result.passesThreshold,\n rawResult: result.raw,\n createdAt: new Date().toISOString(),\n };\n\n // Persist\n await this.storage.aiReviews.create(review);\n\n // Emit event\n this.emitter.emit('ai:review:completed', { contentId, review });\n\n return review;\n }\n\n async generateSocialPosts(contentId: string, platforms: string[]): Promise<SocialPost[]> {\n if (!this.socialGeneratorService) {\n throw new InternalError('AI social generator service not configured');\n }\n\n const content = await this.storage.content.get(contentId);\n if (!content) {\n throw new NotFoundError(`Content item not found: ${contentId}`);\n }\n\n const textContent = [content.title, content.body].filter(Boolean).join('\\n\\n')\n || JSON.stringify(content.data ?? {});\n\n const generated = await this.socialGeneratorService.generate(textContent, platforms);\n\n const now = new Date().toISOString();\n const workflowId = this.workflowDefaults['social-post'] ?? this.workflowDefaults['generic'];\n\n const posts: SocialPost[] = generated.map((g) => ({\n id: crypto.randomUUID(),\n contentId,\n platform: g.platform,\n body: g.body,\n status: 'draft' as const,\n platformPostId: null,\n publishedAt: null,\n createdAt: now,\n ...(workflowId !== undefined ? { workflowId } : {}),\n }));\n\n // Persist all posts\n for (const post of posts) {\n await this.storage.socialPosts.create(post);\n }\n\n // Emit event\n this.emitter.emit('ai:social:generated', { contentId, posts });\n\n return posts;\n }\n\n async enhance(contentId: string, opts?: EnhanceOptions): Promise<EnhancedContent> {\n if (!this.enhanceService) {\n throw new InternalError('AI enhance service not configured');\n }\n\n const content = await this.storage.content.get(contentId);\n if (!content) {\n throw new NotFoundError(`Content item not found: ${contentId}`);\n }\n\n const textContent = [content.title, content.body].filter(Boolean).join('\\n\\n')\n || JSON.stringify(content.data ?? {});\n\n return this.enhanceService.enhance(textContent, opts);\n }\n\n async suggest(contentId: string): Promise<Suggestion[]> {\n if (!this.enhanceService) {\n throw new InternalError('AI enhance service not configured');\n }\n\n const content = await this.storage.content.get(contentId);\n if (!content) {\n throw new NotFoundError(`Content item not found: ${contentId}`);\n }\n\n const textContent = [content.title, content.body].filter(Boolean).join('\\n\\n')\n || JSON.stringify(content.data ?? {});\n\n return this.enhanceService.suggest(textContent);\n }\n}\n","/*\nCopyright (c) 2025 Bernier LLC\n\nThis file is licensed to the client under a limited-use license.\nThe client may use and modify this code *only within the scope of the project it was delivered for*.\nRedistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.\n*/\n\nimport { EventEmitter } from 'events';\nimport type { SocialNamespace } from '../types';\nimport type {\n SocialPlatformAdapter,\n PlatformPublishResult,\n PlatformInfo,\n PreviewResult,\n SocialMetrics,\n} from '../interfaces';\nimport type { ContentStorageAdapter } from '../storage';\nimport { NotFoundError, ValidationError, InternalError } from '../errors';\n\nexport class SocialNamespaceImpl implements SocialNamespace {\n private readonly store = new Map<string, SocialPlatformAdapter>();\n private readonly emitter: EventEmitter;\n private readonly storage: ContentStorageAdapter;\n\n constructor(emitter: EventEmitter, storage: ContentStorageAdapter) {\n this.emitter = emitter;\n this.storage = storage;\n }\n\n registerPlatform(adapter: SocialPlatformAdapter): void {\n this.store.set(adapter.id, adapter);\n }\n\n unregisterPlatform(id: string): void {\n if (!this.store.has(id)) {\n throw new NotFoundError(`Social platform not found: ${id}`);\n }\n this.store.delete(id);\n }\n\n listPlatforms(): PlatformInfo[] {\n return Array.from(this.store.values()).map((adapter) => ({\n id: adapter.id,\n name: adapter.name,\n acceptedTypes: adapter.acceptedTypes,\n hasPreview: typeof adapter.preview === 'function',\n hasMetrics: typeof adapter.getMetrics === 'function',\n }));\n }\n\n async publish(contentId: string, platforms: string[]): Promise<PlatformPublishResult[]> {\n // Check all platforms are registered\n const missing = platforms.filter((p) => !this.store.has(p));\n if (missing.length > 0) {\n throw new ValidationError(\n `Unregistered social platform(s): ${missing.join(', ')}`,\n { details: { missingPlatforms: missing } },\n );\n }\n\n // Get content\n const content = await this.storage.content.get(contentId);\n if (!content) {\n throw new NotFoundError(`Content item not found: ${contentId}`);\n }\n\n // Check publish-stage gating: content must be at a publish-eligible workflow stage\n if (content.workflowId) {\n const workflow = await this.storage.workflows.get(content.workflowId);\n if (workflow && workflow.stages && workflow.stages.length > 0) {\n const currentStage = workflow.stages.find((s) => s.id === content.workflowStage);\n const publishStage = workflow.stages.find((s) => s.isPublishStage);\n if (publishStage && (!currentStage || !currentStage.isPublishStage)) {\n throw new ValidationError(\n `Content is not at a publish-eligible stage. Current stage: \"${content.workflowStage ?? 'none'}\", ` +\n `required publish stage: \"${publishStage.id}\"`,\n {\n details: {\n currentStage: content.workflowStage ?? null,\n requiredStage: publishStage.id,\n },\n },\n );\n }\n }\n }\n\n // Get social posts for this content\n const socialPosts = await this.storage.socialPosts.findByContent(contentId);\n\n const results: PlatformPublishResult[] = [];\n\n for (const platformId of platforms) {\n const adapter = this.store.get(platformId);\n if (!adapter) {\n continue;\n }\n\n // Type validation\n if (!adapter.acceptedTypes.includes(content.type)) {\n results.push({\n platform: platformId,\n success: false,\n error: `Content type \"${content.type}\" not accepted by platform \"${platformId}\". Accepted: ${adapter.acceptedTypes.join(', ')}`,\n });\n continue;\n }\n\n // Find a social post for this platform\n const post = socialPosts.find((p) => p.platform === platformId && p.status === 'draft');\n if (!post) {\n results.push({\n platform: platformId,\n success: false,\n error: `No draft social post found for platform \"${platformId}\"`,\n });\n continue;\n }\n\n try {\n const result = await adapter.publish(post);\n results.push(result);\n\n // Update social post status\n if (result.success) {\n await this.storage.socialPosts.update(post.id, {\n status: 'published',\n publishedAt: new Date().toISOString(),\n ...(result.platformPostId !== undefined ? { platformPostId: result.platformPostId } : {}),\n });\n this.emitter.emit('social:published', { contentId, platform: platformId, result });\n } else {\n await this.storage.socialPosts.update(post.id, { status: 'failed' });\n }\n } catch (error) {\n await this.storage.socialPosts.update(post.id, { status: 'failed' });\n results.push({\n platform: platformId,\n success: false,\n error: error instanceof Error ? error.message : String(error),\n });\n }\n }\n\n return results;\n }\n\n async preview(contentId: string, platform: string): Promise<PreviewResult> {\n const adapter = this.store.get(platform);\n if (!adapter) {\n throw new NotFoundError(`Social platform not found: ${platform}`);\n }\n\n if (!adapter.preview) {\n throw new InternalError(`Platform \"${platform}\" does not support preview`);\n }\n\n const posts = await this.storage.socialPosts.findByContent(contentId);\n const post = posts.find((p) => p.platform === platform);\n if (!post) {\n throw new NotFoundError(`No social post found for content \"${contentId}\" on platform \"${platform}\"`);\n }\n\n return adapter.preview(post);\n }\n\n async getMetrics(contentId: string, platform: string): Promise<SocialMetrics> {\n const adapter = this.store.get(platform);\n if (!adapter) {\n throw new NotFoundError(`Social platform not found: ${platform}`);\n }\n\n if (!adapter.getMetrics) {\n throw new InternalError(`Platform \"${platform}\" does not support metrics`);\n }\n\n const posts = await this.storage.socialPosts.findByContent(contentId);\n const post = posts.find((p) => p.platform === platform && p.platformPostId);\n if (!post || !post.platformPostId) {\n throw new NotFoundError(`No published social post found for content \"${contentId}\" on platform \"${platform}\"`);\n }\n\n return adapter.getMetrics(post.platformPostId);\n }\n}\n"],"mappings":";AAQA,SAAS,oBAAoB;;;ACA7B,SAAS,SAAS;AAEX,IAAM,gCAAgC,EAAE,OAAO;AAAA,EACpD,SAAS,EAAE,OAAO;AAAA,IAChB,iBAAiB,EAAE,OAAO;AAAA,MACxB,IAAI,EAAE,OAAO,EAAE,QAAQ,UAAU;AAAA,MACjC,MAAM,EAAE,OAAO,EAAE,QAAQ,mBAAmB;AAAA,MAC5C,aAAa,EAAE,OAAO,EAAE,QAAQ,6BAA6B;AAAA,MAC7D,QAAQ,EAAE,MAAM,EAAE,OAAO;AAAA,QACvB,IAAI,EAAE,OAAO;AAAA,QACb,MAAM,EAAE,OAAO;AAAA,QACf,OAAO,EAAE,OAAO;AAAA,QAChB,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,KAAK;AAAA,QACzC,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,KAAK;AAAA,QAC3C,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,QACjC,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC;AAAA,MAC7C,CAAC,CAAC,EAAE,QAAQ;AAAA,QACV,EAAE,IAAI,SAAS,MAAM,SAAS,OAAO,GAAG,gBAAgB,OAAO,kBAAkB,OAAO,aAAa,iBAAiB,aAAa,CAAC,cAAc,EAAE;AAAA,QACpJ,EAAE,IAAI,WAAW,MAAM,WAAW,OAAO,GAAG,gBAAgB,MAAM,kBAAkB,MA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;AAKO,SAAS,6BAA6B,SAAiE;AAC5G,SAAO,IAAI,2BAA2B,OAAO;AAC/C;","names":["z","z","crypto","crypto","crypto","crypto"]}
@@ -0,0 +1,26 @@
1
+ import { C as ContentStorageAdapter } from './types-DQpwJ5e3.js';
2
+ import 'zod';
3
+
4
+ /**
5
+ * Prisma adapter for ContentStorageAdapter.
6
+ *
7
+ * This is a stub entry point. The full Prisma adapter implementation
8
+ * will wrap a host app's Prisma client instance. The host app creates
9
+ * Prisma models matching the documented schema and runs their own migrations.
10
+ *
11
+ * Usage:
12
+ * ```typescript
13
+ * import { createPrismaAdapter } from '@bernierllc/content-management-suite/prisma';
14
+ * const adapter = createPrismaAdapter(prisma);
15
+ * ```
16
+ */
17
+
18
+ /**
19
+ * Creates a Prisma-backed storage adapter.
20
+ *
21
+ * @param prismaClient - The host app's Prisma client instance
22
+ * @returns A ContentStorageAdapter backed by Prisma
23
+ */
24
+ declare function createPrismaAdapter(_prismaClient: unknown): ContentStorageAdapter;
25
+
26
+ export { createPrismaAdapter };
@@ -0,0 +1,26 @@
1
+ import { C as ContentStorageAdapter } from './types-DQpwJ5e3.js';
2
+ import 'zod';
3
+
4
+ /**
5
+ * Prisma adapter for ContentStorageAdapter.
6
+ *
7
+ * This is a stub entry point. The full Prisma adapter implementation
8
+ * will wrap a host app's Prisma client instance. The host app creates
9
+ * Prisma models matching the documented schema and runs their own migrations.
10
+ *
11
+ * Usage:
12
+ * ```typescript
13
+ * import { createPrismaAdapter } from '@bernierllc/content-management-suite/prisma';
14
+ * const adapter = createPrismaAdapter(prisma);
15
+ * ```
16
+ */
17
+
18
+ /**
19
+ * Creates a Prisma-backed storage adapter.
20
+ *
21
+ * @param prismaClient - The host app's Prisma client instance
22
+ * @returns A ContentStorageAdapter backed by Prisma
23
+ */
24
+ declare function createPrismaAdapter(_prismaClient: unknown): ContentStorageAdapter;
25
+
26
+ export { createPrismaAdapter };
package/dist/prisma.js ADDED
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/prisma.ts
21
+ var prisma_exports = {};
22
+ __export(prisma_exports, {
23
+ createPrismaAdapter: () => createPrismaAdapter
24
+ });
25
+ module.exports = __toCommonJS(prisma_exports);
26
+ function createPrismaAdapter(_prismaClient) {
27
+ throw new Error(
28
+ "Prisma adapter is not yet implemented. Use createInMemoryAdapter() for development or implement ContentStorageAdapter manually."
29
+ );
30
+ }
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ createPrismaAdapter
34
+ });
35
+ //# sourceMappingURL=prisma.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/prisma.ts"],"sourcesContent":["/*\nCopyright (c) 2025 Bernier LLC\n\nThis file is licensed to the client under a limited-use license.\nThe client may use and modify this code *only within the scope of the project it was delivered for*.\nRedistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.\n*/\n\n/**\n * Prisma adapter for ContentStorageAdapter.\n *\n * This is a stub entry point. The full Prisma adapter implementation\n * will wrap a host app's Prisma client instance. The host app creates\n * Prisma models matching the documented schema and runs their own migrations.\n *\n * Usage:\n * ```typescript\n * import { createPrismaAdapter } from '@bernierllc/content-management-suite/prisma';\n * const adapter = createPrismaAdapter(prisma);\n * ```\n */\n\nimport type { ContentStorageAdapter } from './storage';\n\n/**\n * Creates a Prisma-backed storage adapter.\n *\n * @param prismaClient - The host app's Prisma client instance\n * @returns A ContentStorageAdapter backed by Prisma\n */\nexport function createPrismaAdapter(_prismaClient: unknown): ContentStorageAdapter {\n throw new Error(\n 'Prisma adapter is not yet implemented. ' +\n 'Use createInMemoryAdapter() for development or implement ContentStorageAdapter manually.'\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA8BO,SAAS,oBAAoB,eAA+C;AACjF,QAAM,IAAI;AAAA,IACR;AAAA,EAEF;AACF;","names":[]}
@@ -0,0 +1,10 @@
1
+ // src/prisma.ts
2
+ function createPrismaAdapter(_prismaClient) {
3
+ throw new Error(
4
+ "Prisma adapter is not yet implemented. Use createInMemoryAdapter() for development or implement ContentStorageAdapter manually."
5
+ );
6
+ }
7
+ export {
8
+ createPrismaAdapter
9
+ };
10
+ //# sourceMappingURL=prisma.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/prisma.ts"],"sourcesContent":["/*\nCopyright (c) 2025 Bernier LLC\n\nThis file is licensed to the client under a limited-use license.\nThe client may use and modify this code *only within the scope of the project it was delivered for*.\nRedistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.\n*/\n\n/**\n * Prisma adapter for ContentStorageAdapter.\n *\n * This is a stub entry point. The full Prisma adapter implementation\n * will wrap a host app's Prisma client instance. The host app creates\n * Prisma models matching the documented schema and runs their own migrations.\n *\n * Usage:\n * ```typescript\n * import { createPrismaAdapter } from '@bernierllc/content-management-suite/prisma';\n * const adapter = createPrismaAdapter(prisma);\n * ```\n */\n\nimport type { ContentStorageAdapter } from './storage';\n\n/**\n * Creates a Prisma-backed storage adapter.\n *\n * @param prismaClient - The host app's Prisma client instance\n * @returns A ContentStorageAdapter backed by Prisma\n */\nexport function createPrismaAdapter(_prismaClient: unknown): ContentStorageAdapter {\n throw new Error(\n 'Prisma adapter is not yet implemented. ' +\n 'Use createInMemoryAdapter() for development or implement ContentStorageAdapter manually.'\n );\n}\n"],"mappings":";AA8BO,SAAS,oBAAoB,eAA+C;AACjF,QAAM,IAAI;AAAA,IACR;AAAA,EAEF;AACF;","names":[]}