GraphQL disable shadowCRUD for built-in content-types

System Information
  • Strapi Version: 4.14.5
  • Operating System: Mac
  • Database: SQLite
  • Node Version: 18.14.0
  • NPM Version: 9.3.1
  • Yarn Version: 1.22.19

I want to disable all built-in content-types for the graphql plugin so that only my own content-type schema is being used.

The following command lists all available content-types for my strapi backend:

> yarn strapi content-types:list
yarn run v1.22.19
$ strapi content-types:list
┌──────────────────────────────────────┐
│ Name                                 │
├──────────────────────────────────────┤
│ admin::permission                    │
├──────────────────────────────────────┤
│ admin::user                          │
├──────────────────────────────────────┤
│ admin::role                          │
├──────────────────────────────────────┤
│ admin::api-token                     │
├──────────────────────────────────────┤
│ admin::api-token-permission          │
├──────────────────────────────────────┤
│ admin::transfer-token                │
├──────────────────────────────────────┤
│ admin::transfer-token-permission     │
├──────────────────────────────────────┤
│ api::announcement.announcement       │
├──────────────────────────────────────┤
│ plugin::upload.file                  │
├──────────────────────────────────────┤
│ plugin::upload.folder                │
├──────────────────────────────────────┤
│ plugin::i18n.locale                  │
├──────────────────────────────────────┤
│ plugin::users-permissions.permission │
├──────────────────────────────────────┤
│ plugin::users-permissions.role       │
├──────────────────────────────────────┤
│ plugin::users-permissions.user       │
└──────────────────────────────────────┘
✨  Done in 2.92s.

I would like to disable all admin::* and plugin::* content-types and just leave api::* by following the docs to disable operations in the shadow crud.

register({ strapi }: { strapi: Strapi }) {
  const graphqlExt = strapi.plugin('graphql').service('extension')
  graphqlExt.shadowCRUD('admin::permission').disable()
  graphqlExt.shadowCRUD('admin::role').disable()
  graphqlExt.shadowCRUD('admin::user').disable()
  graphqlExt.shadowCRUD('admin::api-token').disable()
  graphqlExt.shadowCRUD('admin::api-token-permission').disable()
  graphqlExt.shadowCRUD('admin::transfer-token').disable()
  graphqlExt.shadowCRUD('plugin::upload.file').disable()
  graphqlExt.shadowCRUD('plugin::upload.folder').disable()
  graphqlExt.shadowCRUD('plugin::i18n.locale').disable()
  graphqlExt.shadowCRUD('plugin::users-permissions.permission').disable()
  graphqlExt.shadowCRUD('plugin::users-permissions.role').disable()
  graphqlExt.shadowCRUD('plugin::users-permissions.user').disable()
},

Running this code yields the following nexus error when the server starts. Some content-types can be fully disabled, but some only allow calls to disableQueries() or disableMutations() to prevent the nexus error.

The server is restarting

Error: NEXUS__UNKNOWN__TYPE was already defined and imported as a type, check the docs for extending types
    at extendError (/Development/node/cms-strapi/node_modules/nexus/dist/builder.js:1123:12)
    at SchemaBuilder.addType (/Development/node/cms-strapi/node_modules/nexus/dist/builder.js:156:27)
    at SchemaBuilder.missingType (/Development/node/cms-strapi/node_modules/nexus/dist/builder.js:704:14)
    at SchemaBuilder.getOrBuildType (/Development/node/cms-strapi/node_modules/nexus/dist/builder.js:938:21)
    at SchemaBuilder.getOutputType (/Development/node/cms-strapi/node_modules/nexus/dist/builder.js:876:34)
    at SchemaBuilder.buildOutputField (/Development/node/cms-strapi/node_modules/nexus/dist/builder.js:798:60)
    at /Development/node/cms-strapi/node_modules/nexus/dist/builder.js:770:43
    at Array.forEach (<anonymous>)
    at SchemaBuilder.buildOutputFields (/Development/node/cms-strapi/node_modules/nexus/dist/builder.js:769:16)
    at fields (/Development/node/cms-strapi/node_modules/nexus/dist/builder.js:544:32)

Seems related to How do I remove GraphQL mutations related to plugins? and as far as I can tell, the only solutions are to override the queries and mutations (still leaves them in the schema, even if you throw an error) or disable ShadowCRUD entirely and write the resolvers you want from scratch.