Giter Club home page Giter Club logo

outserv's People

Contributors

abhimanyusinghgaur avatar ahsanbarkati avatar ajeetdsouza avatar aman-bansal avatar animesh2049 avatar ashish-goswami avatar ashishnegi avatar ashwin95r avatar bucanero avatar codexnull avatar danielmai avatar darkn3rd avatar deepakjois avatar harshil-goel avatar jatindev543 avatar jchiu0 avatar jchiu255 avatar mangalaman93 avatar manishrjain avatar martinmr avatar michaeljcompton avatar micheldiz avatar minhaj-shakeel avatar namanjain8 avatar omarayo avatar pawanrawal avatar poonai avatar prashant-shahi avatar srfrog avatar vmrajas 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  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

outserv's Issues

Product Roadmap 2022

This product roadmap is based on the initial ideas during launch. As I get more feedback from users, this roadmap is bound to change.

  • Importers

    • Smart Contracts
    • NFTs
    • Blockchains (which ones, TBD)
    • Bridge
    • Postgres
  • GraphQL Query Cache

Can't add by @id

So, the Todo example works great now that you have added @hasInverse. I even queried the reverse type (not in the example), and it works as expected.

However, the Quickstart Example for product reviews does not work.

schema

type Product {
    productID: ID!
    name: String @search(by: [term])
    reviews: [Review] @hasInverse(field: about)
}

type Customer {
    username: String! @id @search(by: [hash, regexp])
    reviews: [Review] @hasInverse(field: by)
}

type Review {
    id: ID!
    about: Product!
    by: Customer!
    comment: String @search(by: [fulltext])
    rating: Int @search
}

First Mutation

mutation {
  addProduct(input: [
    { name: "GraphQL on Dgraph"},
    { name: "Dgraph: The GraphQL Database"}
  ]) {
    product {
      productID
      name
    }
  }
  addCustomer(input: [{ username: "Michael"}]) {
    customer {
      username
    }
  }
}

No issues here. The problem is with the second mutation.

Second Mutation

mutation {
  addReview(input: [{
    by: {username: "Michael"}, 
    about: { productID: "0x2"}, 
    comment: "Fantastic, easy to install, worked great.  Best GraphQL server available",
    rating: 10}]) 
  {
    review {
      comment
      rating
      by { username }
      about { name }
    }
  }
}

The by and the about are nested values that should be addable based on the @id field. It is, in reality, an upsert. How you want to handle this may be different than dgraph, but it is a very common use case.

Side Note: Not sure if this is important, but the extensions come back empty on add mutations.

