Collection defined in defineCollection not reflected in /api/collections:list

I’m seeking some assistance with an issue I’m encountering while working with collections via a plugin. Here’s the problem:

  • I’m trying to create a collection using defineCollection in my plugin.
  • When I attempt to list the collections via the /api/collections:list endpoint, I’m only able to fetch collections that were created via the UI.
  • Collections created via defineCollection are not appearing in the list API response.

Here’s a snippet of my collection definition:

import { defineCollection } from '@nocobase/database';

export default defineCollection({
  name: 'organization',
  fields: [{
    type: 'string',
    name: 'name'  
}, {
    type: "text",
    name: "address"  
}]
});

My question is: Do I need to add anything else in the options or configuration to ensure that collections created via defineCollection are included in the /api/collections:list response?

Any guidance or suggestions would be greatly appreciated!

Thanks in advance!

A possible solution is using db2cm, refer to nocobase/packages/plugins/@nocobase/plugin-acl/src/server/server.ts at bae769c6bf108250bf0679ad5c006e2013549809 · nocobase/nocobase · GitHub.
However, this is an experimental API and could be changed in the future. You need to use it with caution.