Coder Social home page Coder Social logo

ceramicstudio / js-composedb Goto Github PK

View Code? Open in Web Editor NEW
85.0 10.0 31.0 38.62 MB

ComposeDB is a decentralized GraphQL database built on Ceramic Network

Home Page: https://composedb.js.org

License: Other

TypeScript 74.11% JavaScript 2.63% Batchfile 0.01% CSS 0.27% Shell 0.12% MDX 22.86%
ceramic database graphql graph

js-composedb's People

Contributors

3benbox avatar avious00 avatar dbcfd avatar gvelez17 avatar julissadantes avatar justinapetr avatar kay-is avatar kenshyx avatar kgmajor avatar marc-aurele-besner avatar mcclurejt avatar michaelsena avatar mzkrasner avatar nathanielc avatar oed avatar paullecam avatar pawartur avatar pradel avatar qbig avatar smrz2001 avatar stbrody avatar velvet-shark avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

js-composedb's Issues

[Replace me with meaningful title]1st

Descriptionrr

Provide a 2-3 sentence overview of the work to be done.12

Technical Information

Provide an explanation of the technical work to be done.

GraphQL generation errors missing location context

Description

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.

image

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 👼

Docs guides mention localhost instead of 0.0.0.0

Description

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.

It doesn't work when start the local server with GraphiQL using the runtime composite

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.

CLI command `document:create` fails due to deterministic genesis commit constrains

Description

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)

Technical Information

Clarify CLI documentation, or fix a bug 🐛

[EthCC Hackathon Submission] identified early areas for improvement

Description

Our team has identified some major areas of improvement in this repositories.

Project Link: (Project link on Devpost)
Team Members:

  1. Nishant (Team Lead)
  2. Thura
  3. Sami

Challenges we've faced:

  1. Running local Ceramic node took so much time to connect
  2. Lack of clear instruction to create, compile, deployment of composite
  3. Examples should be built using simple to understand thing and structure
  4. there are script in examples present but didn't get any idea how to use cli commands to perform same
  5. few necessary things like creation of schema is missing from its documentation hosted on GitHub pages
  6. and don't need to install glaze/cli as did and private key can be generated using composedb cli itself
  7. we have to use did:private-key not did itself to create composite out of schema using composedb cli
  8. didn't find instruction to add model key to ceramic config file in indexing field.

`@relationDocument` referring to an optional `StreamID` yields internal server error if unset

Description

(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"}

Technical Information

Since a StreamID field can be optional, a @relationDocument field referencing that property must also be optional.

client.execute(<documentNode>,<vars>) mutation errors

Description

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?

Technical Information

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 :)

Allow for always true filter.

Description

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.

Technical Information

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.

Cannot start ceramic node in local mode following "Getting started"

Description

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)

unsetDid for the client when logging out

Description

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);

Outdated Discord links

Description

The Discord links in community.mdx are expired invites.

Technical Information

I can't find up-to-date invites/server links, otherwise I'd just PR.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.