(I imagine you want issues posted here, and features posted under outcaste, so correct me if I'm wrong)

J

Deleting an object that is present in a union field but failing to remove the reference to it causes the API to error

Example:

union TextContainer = Word | Phrase

type Paragraph {
  id: ID!
  textContainers: [TextContainer]
  words: [Word!] @hasInverse(field: paragraph)
  phrases: [Phrase] @hasInverse(field: paragraph)
}

type Word {
  id: ID!
  text: String! @search(by: [regexp])
  paragraph: Paragraph!
  phrase: Phrase
}

type Phrase {
  id: ID!
  paragraph: Paragraph!
  words: [Word!]! @hasInverse(field: phrase)
}

If I run deletePhrase() to delete one of the Phrase objects referenced in the Paragraph.textContainers union list, then the API returns the following:

{
  "errors": [
    {
      "message": "Non-nullable field 'xid' (type String!) was not present in result from Dgraph.  GraphQL error propagation triggered.",
      "locations": [
        {
          "line": 12,
          "column": 9
        }
      ],
      "path": [
        "paginateParagraphsWithPhrases",
        0,
        "textContainers",
        3,
        "xid"
      ]
    }
  ],
"data": {
    "paginateParagraphsWithPhrases": [
      {
        "id": "0x42024",
        "transcript": {
          "id": "0x41f6a"
        },
        "start": 0.15,
        "end": 4.19,
        "textContainers": [
          {
            "__typename": "Word",
            "xid": "06dd22c3-3f52-4c4b-aa10-dc177f65e9ee",
            "text": "I'm"
          },
          {
            "__typename": "Word",
            "xid": "0174abd9-a708-4b6f-8f08-e6ae8f36c427",
            "text": "I"
          },
          {
            "__typename": "Phrase",
            "words": [
              {
                "xid": "b42505e7-0379-49c1-95de-64f0ff95212f",
                "text": "only"
              },
              {
                "xid": "e5941e95-8078-487b-a750-15e426dcfa0c",
                "text": "joking."
              }
            ]
          },
          null
        ]
      },

Notice that there is a null in the textContainers list. Desired behaviour is for deleting the Phrase to remove it from the list, or at the very least for the API to just ignore null references.

EDIT: The problem I have now is that I have no idea how to remove that null reference from the list. So the data is effectively corrupted as a result of this simple operation.

This is a problem I'm experiencing in 20.03, I'm assuming it's still an issue in Outserv.

Outserv Issue - Inverse Relationship

So I am following the guide here: https://dgraph.io/docs/graphql/todo-app-tutorial/todo-schema-design/

I add the data, everything works as expected...

When I query:

query {
  queryUser {
    username
    name
    tasks {
      title
      completed
    }
  }
}

No problems, I get the expected results:

{
  "data": {
    "queryUser": [
      {
        "username": "[email protected]",
        "name": "Alice",
        "tasks": [
          {
            "title": "Avoid crowd",
            "completed": true
          },
          {
            "title": "Wash your hands often",
            "completed": true
          },
          {
            "title": "Avoid touching your face",
            "completed": false
          },
          {
            "title": "Stay safe",
            "completed": false
          }
        ]
      }
    ]
  },
  "extensions": {
    "touched_uids": 16
  }
}

However, when I query the Inverse (from the example), I get this error:

query {
  queryTask {
    id
    title
    completed
    user {
        username
    }
  }
}
{
  "errors": [
    {
      "message": "Non-nullable field 'user' (type User!) was not present in result from Dgraph.  GraphQL error propagation triggered.",
      "locations": [
        {
          "line": 6,
          "column": 5
        }
      ],
      "path": [
        "queryTask",
        0,
        "user"
      ]
    },
    {
      "message": "Non-nullable field 'user' (type User!) was not present in result from Dgraph.  GraphQL error propagation triggered.",
      "locations": [
        {
          "line": 6,
          "column": 5
        }
      ],
      "path": [
        "queryTask",
        1,
        "user"
      ]
    },
    {
      "message": "Non-nullable field 'user' (type User!) was not present in result from Dgraph.  GraphQL error propagation triggered.",
      "locations": [
        {
          "line": 6,
          "column": 5
        }
      ],
      "path": [
        "queryTask",
        2,
        "user"
      ]
    },
    {
      "message": "Non-nullable field 'user' (type User!) was not present in result from Dgraph.  GraphQL error propagation triggered.",
      "locations": [
        {
          "line": 6,
          "column": 5
        }
      ],
      "path": [
        "queryTask",
        3,
        "user"
      ]
    }
  ],
  "data": {
    "queryTask": [
      null,
      null,
      null,
      null
    ]
  },
  "extensions": {
    "touched_uids": 16
  }
}

This may be expected if you did not rewrite the @hasInverse directive. As we discussed, and as the notion says written by Anthony and me, it should be rewritten to use @reverse under-the-hood anyway.

J

Rename add<type> to add<type>s

The addType function, e.g. addThing, addProduct receives an array of items to add. Always throws me that it's named addType (singular) but takes an array as input. I think it'd make sense to rename it to addTypes, e.g. addProducts, addThings, addUsers

As it is currently:

type Author {
	id: ID!
	name: String! @search(by: [hash])
	dob: DateTime
	posts: [Post]
}

type Post {
	postID: ID!
	title: String! @search(by: [term, fulltext])
	text: String @search(by: [fulltext, term])
	datePublished: DateTime
}
addPost(input: [AddPostInput!]!): AddPostPayload

input AddPostInput {
	title: String!
	text: String
	datePublished: DateTime
}

type AddPostPayload {
	post(filter: PostFilter, order: PostOrder, first: Int, offset: Int): [Post]
	numUids: Int
}
mutation {
  addAuthor(input: [{ name: "A.N. Author", posts: []}]) {
    author {
      id
      name
    }
  }
}

Proposed change:

type Author {
	id: ID!
	name: String! @search(by: [hash])
	dob: DateTime
	posts: [Post]
}

type Post {
	postID: ID!
	title: String! @search(by: [term, fulltext])
	text: String @search(by: [fulltext, term])
	datePublished: DateTime
}
addPosts(input: [AddPostsInput!]!): AddPostsPayload

input AddPostsInput {
	title: String!
	text: String
	datePublished: DateTime
}

type AddPostsPayload {
	post(filter: PostFilter, order: PostOrder, first: Int, offset: Int): [Post]
	numUids: Int
}
mutation {
  addAuthors(input: [{ name: "A.N. Author", posts: []}]) {
    author {
      id
      name
    }
  }
}

Avoid converting GraphQL queries to DQL

We directly parse GraphQL queries to the underlying query struct, but then convert it to DQL, before passing it to edgraph. Avoid that conversion to DQL step.

Migration tool

Outserv really needs a tool or workflow for safely managing migrations.

Ideally it'd have:

  • Ability to generate editable migration scripts that can be used to modify the schema and migrate data, or rollback the changes (and the data) if there was a problem
  • Scripts would be timestamped in the filenames, and Outserv would be able to run them in sequence, meaning that developers can migrate their local databases with a CLI command after a schema change in the repo
  • CLI commands for:
    • generating a new timestamped migration script file and automatically adding it to the migrations directory
    • running the latest migrations
    • rolling back the last run migrations

Existing migration tools for reference:

https://www.edgedb.com/docs/cli/edgedb_migration/index

https://github.com/fauna-labs/fauna-schema-migrate

https://guides.rubyonrails.org/active_record_migrations.html

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.