ceramicstudio / js-composedb Goto Github PK
View Code? Open in Web Editor NEWComposeDB is a decentralized GraphQL database built on Ceramic Network
Home Page: https://composedb.js.org
License: Other
ComposeDB is a decentralized GraphQL database built on Ceramic Network
Home Page: https://composedb.js.org
License: Other
Provide a 2-3 sentence overview of the work to be done.12
Provide an explanation of the technical work to be done.
When errors pop up relating to the generation of GraphQL, it's a bit tricky sometimes to track down where the fault is because the error doesn't include any hints to neither source file nor surrounding context.
If it would be possible to add some additional info to these errors it would save both time and frustration when iterating on models which would be much appreciated 👼
In the docs, the guide I am following create-your-composite mentions multiple times to pass localhost:7007
but on my macOS machine, it throws an error. As soon as I replace it with 0.0.0.0:7007
it works.
The error is:
✖ request to http://localhost:7007/api/v0/streams/kjzl6hvfrbw6c5ajfmes842lu09vjxu5956e3xq0xk12gp2jcf9s90cagt2god9?sync=0 failed, reason: connect ECONNREFUSED ::1:7007
I see throughout the docs that localhost:7007
is widely mentioned. It would be worth to understand why on macOS it does not work and if it's the case to replace it docs wide with 0.0.0.0:7007
.
Error happened after I have done everything just as the doc(https://composedb.js.org/docs/0.3.x/first-composite) said.there is an error like this below:
Cannot use GraphQLScalarType "String" from another module or realm.
Ensure that there is only one instance of "graphql" in the node_modules
directory. If different versions of "graphql" are the dependencies of other
relied on modules, use "resolutions" to ensure only one version is installed.
https://yarnpkg.com/en/docs/selective-version-resolutions
Duplicate "graphql" modules cannot be used at the same time since different
versions may have different capabilities and behavior. The data from one
version used in the function from another could produce confusing and
spurious results.
The DateTime
scalar from the graphql-scalars
library converts inputs to JS Date objects rather than strings as expected.
There is a PR already open to fix the issue but we should address it directly here in the meantime.
The PR to fix the issue in graphql-scalars
could a good solution to look into, implementing similar changes in our @composedb/graphql-scalars
package.
Trying to create a document based on a locally deployed model always errors saying it must not have content:
❯ npx @composedb/cli --version
@composedb/cli/0.5.0 linux-x64 node-v16.13.1
❯ npx @composedb/cli document:create \
kjzl6hvfrbw6c7jrhoqzxi7set6yaz3zxg4rbhs6j23okxx1ifk217ermjd3e6l \
"{}" \
-c http://localhost:7007 \
--did-private-key="$(<keyfile)"
ℹ Using DID did:key:z6Mkn1YLPvknNdqJX1imbNoR22SdTggVKwwRskzbDGLHBG2H
✖ HTTP request to 'http://localhost:7007/api/v0/streams' failed with status 'Internal Server Error':
{"error":"Deterministic genesis commits for ModelInstanceDocuments must not have content"}
Using an empty string instead yields the error SyntaxError: Unexpected end of JSON input
, which makes sense since it isn't valid JSON.
Omitting the arg is not valid:
› Error: Missing 1 required arg:
› content Content of the created model instance document (JSON encoded as string)
Clarify CLI documentation, or fix a bug 🐛
Our team has identified some major areas of improvement in this repositories.
Project Link: (Project link on Devpost)
Team Members:
Challenges we've faced:
(discussed on Discord with @dbcfd, adding here for completeness)
In our code base we have the need for optional relations, but there seems to be a bug where the API errors out if a @relationDocument
field refers to an unset property
even if both the StreamID
and the Thing
is optional:
type Thing @loadModel(id: "xyz") {
id: ID!
}
type Host
@createModel(accountRelation: LIST, description: "Holding things")
{
thingID: StreamID @documentReference(model: "Thing") <--------- note optional
thing: Thing @relationDocument(property: "thingID") <--------- note optional
}
The error returned from the ceramic API:
Error: HTTP request to 'http://localhost:7007/api/v0/streams' failed with status 'Internal Server Error':
{"error":"Error while parsing relation from field thingID: Invalid StreamID: Error: Unable to decode multibase string \"undefined\", base36 decoder only supports inputs prefixed with k"}
Since a StreamID
field can be optional, a @relationDocument
field referencing that property must also be optional.
Running a mutation via client.execute
consistently returns Error:
undefined is not supported by the IPLD Data Model and cannot be encoded
. I am not using a remote executor. AFAIK this working up until recently.
Running the same query via client.executeQuery
and the string used to create the DocumentNode succeeds.
I noticed that the test file does not include any testing of client.execute
, is it being phased out?
Unsure of what is causing this to break, here is the relevant section of the error output:
Error: `undefined` is not supported by the IPLD Data Model and cannot be encoded
at undefinedEncoder (file:///Users/mcclurejt/src/intuition/node_modules/.pnpm/@[email protected]/node_modules/@ipld/dag-cbor/src/index.js:46:9)
at objectToTokens (file:///Users/mcclurejt/src/intuition/node_modules/.pnpm/[email protected]/node_modules/cborg/esm/lib/encode.js:177:20)
at Object (file:///Users/mcclurejt/src/intuition/node_modules/.pnpm/[email protected]/node_modules/cborg/esm/lib/encode.js:151:9)
at objectToTokens (file:///Users/mcclurejt/src/intuition/node_modules/.pnpm/[email protected]/node_modules/cborg/esm/lib/encode.js:186:10)
at Object (file:///Users/mcclurejt/src/intuition/node_modules/.pnpm/[email protected]/node_modules/cborg/esm/lib/encode.js:151:9)
at objectToTokens (file:///Users/mcclurejt/src/intuition/node_modules/.pnpm/[email protected]/node_modules/cborg/esm/lib/encode.js:186:10)
at encodeCustom (file:///Users/mcclurejt/src/intuition/node_modules/.pnpm/[email protected]/node_modules/cborg/esm/lib/encode.js:216:18)
at Module.encode (file:///Users/mcclurejt/src/intuition/node_modules/.pnpm/[email protected]/node_modules/cborg/esm/lib/encode.js:239:10)
at Module.encode (file:///Users/mcclurejt/src/intuition/node_modules/.pnpm/@[email protected]/node_modules/@ipld/dag-cbor/src/index.js:110:39)
at Module.encode (file:///Users/mcclurejt/src/intuition/node_modules/.pnpm/[email protected]/node_modules/multiformats/src/block.js:181:23)
Composedb node and ipfs node are using the most recent full versions.
All scalars being used are standard.
Happy to provide additional information :)
I would like the ability to define a filter that always evaluates to true. This way I can dynamically construct the filter on the client dependent on the inputs to my query.
Given a model like:
type Pin
@createModel(accountRelation: LIST, description: "A pin to a location")
@createIndex(fields: [{ path: "tag" }]) {
author: DID! @documentAccount
name: String! @string(minLength: 1, maxLength: 100)
description: String! @string(minLength: 1, maxLength: 300)
tag: String! @string(minLength: 1, maxLength: 100)
lat: Float! @float(min: -90, max: 90)
lon: Float! @float(min: -180, max: 180)
}
I want to write a function that can load pins based on a provided tag or all pins if no tag is provided.
I currently need to implement this function this way, which create lots of duplication of the query string.
async function loadPins(tag) {
let pins = {};
if (tag !== undefined) {
const input = { where: { tag: { equalTo: tag } } };
await compose.executeQuery(`
query($input: PinFiltersInput) {
pinIndex(first:100, filters: $input) {
edges {
node {
id
name
description
tag
lat
lon
author { id }
}
}
}
}`, { input });
} else {
pins = await compose.executeQuery(`
query() {
pinIndex(first:100) {
edges {
node {
id
name
description
tag
lat
lon
author { id }
}
}
}
}`);
}
return pins
}
Instead I would prefer to implement the function in this way:
async function loadPins(tag) {
let input = { };
if (tag !== undefined) {
input = { where: { tag: { equalTo: tag } } }
};
const pins = await compose.executeQuery(`
query($input: PinFiltersInput) {
pinIndex(first:100, filters: $input) {
edges {
node {
id
name
description
tag
lat
lon
author { id }
}
}
}
}`, { input });
return pins
}
However the second function gets error about the input value not being a valid PinFiltersInput object. I would be fine with an explicit value like {where: "true" }
instead of just the empty object {}
. Anything that makes it so its possible to define a filter that is always true.
I am on OS X 11.6.8, with Node v18.15.0
After completing the installation of Ceramic, ComposeDB and via npm
I ran:
npx @ceramicnetwork/cli daemon
as instructed here
Instead of the expected
IMPORTANT: Ceramic API running on 0.0.0.0:7007
I got:
Please migrate your code to use AWS SDK for JavaScript (v3).
For more information, check the migration guide at https://a.co/7PzMCcy
(Use `node --trace-warnings ...` to show where the warning was created)
In order to authenticate with composeDB we do the following to authenticate the requests.
composeClient.setDID(did);
When logging out there is no way to unset the did and do the next request as an unauthenticated user. It would be very handy to be able to do one of the following.
composeClient.setDID(null);
composeClient.unsetDid();
For now as a workaround I am doing the following
composeClient.setDID(null as any);
Most links from the docs to CIPs are broken as they link to a subdir, and the files seems to have moved up one step. Here are a couple of examples: https://composedb.js.org/docs/0.5.x/api/sdl/scalars#did
One of the broken links look like this: https://github.com/ceramicnetwork/CIPs/blob/main/CIPs/CIP-59/CIP-59.md#commitid where it should be https://github.com/ceramicnetwork/CIPs/blob/main/CIPs/cip-59.md#commitid (lowercase and dropped subdir)
The Discord links in community.mdx are expired invites.
I can't find up-to-date invites/server links, otherwise I'd just PR.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.