Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@crossroad/registry

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@crossroad/registry

Store GraphQL extensions definitions into Postgres

  • 0.2.13
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

@crossroad/client

  • register a crossroad extension
  • query a crossroad server

createExtension()

import { createExtension } from '@crossroad/client'

createExtension({
    // Target a @crossroad API server:
    endpoint: 'http://crossroad-server.com',
    token: 'extension-secret-token',

    // Describe your extension:
    name: 'Foo',
    secret: 'xxx',

    // Variables can be used in the definition as first class placeholders
    variables: [
        { name: 'var1', value: 'xxx' },
        { name: 'var2', value: 'yyy' },
    ],
    
    // Headers are prepended to each endpoint definition, value can use variables
    variables: [
        { name: 'x-foo', value: 'var1' },
        { name: 'x-aaa', value: '{{ var1 }}/{{ var2 }}' },
    ],

    // Extension definition as in @marcopeg/graphql-extension
    definition: { ... },
})
secret

Used by @crossroad to generate a meta.signature token that can be verified by the client.
You can then protect your routes with extension.createMiddleware()

variables

Every item that you define into variables will be available for templating in the rest of the definition, along with the values that are provided by the @crossroad server at evaluation time.

  • meta.origin
  • meta.signature
  • root.xxx
  • args.xxx

runQuery()

import { runQuery } from '@crossroad/client'
runQuery({
    query: 'query foo (@name: String!) { Ext1 { name(name:$name) }}', 
    variables: { name: 'foo' },
    endpoint: 'http://crossroad-server.com',
    headers: {
        'x-grapi-origin': 'client token'
    },
})

HttpError

Custom error utility that play nicely with an Express error handler.
(to be completed)

Keywords

FAQs

Package last updated on 17 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc