@payloadcms/plugin-mcp 4.0.0-internal.011fd46 → 4.0.0-internal.0b9bec1
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/LICENSE.md +1 -1
- package/bin.js +7 -0
- package/dist/defaultAccess.d.ts +3 -0
- package/dist/defaultAccess.d.ts.map +1 -0
- package/dist/defaultAccess.js +3 -0
- package/dist/defaultAccess.js.map +1 -0
- package/dist/defineTool.d.ts +8 -8
- package/dist/defineTool.d.ts.map +1 -1
- package/dist/endpoint/access.d.ts +12 -5
- package/dist/endpoint/access.d.ts.map +1 -1
- package/dist/endpoint/access.js +74 -103
- package/dist/endpoint/access.js.map +1 -1
- package/dist/endpoint/index.d.ts +1 -1
- package/dist/endpoint/index.d.ts.map +1 -1
- package/dist/endpoint/index.js +68 -17
- package/dist/endpoint/index.js.map +1 -1
- package/dist/exports/client.d.ts +1 -4
- package/dist/exports/client.d.ts.map +1 -1
- package/dist/exports/client.js +1 -4
- package/dist/exports/client.js.map +1 -1
- package/dist/exports/internal.d.ts +2 -0
- package/dist/exports/internal.d.ts.map +1 -0
- package/dist/exports/internal.js +3 -0
- package/dist/exports/internal.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -56
- package/dist/index.js.map +1 -1
- package/dist/mcp/buildMcpServer.d.ts +4 -4
- package/dist/mcp/buildMcpServer.d.ts.map +1 -1
- package/dist/mcp/buildMcpServer.js +32 -10
- package/dist/mcp/buildMcpServer.js.map +1 -1
- package/dist/mcp/builtin/collections/countTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/countTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/countTool.js +68 -0
- package/dist/mcp/builtin/collections/countTool.js.map +1 -0
- package/dist/mcp/builtin/collections/countVersionsTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/countVersionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/countVersionsTool.js +64 -0
- package/dist/mcp/builtin/collections/countVersionsTool.js.map +1 -0
- package/dist/mcp/builtin/collections/createTool.d.ts +1 -1
- package/dist/mcp/builtin/collections/createTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/createTool.js +93 -40
- package/dist/mcp/builtin/collections/createTool.js.map +1 -1
- package/dist/mcp/builtin/collections/deleteTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/deleteTool.js +3 -2
- package/dist/mcp/builtin/collections/deleteTool.js.map +1 -1
- package/dist/mcp/builtin/collections/duplicateTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/duplicateTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/duplicateTool.js +96 -0
- package/dist/mcp/builtin/collections/duplicateTool.js.map +1 -0
- package/dist/mcp/builtin/collections/fileInput.d.ts +28 -0
- package/dist/mcp/builtin/collections/fileInput.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/fileInput.js +124 -0
- package/dist/mcp/builtin/collections/fileInput.js.map +1 -0
- package/dist/mcp/builtin/collections/fileInput.spec.js +86 -0
- package/dist/mcp/builtin/collections/fileInput.spec.js.map +1 -0
- package/dist/mcp/builtin/collections/findDistinctTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/findDistinctTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/findDistinctTool.js +92 -0
- package/dist/mcp/builtin/collections/findDistinctTool.js.map +1 -0
- package/dist/mcp/builtin/collections/findTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/findTool.js +5 -4
- package/dist/mcp/builtin/collections/findTool.js.map +1 -1
- package/dist/mcp/builtin/collections/findVersionByIDTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/findVersionByIDTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/findVersionByIDTool.js +83 -0
- package/dist/mcp/builtin/collections/findVersionByIDTool.js.map +1 -0
- package/dist/mcp/builtin/collections/findVersionsTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/findVersionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/findVersionsTool.js +98 -0
- package/dist/mcp/builtin/collections/findVersionsTool.js.map +1 -0
- package/dist/mcp/builtin/collections/formatCollectionError.d.ts +1 -1
- package/dist/mcp/builtin/collections/formatCollectionError.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/formatCollectionError.js.map +1 -1
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.js +49 -4
- package/dist/mcp/builtin/collections/getCollectionSchemaTool.js.map +1 -1
- package/dist/mcp/builtin/collections/restoreVersionTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/restoreVersionTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/restoreVersionTool.js +81 -0
- package/dist/mcp/builtin/collections/restoreVersionTool.js.map +1 -0
- package/dist/mcp/builtin/collections/updateTool.d.ts.map +1 -1
- package/dist/mcp/builtin/collections/updateTool.js +26 -12
- package/dist/mcp/builtin/collections/updateTool.js.map +1 -1
- package/dist/mcp/builtin/collections/uploadInstructionsTool.d.ts +2 -0
- package/dist/mcp/builtin/collections/uploadInstructionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/collections/uploadInstructionsTool.js +55 -0
- package/dist/mcp/builtin/collections/uploadInstructionsTool.js.map +1 -0
- package/dist/mcp/builtin/getConfigInfoTool.d.ts.map +1 -1
- package/dist/mcp/builtin/getConfigInfoTool.js +20 -8
- package/dist/mcp/builtin/getConfigInfoTool.js.map +1 -1
- package/dist/mcp/builtin/globals/countVersionsTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/countVersionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/countVersionsTool.js +64 -0
- package/dist/mcp/builtin/globals/countVersionsTool.js.map +1 -0
- package/dist/mcp/builtin/globals/findTool.d.ts.map +1 -1
- package/dist/mcp/builtin/globals/findTool.js +4 -2
- package/dist/mcp/builtin/globals/findTool.js.map +1 -1
- package/dist/mcp/builtin/globals/findVersionByIDTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/findVersionByIDTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/findVersionByIDTool.js +79 -0
- package/dist/mcp/builtin/globals/findVersionByIDTool.js.map +1 -0
- package/dist/mcp/builtin/globals/findVersionsTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/findVersionsTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/findVersionsTool.js +94 -0
- package/dist/mcp/builtin/globals/findVersionsTool.js.map +1 -0
- package/dist/mcp/builtin/globals/getGlobalSchemaTool.d.ts.map +1 -1
- package/dist/mcp/builtin/globals/getGlobalSchemaTool.js +25 -2
- package/dist/mcp/builtin/globals/getGlobalSchemaTool.js.map +1 -1
- package/dist/mcp/builtin/globals/restoreVersionTool.d.ts +2 -0
- package/dist/mcp/builtin/globals/restoreVersionTool.d.ts.map +1 -0
- package/dist/mcp/builtin/globals/restoreVersionTool.js +77 -0
- package/dist/mcp/builtin/globals/restoreVersionTool.js.map +1 -0
- package/dist/mcp/builtin/globals/updateTool.d.ts.map +1 -1
- package/dist/mcp/builtin/globals/updateTool.js +4 -2
- package/dist/mcp/builtin/globals/updateTool.js.map +1 -1
- package/dist/mcp/builtin/validateEntityData.d.ts.map +1 -1
- package/dist/mcp/builtin/validateEntityData.js +1 -1
- package/dist/mcp/builtin/validateEntityData.js.map +1 -1
- package/dist/mcp/builtinTools.d.ts +73 -2
- package/dist/mcp/builtinTools.d.ts.map +1 -1
- package/dist/mcp/builtinTools.js +73 -3
- package/dist/mcp/builtinTools.js.map +1 -1
- package/dist/mcp/sanitizeMCPConfig.d.ts +0 -1
- package/dist/mcp/sanitizeMCPConfig.d.ts.map +1 -1
- package/dist/mcp/sanitizeMCPConfig.js +48 -17
- package/dist/mcp/sanitizeMCPConfig.js.map +1 -1
- package/dist/stdio.d.ts +3 -3
- package/dist/stdio.d.ts.map +1 -1
- package/dist/stdio.js +84 -46
- package/dist/stdio.js.map +1 -1
- package/dist/types.d.ts +93 -87
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -4
- package/dist/types.js.map +1 -1
- package/dist/utils/camelCase.d.ts.map +1 -1
- package/dist/utils/getPluginConfig.d.ts +1 -1
- package/dist/utils/getPluginConfig.js +1 -1
- package/dist/utils/getPluginConfig.js.map +1 -1
- package/dist/utils/resolveProjectRoot.d.ts.map +1 -1
- package/dist/utils/schemaConversion/filterFieldsByAccess.d.ts +28 -0
- package/dist/utils/schemaConversion/filterFieldsByAccess.d.ts.map +1 -0
- package/dist/utils/schemaConversion/filterFieldsByAccess.js +71 -0
- package/dist/utils/schemaConversion/filterFieldsByAccess.js.map +1 -0
- package/dist/utils/schemaConversion/getEntityInputSchema.d.ts +5 -3
- package/dist/utils/schemaConversion/getEntityInputSchema.d.ts.map +1 -1
- package/dist/utils/schemaConversion/getEntityInputSchema.js +44 -12
- package/dist/utils/schemaConversion/getEntityInputSchema.js.map +1 -1
- package/dist/utils/schemaConversion/sanitizeEntitySchema.d.ts +5 -10
- package/dist/utils/schemaConversion/sanitizeEntitySchema.d.ts.map +1 -1
- package/dist/utils/schemaConversion/sanitizeEntitySchema.js +15 -95
- package/dist/utils/schemaConversion/sanitizeEntitySchema.js.map +1 -1
- package/dist/utils/schemaConversion/sanitizeEntitySchema.spec.js +15 -40
- package/dist/utils/schemaConversion/sanitizeEntitySchema.spec.js.map +1 -1
- package/dist/utils/toStandardSchema.d.ts.map +1 -1
- package/package.json +11 -17
- package/src/defaultAccess.ts +3 -0
- package/src/endpoint/access.ts +80 -112
- package/src/endpoint/index.ts +58 -16
- package/src/exports/client.ts +2 -4
- package/src/exports/internal.ts +1 -0
- package/src/index.ts +5 -62
- package/src/mcp/buildMcpServer.ts +46 -21
- package/src/mcp/builtin/collections/countTool.ts +73 -0
- package/src/mcp/builtin/collections/countVersionsTool.ts +69 -0
- package/src/mcp/builtin/collections/createTool.ts +93 -34
- package/src/mcp/builtin/collections/deleteTool.ts +4 -2
- package/src/mcp/builtin/collections/duplicateTool.ts +134 -0
- package/src/mcp/builtin/collections/fileInput.spec.ts +93 -0
- package/src/mcp/builtin/collections/fileInput.ts +164 -0
- package/src/mcp/builtin/collections/findDistinctTool.ts +119 -0
- package/src/mcp/builtin/collections/findTool.ts +6 -4
- package/src/mcp/builtin/collections/findVersionByIDTool.ts +109 -0
- package/src/mcp/builtin/collections/findVersionsTool.ts +154 -0
- package/src/mcp/builtin/collections/formatCollectionError.ts +1 -1
- package/src/mcp/builtin/collections/getCollectionSchemaTool.ts +48 -3
- package/src/mcp/builtin/collections/restoreVersionTool.ts +107 -0
- package/src/mcp/builtin/collections/updateTool.ts +29 -10
- package/src/mcp/builtin/collections/uploadInstructionsTool.ts +64 -0
- package/src/mcp/builtin/getConfigInfoTool.ts +20 -4
- package/src/mcp/builtin/globals/countVersionsTool.ts +68 -0
- package/src/mcp/builtin/globals/findTool.ts +5 -2
- package/src/mcp/builtin/globals/findVersionByIDTool.ts +103 -0
- package/src/mcp/builtin/globals/findVersionsTool.ts +147 -0
- package/src/mcp/builtin/globals/getGlobalSchemaTool.ts +30 -2
- package/src/mcp/builtin/globals/restoreVersionTool.ts +99 -0
- package/src/mcp/builtin/globals/updateTool.ts +5 -2
- package/src/mcp/builtin/validateEntityData.ts +1 -1
- package/src/mcp/builtinTools.ts +72 -6
- package/src/mcp/sanitizeMCPConfig.ts +36 -19
- package/src/stdio.ts +79 -46
- package/src/types.ts +101 -91
- package/src/utils/getPluginConfig.ts +1 -1
- package/src/utils/schemaConversion/filterFieldsByAccess.ts +123 -0
- package/src/utils/schemaConversion/getEntityInputSchema.ts +45 -27
- package/src/utils/schemaConversion/sanitizeEntitySchema.spec.ts +12 -19
- package/src/utils/schemaConversion/sanitizeEntitySchema.ts +17 -114
- package/dist/collection/getAccessField.d.ts +0 -12
- package/dist/collection/getAccessField.d.ts.map +0 -1
- package/dist/collection/getAccessField.js +0 -72
- package/dist/collection/getAccessField.js.map +0 -1
- package/dist/collection/index.d.ts +0 -6
- package/dist/collection/index.d.ts.map +0 -1
- package/dist/collection/index.js +0 -105
- package/dist/collection/index.js.map +0 -1
- package/dist/components/APIKeyField/index.client.d.ts +0 -9
- package/dist/components/APIKeyField/index.client.d.ts.map +0 -1
- package/dist/components/APIKeyField/index.client.js +0 -85
- package/dist/components/APIKeyField/index.client.js.map +0 -1
- package/dist/components/APIKeyField/index.css +0 -105
- package/dist/components/APIKeysEmptyState/index.client.d.ts +0 -4
- package/dist/components/APIKeysEmptyState/index.client.d.ts.map +0 -1
- package/dist/components/APIKeysEmptyState/index.client.js +0 -21
- package/dist/components/APIKeysEmptyState/index.client.js.map +0 -1
- package/dist/components/AccessField/index.client.d.ts +0 -10
- package/dist/components/AccessField/index.client.d.ts.map +0 -1
- package/dist/components/AccessField/index.client.js +0 -247
- package/dist/components/AccessField/index.client.js.map +0 -1
- package/dist/components/AccessField/index.css +0 -99
- package/dist/components/SettingsMenu/index.client.d.ts +0 -8
- package/dist/components/SettingsMenu/index.client.d.ts.map +0 -1
- package/dist/components/SettingsMenu/index.client.js +0 -24
- package/dist/components/SettingsMenu/index.client.js.map +0 -1
- package/dist/translations/index.d.ts +0 -11
- package/dist/translations/index.d.ts.map +0 -1
- package/dist/translations/index.js +0 -92
- package/dist/translations/index.js.map +0 -1
- package/dist/translations/languages/ar.d.ts +0 -31
- package/dist/translations/languages/ar.d.ts.map +0 -1
- package/dist/translations/languages/ar.js +0 -34
- package/dist/translations/languages/ar.js.map +0 -1
- package/dist/translations/languages/az.d.ts +0 -31
- package/dist/translations/languages/az.d.ts.map +0 -1
- package/dist/translations/languages/az.js +0 -34
- package/dist/translations/languages/az.js.map +0 -1
- package/dist/translations/languages/bg.d.ts +0 -31
- package/dist/translations/languages/bg.d.ts.map +0 -1
- package/dist/translations/languages/bg.js +0 -34
- package/dist/translations/languages/bg.js.map +0 -1
- package/dist/translations/languages/bnBd.d.ts +0 -31
- package/dist/translations/languages/bnBd.d.ts.map +0 -1
- package/dist/translations/languages/bnBd.js +0 -34
- package/dist/translations/languages/bnBd.js.map +0 -1
- package/dist/translations/languages/bnIn.d.ts +0 -31
- package/dist/translations/languages/bnIn.d.ts.map +0 -1
- package/dist/translations/languages/bnIn.js +0 -34
- package/dist/translations/languages/bnIn.js.map +0 -1
- package/dist/translations/languages/ca.d.ts +0 -31
- package/dist/translations/languages/ca.d.ts.map +0 -1
- package/dist/translations/languages/ca.js +0 -34
- package/dist/translations/languages/ca.js.map +0 -1
- package/dist/translations/languages/cs.d.ts +0 -31
- package/dist/translations/languages/cs.d.ts.map +0 -1
- package/dist/translations/languages/cs.js +0 -34
- package/dist/translations/languages/cs.js.map +0 -1
- package/dist/translations/languages/da.d.ts +0 -31
- package/dist/translations/languages/da.d.ts.map +0 -1
- package/dist/translations/languages/da.js +0 -34
- package/dist/translations/languages/da.js.map +0 -1
- package/dist/translations/languages/de.d.ts +0 -31
- package/dist/translations/languages/de.d.ts.map +0 -1
- package/dist/translations/languages/de.js +0 -34
- package/dist/translations/languages/de.js.map +0 -1
- package/dist/translations/languages/en.d.ts +0 -31
- package/dist/translations/languages/en.d.ts.map +0 -1
- package/dist/translations/languages/en.js +0 -34
- package/dist/translations/languages/en.js.map +0 -1
- package/dist/translations/languages/es.d.ts +0 -31
- package/dist/translations/languages/es.d.ts.map +0 -1
- package/dist/translations/languages/es.js +0 -34
- package/dist/translations/languages/es.js.map +0 -1
- package/dist/translations/languages/et.d.ts +0 -31
- package/dist/translations/languages/et.d.ts.map +0 -1
- package/dist/translations/languages/et.js +0 -34
- package/dist/translations/languages/et.js.map +0 -1
- package/dist/translations/languages/fa.d.ts +0 -31
- package/dist/translations/languages/fa.d.ts.map +0 -1
- package/dist/translations/languages/fa.js +0 -34
- package/dist/translations/languages/fa.js.map +0 -1
- package/dist/translations/languages/fr.d.ts +0 -31
- package/dist/translations/languages/fr.d.ts.map +0 -1
- package/dist/translations/languages/fr.js +0 -34
- package/dist/translations/languages/fr.js.map +0 -1
- package/dist/translations/languages/he.d.ts +0 -31
- package/dist/translations/languages/he.d.ts.map +0 -1
- package/dist/translations/languages/he.js +0 -34
- package/dist/translations/languages/he.js.map +0 -1
- package/dist/translations/languages/hr.d.ts +0 -31
- package/dist/translations/languages/hr.d.ts.map +0 -1
- package/dist/translations/languages/hr.js +0 -34
- package/dist/translations/languages/hr.js.map +0 -1
- package/dist/translations/languages/hu.d.ts +0 -31
- package/dist/translations/languages/hu.d.ts.map +0 -1
- package/dist/translations/languages/hu.js +0 -34
- package/dist/translations/languages/hu.js.map +0 -1
- package/dist/translations/languages/hy.d.ts +0 -31
- package/dist/translations/languages/hy.d.ts.map +0 -1
- package/dist/translations/languages/hy.js +0 -34
- package/dist/translations/languages/hy.js.map +0 -1
- package/dist/translations/languages/id.d.ts +0 -31
- package/dist/translations/languages/id.d.ts.map +0 -1
- package/dist/translations/languages/id.js +0 -34
- package/dist/translations/languages/id.js.map +0 -1
- package/dist/translations/languages/is.d.ts +0 -31
- package/dist/translations/languages/is.d.ts.map +0 -1
- package/dist/translations/languages/is.js +0 -34
- package/dist/translations/languages/is.js.map +0 -1
- package/dist/translations/languages/it.d.ts +0 -31
- package/dist/translations/languages/it.d.ts.map +0 -1
- package/dist/translations/languages/it.js +0 -34
- package/dist/translations/languages/it.js.map +0 -1
- package/dist/translations/languages/ja.d.ts +0 -31
- package/dist/translations/languages/ja.d.ts.map +0 -1
- package/dist/translations/languages/ja.js +0 -34
- package/dist/translations/languages/ja.js.map +0 -1
- package/dist/translations/languages/ko.d.ts +0 -31
- package/dist/translations/languages/ko.d.ts.map +0 -1
- package/dist/translations/languages/ko.js +0 -34
- package/dist/translations/languages/ko.js.map +0 -1
- package/dist/translations/languages/lt.d.ts +0 -31
- package/dist/translations/languages/lt.d.ts.map +0 -1
- package/dist/translations/languages/lt.js +0 -34
- package/dist/translations/languages/lt.js.map +0 -1
- package/dist/translations/languages/lv.d.ts +0 -31
- package/dist/translations/languages/lv.d.ts.map +0 -1
- package/dist/translations/languages/lv.js +0 -34
- package/dist/translations/languages/lv.js.map +0 -1
- package/dist/translations/languages/my.d.ts +0 -31
- package/dist/translations/languages/my.d.ts.map +0 -1
- package/dist/translations/languages/my.js +0 -34
- package/dist/translations/languages/my.js.map +0 -1
- package/dist/translations/languages/nb.d.ts +0 -31
- package/dist/translations/languages/nb.d.ts.map +0 -1
- package/dist/translations/languages/nb.js +0 -34
- package/dist/translations/languages/nb.js.map +0 -1
- package/dist/translations/languages/nl.d.ts +0 -31
- package/dist/translations/languages/nl.d.ts.map +0 -1
- package/dist/translations/languages/nl.js +0 -34
- package/dist/translations/languages/nl.js.map +0 -1
- package/dist/translations/languages/pl.d.ts +0 -31
- package/dist/translations/languages/pl.d.ts.map +0 -1
- package/dist/translations/languages/pl.js +0 -34
- package/dist/translations/languages/pl.js.map +0 -1
- package/dist/translations/languages/pt.d.ts +0 -31
- package/dist/translations/languages/pt.d.ts.map +0 -1
- package/dist/translations/languages/pt.js +0 -34
- package/dist/translations/languages/pt.js.map +0 -1
- package/dist/translations/languages/ro.d.ts +0 -31
- package/dist/translations/languages/ro.d.ts.map +0 -1
- package/dist/translations/languages/ro.js +0 -34
- package/dist/translations/languages/ro.js.map +0 -1
- package/dist/translations/languages/rs.d.ts +0 -31
- package/dist/translations/languages/rs.d.ts.map +0 -1
- package/dist/translations/languages/rs.js +0 -34
- package/dist/translations/languages/rs.js.map +0 -1
- package/dist/translations/languages/rsLatin.d.ts +0 -31
- package/dist/translations/languages/rsLatin.d.ts.map +0 -1
- package/dist/translations/languages/rsLatin.js +0 -34
- package/dist/translations/languages/rsLatin.js.map +0 -1
- package/dist/translations/languages/ru.d.ts +0 -31
- package/dist/translations/languages/ru.d.ts.map +0 -1
- package/dist/translations/languages/ru.js +0 -34
- package/dist/translations/languages/ru.js.map +0 -1
- package/dist/translations/languages/sk.d.ts +0 -31
- package/dist/translations/languages/sk.d.ts.map +0 -1
- package/dist/translations/languages/sk.js +0 -34
- package/dist/translations/languages/sk.js.map +0 -1
- package/dist/translations/languages/sl.d.ts +0 -31
- package/dist/translations/languages/sl.d.ts.map +0 -1
- package/dist/translations/languages/sl.js +0 -34
- package/dist/translations/languages/sl.js.map +0 -1
- package/dist/translations/languages/sv.d.ts +0 -31
- package/dist/translations/languages/sv.d.ts.map +0 -1
- package/dist/translations/languages/sv.js +0 -34
- package/dist/translations/languages/sv.js.map +0 -1
- package/dist/translations/languages/ta.d.ts +0 -31
- package/dist/translations/languages/ta.d.ts.map +0 -1
- package/dist/translations/languages/ta.js +0 -34
- package/dist/translations/languages/ta.js.map +0 -1
- package/dist/translations/languages/th.d.ts +0 -31
- package/dist/translations/languages/th.d.ts.map +0 -1
- package/dist/translations/languages/th.js +0 -34
- package/dist/translations/languages/th.js.map +0 -1
- package/dist/translations/languages/tr.d.ts +0 -31
- package/dist/translations/languages/tr.d.ts.map +0 -1
- package/dist/translations/languages/tr.js +0 -34
- package/dist/translations/languages/tr.js.map +0 -1
- package/dist/translations/languages/uk.d.ts +0 -31
- package/dist/translations/languages/uk.d.ts.map +0 -1
- package/dist/translations/languages/uk.js +0 -34
- package/dist/translations/languages/uk.js.map +0 -1
- package/dist/translations/languages/vi.d.ts +0 -31
- package/dist/translations/languages/vi.d.ts.map +0 -1
- package/dist/translations/languages/vi.js +0 -34
- package/dist/translations/languages/vi.js.map +0 -1
- package/dist/translations/languages/zh.d.ts +0 -31
- package/dist/translations/languages/zh.d.ts.map +0 -1
- package/dist/translations/languages/zh.js +0 -34
- package/dist/translations/languages/zh.js.map +0 -1
- package/dist/translations/languages/zhTw.d.ts +0 -31
- package/dist/translations/languages/zhTw.d.ts.map +0 -1
- package/dist/translations/languages/zhTw.js +0 -34
- package/dist/translations/languages/zhTw.js.map +0 -1
- package/dist/translations/types.d.ts +0 -32
- package/dist/translations/types.d.ts.map +0 -1
- package/dist/translations/types.js +0 -3
- package/dist/translations/types.js.map +0 -1
- package/dist/utils/localAPIDefaults.d.ts +0 -20
- package/dist/utils/localAPIDefaults.d.ts.map +0 -1
- package/dist/utils/localAPIDefaults.js +0 -19
- package/dist/utils/localAPIDefaults.js.map +0 -1
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.d.ts +0 -7
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.d.ts.map +0 -1
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.js +0 -20
- package/dist/utils/schemaConversion/removeVirtualFieldsFromSchema.js.map +0 -1
- package/src/collection/getAccessField.ts +0 -84
- package/src/collection/index.ts +0 -105
- package/src/components/APIKeyField/index.client.tsx +0 -68
- package/src/components/APIKeyField/index.css +0 -105
- package/src/components/APIKeysEmptyState/index.client.tsx +0 -33
- package/src/components/AccessField/index.client.tsx +0 -296
- package/src/components/AccessField/index.css +0 -99
- package/src/components/SettingsMenu/index.client.tsx +0 -30
- package/src/translations/index.ts +0 -105
- package/src/translations/languages/ar.ts +0 -38
- package/src/translations/languages/az.ts +0 -38
- package/src/translations/languages/bg.ts +0 -39
- package/src/translations/languages/bnBd.ts +0 -39
- package/src/translations/languages/bnIn.ts +0 -39
- package/src/translations/languages/ca.ts +0 -39
- package/src/translations/languages/cs.ts +0 -39
- package/src/translations/languages/da.ts +0 -38
- package/src/translations/languages/de.ts +0 -39
- package/src/translations/languages/en.ts +0 -39
- package/src/translations/languages/es.ts +0 -39
- package/src/translations/languages/et.ts +0 -38
- package/src/translations/languages/fa.ts +0 -39
- package/src/translations/languages/fr.ts +0 -39
- package/src/translations/languages/he.ts +0 -37
- package/src/translations/languages/hr.ts +0 -39
- package/src/translations/languages/hu.ts +0 -39
- package/src/translations/languages/hy.ts +0 -39
- package/src/translations/languages/id.ts +0 -39
- package/src/translations/languages/is.ts +0 -39
- package/src/translations/languages/it.ts +0 -39
- package/src/translations/languages/ja.ts +0 -39
- package/src/translations/languages/ko.ts +0 -39
- package/src/translations/languages/lt.ts +0 -39
- package/src/translations/languages/lv.ts +0 -38
- package/src/translations/languages/my.ts +0 -39
- package/src/translations/languages/nb.ts +0 -39
- package/src/translations/languages/nl.ts +0 -39
- package/src/translations/languages/pl.ts +0 -38
- package/src/translations/languages/pt.ts +0 -39
- package/src/translations/languages/ro.ts +0 -39
- package/src/translations/languages/rs.ts +0 -38
- package/src/translations/languages/rsLatin.ts +0 -38
- package/src/translations/languages/ru.ts +0 -39
- package/src/translations/languages/sk.ts +0 -39
- package/src/translations/languages/sl.ts +0 -38
- package/src/translations/languages/sv.ts +0 -39
- package/src/translations/languages/ta.ts +0 -39
- package/src/translations/languages/th.ts +0 -38
- package/src/translations/languages/tr.ts +0 -38
- package/src/translations/languages/uk.ts +0 -39
- package/src/translations/languages/vi.ts +0 -39
- package/src/translations/languages/zh.ts +0 -36
- package/src/translations/languages/zhTw.ts +0 -36
- package/src/translations/types.ts +0 -34
- package/src/utils/localAPIDefaults.ts +0 -22
- package/src/utils/schemaConversion/removeVirtualFieldsFromSchema.ts +0 -27
package/dist/collection/index.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { createAPIKeyFields } from 'payload';
|
|
2
|
-
import { getAccessField } from './getAccessField.js';
|
|
3
|
-
const apiKeyStorageFields = createAPIKeyFields({
|
|
4
|
-
apiKeyField: {
|
|
5
|
-
admin: {
|
|
6
|
-
components: {
|
|
7
|
-
Field: '@payloadcms/plugin-mcp/client#APIKeyField'
|
|
8
|
-
}
|
|
9
|
-
},
|
|
10
|
-
required: true
|
|
11
|
-
},
|
|
12
|
-
apiKeyIndexField: {
|
|
13
|
-
index: true,
|
|
14
|
-
required: true
|
|
15
|
-
},
|
|
16
|
-
includeEnableAPIKey: false
|
|
17
|
-
});
|
|
18
|
-
export const getAPIKeysCollection = ({ pluginConfig })=>{
|
|
19
|
-
const collection = {
|
|
20
|
-
slug: 'payload-mcp-api-keys',
|
|
21
|
-
admin: {
|
|
22
|
-
components: {
|
|
23
|
-
views: {
|
|
24
|
-
list: {
|
|
25
|
-
NoResults: '@payloadcms/plugin-mcp/client#APIKeysEmptyState'
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
defaultColumns: [
|
|
30
|
-
'label',
|
|
31
|
-
'lastUsed',
|
|
32
|
-
'user'
|
|
33
|
-
],
|
|
34
|
-
// Kept out of the main nav — reachable through the user menu's settings instead.
|
|
35
|
-
group: false,
|
|
36
|
-
useAsTitle: 'label'
|
|
37
|
-
},
|
|
38
|
-
fields: [
|
|
39
|
-
...apiKeyStorageFields,
|
|
40
|
-
getAccessField({
|
|
41
|
-
pluginConfig
|
|
42
|
-
}),
|
|
43
|
-
{
|
|
44
|
-
name: 'label',
|
|
45
|
-
type: 'text',
|
|
46
|
-
admin: {
|
|
47
|
-
description: ({ t })=>t('plugin-mcp:titleDescription'),
|
|
48
|
-
position: 'sidebar'
|
|
49
|
-
},
|
|
50
|
-
label: ({ t })=>t('plugin-mcp:title')
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
name: 'description',
|
|
54
|
-
type: 'text',
|
|
55
|
-
admin: {
|
|
56
|
-
description: ({ t })=>t('plugin-mcp:descriptionDescription'),
|
|
57
|
-
position: 'sidebar'
|
|
58
|
-
},
|
|
59
|
-
label: ({ t })=>t('plugin-mcp:description')
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
name: 'lastUsed',
|
|
63
|
-
type: 'date',
|
|
64
|
-
admin: {
|
|
65
|
-
date: {
|
|
66
|
-
pickerAppearance: 'dayAndTime'
|
|
67
|
-
},
|
|
68
|
-
disabled: {
|
|
69
|
-
field: true
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
label: ({ t })=>t('plugin-mcp:lastUsed')
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
name: 'user',
|
|
76
|
-
type: 'relationship',
|
|
77
|
-
admin: {
|
|
78
|
-
description: ({ t })=>t('plugin-mcp:userDescription'),
|
|
79
|
-
position: 'sidebar'
|
|
80
|
-
},
|
|
81
|
-
label: ({ t })=>t('general:user'),
|
|
82
|
-
relationTo: pluginConfig.userCollection,
|
|
83
|
-
required: true
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
name: 'overrideAccess',
|
|
87
|
-
type: 'checkbox',
|
|
88
|
-
admin: {
|
|
89
|
-
description: ({ t })=>t('plugin-mcp:overrideAccessDescription'),
|
|
90
|
-
position: 'sidebar'
|
|
91
|
-
},
|
|
92
|
-
defaultValue: false,
|
|
93
|
-
label: ({ t })=>t('plugin-mcp:overrideAccess')
|
|
94
|
-
}
|
|
95
|
-
],
|
|
96
|
-
labels: {
|
|
97
|
-
plural: ({ t })=>`${t('plugin-mcp:mcp')} ${t('plugin-mcp:apiKeys')}`,
|
|
98
|
-
singular: ({ t })=>`${t('plugin-mcp:mcp')} ${t('authentication:apiKey')}`
|
|
99
|
-
},
|
|
100
|
-
versions: false
|
|
101
|
-
};
|
|
102
|
-
return pluginConfig.overrideApiKeyCollection ? pluginConfig.overrideApiKeyCollection(collection) : collection;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/collection/index.ts"],"sourcesContent":["import type { CollectionConfig } from 'payload'\n\nimport { createAPIKeyFields } from 'payload'\n\nimport type { SanitizedMCPPluginConfig } from '../types.js'\n\nimport { getAccessField } from './getAccessField.js'\n\nconst apiKeyStorageFields = createAPIKeyFields({\n apiKeyField: {\n admin: {\n components: { Field: '@payloadcms/plugin-mcp/client#APIKeyField' },\n },\n required: true,\n },\n apiKeyIndexField: {\n index: true,\n required: true,\n },\n includeEnableAPIKey: false,\n})\n\nexport const getAPIKeysCollection = ({\n pluginConfig,\n}: {\n pluginConfig: SanitizedMCPPluginConfig\n}): CollectionConfig => {\n const collection: CollectionConfig = {\n slug: 'payload-mcp-api-keys',\n admin: {\n components: {\n views: {\n list: {\n NoResults: '@payloadcms/plugin-mcp/client#APIKeysEmptyState',\n },\n },\n },\n defaultColumns: ['label', 'lastUsed', 'user'],\n // Kept out of the main nav — reachable through the user menu's settings instead.\n group: false,\n useAsTitle: 'label',\n },\n fields: [\n ...apiKeyStorageFields,\n getAccessField({ pluginConfig }),\n {\n name: 'label',\n type: 'text',\n admin: {\n description: ({ t }) => t('plugin-mcp:titleDescription'),\n position: 'sidebar',\n },\n label: ({ t }) => t('plugin-mcp:title'),\n },\n {\n name: 'description',\n type: 'text',\n admin: {\n description: ({ t }) => t('plugin-mcp:descriptionDescription'),\n position: 'sidebar',\n },\n label: ({ t }) => t('plugin-mcp:description'),\n },\n {\n name: 'lastUsed',\n type: 'date',\n admin: {\n date: { pickerAppearance: 'dayAndTime' },\n disabled: { field: true },\n },\n label: ({ t }) => t('plugin-mcp:lastUsed'),\n },\n {\n name: 'user',\n type: 'relationship',\n admin: {\n description: ({ t }) => t('plugin-mcp:userDescription'),\n position: 'sidebar',\n },\n label: ({ t }) => t('general:user'),\n relationTo: pluginConfig.userCollection,\n required: true,\n },\n {\n name: 'overrideAccess',\n type: 'checkbox',\n admin: {\n description: ({ t }) => t('plugin-mcp:overrideAccessDescription'),\n position: 'sidebar',\n },\n defaultValue: false,\n label: ({ t }) => t('plugin-mcp:overrideAccess'),\n },\n ],\n labels: {\n plural: ({ t }) => `${t('plugin-mcp:mcp')} ${t('plugin-mcp:apiKeys')}`,\n singular: ({ t }) => `${t('plugin-mcp:mcp')} ${t('authentication:apiKey')}`,\n },\n versions: false,\n }\n\n return pluginConfig.overrideApiKeyCollection\n ? pluginConfig.overrideApiKeyCollection(collection)\n : collection\n}\n"],"names":["createAPIKeyFields","getAccessField","apiKeyStorageFields","apiKeyField","admin","components","Field","required","apiKeyIndexField","index","includeEnableAPIKey","getAPIKeysCollection","pluginConfig","collection","slug","views","list","NoResults","defaultColumns","group","useAsTitle","fields","name","type","description","t","position","label","date","pickerAppearance","disabled","field","relationTo","userCollection","defaultValue","labels","plural","singular","versions","overrideApiKeyCollection"],"mappings":"AAEA,SAASA,kBAAkB,QAAQ,UAAS;AAI5C,SAASC,cAAc,QAAQ,sBAAqB;AAEpD,MAAMC,sBAAsBF,mBAAmB;IAC7CG,aAAa;QACXC,OAAO;YACLC,YAAY;gBAAEC,OAAO;YAA4C;QACnE;QACAC,UAAU;IACZ;IACAC,kBAAkB;QAChBC,OAAO;QACPF,UAAU;IACZ;IACAG,qBAAqB;AACvB;AAEA,OAAO,MAAMC,uBAAuB,CAAC,EACnCC,YAAY,EAGb;IACC,MAAMC,aAA+B;QACnCC,MAAM;QACNV,OAAO;YACLC,YAAY;gBACVU,OAAO;oBACLC,MAAM;wBACJC,WAAW;oBACb;gBACF;YACF;YACAC,gBAAgB;gBAAC;gBAAS;gBAAY;aAAO;YAC7C,iFAAiF;YACjFC,OAAO;YACPC,YAAY;QACd;QACAC,QAAQ;eACHnB;YACHD,eAAe;gBAAEW;YAAa;YAC9B;gBACEU,MAAM;gBACNC,MAAM;gBACNnB,OAAO;oBACLoB,aAAa,CAAC,EAAEC,CAAC,EAAE,GAAKA,EAAE;oBAC1BC,UAAU;gBACZ;gBACAC,OAAO,CAAC,EAAEF,CAAC,EAAE,GAAKA,EAAE;YACtB;YACA;gBACEH,MAAM;gBACNC,MAAM;gBACNnB,OAAO;oBACLoB,aAAa,CAAC,EAAEC,CAAC,EAAE,GAAKA,EAAE;oBAC1BC,UAAU;gBACZ;gBACAC,OAAO,CAAC,EAAEF,CAAC,EAAE,GAAKA,EAAE;YACtB;YACA;gBACEH,MAAM;gBACNC,MAAM;gBACNnB,OAAO;oBACLwB,MAAM;wBAAEC,kBAAkB;oBAAa;oBACvCC,UAAU;wBAAEC,OAAO;oBAAK;gBAC1B;gBACAJ,OAAO,CAAC,EAAEF,CAAC,EAAE,GAAKA,EAAE;YACtB;YACA;gBACEH,MAAM;gBACNC,MAAM;gBACNnB,OAAO;oBACLoB,aAAa,CAAC,EAAEC,CAAC,EAAE,GAAKA,EAAE;oBAC1BC,UAAU;gBACZ;gBACAC,OAAO,CAAC,EAAEF,CAAC,EAAE,GAAKA,EAAE;gBACpBO,YAAYpB,aAAaqB,cAAc;gBACvC1B,UAAU;YACZ;YACA;gBACEe,MAAM;gBACNC,MAAM;gBACNnB,OAAO;oBACLoB,aAAa,CAAC,EAAEC,CAAC,EAAE,GAAKA,EAAE;oBAC1BC,UAAU;gBACZ;gBACAQ,cAAc;gBACdP,OAAO,CAAC,EAAEF,CAAC,EAAE,GAAKA,EAAE;YACtB;SACD;QACDU,QAAQ;YACNC,QAAQ,CAAC,EAAEX,CAAC,EAAE,GAAK,GAAGA,EAAE,kBAAkB,CAAC,EAAEA,EAAE,uBAAuB;YACtEY,UAAU,CAAC,EAAEZ,CAAC,EAAE,GAAK,GAAGA,EAAE,kBAAkB,CAAC,EAAEA,EAAE,0BAA0B;QAC7E;QACAa,UAAU;IACZ;IAEA,OAAO1B,aAAa2B,wBAAwB,GACxC3B,aAAa2B,wBAAwB,CAAC1B,cACtCA;AACN,EAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import './index.css';
|
|
3
|
-
/**
|
|
4
|
-
* Custom component for the MCP API-keys collection's `apiKey` field:
|
|
5
|
-
* - no key yet: a "Generate new key" button
|
|
6
|
-
* - key set: a dismissible privacy warning + the shared masked-key input
|
|
7
|
-
*/
|
|
8
|
-
export declare const APIKeyField: React.FC;
|
|
9
|
-
//# sourceMappingURL=index.client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../src/components/APIKeyField/index.client.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAIvC,OAAO,aAAa,CAAA;AAIpB;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAmD/B,CAAA"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { APIKeyInput, Button, useField, useTranslation, WarningTriangleIcon } from '@payloadcms/ui';
|
|
4
|
-
import React, { useState } from 'react';
|
|
5
|
-
import './index.css';
|
|
6
|
-
const baseClass = 'mcp-api-key-field';
|
|
7
|
-
/**
|
|
8
|
-
* Custom component for the MCP API-keys collection's `apiKey` field:
|
|
9
|
-
* - no key yet: a "Generate new key" button
|
|
10
|
-
* - key set: a dismissible privacy warning + the shared masked-key input
|
|
11
|
-
*/ export const APIKeyField = ()=>{
|
|
12
|
-
const { setValue: setApiKey, value: apiKey } = useField({
|
|
13
|
-
path: 'apiKey'
|
|
14
|
-
});
|
|
15
|
-
const { t } = useTranslation();
|
|
16
|
-
const [isWarningDismissed, setIsWarningDismissed] = useState(false);
|
|
17
|
-
const generateKey = ()=>{
|
|
18
|
-
setApiKey(crypto.randomUUID());
|
|
19
|
-
setIsWarningDismissed(false);
|
|
20
|
-
};
|
|
21
|
-
return /*#__PURE__*/ _jsxs("div", {
|
|
22
|
-
className: baseClass,
|
|
23
|
-
children: [
|
|
24
|
-
/*#__PURE__*/ _jsx("p", {
|
|
25
|
-
className: `${baseClass}__description`,
|
|
26
|
-
children: t('plugin-mcp:apiKeyDescription')
|
|
27
|
-
}),
|
|
28
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
29
|
-
className: `${baseClass}__panel`,
|
|
30
|
-
children: [
|
|
31
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
32
|
-
className: `${baseClass}__header`,
|
|
33
|
-
children: [
|
|
34
|
-
/*#__PURE__*/ _jsx("span", {
|
|
35
|
-
className: `${baseClass}__title`,
|
|
36
|
-
children: t('authentication:apiKey')
|
|
37
|
-
}),
|
|
38
|
-
!apiKey && /*#__PURE__*/ _jsx(Button, {
|
|
39
|
-
buttonStyle: "primary",
|
|
40
|
-
className: `${baseClass}__generate`,
|
|
41
|
-
onClick: generateKey,
|
|
42
|
-
children: t('authentication:generateNewAPIKey')
|
|
43
|
-
})
|
|
44
|
-
]
|
|
45
|
-
}),
|
|
46
|
-
Boolean(apiKey) && /*#__PURE__*/ _jsxs("div", {
|
|
47
|
-
className: `${baseClass}__body`,
|
|
48
|
-
children: [
|
|
49
|
-
!isWarningDismissed && /*#__PURE__*/ _jsxs("div", {
|
|
50
|
-
className: `${baseClass}__warning`,
|
|
51
|
-
children: [
|
|
52
|
-
/*#__PURE__*/ _jsx(WarningTriangleIcon, {
|
|
53
|
-
className: `${baseClass}__warning-icon`
|
|
54
|
-
}),
|
|
55
|
-
/*#__PURE__*/ _jsxs("p", {
|
|
56
|
-
className: `${baseClass}__warning-text`,
|
|
57
|
-
children: [
|
|
58
|
-
/*#__PURE__*/ _jsx("strong", {
|
|
59
|
-
children: t('plugin-mcp:keepKeyPrivate')
|
|
60
|
-
}),
|
|
61
|
-
` ${t('plugin-mcp:keyPrivateDescription')}`
|
|
62
|
-
]
|
|
63
|
-
}),
|
|
64
|
-
/*#__PURE__*/ _jsx("button", {
|
|
65
|
-
"aria-label": t('plugin-mcp:dismiss'),
|
|
66
|
-
className: `${baseClass}__warning-dismiss`,
|
|
67
|
-
onClick: ()=>setIsWarningDismissed(true),
|
|
68
|
-
type: "button",
|
|
69
|
-
children: "×"
|
|
70
|
-
})
|
|
71
|
-
]
|
|
72
|
-
}),
|
|
73
|
-
/*#__PURE__*/ _jsx(APIKeyInput, {
|
|
74
|
-
"aria-label": t('authentication:apiKey'),
|
|
75
|
-
value: apiKey
|
|
76
|
-
})
|
|
77
|
-
]
|
|
78
|
-
})
|
|
79
|
-
]
|
|
80
|
-
})
|
|
81
|
-
]
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
//# sourceMappingURL=index.client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/APIKeyField/index.client.tsx"],"sourcesContent":["'use client'\n\nimport { APIKeyInput, Button, useField, useTranslation, WarningTriangleIcon } from '@payloadcms/ui'\nimport React, { useState } from 'react'\n\nimport type { PluginMCPTranslationKeys, PluginMCPTranslations } from '../../translations/index.js'\n\nimport './index.css'\n\nconst baseClass = 'mcp-api-key-field'\n\n/**\n * Custom component for the MCP API-keys collection's `apiKey` field:\n * - no key yet: a \"Generate new key\" button\n * - key set: a dismissible privacy warning + the shared masked-key input\n */\nexport const APIKeyField: React.FC = () => {\n const { setValue: setApiKey, value: apiKey } = useField<string>({ path: 'apiKey' })\n const { t } = useTranslation<PluginMCPTranslations, PluginMCPTranslationKeys>()\n const [isWarningDismissed, setIsWarningDismissed] = useState(false)\n\n const generateKey = () => {\n setApiKey(crypto.randomUUID())\n setIsWarningDismissed(false)\n }\n\n return (\n <div className={baseClass}>\n <p className={`${baseClass}__description`}>{t('plugin-mcp:apiKeyDescription')}</p>\n <div className={`${baseClass}__panel`}>\n <div className={`${baseClass}__header`}>\n <span className={`${baseClass}__title`}>{t('authentication:apiKey')}</span>\n {!apiKey && (\n <Button\n buttonStyle=\"primary\"\n className={`${baseClass}__generate`}\n onClick={generateKey}\n >\n {t('authentication:generateNewAPIKey')}\n </Button>\n )}\n </div>\n {Boolean(apiKey) && (\n <div className={`${baseClass}__body`}>\n {!isWarningDismissed && (\n <div className={`${baseClass}__warning`}>\n <WarningTriangleIcon className={`${baseClass}__warning-icon`} />\n <p className={`${baseClass}__warning-text`}>\n <strong>{t('plugin-mcp:keepKeyPrivate')}</strong>\n {` ${t('plugin-mcp:keyPrivateDescription')}`}\n </p>\n <button\n aria-label={t('plugin-mcp:dismiss')}\n className={`${baseClass}__warning-dismiss`}\n onClick={() => setIsWarningDismissed(true)}\n type=\"button\"\n >\n ×\n </button>\n </div>\n )}\n <APIKeyInput aria-label={t('authentication:apiKey')} value={apiKey} />\n </div>\n )}\n </div>\n </div>\n )\n}\n"],"names":["APIKeyInput","Button","useField","useTranslation","WarningTriangleIcon","React","useState","baseClass","APIKeyField","setValue","setApiKey","value","apiKey","path","t","isWarningDismissed","setIsWarningDismissed","generateKey","crypto","randomUUID","div","className","p","span","buttonStyle","onClick","Boolean","strong","button","aria-label","type"],"mappings":"AAAA;;AAEA,SAASA,WAAW,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,cAAc,EAAEC,mBAAmB,QAAQ,iBAAgB;AACnG,OAAOC,SAASC,QAAQ,QAAQ,QAAO;AAIvC,OAAO,cAAa;AAEpB,MAAMC,YAAY;AAElB;;;;CAIC,GACD,OAAO,MAAMC,cAAwB;IACnC,MAAM,EAAEC,UAAUC,SAAS,EAAEC,OAAOC,MAAM,EAAE,GAAGV,SAAiB;QAAEW,MAAM;IAAS;IACjF,MAAM,EAAEC,CAAC,EAAE,GAAGX;IACd,MAAM,CAACY,oBAAoBC,sBAAsB,GAAGV,SAAS;IAE7D,MAAMW,cAAc;QAClBP,UAAUQ,OAAOC,UAAU;QAC3BH,sBAAsB;IACxB;IAEA,qBACE,MAACI;QAAIC,WAAWd;;0BACd,KAACe;gBAAED,WAAW,GAAGd,UAAU,aAAa,CAAC;0BAAGO,EAAE;;0BAC9C,MAACM;gBAAIC,WAAW,GAAGd,UAAU,OAAO,CAAC;;kCACnC,MAACa;wBAAIC,WAAW,GAAGd,UAAU,QAAQ,CAAC;;0CACpC,KAACgB;gCAAKF,WAAW,GAAGd,UAAU,OAAO,CAAC;0CAAGO,EAAE;;4BAC1C,CAACF,wBACA,KAACX;gCACCuB,aAAY;gCACZH,WAAW,GAAGd,UAAU,UAAU,CAAC;gCACnCkB,SAASR;0CAERH,EAAE;;;;oBAIRY,QAAQd,yBACP,MAACQ;wBAAIC,WAAW,GAAGd,UAAU,MAAM,CAAC;;4BACjC,CAACQ,oCACA,MAACK;gCAAIC,WAAW,GAAGd,UAAU,SAAS,CAAC;;kDACrC,KAACH;wCAAoBiB,WAAW,GAAGd,UAAU,cAAc,CAAC;;kDAC5D,MAACe;wCAAED,WAAW,GAAGd,UAAU,cAAc,CAAC;;0DACxC,KAACoB;0DAAQb,EAAE;;4CACV,CAAC,CAAC,EAAEA,EAAE,qCAAqC;;;kDAE9C,KAACc;wCACCC,cAAYf,EAAE;wCACdO,WAAW,GAAGd,UAAU,iBAAiB,CAAC;wCAC1CkB,SAAS,IAAMT,sBAAsB;wCACrCc,MAAK;kDACN;;;;0CAKL,KAAC9B;gCAAY6B,cAAYf,EAAE;gCAA0BH,OAAOC;;;;;;;;AAMxE,EAAC"}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
@layer payload-default {
|
|
2
|
-
/* Section wrapper: description + panel, closed off by a full-bleed divider
|
|
3
|
-
that spans the fields column past its horizontal gutter. */
|
|
4
|
-
.mcp-api-key-field {
|
|
5
|
-
display: flex;
|
|
6
|
-
flex-direction: column;
|
|
7
|
-
gap: var(--base);
|
|
8
|
-
margin-inline: calc(-1 * var(--gutter-h));
|
|
9
|
-
padding-inline: var(--gutter-h);
|
|
10
|
-
padding-block-end: var(--spacer-4);
|
|
11
|
-
border-block-end: var(--stroke-width-small) solid var(--color-border);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.mcp-api-key-field__description {
|
|
15
|
-
margin: 0;
|
|
16
|
-
color: var(--color-text);
|
|
17
|
-
font-family: var(--text-body-medium-font-family);
|
|
18
|
-
font-size: var(--text-body-medium-font-size);
|
|
19
|
-
font-weight: var(--text-body-medium-font-weight);
|
|
20
|
-
line-height: var(--text-body-medium-line-height);
|
|
21
|
-
letter-spacing: var(--text-body-medium-letter-spacing);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.mcp-api-key-field__panel {
|
|
25
|
-
overflow: hidden;
|
|
26
|
-
background: var(--color-bg);
|
|
27
|
-
border: var(--stroke-width-small) solid var(--color-border);
|
|
28
|
-
border-radius: var(--button-radius);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.mcp-api-key-field__header {
|
|
32
|
-
display: flex;
|
|
33
|
-
align-items: center;
|
|
34
|
-
justify-content: space-between;
|
|
35
|
-
gap: var(--spacer-2);
|
|
36
|
-
min-height: var(--spacer-5);
|
|
37
|
-
padding: var(--spacer-2) var(--spacer-3);
|
|
38
|
-
background: var(--color-bg-secondary);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/* Holds the warning + key row; its top border is the full-width divider
|
|
42
|
-
under the header. Only rendered once a key exists. */
|
|
43
|
-
.mcp-api-key-field__body {
|
|
44
|
-
display: flex;
|
|
45
|
-
flex-direction: column;
|
|
46
|
-
gap: var(--spacer-2);
|
|
47
|
-
padding: var(--spacer-3);
|
|
48
|
-
border-block-start: var(--stroke-width-small) solid var(--color-border);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.mcp-api-key-field__title {
|
|
52
|
-
color: var(--color-text);
|
|
53
|
-
font-family: var(--text-body-medium-strong-font-family);
|
|
54
|
-
font-size: var(--text-body-medium-strong-font-size);
|
|
55
|
-
font-weight: var(--text-body-medium-strong-font-weight);
|
|
56
|
-
line-height: var(--text-body-medium-strong-line-height);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.mcp-api-key-field__generate {
|
|
60
|
-
margin: 0;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/* Matches the core Banner's warning treatment: theme-adaptive warning-tertiary
|
|
64
|
-
bg with regular --color-text (NOT --color-text-onwarning, which is only
|
|
65
|
-
defined for light mode and reads as muddy dark-on-dark in dark mode). */
|
|
66
|
-
.mcp-api-key-field__warning {
|
|
67
|
-
display: flex;
|
|
68
|
-
align-items: center;
|
|
69
|
-
gap: calc(var(--base) / 2);
|
|
70
|
-
padding: calc(var(--spacer-2) + (var(--spacer-1) / 2)) calc(var(--base) / 2);
|
|
71
|
-
background: var(--color-bg-warning-tertiary);
|
|
72
|
-
border: none;
|
|
73
|
-
border-radius: var(--radius-medium);
|
|
74
|
-
color: var(--color-text);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.mcp-api-key-field__warning-icon {
|
|
78
|
-
flex-shrink: 0;
|
|
79
|
-
width: 15px;
|
|
80
|
-
height: 13px;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.mcp-api-key-field__warning-text {
|
|
84
|
-
flex-grow: 1;
|
|
85
|
-
margin: 0;
|
|
86
|
-
font-family: var(--text-body-medium-font-family);
|
|
87
|
-
font-size: var(--text-body-medium-font-size);
|
|
88
|
-
line-height: var(--text-body-medium-line-height);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.mcp-api-key-field__warning-text strong {
|
|
92
|
-
font-weight: var(--text-body-medium-strong-font-weight);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.mcp-api-key-field__warning-dismiss {
|
|
96
|
-
appearance: none;
|
|
97
|
-
background: none;
|
|
98
|
-
border: none;
|
|
99
|
-
cursor: pointer;
|
|
100
|
-
color: inherit;
|
|
101
|
-
font-size: 1rem;
|
|
102
|
-
line-height: 1;
|
|
103
|
-
padding: 0;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../src/components/APIKeysEmptyState/index.client.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAGnD,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAuB5D,CAAA"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { Button, NoListResults, useTranslation } from '@payloadcms/ui';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
export const APIKeysEmptyState = ({ hasCreatePermission, newDocumentURL, viewType })=>{
|
|
6
|
-
const { t } = useTranslation();
|
|
7
|
-
return /*#__PURE__*/ _jsx(NoListResults, {
|
|
8
|
-
Actions: hasCreatePermission && newDocumentURL && viewType !== 'trash' ? [
|
|
9
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
10
|
-
el: "link",
|
|
11
|
-
to: newDocumentURL,
|
|
12
|
-
children: t('authentication:generateNewAPIKey')
|
|
13
|
-
}, "create")
|
|
14
|
-
] : [],
|
|
15
|
-
description: t('plugin-mcp:apiKeyDescription'),
|
|
16
|
-
title: t('plugin-mcp:noAPIKeys'),
|
|
17
|
-
withMargin: true
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
//# sourceMappingURL=index.client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/APIKeysEmptyState/index.client.tsx"],"sourcesContent":["'use client'\n\nimport type { NoResultsClientProps } from 'payload'\n\nimport { Button, NoListResults, useTranslation } from '@payloadcms/ui'\nimport React from 'react'\n\nimport type { PluginMCPTranslationKeys, PluginMCPTranslations } from '../../translations/index.js'\n\nexport const APIKeysEmptyState: React.FC<NoResultsClientProps> = ({\n hasCreatePermission,\n newDocumentURL,\n viewType,\n}) => {\n const { t } = useTranslation<PluginMCPTranslations, PluginMCPTranslationKeys>()\n\n return (\n <NoListResults\n Actions={\n hasCreatePermission && newDocumentURL && viewType !== 'trash'\n ? [\n <Button el=\"link\" key=\"create\" to={newDocumentURL}>\n {t('authentication:generateNewAPIKey')}\n </Button>,\n ]\n : []\n }\n description={t('plugin-mcp:apiKeyDescription')}\n title={t('plugin-mcp:noAPIKeys')}\n withMargin\n />\n )\n}\n"],"names":["Button","NoListResults","useTranslation","React","APIKeysEmptyState","hasCreatePermission","newDocumentURL","viewType","t","Actions","el","to","description","title","withMargin"],"mappings":"AAAA;;AAIA,SAASA,MAAM,EAAEC,aAAa,EAAEC,cAAc,QAAQ,iBAAgB;AACtE,OAAOC,WAAW,QAAO;AAIzB,OAAO,MAAMC,oBAAoD,CAAC,EAChEC,mBAAmB,EACnBC,cAAc,EACdC,QAAQ,EACT;IACC,MAAM,EAAEC,CAAC,EAAE,GAAGN;IAEd,qBACE,KAACD;QACCQ,SACEJ,uBAAuBC,kBAAkBC,aAAa,UAClD;0BACE,KAACP;gBAAOU,IAAG;gBAAoBC,IAAIL;0BAChCE,EAAE;eADiB;SAGvB,GACD,EAAE;QAERI,aAAaJ,EAAE;QACfK,OAAOL,EAAE;QACTM,UAAU;;AAGhB,EAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { JSONFieldClientProps } from 'payload';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import type { ClientMCPPluginConfig } from '../../types.js';
|
|
4
|
-
import './index.css';
|
|
5
|
-
type Props = {
|
|
6
|
-
pluginConfig: ClientMCPPluginConfig;
|
|
7
|
-
} & JSONFieldClientProps;
|
|
8
|
-
export declare const AccessField: React.FC<Props>;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=index.client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../src/components/AccessField/index.client.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAGnD,OAAO,KAAmB,MAAM,OAAO,CAAA;AAGvC,OAAO,KAAK,EAAE,qBAAqB,EAA2B,MAAM,gBAAgB,CAAA;AAEpF,OAAO,aAAa,CAAA;AAapB,KAAK,KAAK,GAAG;IACX,YAAY,EAAE,qBAAqB,CAAA;CACpC,GAAG,oBAAoB,CAAA;AAoBxB,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAqPvC,CAAA"}
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { CheckboxInput, Collapsible, Tabs, useField, useTranslation } from '@payloadcms/ui';
|
|
4
|
-
import React, { useState } from 'react';
|
|
5
|
-
import './index.css';
|
|
6
|
-
const baseClass = 'mcp-access-field';
|
|
7
|
-
const LEAF_GROUP_KEYS = [
|
|
8
|
-
'operations',
|
|
9
|
-
'auth',
|
|
10
|
-
'custom'
|
|
11
|
-
];
|
|
12
|
-
/** Drop a key from an object and return a new object — or `undefined` if it'd be empty. */ const without = (obj, key)=>{
|
|
13
|
-
if (!obj || !(key in obj)) {
|
|
14
|
-
return obj;
|
|
15
|
-
}
|
|
16
|
-
const { [key]: _omitted, ...rest } = obj;
|
|
17
|
-
return Object.keys(rest).length === 0 ? undefined : rest;
|
|
18
|
-
};
|
|
19
|
-
const setKey = (obj, key, value)=>({
|
|
20
|
-
...obj ?? {},
|
|
21
|
-
[key]: value
|
|
22
|
-
});
|
|
23
|
-
export const AccessField = ({ path, pluginConfig })=>{
|
|
24
|
-
const { setValue, value } = useField({
|
|
25
|
-
path
|
|
26
|
-
});
|
|
27
|
-
const { t } = useTranslation();
|
|
28
|
-
const [activeTab, setActiveTab] = useState(null);
|
|
29
|
-
const access = value ?? {};
|
|
30
|
-
const leafGroupLabels = {
|
|
31
|
-
auth: t('plugin-mcp:authentication'),
|
|
32
|
-
custom: t('general:custom'),
|
|
33
|
-
operations: t('plugin-mcp:operations')
|
|
34
|
-
};
|
|
35
|
-
const collectionsBySlug = {};
|
|
36
|
-
const globalsBySlug = {};
|
|
37
|
-
const prompts = [];
|
|
38
|
-
const resources = [];
|
|
39
|
-
const tools = [];
|
|
40
|
-
for (const item of pluginConfig.items){
|
|
41
|
-
switch(item.type){
|
|
42
|
-
case 'collectionTool':
|
|
43
|
-
;
|
|
44
|
-
(collectionsBySlug[item.collectionSlug] ??= []).push(item);
|
|
45
|
-
break;
|
|
46
|
-
case 'globalTool':
|
|
47
|
-
;
|
|
48
|
-
(globalsBySlug[item.globalSlug] ??= []).push(item);
|
|
49
|
-
break;
|
|
50
|
-
case 'prompt':
|
|
51
|
-
prompts.push(item);
|
|
52
|
-
break;
|
|
53
|
-
case 'resource':
|
|
54
|
-
resources.push(item);
|
|
55
|
-
break;
|
|
56
|
-
case 'tool':
|
|
57
|
-
tools.push(item);
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
const isScopedAllowed = (scope, slug, configKey)=>access[scope]?.[slug]?.[configKey] !== false;
|
|
62
|
-
const isFlatAllowed = (scope, configKey)=>access[scope]?.[configKey] !== false;
|
|
63
|
-
const toggleScoped = (scope, slug, configKey, allow)=>{
|
|
64
|
-
if (allow) {
|
|
65
|
-
const slugBucket = without(access[scope]?.[slug], configKey);
|
|
66
|
-
const scopeBucket = slugBucket ? setKey(access[scope], slug, slugBucket) : without(access[scope], slug);
|
|
67
|
-
setValue(scopeBucket ? setKey(access, scope, scopeBucket) : without(access, scope) ?? {});
|
|
68
|
-
} else {
|
|
69
|
-
setValue(setKey(access, scope, setKey(access[scope], slug, setKey(access[scope]?.[slug], configKey, false))));
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
const toggleFlat = (scope, configKey, allow)=>{
|
|
73
|
-
if (allow) {
|
|
74
|
-
const bucket = without(access[scope], configKey);
|
|
75
|
-
setValue(bucket ? setKey(access, scope, bucket) : without(access, scope) ?? {});
|
|
76
|
-
} else {
|
|
77
|
-
setValue(setKey(access, scope, setKey(access[scope], configKey, false)));
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
const setAllScoped = (scope, slug, leaves, allow)=>{
|
|
81
|
-
if (allow) {
|
|
82
|
-
const scopeBucket = without(access[scope], slug);
|
|
83
|
-
setValue(scopeBucket ? setKey(access, scope, scopeBucket) : without(access, scope) ?? {});
|
|
84
|
-
} else {
|
|
85
|
-
const slugBucket = leaves.reduce((acc, leaf)=>({
|
|
86
|
-
...acc,
|
|
87
|
-
[leaf.configKey]: false
|
|
88
|
-
}), {});
|
|
89
|
-
setValue(setKey(access, scope, setKey(access[scope], slug, slugBucket)));
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
const setAllFlat = (scope, leaves, allow)=>{
|
|
93
|
-
if (allow) {
|
|
94
|
-
setValue(without(access, scope) ?? {});
|
|
95
|
-
} else {
|
|
96
|
-
const bucket = leaves.reduce((acc, leaf)=>({
|
|
97
|
-
...acc,
|
|
98
|
-
[leaf.configKey]: false
|
|
99
|
-
}), {});
|
|
100
|
-
setValue(setKey(access, scope, bucket));
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
const renderLeaf = (leaf, id, checked, onToggle)=>/*#__PURE__*/ _jsxs("li", {
|
|
104
|
-
className: `${baseClass}__leaf`,
|
|
105
|
-
children: [
|
|
106
|
-
/*#__PURE__*/ _jsx(CheckboxInput, {
|
|
107
|
-
checked: checked,
|
|
108
|
-
id: id,
|
|
109
|
-
label: leaf.label,
|
|
110
|
-
onToggle: (e)=>onToggle(e.target.checked)
|
|
111
|
-
}),
|
|
112
|
-
leaf.description && /*#__PURE__*/ _jsx("p", {
|
|
113
|
-
className: `${baseClass}__leaf-description`,
|
|
114
|
-
children: leaf.description
|
|
115
|
-
})
|
|
116
|
-
]
|
|
117
|
-
}, leaf.configKey);
|
|
118
|
-
const renderCard = ({ id, isLeafAllowed, label, leaves, onSetAll, onToggleLeaf })=>{
|
|
119
|
-
const allowedCount = leaves.filter(isLeafAllowed).length;
|
|
120
|
-
const groups = LEAF_GROUP_KEYS.map((key)=>({
|
|
121
|
-
key,
|
|
122
|
-
label: leafGroupLabels[key],
|
|
123
|
-
leaves: leaves.filter((leaf)=>(leaf.group ?? 'custom') === key)
|
|
124
|
-
})).filter((group)=>group.leaves.length > 0);
|
|
125
|
-
const hasGroupLabels = groups.length > 1;
|
|
126
|
-
return /*#__PURE__*/ _jsx(Collapsible, {
|
|
127
|
-
className: `${baseClass}__card`,
|
|
128
|
-
header: // Keep header clicks on the checkbox from also toggling the collapsible.
|
|
129
|
-
/*#__PURE__*/ _jsx("span", {
|
|
130
|
-
className: `${baseClass}__card-checkbox`,
|
|
131
|
-
onClick: (e)=>e.stopPropagation(),
|
|
132
|
-
role: "presentation",
|
|
133
|
-
children: /*#__PURE__*/ _jsx(CheckboxInput, {
|
|
134
|
-
checked: allowedCount === leaves.length,
|
|
135
|
-
id: `${id}._all`,
|
|
136
|
-
label: label,
|
|
137
|
-
onToggle: ()=>onSetAll(allowedCount < leaves.length),
|
|
138
|
-
partialChecked: allowedCount > 0 && allowedCount < leaves.length
|
|
139
|
-
})
|
|
140
|
-
}),
|
|
141
|
-
initCollapsed: true,
|
|
142
|
-
children: /*#__PURE__*/ _jsx("div", {
|
|
143
|
-
className: `${baseClass}__card-groups`,
|
|
144
|
-
children: groups.map((group)=>/*#__PURE__*/ _jsxs("div", {
|
|
145
|
-
className: `${baseClass}__leaf-group`,
|
|
146
|
-
children: [
|
|
147
|
-
hasGroupLabels && /*#__PURE__*/ _jsx("p", {
|
|
148
|
-
className: `${baseClass}__leaf-group-label`,
|
|
149
|
-
children: group.label
|
|
150
|
-
}),
|
|
151
|
-
/*#__PURE__*/ _jsx("ul", {
|
|
152
|
-
className: `${baseClass}__list`,
|
|
153
|
-
children: group.leaves.map((leaf)=>renderLeaf(leaf, `${id}.${leaf.configKey}`, isLeafAllowed(leaf), (allow)=>onToggleLeaf(leaf, allow)))
|
|
154
|
-
})
|
|
155
|
-
]
|
|
156
|
-
}, group.key))
|
|
157
|
-
})
|
|
158
|
-
}, id);
|
|
159
|
-
};
|
|
160
|
-
const renderScope = (scope, bySlug)=>Object.entries(bySlug).map(([slug, leaves])=>renderCard({
|
|
161
|
-
id: `${path}.${scope}.${slug}`,
|
|
162
|
-
isLeafAllowed: (leaf)=>isScopedAllowed(scope, slug, leaf.configKey),
|
|
163
|
-
label: titleCase(slug),
|
|
164
|
-
leaves,
|
|
165
|
-
onSetAll: (allow)=>setAllScoped(scope, slug, leaves, allow),
|
|
166
|
-
onToggleLeaf: (leaf, allow)=>toggleScoped(scope, slug, leaf.configKey, allow)
|
|
167
|
-
}));
|
|
168
|
-
const renderFlat = (scope, label, leaves)=>leaves.length > 0 && renderCard({
|
|
169
|
-
id: `${path}.${scope}`,
|
|
170
|
-
isLeafAllowed: (leaf)=>isFlatAllowed(scope, leaf.configKey),
|
|
171
|
-
label,
|
|
172
|
-
leaves,
|
|
173
|
-
onSetAll: (allow)=>setAllFlat(scope, leaves, allow),
|
|
174
|
-
onToggleLeaf: (leaf, allow)=>toggleFlat(scope, leaf.configKey, allow)
|
|
175
|
-
});
|
|
176
|
-
const tabs = [
|
|
177
|
-
...Object.keys(collectionsBySlug).length > 0 ? [
|
|
178
|
-
{
|
|
179
|
-
key: 'collections',
|
|
180
|
-
label: t('general:collections')
|
|
181
|
-
}
|
|
182
|
-
] : [],
|
|
183
|
-
...Object.keys(globalsBySlug).length > 0 ? [
|
|
184
|
-
{
|
|
185
|
-
key: 'globals',
|
|
186
|
-
label: t('general:globals')
|
|
187
|
-
}
|
|
188
|
-
] : [],
|
|
189
|
-
...prompts.length > 0 || resources.length > 0 || tools.length > 0 ? [
|
|
190
|
-
{
|
|
191
|
-
key: 'server',
|
|
192
|
-
label: t('plugin-mcp:server')
|
|
193
|
-
}
|
|
194
|
-
] : []
|
|
195
|
-
];
|
|
196
|
-
if (tabs.length === 0) {
|
|
197
|
-
return null;
|
|
198
|
-
}
|
|
199
|
-
const currentTab = activeTab ?? tabs[0].key;
|
|
200
|
-
return /*#__PURE__*/ _jsxs("div", {
|
|
201
|
-
className: baseClass,
|
|
202
|
-
children: [
|
|
203
|
-
/*#__PURE__*/ _jsxs("header", {
|
|
204
|
-
className: `${baseClass}__header`,
|
|
205
|
-
children: [
|
|
206
|
-
/*#__PURE__*/ _jsx("h4", {
|
|
207
|
-
children: t('plugin-mcp:permissions')
|
|
208
|
-
}),
|
|
209
|
-
/*#__PURE__*/ _jsx("p", {
|
|
210
|
-
children: t('plugin-mcp:permissionsDescription')
|
|
211
|
-
})
|
|
212
|
-
]
|
|
213
|
-
}),
|
|
214
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
215
|
-
className: `${baseClass}__tabbed-content`,
|
|
216
|
-
children: [
|
|
217
|
-
/*#__PURE__*/ _jsx(Tabs, {
|
|
218
|
-
className: `${baseClass}__tabs`,
|
|
219
|
-
onChange: setActiveTab,
|
|
220
|
-
tabs: tabs.map((tab)=>({
|
|
221
|
-
label: tab.label,
|
|
222
|
-
value: tab.key
|
|
223
|
-
})),
|
|
224
|
-
value: currentTab
|
|
225
|
-
}),
|
|
226
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
227
|
-
className: `${baseClass}__cards`,
|
|
228
|
-
children: [
|
|
229
|
-
currentTab === 'collections' && renderScope('collections', collectionsBySlug),
|
|
230
|
-
currentTab === 'globals' && renderScope('globals', globalsBySlug),
|
|
231
|
-
currentTab === 'server' && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
232
|
-
children: [
|
|
233
|
-
renderFlat('prompts', t('plugin-mcp:prompts'), prompts),
|
|
234
|
-
renderFlat('resources', t('plugin-mcp:resources'), resources),
|
|
235
|
-
renderFlat('tools', t('plugin-mcp:tools'), tools)
|
|
236
|
-
]
|
|
237
|
-
})
|
|
238
|
-
]
|
|
239
|
-
})
|
|
240
|
-
]
|
|
241
|
-
})
|
|
242
|
-
]
|
|
243
|
-
});
|
|
244
|
-
};
|
|
245
|
-
const titleCase = (slug)=>slug.replace(/(^|[-_])(.)/g, (_, sep, ch)=>sep ? ` ${ch.toUpperCase()}` : ch.toUpperCase());
|
|
246
|
-
|
|
247
|
-
//# sourceMappingURL=index.client.js.map
|