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

core-types-graphql

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

core-types-graphql - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

dist/lib/utils.d.ts

4

dist/lib/core-types-to-graphql.js

@@ -71,3 +71,3 @@ "use strict";

}, ctx);
if (node.type === 'null') {
else if (node.type === 'null') {
if (nullTypeName)

@@ -77,3 +77,3 @@ return gqlUnionTypeOfTypes(node, [gql_utils_1.gqlNamedTypeNode(nullTypeName)], ctx);

}
if (node.type === 'or') {
else if (node.type === 'or') {
return makeUnionType(node, ctx);

@@ -80,0 +80,0 @@ }

@@ -8,2 +8,3 @@ "use strict";

const gql_utils_1 = require("./gql-utils");
const utils_1 = require("./utils");
function getGraphqlAst(source) {

@@ -14,4 +15,16 @@ return graphql_1.parse(source);

function convertGraphqlToCoreTypes(source, options) {
var _a;
const { warn = (message) => console.warn(message), unsupported = 'ignore', } = options !== null && options !== void 0 ? options : {};
const document = getGraphqlAst(source);
let document;
try {
document = getGraphqlAst(source);
}
catch (err) {
if (err instanceof graphql_1.GraphQLError)
core_types_1.throwRelatedError(err, {
source,
loc: utils_1.gqlLocationsToCoreTypesLocation(source, (_a = err.locations) !== null && _a !== void 0 ? _a : [])
});
throw err;
}
if (document.kind !== 'Document')

@@ -26,3 +39,3 @@ throw new core_types_1.UnsupportedError(`Invalid document type "${document.kind}"`, {

.map((definition) => {
var _a, _b, _c, _d;
var _a, _b, _c, _d, _e;
if (definition.kind === 'UnionTypeDefinition') {

@@ -55,5 +68,13 @@ if (!((_a = definition.types) === null || _a === void 0 ? void 0 : _a.length)) {

}
else if (definition.kind === 'EnumTypeDefinition') {
const fields = (_c = definition.values) !== null && _c !== void 0 ? _c : [];
return {
...parseCommonFields(definition),
type: 'string',
enum: fields.map(field => field.name.value),
};
}
else {
if (unsupported === 'ignore') {
const name = (_d = (_c = definition) === null || _c === void 0 ? void 0 : _c.name) === null || _d === void 0 ? void 0 : _d.value;
const name = (_e = (_d = definition) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.value;
if (name)

@@ -60,0 +81,0 @@ notConvertedTypes.push(name);

{
"name": "core-types-graphql",
"version": "1.1.0",
"version": "1.2.0",
"description": "core-types ⬌ GraphQL conversion",

@@ -37,3 +37,3 @@ "author": "Gustaf Räntilä",

"dependencies": {
"core-types": "^1.1.2",
"core-types": "^1.2.0",
"graphql": "^15.5.0"

@@ -40,0 +40,0 @@ },

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