Nietzsche's Preposterous Moustache

    @zaibot/graphql-cosmos
    TypeScript icon, indicating that this package has built-in type declarations

    0.0.120 • Public • Published

    graphql-cosmos

    Concept

    @cosmos(container, ours, theirs)

    The container argument indicates the value of the field is stored in a different Cosmos Container

    The ours argument tells the resolver that this entity owns the information and specifies what underlying column to use. Combined with container this indicates the relational ID column.

    The theirs argument tells the resolver that the relational information is owned by an entity in the container Cosmos Container.

    Pseudo code:

    Person {
        id
        name
        preferredContactId?
    }
    
    Contact {
        id
        personId
        phonenumber
    }
    
    type Query {
      people: [Person!]! @cosmos
    }
    
    type Person @cosmos(database: "AddressBook", container: "Persons") {
      id: ID
      name: String!
      contacts: [Contact!]! @cosmos(theirs: "personId")
      perferredContact: Contact @cosmos(ours: "preferredContactId")
    }
    
    type Contact @cosmos(database: "AddressBook", container: "Contacts") {
      person: Person! @cosmos(ours: "personId")
      preferredBy: [Person!]! @cosmos(theirs: "preferredContactId")
      phonenumber: String!
    }

    Install

    npm i @zaibot/graphql-cosmos

    DownloadsWeekly Downloads

    43

    Version

    0.0.120

    License

    MIT

    Unpacked Size

    596 kB

    Total Files

    256

    Last publish

    Collaborators

    • zaibot