@elba-security/graphql-zeus
Advanced tools
Comparing version 5.1.9-alpha.1 to 6.0.0-alpha.0
@@ -7,2 +7,3 @@ "use strict"; | ||
const graphql_js_tree_1 = require("graphql-js-tree"); | ||
const enums_1 = require("../shared/enums"); | ||
exports.MODEL_TYPES = 'ModelTypes'; | ||
@@ -14,3 +15,3 @@ const resolveTypeFromRoot = (i, rootNodes) => { | ||
if (i.data.type === graphql_js_tree_1.TypeDefinition.EnumTypeDefinition) { | ||
return `["${i.name}"]:${i.name}`; | ||
return `["${i.name}"]:${(0, enums_1.toTypeNameFromEnum)(i.name)}`; | ||
} | ||
@@ -17,0 +18,0 @@ if (i.data.type === graphql_js_tree_1.TypeDefinition.ScalarTypeDefinition) { |
@@ -5,2 +5,3 @@ "use strict"; | ||
const description_1 = require("../shared/description"); | ||
const enums_1 = require("../shared/enums"); | ||
const resolveEnum = (i) => { | ||
@@ -10,7 +11,7 @@ if (!i.args) { | ||
} | ||
return `${(0, description_1.plusDescription)(i.description)}export const enum ${i.name} {\n${i.args | ||
.map((f) => `\t${f.name} = "${f.name}"`) | ||
.join(',\n')}\n}`; | ||
const typeName = (0, enums_1.toTypeNameFromEnum)(i.name); | ||
const stringLiterals = i.args.map((f) => `'${f.name}'`).join(' | '); | ||
return `${(0, description_1.plusDescription)(i.description)}export type ${typeName} = ${stringLiterals}\n`; | ||
}; | ||
exports.resolveEnum = resolveEnum; | ||
//# sourceMappingURL=enum.js.map |
@@ -10,6 +10,7 @@ "use strict"; | ||
const graphql_js_tree_1 = require("graphql-js-tree"); | ||
const enums_1 = require("../shared/enums"); | ||
const resolveType = ({ data, name, args }, rootNodes) => { | ||
switch (data.type) { | ||
case graphql_js_tree_1.TypeDefinition.EnumTypeDefinition: | ||
return `["${name}"]: ${name}`; | ||
return `["${name}"]: ${(0, enums_1.toTypeNameFromEnum)(name)}`; | ||
case graphql_js_tree_1.TypeDefinition.InputObjectTypeDefinition: | ||
@@ -16,0 +17,0 @@ return `["${name}"]: {\n\t${args.map((f) => (0, field_1.resolveField)(f)).join(',\n')}\n}`; |
@@ -23,3 +23,3 @@ "use strict"; | ||
const isNullType = (type) => { | ||
return f.type.fieldType.type === graphql_js_tree_1.Options.required || type.endsWith(' | null') ? `: ${type}` : `: ${type} | null`; | ||
return f.type.fieldType.type === graphql_js_tree_1.Options.required ? `: ${type}` : `: ${type}`; | ||
}; | ||
@@ -26,0 +26,0 @@ return `${(0, description_1.plusDescription)(f.description, '\t')}\t${f.name}${isNullType((0, exports.resolveFieldType)((0, primitive_1.toTypeScriptPrimitive)((0, graphql_js_tree_1.getTypeName)(f.type.fieldType), t), f.type.fieldType))}`; |
@@ -9,2 +9,3 @@ "use strict"; | ||
const models_1 = require("./models"); | ||
const enums_1 = require("../shared/enums"); | ||
const AliasType = (code) => `AliasType<${code}>`; | ||
@@ -21,3 +22,3 @@ const resolveValueTypeFromRoot = (i, rootNodes, enumsAndScalars) => { | ||
if (i.data.type === graphql_js_tree_1.TypeDefinition.EnumTypeDefinition) { | ||
return `["${i.name}"]:${i.name}`; | ||
return `["${i.name}"]:${(0, enums_1.toTypeNameFromEnum)(i.name)}`; | ||
} | ||
@@ -24,0 +25,0 @@ if (i.data.type === graphql_js_tree_1.TypeDefinition.InputObjectTypeDefinition) { |
@@ -9,2 +9,3 @@ "use strict"; | ||
const models_1 = require("../models"); | ||
const enums_1 = require("../../shared/enums"); | ||
const AliasType = (code) => `AliasType<${code}>`; | ||
@@ -16,3 +17,3 @@ const resolveValueTypeFromRoot = (i, rootNodes, enumsAndScalars) => { | ||
if (i.data.type === graphql_js_tree_1.TypeDefinition.EnumTypeDefinition) { | ||
return `["${i.name}"]:${i.name}`; | ||
return `["${i.name}"]:${(0, enums_1.toTypeNameFromEnum)(i.name)}`; | ||
} | ||
@@ -19,0 +20,0 @@ if (i.data.type === graphql_js_tree_1.TypeDefinition.InputObjectTypeDefinition) { |
{ | ||
"name": "@elba-security/graphql-zeus", | ||
"version": "5.1.9-alpha.1", | ||
"version": "6.0.0-alpha.0", | ||
"private": false, | ||
@@ -18,3 +18,2 @@ "license": "MIT", | ||
"cli": "node ./lib/CLI/index.js", | ||
"prepublishOnly": "yarn && yarn build", | ||
"examples-generate": "npm run generate-typescript-node", | ||
@@ -21,0 +20,0 @@ "generate-typescript-node": "node ./lib/CLI/index.js https://faker.graphqleditor.com/a-team/olympus/graphql examples/typescript-node/src --n -g examples/typescript-node/zeus.graphql --apollo --reactQuery --stuccoSubscriptions --td", |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
2
642659
190
7579