Socket
Book a DemoInstallSign in
Socket

@cdmbase/graphql-type-uri

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cdmbase/graphql-type-uri

JSON scalar types for GraphQL.js

4.0.0
latest
Source
npmnpm
Version published
Maintainers
0
Created
Source

graphql-type-uri

URI scalar types for GraphQL.js.

Usage

This package exports a URI value scalar GraphQL.js type:

import graphQLURI from '@cdmbase/graphql-type-uri';

These types can also be imported as follows using CommonJS:

const { graphQLURI } = require('@cdmbase/graphql-type-uri');

Programmatically-constructed schemas

You can use this in a programmatically-constructed schema as with any other scalar type:

import graphQLURI from '@cdmbase/graphql-type-uri';

const GraphQLURI = graphQLURI('URI');
export default new GraphQLObjectType({
  name: 'MyType',

  fields: {
    myValue: { type: GraphQLURI },
  },
});

SDL with GraphQL-tools

When using the SDL with GraphQL-tools, define GraphQLURI as the resolver for the appropriate scalar type in your schema:

import { makeExecutableSchema } from 'graphql-tools';
import graphQLURI, from '@cdmbase/graphql-type-uri';

const GraphQLURI = graphQLURI('URI');
const typeDefs = `
scalar URI

type MyType {
  myValue: URI
}

# ...
`;

const resolvers = {
  URI: GraphQLURI,
};

export default makeExecutableSchema({ typeDefs, resolvers });

Keywords

graphql

FAQs

Package last updated on 16 Dec 2024

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.