Skip to content

nijynot/graphql-base64

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

graphql-base64

Turn IDs into opaque identifiers for GraphQL.

Encode and decode IDs in Base64. Partial fork of graphql-relay-js with slight changes. It does not rely node's internal Buffer when encoding/decoding in Base64.

Install

$ yarn add graphql-base64

Usage

Example:

import { globalIdField } from 'graphql-base64';

export const userType = new GraphQLObjectType({
  name: 'User',
  fields: () => ({
    id: globalIdField(),
  }),
});

API

globalIdField()

Returns configuration for the id field of an object.

toGlobalId(type, id)

Encode a type name and ID in Base64.

fromGlobalId(string)

Decode a global ID from Base64 and return it's type name and ID.

Related

About

Partial modified fork of graphql-relay's globalId feature

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published