1.0.2 • Published 8 years ago

graphql-base64 v1.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

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

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago