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

@contember/graphql-utils

Package Overview
Dependencies
Maintainers
4
Versions
224
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contember/graphql-utils - npm Package Compare versions

Comparing version 2.0.0-alpha.12 to 2.0.0-alpha.13

5

dist/development/index.js
import { DateTimeType } from "./src/DateTimeType.js";
import { JSONType } from "./src/JsonType.js";
import { JSONType, createJsonLikeType } from "./src/JsonType.js";
import { ForbiddenError, UserInputError } from "./src/errors.js";

@@ -10,4 +10,5 @@ import { UuidType } from "./src/UuidType.js";

UserInputError,
UuidType
UuidType,
createJsonLikeType
};
//# sourceMappingURL=index.js.map

76

dist/development/src/JsonType.js
import { GraphQLScalarType, Kind } from "graphql";
const JSONType = new GraphQLScalarType({
name: "Json",
description: "Json custom scalar type",
serialize(value) {
return value;
},
parseValue(value) {
return value;
},
parseLiteral(ast, variables) {
const parseLiteral = (ast2, variables2) => {
switch (ast2.kind) {
case Kind.STRING:
return ast2.value;
case Kind.BOOLEAN:
return ast2.value;
case Kind.FLOAT:
return parseFloat(ast2.value);
case Kind.INT:
return Number(ast2.value);
case Kind.LIST:
return ast2.values.map((it) => parseLiteral(it, variables2));
case Kind.OBJECT:
return Object.fromEntries(ast2.fields.map((it) => [it.name.value, parseLiteral(it.value, variables2)]));
case Kind.NULL:
return null;
case Kind.VARIABLE:
return variables2?.[ast2.name.value] || void 0;
default:
throw new TypeError();
}
};
return parseLiteral(ast, variables);
}
});
const createJsonLikeType = (name, description) => {
return new GraphQLScalarType({
name,
description,
serialize(value) {
return value;
},
parseValue(value) {
return value;
},
parseLiteral(ast, variables) {
const parseLiteral = (ast2, variables2) => {
switch (ast2.kind) {
case Kind.STRING:
return ast2.value;
case Kind.BOOLEAN:
return ast2.value;
case Kind.FLOAT:
return parseFloat(ast2.value);
case Kind.INT:
return Number(ast2.value);
case Kind.LIST:
return ast2.values.map((it) => parseLiteral(it, variables2));
case Kind.OBJECT:
return Object.fromEntries(ast2.fields.map((it) => [it.name.value, parseLiteral(it.value, variables2)]));
case Kind.NULL:
return null;
case Kind.VARIABLE:
return variables2?.[ast2.name.value] || void 0;
default:
throw new TypeError();
}
};
return parseLiteral(ast, variables);
}
});
};
const JSONType = createJsonLikeType("Json", "JSON custom scalar type");
export {
JSONType
JSONType,
createJsonLikeType
};
//# sourceMappingURL=JsonType.js.map
import { DateTimeType } from "./src/DateTimeType.js";
import { JSONType } from "./src/JsonType.js";
import { JSONType, createJsonLikeType } from "./src/JsonType.js";
import { ForbiddenError, UserInputError } from "./src/errors.js";

@@ -10,4 +10,5 @@ import { UuidType } from "./src/UuidType.js";

UserInputError,
UuidType
UuidType,
createJsonLikeType
};
//# sourceMappingURL=index.js.map
import { GraphQLScalarType, Kind } from "graphql";
const JSONType = new GraphQLScalarType({
name: "Json",
description: "Json custom scalar type",
serialize(value) {
return value;
},
parseValue(value) {
return value;
},
parseLiteral(ast, variables) {
const parseLiteral = (ast2, variables2) => {
switch (ast2.kind) {
case Kind.STRING:
return ast2.value;
case Kind.BOOLEAN:
return ast2.value;
case Kind.FLOAT:
return parseFloat(ast2.value);
case Kind.INT:
return Number(ast2.value);
case Kind.LIST:
return ast2.values.map((it) => parseLiteral(it, variables2));
case Kind.OBJECT:
return Object.fromEntries(ast2.fields.map((it) => [it.name.value, parseLiteral(it.value, variables2)]));
case Kind.NULL:
return null;
case Kind.VARIABLE:
return variables2?.[ast2.name.value] || void 0;
default:
throw new TypeError();
}
};
return parseLiteral(ast, variables);
}
});
const createJsonLikeType = (name, description) => {
return new GraphQLScalarType({
name,
description,
serialize(value) {
return value;
},
parseValue(value) {
return value;
},
parseLiteral(ast, variables) {
const parseLiteral = (ast2, variables2) => {
switch (ast2.kind) {
case Kind.STRING:
return ast2.value;
case Kind.BOOLEAN:
return ast2.value;
case Kind.FLOAT:
return parseFloat(ast2.value);
case Kind.INT:
return Number(ast2.value);
case Kind.LIST:
return ast2.values.map((it) => parseLiteral(it, variables2));
case Kind.OBJECT:
return Object.fromEntries(ast2.fields.map((it) => [it.name.value, parseLiteral(it.value, variables2)]));
case Kind.NULL:
return null;
case Kind.VARIABLE:
return variables2?.[ast2.name.value] || void 0;
default:
throw new TypeError();
}
};
return parseLiteral(ast, variables);
}
});
};
const JSONType = createJsonLikeType("Json", "JSON custom scalar type");
export {
JSONType
JSONType,
createJsonLikeType
};
//# sourceMappingURL=JsonType.js.map
import { GraphQLScalarType } from 'graphql';
export declare const createJsonLikeType: (name: string, description: string) => GraphQLScalarType<unknown, unknown>;
export declare const JSONType: GraphQLScalarType<unknown, unknown>;
//# sourceMappingURL=JsonType.d.ts.map
{
"name": "@contember/graphql-utils",
"version": "2.0.0-alpha.12",
"version": "2.0.0-alpha.13",
"license": "Apache-2.0",

@@ -5,0 +5,0 @@ "main": "./dist/production/index.js",

@@ -6,36 +6,41 @@ import { JSONValue } from './json'

export const JSONType = new GraphQLScalarType({
name: 'Json',
description: 'Json custom scalar type',
serialize(value) {
return value
},
parseValue(value) {
return value
},
parseLiteral(ast, variables) {
const parseLiteral = (ast: ValueNode, variables: Maybe<{ [key: string]: any }>): JSONValue => {
switch (ast.kind) {
case Kind.STRING:
return ast.value
case Kind.BOOLEAN:
return ast.value
case Kind.FLOAT:
return parseFloat(ast.value)
case Kind.INT:
return Number(ast.value)
case Kind.LIST:
return ast.values.map(it => parseLiteral(it, variables))
case Kind.OBJECT:
return Object.fromEntries(ast.fields.map(it => [it.name.value, parseLiteral(it.value, variables)]))
case Kind.NULL:
return null
case Kind.VARIABLE:
return variables?.[ast.name.value] || undefined
default:
throw new TypeError()
export const createJsonLikeType = (name: string, description: string) => {
return new GraphQLScalarType({
name,
description,
serialize(value) {
return value
},
parseValue(value) {
return value
},
parseLiteral(ast, variables) {
const parseLiteral = (ast: ValueNode, variables: Maybe<{ [key: string]: any }>): JSONValue => {
switch (ast.kind) {
case Kind.STRING:
return ast.value
case Kind.BOOLEAN:
return ast.value
case Kind.FLOAT:
return parseFloat(ast.value)
case Kind.INT:
return Number(ast.value)
case Kind.LIST:
return ast.values.map(it => parseLiteral(it, variables))
case Kind.OBJECT:
return Object.fromEntries(ast.fields.map(it => [it.name.value, parseLiteral(it.value, variables)]))
case Kind.NULL:
return null
case Kind.VARIABLE:
return variables?.[ast.name.value] || undefined
default:
throw new TypeError()
}
}
}
return parseLiteral(ast, variables)
},
})
return parseLiteral(ast, variables)
},
})
}
export const JSONType = createJsonLikeType('Json', 'JSON custom scalar type')

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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