@bernierllc/content-management-nextjs 0.0.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +381 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +363 -0
- package/dist/index.d.ts +363 -0
- package/dist/index.js +352 -0
- package/dist/index.js.map +1 -0
- package/package.json +61 -7
- package/README.md +0 -45
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types.ts","../src/error-mapper.ts","../src/handlers/content.ts","../src/handlers/workflows.ts","../src/handlers/sources.ts","../src/handlers/publishers.ts","../src/handlers/content-types.ts","../src/handlers/social.ts","../src/route-handler-factory.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 * Local type stubs matching the content management suite's interface contracts.\n * These will be replaced by imports from @bernierllc/content-management-suite at merge time.\n */\n\n// --- Data Models ---\n\nexport interface ContentItem {\n id: string;\n type: string;\n createdAt: string;\n title?: string;\n body?: string;\n data?: Record<string, unknown>;\n status?: string;\n channels?: string[];\n metadata?: Record<string, unknown>;\n updatedAt?: string;\n publishedAt?: string;\n scheduledFor?: Date;\n workflowId?: string;\n workflowStage?: string;\n sourceType?: string | null;\n sourceId?: string | null;\n}\n\nexport interface CreateContentInput {\n type: string;\n title?: string;\n body?: string;\n data?: Record<string, unknown>;\n channels?: string[];\n metadata?: Record<string, unknown>;\n}\n\nexport interface UpdateContentInput {\n title?: string;\n body?: string;\n data?: Record<string, unknown>;\n channels?: string[];\n metadata?: Record<string, unknown>;\n status?: string;\n}\n\nexport interface ContentFilters {\n type?: string;\n status?: string;\n page?: number;\n limit?: number;\n}\n\nexport interface PaginatedResult<T> {\n items: T[];\n total: number;\n page: number;\n limit: number;\n totalPages: number;\n}\n\nexport interface AIReview {\n id: string;\n contentId: string;\n score: number;\n suggestions: AIReviewSuggestion[];\n passesThreshold: boolean;\n rawResult: Record<string, unknown>;\n createdAt: string;\n}\n\nexport interface AIReviewSuggestion {\n category: string;\n severity: 'info' | 'warning' | 'error';\n message: string;\n originalText?: string;\n suggestedFix?: string;\n}\n\nexport interface SocialPost {\n id: string;\n contentId: string;\n platform: string;\n body: string;\n status: 'draft' | 'published' | 'failed';\n platformPostId?: string | null;\n publishedAt?: string | null;\n workflowId?: string;\n workflowStage?: string;\n createdAt: string;\n}\n\nexport interface Workflow {\n id: string;\n name: string;\n stages: WorkflowStage[];\n contentType?: string;\n description?: string;\n createdAt?: string;\n updatedAt?: string;\n}\n\nexport interface WorkflowStage {\n id: string;\n name: string;\n order: number;\n isPublishStage?: boolean;\n allowsScheduling?: boolean;\n description?: string;\n permissions?: string[];\n conditions?: StageConditions;\n}\n\nexport interface StageConditions {\n autoAdvance?: boolean;\n minScore?: number;\n requiresHumanReview?: boolean;\n}\n\nexport interface User {\n id: string;\n name: string;\n email: string;\n role?: string;\n permissions?: string[];\n createdAt?: string;\n updatedAt?: string;\n}\n\nexport interface ContentTypeDefinition {\n id: string;\n name: string;\n schema?: unknown;\n defaults?: Record<string, unknown>;\n description?: string;\n}\n\nexport interface PublishResult {\n channelId: string;\n success: boolean;\n url?: string;\n error?: string;\n}\n\nexport interface ContentPublishResult {\n item: ContentItem;\n results: PublishResult[];\n}\n\nexport interface IngestResult {\n created: boolean;\n content: ContentItem;\n}\n\nexport interface PlatformPublishResult {\n platform: string;\n success: boolean;\n platformPostId?: string;\n url?: string;\n error?: string;\n}\n\nexport interface ContentSource {\n id: string;\n name: string;\n outputTypes: string[];\n}\n\nexport interface ContentPublisher {\n id: string;\n name: string;\n acceptedTypes: string[];\n}\n\nexport interface EnhancedContent {\n original: string;\n enhanced: string;\n changes: Array<{ type: string; description: string }>;\n}\n\nexport interface Suggestion {\n category: string;\n severity: 'info' | 'warning' | 'error';\n message: string;\n suggestedFix?: string;\n}\n\nexport interface EnhanceOptions {\n tone?: string;\n style?: string;\n instructions?: string;\n}\n\nexport interface PlatformInfo {\n id: string;\n name: string;\n acceptedTypes: string[];\n hasPreview: boolean;\n hasMetrics: boolean;\n}\n\nexport interface PreviewResult {\n html?: string;\n url?: string;\n text?: string;\n}\n\nexport interface SocialMetrics {\n platform: string;\n platformPostId: string;\n impressions?: number;\n engagement?: number;\n clicks?: number;\n shares?: number;\n raw?: Record<string, unknown>;\n}\n\n// --- Namespace Interfaces ---\n\nexport interface ContentNamespace {\n list(filters?: ContentFilters): Promise<PaginatedResult<ContentItem>>;\n get(id: string): Promise<ContentItem | null>;\n create(input: CreateContentInput): Promise<ContentItem>;\n update(id: string, input: UpdateContentInput): Promise<ContentItem>;\n delete(id: string): Promise<void>;\n publish(id: string, options?: { channels?: string[] }): Promise<ContentPublishResult>;\n}\n\nexport interface ContentTypesNamespace {\n register(definition: ContentTypeDefinition): void;\n unregister(id: string): void;\n list(): ContentTypeDefinition[];\n get(id: string): ContentTypeDefinition | undefined;\n}\n\nexport interface WorkflowsNamespace {\n list(): Promise<Workflow[]>;\n get(id: string): Promise<Workflow>;\n create(input: Partial<Workflow>): Promise<Workflow>;\n update(id: string, input: Partial<Workflow>): Promise<Workflow>;\n delete(id: string): Promise<void>;\n}\n\nexport interface PublishersNamespace {\n register(publisher: ContentPublisher): void;\n unregister(id: string): void;\n list(): ContentPublisher[];\n get(id: string): ContentPublisher | undefined;\n}\n\nexport interface SourcesNamespace {\n register(source: ContentSource): void;\n unregister(id: string): void;\n list(): ContentSource[];\n get(id: string): ContentSource | undefined;\n ingest(sourceId: string, rawPayload: unknown): Promise<IngestResult>;\n}\n\nexport interface AINamespace {\n review(contentId: string): Promise<AIReview>;\n generateSocialPosts(contentId: string, platforms: string[]): Promise<SocialPost[]>;\n enhance(contentId: string, opts?: EnhanceOptions): Promise<EnhancedContent>;\n suggest(contentId: string): Promise<Suggestion[]>;\n}\n\nexport interface SocialNamespace {\n registerPlatform(adapter: unknown): void;\n unregisterPlatform(id: string): void;\n listPlatforms(): PlatformInfo[];\n publish(contentId: string, platforms: string[]): Promise<PlatformPublishResult[]>;\n preview(contentId: string, platform: string): Promise<PreviewResult>;\n getMetrics(contentId: string, platform: string): Promise<SocialMetrics>;\n}\n\nexport interface UsersNamespace {\n list(): Promise<User[]>;\n get(id: string): Promise<User | null>;\n create(input: Partial<User>): Promise<User>;\n update(id: string, input: Partial<User>): Promise<User>;\n delete(id: string): Promise<void>;\n}\n\nexport interface PermissionsNamespace {\n check(userId: string, permission: string): Promise<boolean>;\n grant(userId: string, permission: string): Promise<void>;\n revoke(userId: string, permission: string): Promise<void>;\n list(userId: string): Promise<string[]>;\n}\n\nexport interface ConfigNamespace {\n get<T = unknown>(key: string): T | undefined;\n set<T = unknown>(key: string, value: T): void;\n getAll(): Record<string, unknown>;\n}\n\nexport interface PluginsNamespace {\n register(plugin: unknown): void;\n unregister(id: string): void;\n list(): unknown[];\n get(id: string): unknown | undefined;\n}\n\n// --- Suite Interface ---\n\nexport interface ContentManagementSuite {\n readonly content: ContentNamespace;\n readonly contentTypes: ContentTypesNamespace;\n readonly workflows: WorkflowsNamespace;\n readonly publishers: PublishersNamespace;\n readonly sources: SourcesNamespace;\n readonly ai: AINamespace;\n readonly social: SocialNamespace;\n readonly users: UsersNamespace;\n readonly permissions: PermissionsNamespace;\n readonly config: ConfigNamespace;\n readonly plugins: PluginsNamespace;\n\n initialize(): Promise<void>;\n dispose(): Promise<void>;\n}\n\n// --- Error Classes ---\n\nexport class ContentManagementError extends Error {\n readonly code: string;\n readonly context: Record<string, unknown> | undefined;\n\n constructor(message: string, options?: {\n cause?: Error;\n code?: string;\n context?: Record<string, unknown>;\n }) {\n super(message, { cause: options?.cause });\n this.name = 'ContentManagementError';\n this.code = options?.code ?? 'CONTENT_MANAGEMENT_ERROR';\n this.context = options?.context;\n }\n}\n\nexport class ValidationError extends ContentManagementError {\n constructor(message: string, options?: {\n cause?: Error;\n code?: string;\n context?: Record<string, unknown>;\n }) {\n super(message, { ...options, code: options?.code ?? 'VALIDATION_ERROR' });\n this.name = 'ValidationError';\n }\n}\n\nexport class NotFoundError extends ContentManagementError {\n constructor(message: string, options?: {\n cause?: Error;\n code?: string;\n context?: Record<string, unknown>;\n }) {\n super(message, { ...options, code: options?.code ?? 'NOT_FOUND' });\n this.name = 'NotFoundError';\n }\n}\n\nexport class UnauthorizedError extends ContentManagementError {\n constructor(message: string, options?: {\n cause?: Error;\n code?: string;\n context?: Record<string, unknown>;\n }) {\n super(message, { ...options, code: options?.code ?? 'UNAUTHORIZED' });\n this.name = 'UnauthorizedError';\n }\n}\n\nexport class ForbiddenError extends ContentManagementError {\n constructor(message: string, options?: {\n cause?: Error;\n code?: string;\n context?: Record<string, unknown>;\n }) {\n super(message, { ...options, code: options?.code ?? 'FORBIDDEN' });\n this.name = 'ForbiddenError';\n }\n}\n\nexport class ConflictError extends ContentManagementError {\n constructor(message: string, options?: {\n cause?: Error;\n code?: string;\n context?: Record<string, unknown>;\n }) {\n super(message, { ...options, code: options?.code ?? 'CONFLICT' });\n this.name = 'ConflictError';\n }\n}\n\nexport class InternalError extends ContentManagementError {\n constructor(message: string, options?: {\n cause?: Error;\n code?: string;\n context?: Record<string, unknown>;\n }) {\n super(message, { ...options, code: options?.code ?? 'INTERNAL_ERROR' });\n this.name = 'InternalError';\n }\n}\n\n// --- Route Handler Options ---\n\nexport interface RouteHandlerOptions {\n auth: (request: Request) => Promise<{ userId: string } | null>;\n basePath?: string;\n}\n\nexport interface AuthUser {\n userId: string;\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 {\n ValidationError,\n UnauthorizedError,\n ForbiddenError,\n NotFoundError,\n ConflictError,\n InternalError,\n} from './types.js';\n\n/**\n * Map error instances to HTTP status codes.\n */\nexport function errorToStatusCode(error: unknown): number {\n if (error instanceof ValidationError) return 400;\n if (error instanceof UnauthorizedError) return 401;\n if (error instanceof ForbiddenError) return 403;\n if (error instanceof NotFoundError) return 404;\n if (error instanceof ConflictError) return 409;\n if (error instanceof InternalError) return 500;\n return 500;\n}\n\n/**\n * Extract an error message suitable for HTTP responses.\n */\nexport function errorToMessage(error: unknown): string {\n if (error instanceof Error) {\n return error.message;\n }\n return 'Internal server error';\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 { ContentManagementSuite, AuthUser } from '../types.js';\n\n/**\n * GET /api/content — list with filters\n * GET /api/content/[id] — get by id\n */\nexport async function handleContentGet(\n suite: ContentManagementSuite,\n _user: AuthUser,\n segments: string[],\n request: Request,\n): Promise<Response> {\n if (segments.length === 1) {\n const id = segments[0]!;\n const item = await suite.content.get(id);\n if (!item) {\n return Response.json({ error: 'Content not found' }, { status: 404 });\n }\n return Response.json(item);\n }\n\n const url = new URL(request.url);\n const filters: Record<string, unknown> = {};\n const type = url.searchParams.get('type');\n const status = url.searchParams.get('status');\n const page = url.searchParams.get('page');\n const limit = url.searchParams.get('limit');\n\n if (type) filters.type = type;\n if (status) filters.status = status;\n if (page) filters.page = parseInt(page, 10);\n if (limit) filters.limit = parseInt(limit, 10);\n\n const result = await suite.content.list(filters);\n return Response.json(result);\n}\n\n/**\n * POST /api/content — create content\n * POST /api/content/[id]/publish — publish\n * POST /api/content/[id]/review — AI review\n */\nexport async function handleContentPost(\n suite: ContentManagementSuite,\n _user: AuthUser,\n segments: string[],\n request: Request,\n): Promise<Response> {\n if (segments.length === 2 && segments[1] === 'publish') {\n const id = segments[0]!;\n let body: Record<string, unknown> = {};\n try {\n body = await request.json();\n } catch {\n // empty body is acceptable — publish to all channels\n }\n const channels = body.channels as string[] | undefined;\n const result = await suite.content.publish(id, channels ? { channels } : {});\n return Response.json(result);\n }\n\n if (segments.length === 2 && segments[1] === 'review') {\n const id = segments[0]!;\n const review = await suite.ai.review(id);\n return Response.json(review);\n }\n\n const body = await request.json();\n const item = await suite.content.create(body);\n return Response.json(item, { status: 201 });\n}\n\n/**\n * PUT /api/content/[id] — update\n */\nexport async function handleContentPut(\n suite: ContentManagementSuite,\n _user: AuthUser,\n segments: string[],\n request: Request,\n): Promise<Response> {\n if (segments.length !== 1) {\n return Response.json({ error: 'Invalid path' }, { status: 400 });\n }\n const id = segments[0]!;\n const body = await request.json();\n const item = await suite.content.update(id, body);\n return Response.json(item);\n}\n\n/**\n * DELETE /api/content/[id] — soft-delete\n */\nexport async function handleContentDelete(\n suite: ContentManagementSuite,\n _user: AuthUser,\n segments: string[],\n): Promise<Response> {\n if (segments.length !== 1) {\n return Response.json({ error: 'Invalid path' }, { status: 400 });\n }\n const id = segments[0]!;\n await suite.content.delete(id);\n return Response.json({ success: true }, { status: 200 });\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 { ContentManagementSuite, AuthUser } from '../types.js';\n\n/**\n * GET /api/workflows — list\n * GET /api/workflows/[id] — get\n */\nexport async function handleWorkflowsGet(\n suite: ContentManagementSuite,\n _user: AuthUser,\n segments: string[],\n): Promise<Response> {\n if (segments.length === 1) {\n const id = segments[0]!;\n const workflow = await suite.workflows.get(id);\n return Response.json(workflow);\n }\n\n const workflows = await suite.workflows.list();\n return Response.json(workflows);\n}\n\n/**\n * POST /api/workflows — create\n */\nexport async function handleWorkflowsPost(\n suite: ContentManagementSuite,\n _user: AuthUser,\n _segments: string[],\n request: Request,\n): Promise<Response> {\n const body = await request.json();\n const workflow = await suite.workflows.create(body);\n return Response.json(workflow, { status: 201 });\n}\n\n/**\n * PUT /api/workflows/[id] — update\n */\nexport async function handleWorkflowsPut(\n suite: ContentManagementSuite,\n _user: AuthUser,\n segments: string[],\n request: Request,\n): Promise<Response> {\n if (segments.length !== 1) {\n return Response.json({ error: 'Invalid path' }, { status: 400 });\n }\n const id = segments[0]!;\n const body = await request.json();\n const workflow = await suite.workflows.update(id, body);\n return Response.json(workflow);\n}\n\n/**\n * DELETE /api/workflows/[id] — delete\n */\nexport async function handleWorkflowsDelete(\n suite: ContentManagementSuite,\n _user: AuthUser,\n segments: string[],\n): Promise<Response> {\n if (segments.length !== 1) {\n return Response.json({ error: 'Invalid path' }, { status: 400 });\n }\n const id = segments[0]!;\n await suite.workflows.delete(id);\n return Response.json({ success: true }, { status: 200 });\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 { ContentManagementSuite, AuthUser } from '../types.js';\n\n/**\n * GET /api/sources — list registered sources with output types\n */\nexport async function handleSourcesGet(\n suite: ContentManagementSuite,\n _user: AuthUser,\n): Promise<Response> {\n const sources = suite.sources.list();\n const result = sources.map((s) => ({\n id: s.id,\n name: s.name,\n outputTypes: s.outputTypes,\n }));\n return Response.json(result);\n}\n\n/**\n * POST /api/sources/ingest/[sourceId] — ingest raw payload\n */\nexport async function handleSourcesIngest(\n suite: ContentManagementSuite,\n _user: AuthUser,\n sourceId: string,\n request: Request,\n): Promise<Response> {\n const body = await request.json();\n const result = await suite.sources.ingest(sourceId, body);\n return Response.json(result, { status: result.created ? 201 : 200 });\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 { ContentManagementSuite, AuthUser } from '../types.js';\n\n/**\n * GET /api/publishers — list registered publishers with accepted types\n */\nexport async function handlePublishersGet(\n suite: ContentManagementSuite,\n _user: AuthUser,\n): Promise<Response> {\n const publishers = suite.publishers.list();\n const result = publishers.map((p) => ({\n id: p.id,\n name: p.name,\n acceptedTypes: p.acceptedTypes,\n }));\n return Response.json(result);\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 { ContentManagementSuite, AuthUser } from '../types.js';\n\n/**\n * GET /api/content-types — list registered content types\n */\nexport async function handleContentTypesGet(\n suite: ContentManagementSuite,\n _user: AuthUser,\n): Promise<Response> {\n const types = suite.contentTypes.list();\n const result = types.map((t) => ({\n id: t.id,\n name: t.name,\n description: t.description,\n defaults: t.defaults,\n }));\n return Response.json(result);\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 { ContentManagementSuite, AuthUser } from '../types.js';\n\n/**\n * POST /api/social/[contentId]/publish — publish to social platforms\n */\nexport async function handleSocialPublish(\n suite: ContentManagementSuite,\n _user: AuthUser,\n contentId: string,\n request: Request,\n): Promise<Response> {\n const body = await request.json();\n const platforms = body.platforms as string[];\n if (!platforms || !Array.isArray(platforms)) {\n return Response.json(\n { error: 'platforms array is required' },\n { status: 400 },\n );\n }\n const results = await suite.social.publish(contentId, platforms);\n return Response.json(results);\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 { ContentManagementSuite, RouteHandlerOptions, AuthUser } from './types.js';\nimport { errorToStatusCode, errorToMessage } from './error-mapper.js';\nimport {\n handleContentGet,\n handleContentPost,\n handleContentPut,\n handleContentDelete,\n} from './handlers/content.js';\nimport {\n handleWorkflowsGet,\n handleWorkflowsPost,\n handleWorkflowsPut,\n handleWorkflowsDelete,\n} from './handlers/workflows.js';\nimport { handleSourcesGet, handleSourcesIngest } from './handlers/sources.js';\nimport { handlePublishersGet } from './handlers/publishers.js';\nimport { handleContentTypesGet } from './handlers/content-types.js';\nimport { handleSocialPublish } from './handlers/social.js';\n\nexport interface RouteHandlers {\n GET: (request: Request) => Promise<Response>;\n POST: (request: Request) => Promise<Response>;\n PUT: (request: Request) => Promise<Response>;\n DELETE: (request: Request) => Promise<Response>;\n}\n\n/**\n * Create Next.js App Router route handlers for the content management suite.\n *\n * Returns GET, POST, PUT, DELETE functions that internally route based on the URL path.\n */\nexport function createContentRouteHandlers(\n suite: ContentManagementSuite,\n options: RouteHandlerOptions,\n): RouteHandlers {\n if (!options.auth) {\n throw new Error(\n 'auth callback is required - content management routes must not be publicly accessible',\n );\n }\n\n const basePath = options.basePath ?? '/api/content';\n // Normalize: remove trailing slash for consistent matching\n const normalizedBase = basePath.endsWith('/') ? basePath.slice(0, -1) : basePath;\n\n // The base path is the \"API root\" — we need to match several top-level resources:\n // /api/content/... -> content handlers\n // /api/workflows/... -> workflow handlers\n // /api/sources/... -> source handlers\n // /api/publishers -> publisher handlers\n // /api/content-types -> content type handlers\n // /api/social/... -> social handlers\n //\n // We derive the \"api prefix\" from the basePath by going up one level.\n // e.g., basePath = '/api/content' -> apiPrefix = '/api'\n const lastSlash = normalizedBase.lastIndexOf('/');\n const apiPrefix = lastSlash > 0 ? normalizedBase.slice(0, lastSlash) : '';\n\n async function withAuth(\n request: Request,\n handler: (user: AuthUser) => Promise<Response>,\n ): Promise<Response> {\n try {\n const user = await options.auth(request);\n if (!user) {\n return Response.json({ error: 'Unauthorized' }, { status: 401 });\n }\n return await handler(user);\n } catch (error: unknown) {\n const status = errorToStatusCode(error);\n const message = errorToMessage(error);\n return Response.json({ error: message }, { status });\n }\n }\n\n function routeSegments(url: string): { resource: string; segments: string[] } | null {\n const parsed = new URL(url);\n const pathname = parsed.pathname;\n\n // Try matching against the full basePath first (content resource)\n if (pathname === normalizedBase || pathname.startsWith(normalizedBase + '/')) {\n const rest = pathname.slice(normalizedBase.length);\n const segments = rest.split('/').filter(Boolean);\n return { resource: 'content', segments };\n }\n\n // Try other resources under the apiPrefix\n if (apiPrefix) {\n const afterPrefix = pathname.slice(apiPrefix.length);\n const parts = afterPrefix.split('/').filter(Boolean);\n\n if (parts.length >= 1 && parts[0]) {\n const resource = parts[0];\n const segments = parts.slice(1);\n return { resource, segments };\n }\n }\n\n return null;\n }\n\n const GET = async (request: Request): Promise<Response> => {\n return withAuth(request, async (user) => {\n const route = routeSegments(request.url);\n if (!route) {\n return Response.json({ error: 'Not found' }, { status: 404 });\n }\n\n switch (route.resource) {\n case 'content':\n return handleContentGet(suite, user, route.segments, request);\n case 'workflows':\n return handleWorkflowsGet(suite, user, route.segments);\n case 'sources':\n return handleSourcesGet(suite, user);\n case 'publishers':\n return handlePublishersGet(suite, user);\n case 'content-types':\n return handleContentTypesGet(suite, user);\n default:\n return Response.json({ error: 'Not found' }, { status: 404 });\n }\n });\n };\n\n const POST = async (request: Request): Promise<Response> => {\n return withAuth(request, async (user) => {\n const route = routeSegments(request.url);\n if (!route) {\n return Response.json({ error: 'Not found' }, { status: 404 });\n }\n\n switch (route.resource) {\n case 'content':\n return handleContentPost(suite, user, route.segments, request);\n case 'workflows':\n return handleWorkflowsPost(suite, user, route.segments, request);\n case 'sources':\n // POST /api/sources/ingest/[sourceId]\n if (route.segments.length === 2 && route.segments[0] === 'ingest' && route.segments[1]) {\n return handleSourcesIngest(suite, user, route.segments[1], request);\n }\n return Response.json({ error: 'Not found' }, { status: 404 });\n case 'social':\n // POST /api/social/[contentId]/publish\n if (route.segments.length === 2 && route.segments[0] && route.segments[1] === 'publish') {\n return handleSocialPublish(suite, user, route.segments[0], request);\n }\n return Response.json({ error: 'Not found' }, { status: 404 });\n default:\n return Response.json({ error: 'Not found' }, { status: 404 });\n }\n });\n };\n\n const PUT = async (request: Request): Promise<Response> => {\n return withAuth(request, async (user) => {\n const route = routeSegments(request.url);\n if (!route) {\n return Response.json({ error: 'Not found' }, { status: 404 });\n }\n\n switch (route.resource) {\n case 'content':\n return handleContentPut(suite, user, route.segments, request);\n case 'workflows':\n return handleWorkflowsPut(suite, user, route.segments, request);\n default:\n return Response.json({ error: 'Not found' }, { status: 404 });\n }\n });\n };\n\n const DELETE = async (request: Request): Promise<Response> => {\n return withAuth(request, async (user) => {\n const route = routeSegments(request.url);\n if (!route) {\n return Response.json({ error: 'Not found' }, { status: 404 });\n }\n\n switch (route.resource) {\n case 'content':\n return handleContentDelete(suite, user, route.segments);\n case 'workflows':\n return handleWorkflowsDelete(suite, user, route.segments);\n default:\n return Response.json({ error: 'Not found' }, { status: 404 });\n }\n });\n };\n\n return { GET, POST, PUT, DELETE };\n}\n"],"mappings":";AAyUO,IAAM,yBAAN,cAAqC,MAAM;AAAA,EAIhD,YAAY,SAAiB,SAI1B;AACD,UAAM,SAAS,EAAE,OAAO,SAAS,MAAM,CAAC;AACxC,SAAK,OAAO;AACZ,SAAK,OAAO,SAAS,QAAQ;AAC7B,SAAK,UAAU,SAAS;AAAA,EAC1B;AACF;AAEO,IAAM,kBAAN,cAA8B,uBAAuB;AAAA,EAC1D,YAAY,SAAiB,SAI1B;AACD,UAAM,SAAS,EAAE,GAAG,SAAS,MAAM,SAAS,QAAQ,mBAAmB,CAAC;AACxE,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,gBAAN,cAA4B,uBAAuB;AAAA,EACxD,YAAY,SAAiB,SAI1B;AACD,UAAM,SAAS,EAAE,GAAG,SAAS,MAAM,SAAS,QAAQ,YAAY,CAAC;AACjE,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,oBAAN,cAAgC,uBAAuB;AAAA,EAC5D,YAAY,SAAiB,SAI1B;AACD,UAAM,SAAS,EAAE,GAAG,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AI,CAAC;AAAA,MAC9D;AAEA,cAAQ,MAAM,UAAU;AAAA,QACtB,KAAK;AACH,iBAAO,iBAAiB,OAAO,MAAM,MAAM,UAAU,OAAO;AAAA,QAC9D,KAAK;AACH,iBAAO,mBAAmB,OAAO,MAAM,MAAM,UAAU,OAAO;AAAA,QAChE;AACE,iBAAO,SAAS,KAAK,EAAE,OAAO,YAAY,GAAG,EAAE,QAAQ,IAAI,CAAC;AAAA,MAChE;AAAA,IACF,CAAC;AAAA,EACH;AAEA,QAAM,SAAS,OAAO,YAAwC;AAC5D,WAAO,SAAS,SAAS,OAAO,SAAS;AACvC,YAAM,QAAQ,cAAc,QAAQ,GAAG;AACvC,UAAI,CAAC,OAAO;AACV,eAAO,SAAS,KAAK,EAAE,OAAO,YAAY,GAAG,EAAE,QAAQ,IAAI,CAAC;AAAA,MAC9D;AAEA,cAAQ,MAAM,UAAU;AAAA,QACtB,KAAK;AACH,iBAAO,oBAAoB,OAAO,MAAM,MAAM,QAAQ;AAAA,QACxD,KAAK;AACH,iBAAO,sBAAsB,OAAO,MAAM,MAAM,QAAQ;AAAA,QAC1D;AACE,iBAAO,SAAS,KAAK,EAAE,OAAO,YAAY,GAAG,EAAE,QAAQ,IAAI,CAAC;AAAA,MAChE;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO,EAAE,KAAK,MAAM,KAAK,OAAO;AAClC;","names":["body"]}
|
package/package.json
CHANGED
|
@@ -1,10 +1,64 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bernierllc/content-management-nextjs",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Next.js App Router route handlers for the content management suite",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.cjs",
|
|
7
|
+
"module": "dist/index.mjs",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.cjs",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
5
19
|
"keywords": [
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
20
|
+
"content",
|
|
21
|
+
"management",
|
|
22
|
+
"cms",
|
|
23
|
+
"nextjs",
|
|
24
|
+
"route-handlers",
|
|
25
|
+
"app-router"
|
|
26
|
+
],
|
|
27
|
+
"author": "Bernier LLC",
|
|
28
|
+
"license": "UNLICENSED",
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"next": ">=14.0.0",
|
|
31
|
+
"@bernierllc/content-management-suite": "0.8.0"
|
|
32
|
+
},
|
|
33
|
+
"peerDependenciesMeta": {
|
|
34
|
+
"@bernierllc/content-management-suite": {
|
|
35
|
+
"optional": true
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/jest": "^29.5.0",
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
41
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
42
|
+
"eslint": "^8.0.0",
|
|
43
|
+
"jest": "^29.5.0",
|
|
44
|
+
"ts-jest": "^29.1.0",
|
|
45
|
+
"tsup": "^7.0.0",
|
|
46
|
+
"typescript": "^5.0.0"
|
|
47
|
+
},
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": ">=18.0.0"
|
|
50
|
+
},
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public",
|
|
53
|
+
"registry": "https://registry.npmjs.org/"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "tsup",
|
|
57
|
+
"dev": "tsup --watch",
|
|
58
|
+
"test": "jest",
|
|
59
|
+
"test:run": "jest --passWithNoTests",
|
|
60
|
+
"lint": "eslint src --ext .ts",
|
|
61
|
+
"lint:fix": "eslint src --ext .ts --fix",
|
|
62
|
+
"type-check": "tsc --noEmit"
|
|
63
|
+
}
|
|
64
|
+
}
|
package/README.md
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# @bernierllc/content-management-nextjs
|
|
2
|
-
|
|
3
|
-
## ⚠️ IMPORTANT NOTICE ⚠️
|
|
4
|
-
|
|
5
|
-
**This package is created solely for the purpose of setting up OIDC (OpenID Connect) trusted publishing with npm.**
|
|
6
|
-
|
|
7
|
-
This is **NOT** a functional package and contains **NO** code or functionality beyond the OIDC setup configuration.
|
|
8
|
-
|
|
9
|
-
## Purpose
|
|
10
|
-
|
|
11
|
-
This package exists to:
|
|
12
|
-
1. Configure OIDC trusted publishing for the package name `@bernierllc/content-management-nextjs`
|
|
13
|
-
2. Enable secure, token-less publishing from CI/CD workflows
|
|
14
|
-
3. Establish provenance for packages published under this name
|
|
15
|
-
|
|
16
|
-
## What is OIDC Trusted Publishing?
|
|
17
|
-
|
|
18
|
-
OIDC trusted publishing allows package maintainers to publish packages directly from their CI/CD workflows without needing to manage npm access tokens. Instead, it uses OpenID Connect to establish trust between the CI/CD provider (like GitHub Actions) and npm.
|
|
19
|
-
|
|
20
|
-
## Setup Instructions
|
|
21
|
-
|
|
22
|
-
To properly configure OIDC trusted publishing for this package:
|
|
23
|
-
|
|
24
|
-
1. Go to [npmjs.com](https://www.npmjs.com/) and navigate to your package settings
|
|
25
|
-
2. Configure the trusted publisher (e.g., GitHub Actions)
|
|
26
|
-
3. Specify the repository and workflow that should be allowed to publish
|
|
27
|
-
4. Use the configured workflow to publish your actual package
|
|
28
|
-
|
|
29
|
-
## DO NOT USE THIS PACKAGE
|
|
30
|
-
|
|
31
|
-
This package is a placeholder for OIDC configuration only. It:
|
|
32
|
-
- Contains no executable code
|
|
33
|
-
- Provides no functionality
|
|
34
|
-
- Should not be installed as a dependency
|
|
35
|
-
- Exists only for administrative purposes
|
|
36
|
-
|
|
37
|
-
## More Information
|
|
38
|
-
|
|
39
|
-
For more details about npm's trusted publishing feature, see:
|
|
40
|
-
- [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
|
|
41
|
-
- [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
**Maintained for OIDC setup purposes only**
|