Is there any api to list out all existing compose db models from network?

is there any API to list out all existing compose db models from the network? I believe it is possible through compose db cli composedb model:list --table can we do same through client or graphql API?

3 Likes

Hey, thanks for the great question. we’re actually working towards exposing the ComposeDB APis - CLI: model:* commands | ComposeDB on Ceramic - but I don’t believe these are available yet @paul

Can you share a bit more about how you’d like to use the model list API?

1 Like

No, the client and GraphQL APIs don’t support this, they only work with composites.
The model:list command calls a dedicated service 3Box Labs runs to index all models on the network.

@paul if they configure their node to index the Meta-model then shouldn’t it be possible to query this with the standard APIs?

The GraphQL APIs are designed for runtime app interactions with documents, not with models.
The models are used to define the structure of the documents in the devtools but the runtime doesn’t interact with models at all, only documents.

So the answer is no? There is no way to find out all the composites and models? @spencer could you elaborate? Will be more than happy to contribute.

The answer is yes. You can index all models by indexing the metamodel: kh4q0ozorrgaq2mezktnrmdwleo1d

@0xEE3CA4dd4CeB341691 - the simplest way to see the list of models is through the composedb CLI. You can use the composedb model:list command.

This question was about whether you can query that list using the graphql APIs. I’m surprised to here it isn’t supported by the client @paul given that the Ceramic server supports querying the model list in this way with the exact same HTTP API as is used for querying ModelInstanceDocuments. Seems like it should be a pretty simple thing to add support for to the graphql client?

CC @avi to track the feature request - query the list of all Models using GraphQL

1 Like

Yes, I also see the metamodel stream id in the source code.
But the type of metamodel stream is UNLOADABLE, so I can’t index the model in my own ceramic node,
like this: composedb composite:from-model kh4q0ozorrgaq2mezktnrmdwleo1d --ceramic-url=https://ceramic-private-clay.3boxlabs.com --output=my-first-composite-single.json
it resposnes: “StreamID kh4q0ozorrgaq2mezktnrmdwleo1d does not refer to a ‘model’ stream, but to a UNLOADABLE”

So, if I want to index/store all models by my own ceramic node, how should I do? Or, Is there any other way?

1 Like

@0xE243BB905378f7aB70 Right now there’s no nice way to do this however you can manually modify the DB used by Ceramic to index all models:

Steps by @alex

  1. make sure compose db is not disabled (on by defalt) & the ceramic_models table was created
  2. INSERT INTO ceramic_models VALUES ('kh4q0ozorrgaq2mezktnrmdwleo1d', true, true, NOW(), NOW(), '0');
  3. restart the node.

Hope that works for you until we have an easier way to configure this through the ComposeDB cli.

3 Likes