@payloadcms/plugin-mcp 3.68.0-internal-debug.dafc24d → 3.68.0-internal.2b8df4a
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.
|
@@ -47,10 +47,8 @@
|
|
|
47
47
|
let collectionsContent = collectionsMatch[1];
|
|
48
48
|
// Remove the collection name and clean up commas
|
|
49
49
|
collectionsContent = collectionsContent.replace(new RegExp(`\\s*,?\\s*${capitalizedName}\\s*,?`, 'g'), '');
|
|
50
|
-
collectionsContent = collectionsContent.replace(/,\s*,/g, ',') // Remove double commas
|
|
51
|
-
;
|
|
52
|
-
collectionsContent = collectionsContent.replace(/^\s*,|,\s*$/g, '') // Remove leading/trailing commas
|
|
53
|
-
;
|
|
50
|
+
collectionsContent = collectionsContent.replace(/,\s*,/g, ','); // Remove double commas
|
|
51
|
+
collectionsContent = collectionsContent.replace(/^\s*,|,\s*$/g, ''); // Remove leading/trailing commas
|
|
54
52
|
content = content.replace(collectionsRegex, `collections: [${collectionsContent}]`);
|
|
55
53
|
}
|
|
56
54
|
// Clean up any double newlines from removed imports
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/mcp/helpers/config.ts"],"sourcesContent":["import type {\n AdminConfig,\n CollectionConfigUpdates,\n DatabaseConfig,\n GeneralConfig,\n PluginUpdates,\n} from '../../types.js'\n\n/**\n * Adds a collection to the payload.config.ts file\n */\nexport function addCollectionToConfig(content: string, collectionName: string): string {\n const capitalizedName = collectionName.charAt(0).toUpperCase() + collectionName.slice(1)\n\n // Add import statement\n const importRegex = /import.*from\\s*['\"]\\.\\/collections\\/.*['\"]/g\n const importMatches = content.match(importRegex)\n\n if (importMatches && importMatches.length > 0) {\n const lastImport = importMatches[importMatches.length - 1]\n const newImport = `import { ${capitalizedName} } from './collections/${capitalizedName}'`\n\n // Check if import already exists\n if (lastImport && !content.includes(newImport)) {\n content = content.replace(lastImport, `${lastImport}\\n${newImport}`)\n }\n } else {\n // Add import after existing imports\n const importInsertPoint = content.indexOf(\"import sharp from 'sharp'\")\n if (importInsertPoint !== -1) {\n const lineEnd = content.indexOf('\\n', importInsertPoint)\n const newImport = `import { ${capitalizedName} } from './collections/${capitalizedName}'`\n content = content.slice(0, lineEnd + 1) + newImport + '\\n' + content.slice(lineEnd + 1)\n }\n }\n\n // Add to collections array\n const collectionsRegex = /collections:\\s*\\[([\\s\\S]*?)\\]/\n const collectionsMatch = content.match(collectionsRegex)\n\n if (collectionsMatch && collectionsMatch[1]) {\n const collectionsContent = collectionsMatch[1].trim()\n if (!collectionsContent.includes(capitalizedName)) {\n const newCollections = collectionsContent\n ? `${collectionsContent}, ${capitalizedName}`\n : capitalizedName\n content = content.replace(collectionsRegex, `collections: [${newCollections}]`)\n }\n }\n\n return content\n}\n\n/**\n * Removes a collection from the payload.config.ts file\n */\nexport function removeCollectionFromConfig(content: string, collectionName: string): string {\n const capitalizedName = collectionName.charAt(0).toUpperCase() + collectionName.slice(1)\n\n // Remove import statement\n const importRegex = new RegExp(\n `import\\\\s*{\\\\s*${capitalizedName}\\\\s*}\\\\s*from\\\\s*['\"]\\\\./collections/${capitalizedName}['\"]\\\\s*\\\\n?`,\n 'g',\n )\n content = content.replace(importRegex, '')\n\n // Remove from collections array\n const collectionsRegex = /collections:\\s*\\[([\\s\\S]*?)\\]/\n const collectionsMatch = content.match(collectionsRegex)\n\n if (collectionsMatch && collectionsMatch[1]) {\n let collectionsContent = collectionsMatch[1]\n\n // Remove the collection name and clean up commas\n collectionsContent = collectionsContent.replace(\n new RegExp(`\\\\s*,?\\\\s*${capitalizedName}\\\\s*,?`, 'g'),\n '',\n )\n collectionsContent = collectionsContent.replace(/,\\s*,/g, ',') // Remove double commas\n collectionsContent = collectionsContent.replace(/^\\s*,|,\\s*$/g, '') // Remove leading/trailing commas\n\n content = content.replace(collectionsRegex, `collections: [${collectionsContent}]`)\n }\n\n // Clean up any double newlines from removed imports\n content = content.replace(/\\n{3,}/g, '\\n\\n')\n\n return content\n}\n\n/**\n * Updates admin configuration in payload.config.ts\n */\nexport function updateAdminConfig(content: string, adminConfig: AdminConfig): string {\n const adminRegex = /admin:\\s*\\{([^}]*)\\}/\n const adminMatch = content.match(adminRegex)\n\n if (adminMatch && adminMatch[1]) {\n let adminContent = adminMatch[1]\n\n // Update specific admin properties\n if (adminConfig.user) {\n if (adminContent.includes('user:')) {\n adminContent = adminContent.replace(/user:[^,}]*/, `user: ${adminConfig.user}.slug`)\n } else {\n adminContent = `\\n user: ${adminConfig.user}.slug,${adminContent}`\n }\n }\n\n if (adminConfig.meta) {\n const metaConfig = Object.entries(adminConfig.meta)\n .map(([key, value]) => ` ${key}: '${value}'`)\n .join(',\\n')\n\n if (adminContent.includes('meta:')) {\n adminContent = adminContent.replace(/meta:\\s*\\{[^}]*\\}/, `meta: {\\n${metaConfig}\\n }`)\n } else {\n adminContent = `${adminContent}\\n meta: {\\n${metaConfig}\\n },`\n }\n }\n\n content = content.replace(adminRegex, `admin: {${adminContent}\\n }`)\n } else {\n // Add admin config if it doesn't exist\n const adminConfigEntries = []\n\n if (adminConfig.user) {\n adminConfigEntries.push(` user: ${adminConfig.user}.slug`)\n }\n\n if (adminConfig.meta) {\n const metaConfig = Object.entries(adminConfig.meta)\n .map(([key, value]) => ` ${key}: '${value}'`)\n .join(',\\n')\n adminConfigEntries.push(` meta: {\\n${metaConfig}\\n }`)\n }\n\n const adminConfigString = `admin: {\\n${adminConfigEntries.join(',\\n')}\\n },`\n content = content.replace(\n /export default buildConfig\\(\\{/,\n `export default buildConfig({\\n ${adminConfigString}`,\n )\n }\n\n return content\n}\n\n/**\n * Updates database configuration in payload.config.ts\n */\nexport function updateDatabaseConfig(content: string, databaseConfig: DatabaseConfig): string {\n if (databaseConfig.type === 'mongodb') {\n // Update to MongoDB adapter\n const dbRegex = /db:[^,}]*(?:,|\\})/\n const mongoImportRegex = /import.*mongooseAdapter.*from.*@payloadcms\\/db-mongodb.*/\n\n if (!content.match(mongoImportRegex)) {\n content = content.replace(\n /(import.*from.*payload.*\\n)/,\n `$1import { mongooseAdapter } from '@payloadcms/db-mongodb'\\n`,\n )\n }\n\n const dbConfig = `db: mongooseAdapter({\\n url: process.env.DATABASE_URI || '${databaseConfig.url || ''}',\\n })`\n content = content.replace(dbRegex, `${dbConfig},`)\n }\n\n return content\n}\n\n/**\n * Updates plugins configuration in payload.config.ts\n */\nexport function updatePluginsConfig(content: string, pluginUpdates: PluginUpdates): string {\n // Add plugin imports\n if (pluginUpdates.add) {\n pluginUpdates.add.forEach((pluginImport: string) => {\n if (!content.includes(pluginImport)) {\n content = content.replace(/(import.*from.*payload.*\\n)/, `$1${pluginImport}\\n`)\n }\n })\n }\n\n // Handle plugins array\n const pluginsRegex = /plugins:\\s*\\[([\\s\\S]*?)\\]/\n const pluginsMatch = content.match(pluginsRegex)\n\n if (pluginsMatch && pluginsMatch[1]) {\n let pluginsContent = pluginsMatch[1]\n\n // Remove plugins\n if (pluginUpdates.remove) {\n pluginUpdates.remove.forEach((pluginName: string) => {\n const pluginRegex = new RegExp(`\\\\s*${pluginName}\\\\(\\\\)\\\\s*,?`, 'g')\n pluginsContent = pluginsContent.replace(pluginRegex, '')\n })\n }\n\n // Add plugins\n if (pluginUpdates.add) {\n pluginUpdates.add.forEach((pluginImport: string) => {\n // This will match: import { PluginName } from '...';\n const match = pluginImport.match(/import\\s*\\{\\s*(\\w+)\\s*\\}/)\n if (match && match[1]) {\n const pluginName = match[1]\n if (!pluginsContent.includes(`${pluginName}(`)) {\n pluginsContent = pluginsContent.trim()\n ? `${pluginsContent}\\n ${pluginName}(),`\n : `\\n ${pluginName}(),`\n }\n }\n })\n }\n\n content = content.replace(pluginsRegex, `plugins: [${pluginsContent}\\n ]`)\n }\n\n return content\n}\n\n/**\n * Updates general configuration options in payload.config.ts\n */\nexport function updateGeneralConfig(content: string, generalConfig: GeneralConfig): string {\n // Update various general configuration options\n Object.entries(generalConfig).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n const configRegex = new RegExp(`${key}:\\\\s*[^,}]*`, 'g')\n\n if (content.match(configRegex)) {\n if (typeof value === 'string') {\n content = content.replace(configRegex, `${key}: '${value}'`)\n } else if (typeof value === 'boolean') {\n content = content.replace(configRegex, `${key}: ${value}`)\n } else if (typeof value === 'object') {\n content = content.replace(configRegex, `${key}: ${JSON.stringify(value, null, 2)}`)\n }\n } else {\n // Add new config option\n const configValue =\n typeof value === 'string'\n ? `'${value}'`\n : typeof value === 'object'\n ? JSON.stringify(value, null, 2)\n : value\n content = content.replace(\n /export default buildConfig\\(\\{/,\n `export default buildConfig({\\n ${key}: ${configValue},`,\n )\n }\n }\n })\n\n return content\n}\n\n/**\n * Updates collection-level configuration in a collection file\n */\nexport function updateCollectionConfig(\n content: string,\n updates: CollectionConfigUpdates,\n collectionName: string,\n): string {\n let updatedContent = content\n\n if (updates.slug) {\n updatedContent = updatedContent.replace(/slug:\\s*'[^']*'/, `slug: '${updates.slug}'`)\n }\n\n if (updates.access) {\n const accessRegex = /access:\\s*\\{[^}]*\\}/\n if (updatedContent.match(accessRegex)) {\n // Update existing access config\n Object.entries(updates.access).forEach(([key, value]) => {\n if (value !== undefined) {\n updatedContent = updatedContent.replace(\n new RegExp(`${key}:\\\\s*[^,}]*`),\n `${key}: ${value}`,\n )\n }\n })\n } else {\n // Add access config\n const accessConfig = Object.entries(updates.access)\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => ` ${key}: ${value}`)\n .join(',\\n')\n\n updatedContent = updatedContent.replace(\n /slug:\\s*'[^']*',/,\n `slug: '${collectionName}',\\n access: {\\n${accessConfig}\\n },`,\n )\n }\n }\n\n if (updates.timestamps !== undefined) {\n if (updatedContent.includes('timestamps:')) {\n updatedContent = updatedContent.replace(\n /timestamps:[^,}]*/,\n `timestamps: ${updates.timestamps}`,\n )\n } else {\n updatedContent = updatedContent.replace(\n /fields:\\s*\\[/,\n `timestamps: ${updates.timestamps},\\n fields: [`,\n )\n }\n }\n\n if (updates.versioning !== undefined) {\n if (updatedContent.includes('versioning:')) {\n updatedContent = updatedContent.replace(\n /versioning:[^,}]*/,\n `versioning: ${updates.versioning}`,\n )\n } else {\n updatedContent = updatedContent.replace(\n /fields:\\s*\\[/,\n `versioning: ${updates.versioning},\\n fields: [`,\n )\n }\n }\n\n return updatedContent\n}\n"],"names":["addCollectionToConfig","content","collectionName","capitalizedName","charAt","toUpperCase","slice","importRegex","importMatches","match","length","lastImport","newImport","includes","replace","importInsertPoint","indexOf","lineEnd","collectionsRegex","collectionsMatch","collectionsContent","trim","newCollections","removeCollectionFromConfig","RegExp","updateAdminConfig","adminConfig","adminRegex","adminMatch","adminContent","user","meta","metaConfig","Object","entries","map","key","value","join","adminConfigEntries","push","adminConfigString","updateDatabaseConfig","databaseConfig","type","dbRegex","mongoImportRegex","dbConfig","url","updatePluginsConfig","pluginUpdates","add","forEach","pluginImport","pluginsRegex","pluginsMatch","pluginsContent","remove","pluginName","pluginRegex","updateGeneralConfig","generalConfig","undefined","configRegex","JSON","stringify","configValue","updateCollectionConfig","updates","updatedContent","slug","access","accessRegex","accessConfig","filter","timestamps","versioning"],"mappings":"AAQA;;CAEC,GACD,OAAO,SAASA,sBAAsBC,OAAe,EAAEC,cAAsB;IAC3E,MAAMC,kBAAkBD,eAAeE,MAAM,CAAC,GAAGC,WAAW,KAAKH,eAAeI,KAAK,CAAC;IAEtF,uBAAuB;IACvB,MAAMC,cAAc;IACpB,MAAMC,gBAAgBP,QAAQQ,KAAK,CAACF;IAEpC,IAAIC,iBAAiBA,cAAcE,MAAM,GAAG,GAAG;QAC7C,MAAMC,aAAaH,aAAa,CAACA,cAAcE,MAAM,GAAG,EAAE;QAC1D,MAAME,YAAY,CAAC,SAAS,EAAET,gBAAgB,uBAAuB,EAAEA,gBAAgB,CAAC,CAAC;QAEzF,iCAAiC;QACjC,IAAIQ,cAAc,CAACV,QAAQY,QAAQ,CAACD,YAAY;YAC9CX,UAAUA,QAAQa,OAAO,CAACH,YAAY,GAAGA,WAAW,EAA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C,YAAY,EAAEsD,QAAQQ,UAAU,EAAE;QAEvC,OAAO;YACLP,iBAAiBA,eAAevD,OAAO,CACrC,gBACA,CAAC,YAAY,EAAEsD,QAAQQ,UAAU,CAAC,cAAc,CAAC;QAErD;IACF;IAEA,OAAOP;AACT"}
|
|
1
|
+
{"version":3,"sources":["../../../src/mcp/helpers/config.ts"],"sourcesContent":["import type {\n AdminConfig,\n CollectionConfigUpdates,\n DatabaseConfig,\n GeneralConfig,\n PluginUpdates,\n} from '../../types.js'\n\n/**\n * Adds a collection to the payload.config.ts file\n */\nexport function addCollectionToConfig(content: string, collectionName: string): string {\n const capitalizedName = collectionName.charAt(0).toUpperCase() + collectionName.slice(1)\n\n // Add import statement\n const importRegex = /import.*from\\s*['\"]\\.\\/collections\\/.*['\"]/g\n const importMatches = content.match(importRegex)\n\n if (importMatches && importMatches.length > 0) {\n const lastImport = importMatches[importMatches.length - 1]\n const newImport = `import { ${capitalizedName} } from './collections/${capitalizedName}'`\n\n // Check if import already exists\n if (lastImport && !content.includes(newImport)) {\n content = content.replace(lastImport, `${lastImport}\\n${newImport}`)\n }\n } else {\n // Add import after existing imports\n const importInsertPoint = content.indexOf(\"import sharp from 'sharp'\")\n if (importInsertPoint !== -1) {\n const lineEnd = content.indexOf('\\n', importInsertPoint)\n const newImport = `import { ${capitalizedName} } from './collections/${capitalizedName}'`\n content = content.slice(0, lineEnd + 1) + newImport + '\\n' + content.slice(lineEnd + 1)\n }\n }\n\n // Add to collections array\n const collectionsRegex = /collections:\\s*\\[([\\s\\S]*?)\\]/\n const collectionsMatch = content.match(collectionsRegex)\n\n if (collectionsMatch && collectionsMatch[1]) {\n const collectionsContent = collectionsMatch[1].trim()\n if (!collectionsContent.includes(capitalizedName)) {\n const newCollections = collectionsContent\n ? `${collectionsContent}, ${capitalizedName}`\n : capitalizedName\n content = content.replace(collectionsRegex, `collections: [${newCollections}]`)\n }\n }\n\n return content\n}\n\n/**\n * Removes a collection from the payload.config.ts file\n */\nexport function removeCollectionFromConfig(content: string, collectionName: string): string {\n const capitalizedName = collectionName.charAt(0).toUpperCase() + collectionName.slice(1)\n\n // Remove import statement\n const importRegex = new RegExp(\n `import\\\\s*{\\\\s*${capitalizedName}\\\\s*}\\\\s*from\\\\s*['\"]\\\\./collections/${capitalizedName}['\"]\\\\s*\\\\n?`,\n 'g',\n )\n content = content.replace(importRegex, '')\n\n // Remove from collections array\n const collectionsRegex = /collections:\\s*\\[([\\s\\S]*?)\\]/\n const collectionsMatch = content.match(collectionsRegex)\n\n if (collectionsMatch && collectionsMatch[1]) {\n let collectionsContent = collectionsMatch[1]\n\n // Remove the collection name and clean up commas\n collectionsContent = collectionsContent.replace(\n new RegExp(`\\\\s*,?\\\\s*${capitalizedName}\\\\s*,?`, 'g'),\n '',\n )\n collectionsContent = collectionsContent.replace(/,\\s*,/g, ',') // Remove double commas\n collectionsContent = collectionsContent.replace(/^\\s*,|,\\s*$/g, '') // Remove leading/trailing commas\n\n content = content.replace(collectionsRegex, `collections: [${collectionsContent}]`)\n }\n\n // Clean up any double newlines from removed imports\n content = content.replace(/\\n{3,}/g, '\\n\\n')\n\n return content\n}\n\n/**\n * Updates admin configuration in payload.config.ts\n */\nexport function updateAdminConfig(content: string, adminConfig: AdminConfig): string {\n const adminRegex = /admin:\\s*\\{([^}]*)\\}/\n const adminMatch = content.match(adminRegex)\n\n if (adminMatch && adminMatch[1]) {\n let adminContent = adminMatch[1]\n\n // Update specific admin properties\n if (adminConfig.user) {\n if (adminContent.includes('user:')) {\n adminContent = adminContent.replace(/user:[^,}]*/, `user: ${adminConfig.user}.slug`)\n } else {\n adminContent = `\\n user: ${adminConfig.user}.slug,${adminContent}`\n }\n }\n\n if (adminConfig.meta) {\n const metaConfig = Object.entries(adminConfig.meta)\n .map(([key, value]) => ` ${key}: '${value}'`)\n .join(',\\n')\n\n if (adminContent.includes('meta:')) {\n adminContent = adminContent.replace(/meta:\\s*\\{[^}]*\\}/, `meta: {\\n${metaConfig}\\n }`)\n } else {\n adminContent = `${adminContent}\\n meta: {\\n${metaConfig}\\n },`\n }\n }\n\n content = content.replace(adminRegex, `admin: {${adminContent}\\n }`)\n } else {\n // Add admin config if it doesn't exist\n const adminConfigEntries = []\n\n if (adminConfig.user) {\n adminConfigEntries.push(` user: ${adminConfig.user}.slug`)\n }\n\n if (adminConfig.meta) {\n const metaConfig = Object.entries(adminConfig.meta)\n .map(([key, value]) => ` ${key}: '${value}'`)\n .join(',\\n')\n adminConfigEntries.push(` meta: {\\n${metaConfig}\\n }`)\n }\n\n const adminConfigString = `admin: {\\n${adminConfigEntries.join(',\\n')}\\n },`\n content = content.replace(\n /export default buildConfig\\(\\{/,\n `export default buildConfig({\\n ${adminConfigString}`,\n )\n }\n\n return content\n}\n\n/**\n * Updates database configuration in payload.config.ts\n */\nexport function updateDatabaseConfig(content: string, databaseConfig: DatabaseConfig): string {\n if (databaseConfig.type === 'mongodb') {\n // Update to MongoDB adapter\n const dbRegex = /db:[^,}]*(?:,|\\})/\n const mongoImportRegex = /import.*mongooseAdapter.*from.*@payloadcms\\/db-mongodb.*/\n\n if (!content.match(mongoImportRegex)) {\n content = content.replace(\n /(import.*from.*payload.*\\n)/,\n `$1import { mongooseAdapter } from '@payloadcms/db-mongodb'\\n`,\n )\n }\n\n const dbConfig = `db: mongooseAdapter({\\n url: process.env.DATABASE_URI || '${databaseConfig.url || ''}',\\n })`\n content = content.replace(dbRegex, `${dbConfig},`)\n }\n\n return content\n}\n\n/**\n * Updates plugins configuration in payload.config.ts\n */\nexport function updatePluginsConfig(content: string, pluginUpdates: PluginUpdates): string {\n // Add plugin imports\n if (pluginUpdates.add) {\n pluginUpdates.add.forEach((pluginImport: string) => {\n if (!content.includes(pluginImport)) {\n content = content.replace(/(import.*from.*payload.*\\n)/, `$1${pluginImport}\\n`)\n }\n })\n }\n\n // Handle plugins array\n const pluginsRegex = /plugins:\\s*\\[([\\s\\S]*?)\\]/\n const pluginsMatch = content.match(pluginsRegex)\n\n if (pluginsMatch && pluginsMatch[1]) {\n let pluginsContent = pluginsMatch[1]\n\n // Remove plugins\n if (pluginUpdates.remove) {\n pluginUpdates.remove.forEach((pluginName: string) => {\n const pluginRegex = new RegExp(`\\\\s*${pluginName}\\\\(\\\\)\\\\s*,?`, 'g')\n pluginsContent = pluginsContent.replace(pluginRegex, '')\n })\n }\n\n // Add plugins\n if (pluginUpdates.add) {\n pluginUpdates.add.forEach((pluginImport: string) => {\n // This will match: import { PluginName } from '...';\n const match = pluginImport.match(/import\\s*\\{\\s*(\\w+)\\s*\\}/)\n if (match && match[1]) {\n const pluginName = match[1]\n if (!pluginsContent.includes(`${pluginName}(`)) {\n pluginsContent = pluginsContent.trim()\n ? `${pluginsContent}\\n ${pluginName}(),`\n : `\\n ${pluginName}(),`\n }\n }\n })\n }\n\n content = content.replace(pluginsRegex, `plugins: [${pluginsContent}\\n ]`)\n }\n\n return content\n}\n\n/**\n * Updates general configuration options in payload.config.ts\n */\nexport function updateGeneralConfig(content: string, generalConfig: GeneralConfig): string {\n // Update various general configuration options\n Object.entries(generalConfig).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n const configRegex = new RegExp(`${key}:\\\\s*[^,}]*`, 'g')\n\n if (content.match(configRegex)) {\n if (typeof value === 'string') {\n content = content.replace(configRegex, `${key}: '${value}'`)\n } else if (typeof value === 'boolean') {\n content = content.replace(configRegex, `${key}: ${value}`)\n } else if (typeof value === 'object') {\n content = content.replace(configRegex, `${key}: ${JSON.stringify(value, null, 2)}`)\n }\n } else {\n // Add new config option\n const configValue =\n typeof value === 'string'\n ? `'${value}'`\n : typeof value === 'object'\n ? JSON.stringify(value, null, 2)\n : value\n content = content.replace(\n /export default buildConfig\\(\\{/,\n `export default buildConfig({\\n ${key}: ${configValue},`,\n )\n }\n }\n })\n\n return content\n}\n\n/**\n * Updates collection-level configuration in a collection file\n */\nexport function updateCollectionConfig(\n content: string,\n updates: CollectionConfigUpdates,\n collectionName: string,\n): string {\n let updatedContent = content\n\n if (updates.slug) {\n updatedContent = updatedContent.replace(/slug:\\s*'[^']*'/, `slug: '${updates.slug}'`)\n }\n\n if (updates.access) {\n const accessRegex = /access:\\s*\\{[^}]*\\}/\n if (updatedContent.match(accessRegex)) {\n // Update existing access config\n Object.entries(updates.access).forEach(([key, value]) => {\n if (value !== undefined) {\n updatedContent = updatedContent.replace(\n new RegExp(`${key}:\\\\s*[^,}]*`),\n `${key}: ${value}`,\n )\n }\n })\n } else {\n // Add access config\n const accessConfig = Object.entries(updates.access)\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => ` ${key}: ${value}`)\n .join(',\\n')\n\n updatedContent = updatedContent.replace(\n /slug:\\s*'[^']*',/,\n `slug: '${collectionName}',\\n access: {\\n${accessConfig}\\n },`,\n )\n }\n }\n\n if (updates.timestamps !== undefined) {\n if (updatedContent.includes('timestamps:')) {\n updatedContent = updatedContent.replace(\n /timestamps:[^,}]*/,\n `timestamps: ${updates.timestamps}`,\n )\n } else {\n updatedContent = updatedContent.replace(\n /fields:\\s*\\[/,\n `timestamps: ${updates.timestamps},\\n fields: [`,\n )\n }\n }\n\n if (updates.versioning !== undefined) {\n if (updatedContent.includes('versioning:')) {\n updatedContent = updatedContent.replace(\n /versioning:[^,}]*/,\n `versioning: ${updates.versioning}`,\n )\n } else {\n updatedContent = updatedContent.replace(\n /fields:\\s*\\[/,\n `versioning: ${updates.versioning},\\n fields: [`,\n )\n }\n }\n\n return updatedContent\n}\n"],"names":["addCollectionToConfig","content","collectionName","capitalizedName","charAt","toUpperCase","slice","importRegex","importMatches","match","length","lastImport","newImport","includes","replace","importInsertPoint","indexOf","lineEnd","collectionsRegex","collectionsMatch","collectionsContent","trim","newCollections","removeCollectionFromConfig","RegExp","updateAdminConfig","adminConfig","adminRegex","adminMatch","adminContent","user","meta","metaConfig","Object","entries","map","key","value","join","adminConfigEntries","push","adminConfigString","updateDatabaseConfig","databaseConfig","type","dbRegex","mongoImportRegex","dbConfig","url","updatePluginsConfig","pluginUpdates","add","forEach","pluginImport","pluginsRegex","pluginsMatch","pluginsContent","remove","pluginName","pluginRegex","updateGeneralConfig","generalConfig","undefined","configRegex","JSON","stringify","configValue","updateCollectionConfig","updates","updatedContent","slug","access","accessRegex","accessConfig","filter","timestamps","versioning"],"mappings":"AAQA;;CAEC,GACD,OAAO,SAASA,sBAAsBC,OAAe,EAAEC,cAAsB;IAC3E,MAAMC,kBAAkBD,eAAeE,MAAM,CAAC,GAAGC,WAAW,KAAKH,eAAeI,KAAK,CAAC;IAEtF,uBAAuB;IACvB,MAAMC,cAAc;IACpB,MAAMC,gBAAgBP,QAAQQ,KAAK,CAACF;IAEpC,IAAIC,iBAAiBA,cAAcE,MAAM,GAAG,GAAG;QAC7C,MAAMC,aAAaH,aAAa,CAACA,cAAcE,MAAM,GAAG,EAAE;QAC1D,MAAME,YAAY,CAAC,SAAS,EAAET,gBAAgB,uBAAuB,EAAEA,gBAAgB,CAAC,CAAC;QAEzF,iCAAiC;QACjC,IAAIQ,cAAc,CAACV,QAAQY,QAAQ,CAACD,YAAY;YAC9CX,UAAUA,QAAQa,OAAO,CAACH,YAAY,GAAGA,WAAW,EAAE,EAAEC,WAAW;QACrE;IACF,OAAO;QACL,oCAAoC;QACpC,MAAMG,oBAAoBd,QAAQe,OAAO,CAAC;QAC1C,IAAID,sBAAsB,CAAC,GAAG;YAC5B,MAAME,UAAUhB,QAAQe,OAAO,CAAC,MAAMD;YACtC,MAAMH,YAAY,CAAC,SAAS,EAAET,gBAAgB,uBAAuB,EAAEA,gBAAgB,CAAC,CAAC;YACzFF,UAAUA,QAAQK,KAAK,CAAC,GAAGW,UAAU,KAAKL,YAAY,OAAOX,QAAQK,KAAK,CAACW,UAAU;QACvF;IACF;IAEA,2BAA2B;IAC3B,MAAMC,mBAAmB;IACzB,MAAMC,mBAAmBlB,QAAQQ,KAAK,CAACS;IAEvC,IAAIC,oBAAoBA,gBAAgB,CAAC,EAAE,EAAE;QAC3C,MAAMC,qBAAqBD,gBAAgB,CAAC,EAAE,CAACE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MAAM,CAAC,CAAC,GAAGrC,MAAM,GAAKA,UAAUyB,WAChC3B,GAAG,CAAC,CAAC,CAACC,KAAKC,MAAM,GAAK,CAAC,IAAI,EAAED,IAAI,EAAE,EAAEC,OAAO,EAC5CC,IAAI,CAAC;YAER+B,iBAAiBA,eAAevD,OAAO,CACrC,oBACA,CAAC,OAAO,EAAEZ,eAAe,iBAAiB,EAAEuE,aAAa,MAAM,CAAC;QAEpE;IACF;IAEA,IAAIL,QAAQO,UAAU,KAAKb,WAAW;QACpC,IAAIO,eAAexD,QAAQ,CAAC,gBAAgB;YAC1CwD,iBAAiBA,eAAevD,OAAO,CACrC,qBACA,CAAC,YAAY,EAAEsD,QAAQO,UAAU,EAAE;QAEvC,OAAO;YACLN,iBAAiBA,eAAevD,OAAO,CACrC,gBACA,CAAC,YAAY,EAAEsD,QAAQO,UAAU,CAAC,cAAc,CAAC;QAErD;IACF;IAEA,IAAIP,QAAQQ,UAAU,KAAKd,WAAW;QACpC,IAAIO,eAAexD,QAAQ,CAAC,gBAAgB;YAC1CwD,iBAAiBA,eAAevD,OAAO,CACrC,qBACA,CAAC,YAAY,EAAEsD,QAAQQ,UAAU,EAAE;QAEvC,OAAO;YACLP,iBAAiBA,eAAevD,OAAO,CACrC,gBACA,CAAC,YAAY,EAAEsD,QAAQQ,UAAU,CAAC,cAAc,CAAC;QAErD;IACF;IAEA,OAAOP;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/plugin-mcp",
|
|
3
|
-
"version": "3.68.0-internal
|
|
3
|
+
"version": "3.68.0-internal.2b8df4a",
|
|
4
4
|
"description": "MCP (Model Context Protocol) capabilities with Payload",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"plugin",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@payloadcms/eslint-config": "3.28.0",
|
|
48
|
-
"payload": "3.68.0-internal
|
|
48
|
+
"payload": "3.68.0-internal.2b8df4a"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"payload": "3.68.0-internal
|
|
51
|
+
"payload": "3.68.0-internal.2b8df4a"
|
|
52
52
|
},
|
|
53
53
|
"homepage:": "https://payloadcms.com",
|
|
54
54
|
"scripts": {
|
|
@@ -60,6 +60,6 @@
|
|
|
60
60
|
"copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
|
|
61
61
|
"lint": "eslint .",
|
|
62
62
|
"lint:fix": "eslint . --fix",
|
|
63
|
-
"pack:plugin": "pnpm
|
|
63
|
+
"pack:plugin": "pnpm prepublishOnly && pnpm copyfiles && pnpm pack"
|
|
64
64
|
}
|
|
65
65
|
}
|