How to use graphql-type-json - 8 common examples

To help you get started, we’ve selected a few graphql-type-json examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qmit-pro / moleculer-api / dist / schema / plugin / protocol / graphql / handler / options.js View on Github external
"use strict";
/*
  GraphQL Plugin default options for base schema and resolvers
*/
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const apollo_server_caching_1 = require("apollo-server-caching");
const graphql_upload_1 = require("graphql-upload");
const graphql_type_json_1 = require("graphql-type-json");
const graphql_iso_date_1 = require("graphql-iso-date");
// TODO: as preset
delete graphql_upload_1.GraphQLUpload.description;
delete graphql_type_json_1.GraphQLJSON.description;
delete graphql_iso_date_1.GraphQLDate.description;
delete graphql_iso_date_1.GraphQLDateTime.description;
delete graphql_iso_date_1.GraphQLTime.description;
const typeDefs = [];
const resolvers = {};
/* default scalar types */
typeDefs.push(`
"""
Upload scalar type
@input: [GraphQL multipart request spec](https://github.com/jaydenseric/graphql-multipart-request-spec)
@output: { filename, mimetype, encoding, createReadStream }
filename          string    File name.
mimetype          string    File MIME type. Provided by the client and can’t be trusted.
encoding          string    File stream transfer encoding.
createReadStream  Function  Returns a Node.js readable stream of the file contents, for processing and storing the file. Multiple calls create independent streams. Throws if called after all resolvers have resolved, or after an error has interrupted the request.
"""
github qmit-pro / moleculer-api / src / schema / plugin / protocol / graphql / handler / options.ts View on Github external
/*
  GraphQL Plugin default options for base schema and resolvers
*/

import { GraphQLHandlersOptions } from "./handlers";
import { InMemoryLRUCache } from "apollo-server-caching";
import { GraphQLUpload } from "graphql-upload";
import { GraphQLJSON } from "graphql-type-json";
import { GraphQLDate, GraphQLDateTime, GraphQLTime } from "graphql-iso-date";

// TODO: as preset

delete GraphQLUpload.description;
delete GraphQLJSON.description;
delete GraphQLDate.description;
delete GraphQLDateTime.description;
delete GraphQLTime.description;

const typeDefs: string[] = [];
const resolvers: any = {};

/* default scalar types */
typeDefs.push(`
"""
Upload scalar type
@input: [GraphQL multipart request spec](https://github.com/jaydenseric/graphql-multipart-request-spec)
@output: { filename, mimetype, encoding, createReadStream }
filename          string    File name.
mimetype          string    File MIME type. Provided by the client and can’t be trusted.
encoding          string    File stream transfer encoding.
github CodeCommission / subkit / lib / custom-directives.js View on Github external
for (const arg of directive.arguments) {
    args[arg.name.value] =
      arg.value.kind === 'StringValue'
        ? format(
            arg.value.value,
            Object.assign(
              {},
              {
                parent: source,
                args: fieldArgs,
                context
              }
            ),
            {partial: true}
          )
        : arg.value.value || GraphQLJSON.parseLiteral(arg.value);
  }
  args = Object.assign({}, args, fieldArgs);

  return (
    directiveConfig &&
    directiveConfig.resolve &&
    directiveConfig.resolve(resolve, source, args, context, info)
  );
}
github ConduitVC / aws-utils / packages / appsync-emulator-serverless / schemaWrapper.js View on Github external
parseLiteral(value) {
    return GraphQLJSON.parseLiteral(value);
  },
});
github qmit-pro / moleculer-api / dist / schema / plugin / protocol / graphql / handler / options.js View on Github external
mimetype          string    File MIME type. Provided by the client and can’t be trusted.
encoding          string    File stream transfer encoding.
createReadStream  Function  Returns a Node.js readable stream of the file contents, for processing and storing the file. Multiple calls create independent streams. Throws if called after all resolvers have resolved, or after an error has interrupted the request.
"""
scalar Upload
`);
resolvers.Upload = graphql_upload_1.GraphQLUpload;
typeDefs.push(`
"""
JSON scalar type
@input: JSON string
@output: Result of JSON.parse(@input)
"""
scalar JSON
`);
resolvers.JSON = graphql_type_json_1.GraphQLJSON;
typeDefs.push(`
"""
Date scalar type
@input: RFC3339 full-date string: "2007-12-03"
@output: Date instance
"""
scalar Date
`);
resolvers.Date = graphql_iso_date_1.GraphQLDate;
typeDefs.push(`
"""
Time scalar type
@input: RFC3339 full-time string (UTC): "13:10:20Z"
@output: Date instance
"""
scalar Time
github ConduitVC / aws-utils / packages / appsync-emulator-serverless / schemaWrapper.js View on Github external
name: 'AWSDateTime',
  description: GraphQLDateTime.description,
  serialize(value) {
    return GraphQLDateTime.serialize(value);
  },
  parseValue(value) {
    return GraphQLDateTime.parseValue(value) ? value : undefined;
  },
  parseLiteral(value) {
    return GraphQLDateTime.parseLiteral(value) ? value.value : undefined;
  },
});

const AWSJSON = new GraphQLScalarType({
  name: 'AWSJSON',
  description: GraphQLJSON.description,
  serialize(value) {
    return JSON.stringify(GraphQLJSON.serialize(value));
  },
  parseValue(value) {
    return GraphQLJSON.parseValue(value);
  },
  parseLiteral(value) {
    return GraphQLJSON.parseLiteral(value);
  },
});

const scalars = {
  AWSJSON,
  AWSDate,
  AWSTime,
  AWSDateTime,
github ConduitVC / aws-utils / packages / appsync-emulator-serverless / schemaWrapper.js View on Github external
parseValue(value) {
    return GraphQLJSON.parseValue(value);
  },
  parseLiteral(value) {
github ConduitVC / aws-utils / packages / appsync-emulator-serverless / schemaWrapper.js View on Github external
serialize(value) {
    return JSON.stringify(GraphQLJSON.serialize(value));
  },
  parseValue(value) {