From 1ef0a003cd909ec1adfdd647f2eb03bf662205c5 Mon Sep 17 00:00:00 2001 From: Christian Wesselhoeft Date: Wed, 22 Aug 2018 17:33:54 -0600 Subject: [PATCH] Fix bad merge --- dist/bundle.js | 7181 +++++------------ elm-package.json | 33 - generator/index.html | 6898 ++++++++++++++++ generator/src/Graphql/Generator/Decoder.elm | 10 +- .../src/Graphql/Generator/DocComment.elm | 17 +- generator/src/Graphql/Generator/Field.elm | 10 +- generator/src/Graphql/Generator/Group.elm | 5 +- .../src/Graphql/Generator/InputObjectFile.elm | 9 +- .../Generator/InputObjectFile/Constructor.elm | 5 +- .../Generator/InputObjectFile/Details.elm | 2 +- .../Graphql/Generator/InputObjectLoops.elm | 3 +- .../src/Graphql/Generator/ModuleName.elm | 18 +- generator/src/Graphql/Generator/Normalize.elm | 12 +- .../src/Graphql/Generator/OptionalArgs.elm | 15 +- .../src/Graphql/Generator/ReferenceLeaf.elm | 4 +- generator/src/Graphql/Generator/Scalar.elm | 3 +- .../Graphql/Generator/TypeLockDefinitions.elm | 3 +- {src => generator/src}/Graphql/Parser.elm | 0 .../src}/Graphql/Parser/CamelCaseName.elm | 0 .../src}/Graphql/Parser/ClassCaseName.elm | 0 .../src}/Graphql/Parser/Scalar.elm | 0 .../src}/Graphql/Parser/Type.elm | 24 +- .../src}/Graphql/Parser/TypeKind.elm | 0 {src => generator/src}/elm-graphql.ts | 8 +- generator/src/graphqelm.ts | 148 - package-lock.json | 218 +- webpack.config.ts | 4 +- 27 files changed, 8960 insertions(+), 5670 deletions(-) delete mode 100644 elm-package.json create mode 100644 generator/index.html rename {src => generator/src}/Graphql/Parser.elm (100%) rename {src => generator/src}/Graphql/Parser/CamelCaseName.elm (100%) rename {src => generator/src}/Graphql/Parser/ClassCaseName.elm (100%) rename {src => generator/src}/Graphql/Parser/Scalar.elm (100%) rename {src => generator/src}/Graphql/Parser/Type.elm (93%) rename {src => generator/src}/Graphql/Parser/TypeKind.elm (100%) rename {src => generator/src}/elm-graphql.ts (95%) delete mode 100644 generator/src/graphqelm.ts diff --git a/dist/bundle.js b/dist/bundle.js index 43a877cfd..1b1974ad4 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -3274,7 +3274,7 @@ function onceStrict (fn) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var Elm = __webpack_require__(30); +var Elm = __webpack_require__(30).Elm; var fs = __webpack_require__(13); var graphql_request_1 = __webpack_require__(55); var minimist = __webpack_require__(61); @@ -3351,7 +3351,7 @@ if (!(graphqlUrl || introspectionFile)) { warnIfContainsNonGenerated(prependBasePath("/")); var onDataAvailable = function (data) { console.log("Generating files..."); - var app = Elm.Main.worker({ data: data, baseModule: baseModule }); + var app = Elm.Main.init({ flags: { data: data, baseModule: baseModule } }); app.ports.generatedFiles.subscribe(function (generatedFile) { removeGenerated(prependBasePath("/")); fs.mkdirpSync(prependBasePath("InputObject")); @@ -3391,7 +3391,7 @@ else { /***/ }), /* 30 */ -/***/ (function(module, exports, __webpack_require__) { +/***/ (function(module, exports) { (function(scope){ 'use strict'; @@ -3853,8 +3853,8 @@ function _Debug_crash(identifier, fact1, fact2, fact3, fact4) throw new Error('Browser.application programs cannot handle URLs like this:\n\n ' + document.location.href + '\n\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.'); case 2: - var message = fact1; - throw new Error('Problem with the flags given to your Elm program on initialization.\n\n' + message); + var jsonErrorString = fact1; + throw new Error('Problem with the flags given to your Elm program on initialization.\n\n' + jsonErrorString); case 3: var portName = fact1; @@ -4733,6 +4733,14 @@ function _Char_toLocaleLower(char) +/**/ +function _Json_errorToString(error) +{ + return elm$json$Json$Decode$errorToString(error); +} +//*/ + + // CORE DECODERS function _Json_succeed(msg) @@ -5122,7 +5130,7 @@ function _Json_listEquality(aDecoders, bDecoders) var _Json_encode = F2(function(indentLevel, value) { - return JSON.stringify(_Json_unwrap(value), null, indentLevel); + return JSON.stringify(_Json_unwrap(value), null, indentLevel) + ''; }); function _Json_wrap(value) { return { $: 0, a: value }; } @@ -5381,7 +5389,7 @@ var _Platform_worker = F4(function(impl, flagDecoder, debugMetadata, args) function _Platform_initialize(flagDecoder, args, init, update, subscriptions, stepperBuilder) { var result = A2(_Json_run, flagDecoder, _Json_wrap(args ? args['flags'] : undefined)); - elm$core$Result$isOk(result) || _Debug_crash(2, result.a); + elm$core$Result$isOk(result) || _Debug_crash(2 /**/, _Json_errorToString(result.a) /**/); var managers = {}; result = init(result.a); var model = result.a; @@ -5907,7 +5915,7 @@ var elm$core$Set$toList = function (_n0) { return elm$core$Dict$keys(dict); }; var elm$core$String$startsWith = _String_startsWith; -var author$project$Graphqelm$Parser$ClassCaseName$isBuiltIn = function (_n0) { +var author$project$Graphql$Parser$ClassCaseName$isBuiltIn = function (_n0) { var rawName = _n0.a; return A2(elm$core$String$startsWith, '__', rawName) ? true : false; }; @@ -5950,93 +5958,93 @@ var elm$core$List$foldrHelper = F4( if (!r1.b) { return A2(fn, a, acc); } else { - return _p2._0; - } - } - }); -var _lukewestby$elm_string_interpolate$String_Interpolate$interpolationRegex = _elm_lang$core$Regex$regex('\\{\\d+\\}'); -var _lukewestby$elm_string_interpolate$String_Interpolate$interpolate = F2( - function (string, args) { - var asArray = _elm_lang$core$Array$fromList(args); - return A4( - _elm_lang$core$Regex$replace, - _elm_lang$core$Regex$All, - _lukewestby$elm_string_interpolate$String_Interpolate$interpolationRegex, - _lukewestby$elm_string_interpolate$String_Interpolate$applyInterpolation(asArray), - string); - }); - -var _dillonkearns$elm_graphql$Graphql_Generator_AnnotatedArg$toString = F2( - function (functionName, _p0) { - var _p1 = _p0; - var _p2 = _p1.args; - var parameterNames = A2(_elm_lang$core$List$map, _elm_lang$core$Tuple$second, _p2); - var annotations = A2( - _elm_lang$core$Basics_ops['++'], - A2(_elm_lang$core$List$map, _elm_lang$core$Tuple$first, _p2), - { - ctor: '::', - _0: _p1.returnAnnotation, - _1: {ctor: '[]'} - }); - var typeAnnotation = A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '{0} : {1}', - { - ctor: '::', - _0: functionName, - _1: { - ctor: '::', - _0: A2(_elm_lang$core$String$join, ' -> ', annotations), - _1: {ctor: '[]'} - } - }); - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '{0}\n{1} {2} =\n', - { - ctor: '::', - _0: typeAnnotation, - _1: { - ctor: '::', - _0: functionName, - _1: { - ctor: '::', - _0: A2(_elm_lang$core$String$join, ' ', parameterNames), - _1: {ctor: '[]'} + var b = r1.a; + var r2 = r1.b; + if (!r2.b) { + return A2( + fn, + a, + A2(fn, b, acc)); + } else { + var c = r2.a; + var r3 = r2.b; + if (!r3.b) { + return A2( + fn, + a, + A2( + fn, + b, + A2(fn, c, acc))); + } else { + var d = r3.a; + var r4 = r3.b; + var res = (ctr > 500) ? A3( + elm$core$List$foldl, + fn, + acc, + elm$core$List$reverse(r4)) : A4(elm$core$List$foldrHelper, fn, acc, ctr + 1, r4); + return A2( + fn, + a, + A2( + fn, + b, + A2( + fn, + c, + A2(fn, d, res)))); } } } } }); -var _dillonkearns$elm_graphql$Graphql_Generator_AnnotatedArg$prepend = F2( - function (_p3, annotatedArgs) { - var _p4 = _p3; - return _elm_lang$core$Native_Utils.update( - annotatedArgs, - { - args: { - ctor: '::', - _0: {ctor: '_Tuple2', _0: _p4._0, _1: _p4._1}, - _1: annotatedArgs.args - } - }); +var elm$core$List$foldr = F3( + function (fn, acc, ls) { + return A4(elm$core$List$foldrHelper, fn, acc, 0, ls); }); -var _dillonkearns$elm_graphql$Graphql_Generator_AnnotatedArg$AnnotatedArgs = F2( - function (a, b) { - return {args: a, returnAnnotation: b}; +var elm$core$List$filter = F2( + function (isGood, list) { + return A3( + elm$core$List$foldr, + F2( + function (x, xs) { + return isGood(x) ? A2(elm$core$List$cons, x, xs) : xs; + }), + _List_Nil, + list); }); -var _dillonkearns$elm_graphql$Graphql_Generator_AnnotatedArg$build = function (returnAnnotation) { +var author$project$Graphql$Generator$Group$excludeBuiltIns = function (typeDefinitions) { return A2( - _dillonkearns$elm_graphql$Graphql_Generator_AnnotatedArg$AnnotatedArgs, - {ctor: '[]'}, - returnAnnotation); + elm$core$List$filter, + function (_n0) { + var name = _n0.a; + var definableType = _n0.b; + var description = _n0.c; + return !author$project$Graphql$Parser$ClassCaseName$isBuiltIn(name); + }, + typeDefinitions); }; -var _dillonkearns$elm_graphql$Graphql_Generator_AnnotatedArg$buildWithArgs = F2( - function (args, returnAnnotation) { - return A2(_dillonkearns$elm_graphql$Graphql_Generator_AnnotatedArg$AnnotatedArgs, args, returnAnnotation); +var elm$core$Basics$neq = _Utils_notEqual; +var author$project$Graphql$Generator$Group$excludeMutation = F2( + function (_n0, typeDefinitions) { + var mutation = _n0.mutation; + if (mutation.$ === 'Just') { + var mutationObjectName = mutation.a; + return A2( + elm$core$List$filter, + function (_n2) { + var name = _n2.a; + var definableType = _n2.b; + var description = _n2.c; + return !_Utils_eq(name, mutationObjectName); + }, + typeDefinitions); + } else { + return typeDefinitions; + } }); -var author$project$Graphqelm$Generator$Group$excludeQuery = F2( +var author$project$Graphql$Generator$Group$excludeQuery = F2( function (_n0, typeDefinitions) { var query = _n0.query; return A2( @@ -6049,7 +6057,7 @@ var author$project$Graphqelm$Generator$Group$excludeQuery = F2( }, typeDefinitions); }); -var author$project$Graphqelm$Generator$Group$excludeSubscription = F2( +var author$project$Graphql$Generator$Group$excludeSubscription = F2( function (_n0, typeDefinitions) { var subscription = _n0.subscription; if (subscription.$ === 'Just') { @@ -6067,7 +6075,7 @@ var author$project$Graphqelm$Generator$Group$excludeSubscription = F2( return typeDefinitions; } }); -var author$project$Graphqelm$Parser$ClassCaseName$raw = function (_n0) { +var author$project$Graphql$Parser$ClassCaseName$raw = function (_n0) { var rawName = _n0.a; return rawName; }; @@ -6212,7 +6220,7 @@ var elm$core$List$filterMap = F2( _List_Nil, xs); }); -var author$project$Graphqelm$Generator$Group$interfacePossibleTypesDict = function (typeDefs) { +var author$project$Graphql$Generator$Group$interfacePossibleTypesDict = function (typeDefs) { return elm$core$Dict$fromList( A2( elm$core$List$filterMap, @@ -6225,7 +6233,7 @@ var author$project$Graphqelm$Generator$Group$interfacePossibleTypesDict = functi var possibleTypes = definableType.b; return elm$core$Maybe$Just( _Utils_Tuple2( - author$project$Graphqelm$Parser$ClassCaseName$raw(typeName), + author$project$Graphql$Parser$ClassCaseName$raw(typeName), possibleTypes)); } else { return elm$core$Maybe$Nothing; @@ -6241,7 +6249,7 @@ var elm$core$String$join = F2( sep, _List_toArray(chunks)); }); -var author$project$Graphqelm$Generator$Group$moduleToFileName = function (modulePath) { +var author$project$Graphql$Generator$Group$moduleToFileName = function (modulePath) { return A2(elm$core$String$join, '/', modulePath) + '.elm'; }; var elm$core$Maybe$map = F2( @@ -6518,7 +6526,7 @@ var lukewestby$elm_string_interpolate$String$Interpolate$interpolate = F2( lukewestby$elm_string_interpolate$String$Interpolate$applyInterpolation(asArray), string); }); -var author$project$Graphqelm$Generator$DocComment$argDoc = function (_n0) { +var author$project$Graphql$Generator$DocComment$argDoc = function (_n0) { var name = _n0.name; var description = _n0.description; return A2( @@ -6532,8 +6540,8 @@ var author$project$Graphqelm$Generator$DocComment$argDoc = function (_n0) { }, description); }; -var author$project$Graphqelm$Generator$DocComment$argsDoc = function (args) { - var _n0 = A2(elm$core$List$filterMap, author$project$Graphqelm$Generator$DocComment$argDoc, args); +var author$project$Graphql$Generator$DocComment$argsDoc = function (args) { + var _n0 = A2(elm$core$List$filterMap, author$project$Graphql$Generator$DocComment$argDoc, args); if (!_n0.b) { return ''; } else { @@ -6554,7 +6562,7 @@ var elm$core$List$isEmpty = function (xs) { return false; } }; -var author$project$Graphqelm$Generator$DocComment$hasDocs = F2( +var author$project$Graphql$Generator$DocComment$hasDocs = F2( function (mainDescription, itemDescriptions) { if (mainDescription.$ === 'Just') { var string = mainDescription.a; @@ -6569,9 +6577,9 @@ var author$project$Graphqelm$Generator$DocComment$hasDocs = F2( itemDescriptions)); } }); -var author$project$Graphqelm$Generator$DocComment$generate_ = F2( +var author$project$Graphql$Generator$DocComment$generate_ = F2( function (mainDescription, itemDescriptions) { - return A2(author$project$Graphqelm$Generator$DocComment$hasDocs, mainDescription, itemDescriptions) ? A2( + return A2(author$project$Graphql$Generator$DocComment$hasDocs, mainDescription, itemDescriptions) ? A2( lukewestby$elm_string_interpolate$String$Interpolate$interpolate, '{-|{0}{1}\n-}\n', _List_fromArray( @@ -6585,7 +6593,7 @@ var author$project$Graphqelm$Generator$DocComment$generate_ = F2( return ' ' + description; }, mainDescription)), - author$project$Graphqelm$Generator$DocComment$argsDoc(itemDescriptions) + author$project$Graphql$Generator$DocComment$argsDoc(itemDescriptions) ])) : ''; }); var elm$core$Char$toUpper = _Char_toUpper; @@ -6594,7 +6602,7 @@ var elm$core$String$foldr = _String_foldr; var elm$core$String$toList = function (string) { return A3(elm$core$String$foldr, elm$core$List$cons, _List_Nil, string); }; -var author$project$Graphqelm$Generator$Normalize$capitilize = function (string) { +var author$project$Graphql$Generator$Normalize$capitilize = function (string) { var _n0 = elm$core$String$toList(string); if (_n0.b) { var firstChar = _n0.a; @@ -6609,7 +6617,7 @@ var author$project$Graphqelm$Generator$Normalize$capitilize = function (string) } }; var elm$core$String$toUpper = _String_toUpper; -var author$project$Graphqelm$Generator$Normalize$isAllUpper = function (string) { +var author$project$Graphql$Generator$Normalize$isAllUpper = function (string) { return _Utils_eq( elm$core$String$toUpper(string), string); @@ -6630,7 +6638,7 @@ var elm$core$List$head = function (list) { } }; var elm$regex$Regex$find = _Regex_findAtMost(_Regex_infinity); -var author$project$Graphqelm$Generator$Normalize$underscores = function (string) { +var author$project$Graphql$Generator$Normalize$underscores = function (string) { var regexFromString = A2( elm$core$Basics$composeR, elm$regex$Regex$fromString, @@ -6646,21 +6654,17 @@ var author$project$Graphqelm$Generator$Normalize$underscores = function (string) regexFromString('^(_*)([^_]?.*[^_]?)(_*)$'), string))); if (_n0.$ === 'Just') { - if ((((_n0.a.b && _n0.a.b.b) && (_n0.a.b.a.$ === 'Just')) && _n0.a.b.b.b) && (!_n0.a.b.b.b.b)) { + if ((((((_n0.a.b && (_n0.a.a.$ === 'Just')) && _n0.a.b.b) && (_n0.a.b.a.$ === 'Just')) && _n0.a.b.b.b) && (_n0.a.b.b.a.$ === 'Just')) && (!_n0.a.b.b.b.b)) { var _n1 = _n0.a; - var leading = _n1.a; + var leading = _n1.a.a; var _n2 = _n1.b; var remaining = _n2.a.a; var _n3 = _n2.b; - var trailing = _n3.a; - return { - leading: A2(elm$core$Maybe$withDefault, '', leading), - remaining: remaining, - trailing: A2(elm$core$Maybe$withDefault, '', trailing) - }; + var trailing = _n3.a.a; + return {leading: leading, remaining: remaining, trailing: trailing}; } else { return _Debug_todo( - 'Graphqelm.Generator.Normalize', + 'Graphql.Generator.Normalize', { start: {line: 34, column: 13}, end: {line: 34, column: 23} @@ -6668,7 +6672,7 @@ var author$project$Graphqelm$Generator$Normalize$underscores = function (string) } } else { return _Debug_todo( - 'Graphqelm.Generator.Normalize', + 'Graphql.Generator.Normalize', { start: {line: 31, column: 13}, end: {line: 31, column: 23} @@ -6753,16 +6757,16 @@ var elm_community$string_extra$String$Extra$classify = function (string) { elm$core$Basics$always(' '), string)))); }; -var author$project$Graphqelm$Generator$Normalize$capitalized = function (name) { - var group = author$project$Graphqelm$Generator$Normalize$underscores(name); +var author$project$Graphql$Generator$Normalize$capitalized = function (name) { + var group = author$project$Graphql$Generator$Normalize$underscores(name); return _Utils_ap( - author$project$Graphqelm$Generator$Normalize$isAllUpper(group.remaining) ? elm_community$string_extra$String$Extra$classify( - elm$core$String$toLower(group.remaining)) : author$project$Graphqelm$Generator$Normalize$capitilize(group.remaining), + author$project$Graphql$Generator$Normalize$isAllUpper(group.remaining) ? elm_community$string_extra$String$Extra$classify( + elm$core$String$toLower(group.remaining)) : author$project$Graphql$Generator$Normalize$capitilize(group.remaining), _Utils_ap(group.leading, group.trailing)); }; -var author$project$Graphqelm$Parser$ClassCaseName$normalized = function (_n0) { +var author$project$Graphql$Parser$ClassCaseName$normalized = function (_n0) { var rawName = _n0.a; - return author$project$Graphqelm$Generator$Normalize$capitalized(rawName); + return author$project$Graphql$Generator$Normalize$capitalized(rawName); }; var elm$core$List$map = F2( function (f, xs) { @@ -6778,80 +6782,80 @@ var elm$core$List$map = F2( _List_Nil, xs); }); -var author$project$Graphqelm$Generator$DocComment$generateForEnum = F2( +var author$project$Graphql$Generator$DocComment$generateForEnum = F2( function (description, enumValues) { return A2( - author$project$Graphqelm$Generator$DocComment$generate_, + author$project$Graphql$Generator$DocComment$generate_, description, A2( elm$core$List$map, function (enumValue) { return { description: enumValue.description, - name: author$project$Graphqelm$Parser$ClassCaseName$normalized(enumValue.name) + name: author$project$Graphql$Parser$ClassCaseName$normalized(enumValue.name) }; }, enumValues)); }); -var author$project$Graphqelm$Generator$Enum$enumDocs = F2( +var author$project$Graphql$Generator$Enum$enumDocs = F2( function (enumDescription, enumValues) { - return A2(author$project$Graphqelm$Generator$DocComment$generateForEnum, enumDescription, enumValues); + return A2(author$project$Graphql$Generator$DocComment$generateForEnum, enumDescription, enumValues); }); -var author$project$Graphqelm$Generator$Enum$enumDecoder = F2( +var author$project$Graphql$Generator$Enum$enumDecoder = F2( function (enumName, enumValues) { return A2( lukewestby$elm_string_interpolate$String$Interpolate$interpolate, 'decoder : Decoder {0}\ndecoder =\n Decode.string\n |> Decode.andThen\n (\\string ->\n case string of\n', _List_fromArray( [ - author$project$Graphqelm$Parser$ClassCaseName$normalized(enumName) + author$project$Graphql$Parser$ClassCaseName$normalized(enumName) ])) + (A2( elm$core$String$join, '\n\n', A2( elm$core$List$map, function (enumValue) { - return ' \"' + (author$project$Graphqelm$Parser$ClassCaseName$raw(enumValue) + ('\" ->\n Decode.succeed ' + author$project$Graphqelm$Parser$ClassCaseName$normalized(enumValue))); + return ' \"' + (author$project$Graphql$Parser$ClassCaseName$raw(enumValue) + ('\" ->\n Decode.succeed ' + author$project$Graphql$Parser$ClassCaseName$normalized(enumValue))); }, A2( elm$core$List$map, function ($) { return $.name; }, - enumValues))) + ('\n\n _ ->\n Decode.fail ("Invalid ' + (author$project$Graphqelm$Parser$ClassCaseName$normalized(enumName) + ' type, " ++ string ++ " try re-running the graphqelm CLI ")\n )\n '))); + enumValues))) + ('\n\n _ ->\n Decode.fail ("Invalid ' + (author$project$Graphql$Parser$ClassCaseName$normalized(enumName) + ' type, " ++ string ++ " try re-running the @dillonkearns/elm-graphql CLI ")\n )\n '))); }); -var author$project$Graphqelm$Generator$Enum$toStringCase = function (enumValue) { +var author$project$Graphql$Generator$Enum$toStringCase = function (enumValue) { return A2( lukewestby$elm_string_interpolate$String$Interpolate$interpolate, ' {0} ->\n "{1}"\n', _List_fromArray( [ - author$project$Graphqelm$Parser$ClassCaseName$normalized(enumValue.name), - author$project$Graphqelm$Parser$ClassCaseName$raw(enumValue.name) + author$project$Graphql$Parser$ClassCaseName$normalized(enumValue.name), + author$project$Graphql$Parser$ClassCaseName$raw(enumValue.name) ])); }; -var author$project$Graphqelm$Generator$Enum$enumToString = F2( +var author$project$Graphql$Generator$Enum$enumToString = F2( function (enumName, enumValues) { return A2( lukewestby$elm_string_interpolate$String$Interpolate$interpolate, '{-| Convert from the union type representating the Enum to a string that the GraphQL server will recognize.\n-}\ntoString : {0} -> String\ntoString enum =\n case enum of\n{1}', _List_fromArray( [ - author$project$Graphqelm$Parser$ClassCaseName$normalized(enumName), + author$project$Graphql$Parser$ClassCaseName$normalized(enumName), A2( elm$core$String$join, '\n\n', - A2(elm$core$List$map, author$project$Graphqelm$Generator$Enum$toStringCase, enumValues)) + A2(elm$core$List$map, author$project$Graphql$Generator$Enum$toStringCase, enumValues)) ])); }); -var author$project$Graphqelm$Generator$Enum$enumType = F2( +var author$project$Graphql$Generator$Enum$enumType = F2( function (enumName, enumValues) { - return 'type ' + (author$project$Graphqelm$Parser$ClassCaseName$normalized(enumName) + ('\n = ' + (A2( + return 'type ' + (author$project$Graphql$Parser$ClassCaseName$normalized(enumName) + ('\n = ' + (A2( elm$core$String$join, '\n | ', A2( elm$core$List$map, - author$project$Graphqelm$Parser$ClassCaseName$normalized, + author$project$Graphql$Parser$ClassCaseName$normalized, A2( elm$core$List$map, function ($) { @@ -6859,7 +6863,7 @@ var author$project$Graphqelm$Generator$Enum$enumType = F2( }, enumValues))) + '\n'))); }); -var author$project$Graphqelm$Generator$Enum$prepend = F4( +var author$project$Graphql$Generator$Enum$prepend = F4( function (moduleName, enumName, enumValues, docComment) { return A2( lukewestby$elm_string_interpolate$String$Interpolate$interpolate, @@ -6867,18 +6871,18 @@ var author$project$Graphqelm$Generator$Enum$prepend = F4( _List_fromArray( [ A2(elm$core$String$join, '.', moduleName) - ])) + (docComment + (A2(author$project$Graphqelm$Generator$Enum$enumType, enumName, enumValues) + (A2(author$project$Graphqelm$Generator$Enum$enumDecoder, enumName, enumValues) + ('\n\n' + A2(author$project$Graphqelm$Generator$Enum$enumToString, enumName, enumValues))))); + ])) + (docComment + (A2(author$project$Graphql$Generator$Enum$enumType, enumName, enumValues) + (A2(author$project$Graphql$Generator$Enum$enumDecoder, enumName, enumValues) + ('\n\n' + A2(author$project$Graphql$Generator$Enum$enumToString, enumName, enumValues))))); }); -var author$project$Graphqelm$Generator$Enum$generate = F4( +var author$project$Graphql$Generator$Enum$generate = F4( function (enumName, moduleName, enumValues, description) { return A4( - author$project$Graphqelm$Generator$Enum$prepend, + author$project$Graphql$Generator$Enum$prepend, moduleName, enumName, enumValues, - A2(author$project$Graphqelm$Generator$Enum$enumDocs, description, enumValues)); + A2(author$project$Graphql$Generator$Enum$enumDocs, description, enumValues)); }); -var author$project$Graphqelm$Generator$Normalize$elmReservedWords = _List_fromArray( +var author$project$Graphql$Generator$Normalize$elmReservedWords = _List_fromArray( ['as', 'case', 'else', 'exposing', 'if', 'import', 'in', 'infix', 'let', 'module', 'of', 'port', 'then', 'type', 'where']); var elm$core$List$any = F2( function (isOkay, list) { @@ -6910,39 +6914,39 @@ var elm$core$List$member = F2( }, xs); }); -var author$project$Graphqelm$Generator$Normalize$normalizeIfElmReserved = function (name) { - return A2(elm$core$List$member, name, author$project$Graphqelm$Generator$Normalize$elmReservedWords) ? (name + '_') : name; +var author$project$Graphql$Generator$Normalize$normalizeIfElmReserved = function (name) { + return A2(elm$core$List$member, name, author$project$Graphql$Generator$Normalize$elmReservedWords) ? (name + '_') : name; }; var elm$core$Char$toLower = _Char_toLower; var elm_community$string_extra$String$Extra$decapitalize = function (word) { return A2(elm_community$string_extra$String$Extra$changeCase, elm$core$Char$toLower, word); }; -var author$project$Graphqelm$Generator$Normalize$decapitalized = function (name) { - return author$project$Graphqelm$Generator$Normalize$normalizeIfElmReserved( +var author$project$Graphql$Generator$Normalize$decapitalized = function (name) { + return author$project$Graphql$Generator$Normalize$normalizeIfElmReserved( elm_community$string_extra$String$Extra$decapitalize( - author$project$Graphqelm$Generator$Normalize$capitalized(name))); + author$project$Graphql$Generator$Normalize$capitalized(name))); }; -var author$project$Graphqelm$Parser$CamelCaseName$normalized = function (_n0) { +var author$project$Graphql$Parser$CamelCaseName$normalized = function (_n0) { var name = _n0.a; - return author$project$Graphqelm$Generator$Normalize$decapitalized(name); + return author$project$Graphql$Generator$Normalize$decapitalized(name); }; -var author$project$Graphqelm$Generator$DocComment$generate = function (_n0) { +var author$project$Graphql$Generator$DocComment$generate = function (_n0) { var description = _n0.description; var args = _n0.args; return A2( - author$project$Graphqelm$Generator$DocComment$generate_, + author$project$Graphql$Generator$DocComment$generate_, description, A2( elm$core$List$map, function (arg) { return { description: arg.description, - name: author$project$Graphqelm$Parser$CamelCaseName$normalized(arg.name) + name: author$project$Graphql$Parser$CamelCaseName$normalized(arg.name) }; }, args)); }; -var author$project$Graphqelm$Generator$Field$argsListString = function (_n0) { +var author$project$Graphql$Generator$Field$argsListString = function (_n0) { var annotatedArgs = _n0.annotatedArgs; return _Utils_eq(annotatedArgs, _List_Nil) ? '' : (A2( elm$core$String$join, @@ -6954,7 +6958,7 @@ var author$project$Graphqelm$Generator$Field$argsListString = function (_n0) { }, annotatedArgs)) + ' '); }; -var author$project$Graphqelm$Generator$Field$fieldArgsString = function (_n0) { +var author$project$Graphql$Generator$Field$fieldArgsString = function (_n0) { var fieldArgs = _n0.fieldArgs; if (!fieldArgs.b) { return '[]'; @@ -6967,11 +6971,11 @@ var author$project$Graphqelm$Generator$Field$fieldArgsString = function (_n0) { } } }; -var author$project$Graphqelm$Parser$CamelCaseName$raw = function (_n0) { +var author$project$Graphql$Parser$CamelCaseName$raw = function (_n0) { var name = _n0.a; return name; }; -var author$project$Graphqelm$Generator$Field$typeAliasesToString = F2( +var author$project$Graphql$Generator$Field$typeAliasesToString = F2( function (field, fieldGenerator) { return _Utils_eq(fieldGenerator.typeAliases, _List_Nil) ? elm$core$Maybe$Nothing : elm$core$Maybe$Just( A2( @@ -6988,14 +6992,14 @@ var author$project$Graphqelm$Generator$Field$typeAliasesToString = F2( _List_fromArray( [ elm_community$string_extra$String$Extra$classify( - author$project$Graphqelm$Parser$CamelCaseName$raw(field.name)), + author$project$Graphql$Parser$CamelCaseName$raw(field.name)), suffix, body ])); }, fieldGenerator.typeAliases))); }); -var author$project$Graphqelm$Generator$Let$generate = function (letBindings) { +var author$project$Graphql$Generator$Let$generate = function (letBindings) { var toLetString = function (_n0) { var name = _n0.a; var value = _n0.b; @@ -7018,7 +7022,7 @@ var author$project$Graphqelm$Generator$Let$generate = function (letBindings) { var elm$core$Basics$identity = function (x) { return x; }; -var author$project$Graphqelm$Generator$Field$fieldGeneratorToString = F3( +var author$project$Graphql$Generator$Field$fieldGeneratorToString = F3( function (returnAnnotation, field, fieldGenerator) { var fieldTypeAnnotation = A2( elm$core$String$join, @@ -7040,30 +7044,30 @@ var author$project$Graphqelm$Generator$Field$fieldGeneratorToString = F3( elm$core$Basics$identity, _List_fromArray( [ - A2(author$project$Graphqelm$Generator$Field$typeAliasesToString, field, fieldGenerator), + A2(author$project$Graphql$Generator$Field$typeAliasesToString, field, fieldGenerator), elm$core$Maybe$Just( A2( lukewestby$elm_string_interpolate$String$Interpolate$interpolate, '{9}{6} : {3}\n{6} {4}={7}\n {5} "{0}" {1} ({2}){8}\n', _List_fromArray( [ - author$project$Graphqelm$Parser$CamelCaseName$raw(field.name), - author$project$Graphqelm$Generator$Field$fieldArgsString(fieldGenerator), + author$project$Graphql$Parser$CamelCaseName$raw(field.name), + author$project$Graphql$Generator$Field$fieldArgsString(fieldGenerator), fieldGenerator.decoder, fieldTypeAnnotation, - author$project$Graphqelm$Generator$Field$argsListString(fieldGenerator), + author$project$Graphql$Generator$Field$argsListString(fieldGenerator), 'Object' + fieldGenerator.otherThing, - author$project$Graphqelm$Parser$CamelCaseName$normalized(field.name), - author$project$Graphqelm$Generator$Let$generate(fieldGenerator.letBindings), + author$project$Graphql$Parser$CamelCaseName$normalized(field.name), + author$project$Graphql$Generator$Let$generate(fieldGenerator.letBindings), A2(elm$core$Maybe$withDefault, '', fieldGenerator.objectDecoderChain), - author$project$Graphqelm$Generator$DocComment$generate(field) + author$project$Graphql$Generator$DocComment$generate(field) ]))) ]))); }); -var author$project$Graphqelm$Generator$Field$forObject_ = F4( +var author$project$Graphql$Generator$Field$forObject_ = F4( function (context, thisObjectName, field, fieldGenerator) { return A3( - author$project$Graphqelm$Generator$Field$fieldGeneratorToString, + author$project$Graphql$Generator$Field$fieldGeneratorToString, A2( lukewestby$elm_string_interpolate$String$Interpolate$interpolate, 'Field {0} {1}', @@ -7075,7 +7079,7 @@ var author$project$Graphqelm$Generator$Field$forObject_ = F4( field, fieldGenerator); }); -var author$project$Graphqelm$Generator$Field$prependArg = F2( +var author$project$Graphql$Generator$Field$prependArg = F2( function (annotatedArg, fieldGenerator) { var annotation = annotatedArg.annotation; var arg = annotatedArg.arg; @@ -7085,14 +7089,14 @@ var author$project$Graphqelm$Generator$Field$prependArg = F2( annotatedArgs: A2(elm$core$List$cons, annotatedArg, fieldGenerator.annotatedArgs) }); }); -var author$project$Graphqelm$Generator$OptionalArgs$annotation = function (fieldName) { +var author$project$Graphql$Generator$OptionalArgs$annotation = function (fieldName) { return A2( lukewestby$elm_string_interpolate$String$Interpolate$interpolate, '({0}OptionalArguments -> {0}OptionalArguments)', _List_fromArray( [fieldName])); }; -var author$project$Graphqelm$Generator$ModuleName$enum = F2( +var author$project$Graphql$Generator$ModuleName$enum = F2( function (_n0, name) { var apiSubmodule = _n0.apiSubmodule; return _Utils_ap( @@ -7100,10 +7104,10 @@ var author$project$Graphqelm$Generator$ModuleName$enum = F2( _List_fromArray( [ 'Enum', - author$project$Graphqelm$Parser$ClassCaseName$normalized(name) + author$project$Graphql$Parser$ClassCaseName$normalized(name) ])); }); -var author$project$Graphqelm$Generator$ModuleName$inputObject = F2( +var author$project$Graphql$Generator$ModuleName$inputObject = F2( function (_n0, name) { var apiSubmodule = _n0.apiSubmodule; return _Utils_ap( @@ -7111,7 +7115,7 @@ var author$project$Graphqelm$Generator$ModuleName$inputObject = F2( _List_fromArray( ['InputObject'])); }); -var author$project$Graphqelm$Generator$Decoder$generateEncoder_ = F3( +var author$project$Graphql$Generator$Decoder$generateEncoder_ = F3( function (forInputObject, apiSubmodule, _n0) { var referrableType = _n0.a; var isNullable = _n0.b; @@ -7121,78 +7125,113 @@ var author$project$Graphqelm$Generator$Decoder$generateEncoder_ = F3( } else { return ''; } - }, - _elm_lang$core$String$trim(string)); -}; -var _elm_community$string_extra$String_Extra$isBlank = function (string) { - return A2( - _elm_lang$core$Regex$contains, - _elm_lang$core$Regex$regex('^\\s*$'), - string); -}; -var _elm_community$string_extra$String_Extra$nonBlank = function (string) { - return _elm_community$string_extra$String_Extra$isBlank(string) ? _elm_lang$core$Maybe$Nothing : _elm_lang$core$Maybe$Just(string); -}; -var _elm_community$string_extra$String_Extra$clean = function (string) { - return _elm_lang$core$String$trim( - A4( - _elm_lang$core$Regex$replace, - _elm_lang$core$Regex$All, - _elm_lang$core$Regex$regex('\\s\\s+'), - _elm_lang$core$Basics$always(' '), - string)); -}; -var _elm_community$string_extra$String_Extra$softBreakRegexp = function (width) { - return _elm_lang$core$Regex$regex( - A2( - _elm_lang$core$Basics_ops['++'], - '.{1,', - A2( - _elm_lang$core$Basics_ops['++'], - _elm_lang$core$Basics$toString(width), - '}(\\s+|$)|\\S+?(\\s+|$)'))); -}; -var _elm_community$string_extra$String_Extra$softEllipsis = F2( - function (howLong, string) { - return (_elm_lang$core$Native_Utils.cmp( - _elm_lang$core$String$length(string), - howLong) < 1) ? string : A3( - _elm_lang$core$Basics$flip, - _elm_lang$core$String$append, - '...', - A4( - _elm_lang$core$Regex$replace, - _elm_lang$core$Regex$All, - _elm_lang$core$Regex$regex('([\\.,;:\\s])+$'), - _elm_lang$core$Basics$always(''), - A2( - _elm_lang$core$String$join, - '', + }(); + switch (referrableType.$) { + case 'Scalar': + var scalar = referrableType.a; + switch (scalar.$) { + case 'String': + return 'Encode.string' + isNullableString; + case 'Boolean': + return 'Encode.bool' + isNullableString; + case 'Int': + return 'Encode.int' + isNullableString; + case 'Float': + return 'Encode.float' + isNullableString; + default: + var customScalarName = scalar.a; + var constructor = A2( + elm$core$String$join, + '.', + _Utils_ap( + apiSubmodule, + _Utils_ap( + _List_fromArray( + ['Scalar']), + _List_fromArray( + [ + author$project$Graphql$Parser$ClassCaseName$normalized(customScalarName) + ])))); + return _Utils_ap( + A2( + lukewestby$elm_string_interpolate$String$Interpolate$interpolate, + '(\\({0} raw) -> Encode.string raw)', + _List_fromArray( + [constructor])), + isNullableString); + } + case 'List': + var typeRef = referrableType.a; + return A3(author$project$Graphql$Generator$Decoder$generateEncoder_, forInputObject, apiSubmodule, typeRef) + (isNullableString + ' |> Encode.list'); + case 'ObjectRef': + var objectName = referrableType.a; + return _Debug_todo( + 'Graphql.Generator.Decoder', + { + start: {line: 120, column: 13}, + end: {line: 120, column: 23} + })('I don\'t expect to see object references as argument types.'); + case 'InterfaceRef': + var interfaceName = referrableType.a; + return _Debug_todo( + 'Graphql.Generator.Decoder', + { + start: {line: 123, column: 13}, + end: {line: 123, column: 23} + })('Interfaces are never valid inputs http://facebook.github.io/graphql/October2016/#sec-Interfaces'); + case 'UnionRef': + return _Debug_todo( + 'Graphql.Generator.Decoder', + { + start: {line: 126, column: 13}, + end: {line: 126, column: 23} + })('Unions are never valid inputs http://facebook.github.io/graphql/October2016/#sec-Unions'); + case 'EnumRef': + var enumName = referrableType.a; + return A2( + lukewestby$elm_string_interpolate$String$Interpolate$interpolate, + '(Encode.enum {0})' + isNullableString, + _List_fromArray( + [ + A2( + elm$core$String$join, + '.', + _Utils_ap( + A2( + author$project$Graphql$Generator$ModuleName$enum, + {apiSubmodule: apiSubmodule}, + enumName), + _List_fromArray( + ['toString']))) + ])); + default: + var inputObjectName = referrableType.a; + return _Utils_ap( A2( elm$core$String$join, '.', forInputObject ? _List_fromArray( [ - 'encode' + author$project$Graphqelm$Parser$ClassCaseName$normalized(inputObjectName) + 'encode' + author$project$Graphql$Parser$ClassCaseName$normalized(inputObjectName) ]) : _Utils_ap( A2( - author$project$Graphqelm$Generator$ModuleName$inputObject, + author$project$Graphql$Generator$ModuleName$inputObject, {apiSubmodule: apiSubmodule}, inputObjectName), _List_fromArray( [ - 'encode' + author$project$Graphqelm$Parser$ClassCaseName$normalized(inputObjectName) + 'encode' + author$project$Graphql$Parser$ClassCaseName$normalized(inputObjectName) ]))), isNullableString); } }); -var author$project$Graphqelm$Generator$Decoder$generateEncoder = author$project$Graphqelm$Generator$Decoder$generateEncoder_(false); -var author$project$Graphqelm$Parser$Type$NonNullable = {$: 'NonNullable'}; -var author$project$Graphqelm$Parser$Type$TypeReference = F2( +var author$project$Graphql$Generator$Decoder$generateEncoder = author$project$Graphql$Generator$Decoder$generateEncoder_(false); +var author$project$Graphql$Parser$Type$NonNullable = {$: 'NonNullable'}; +var author$project$Graphql$Parser$Type$TypeReference = F2( function (a, b) { return {$: 'TypeReference', a: a, b: b}; }); -var author$project$Graphqelm$Generator$OptionalArgs$argValue = F2( +var author$project$Graphql$Generator$OptionalArgs$argValue = F2( function (apiSubmodule, _n0) { var name = _n0.name; var typeOf = _n0.typeOf; @@ -7201,22 +7240,22 @@ var author$project$Graphqelm$Generator$OptionalArgs$argValue = F2( 'Argument.optional "{0}" filledInOptionals.{1} ({2})', _List_fromArray( [ - author$project$Graphqelm$Parser$CamelCaseName$raw(name), - author$project$Graphqelm$Parser$CamelCaseName$normalized(name), + author$project$Graphql$Parser$CamelCaseName$raw(name), + author$project$Graphql$Parser$CamelCaseName$normalized(name), A2( - author$project$Graphqelm$Generator$Decoder$generateEncoder, + author$project$Graphql$Generator$Decoder$generateEncoder, apiSubmodule, - A2(author$project$Graphqelm$Parser$Type$TypeReference, typeOf, author$project$Graphqelm$Parser$Type$NonNullable)) + A2(author$project$Graphql$Parser$Type$TypeReference, typeOf, author$project$Graphql$Parser$Type$NonNullable)) ])); }); -var author$project$Graphqelm$Generator$OptionalArgs$argValues = F2( +var author$project$Graphql$Generator$OptionalArgs$argValues = F2( function (apiSubmodule, optionalArgs) { var values = A2( elm$core$String$join, ', ', A2( elm$core$List$map, - author$project$Graphqelm$Generator$OptionalArgs$argValue(apiSubmodule), + author$project$Graphql$Generator$OptionalArgs$argValue(apiSubmodule), optionalArgs)); return A2( lukewestby$elm_string_interpolate$String$Interpolate$interpolate, @@ -7224,7 +7263,7 @@ var author$project$Graphqelm$Generator$OptionalArgs$argValues = F2( _List_fromArray( [values])); }); -var author$project$Graphqelm$Generator$OptionalArgs$emptyRecord = function (optionalArgs) { +var author$project$Graphql$Generator$OptionalArgs$emptyRecord = function (optionalArgs) { var recordEntries = A2( elm$core$String$join, ', ', @@ -7232,7 +7271,7 @@ var author$project$Graphqelm$Generator$OptionalArgs$emptyRecord = function (opti elm$core$List$map, function (_n0) { var name = _n0.name; - return author$project$Graphqelm$Parser$CamelCaseName$normalized(name) + ' = Absent'; + return author$project$Graphql$Parser$CamelCaseName$normalized(name) + ' = Absent'; }, optionalArgs)); return A2( @@ -7241,7 +7280,7 @@ var author$project$Graphqelm$Generator$OptionalArgs$emptyRecord = function (opti _List_fromArray( [recordEntries])); }; -var author$project$Graphqelm$Generator$OptionalArgs$optionalArgOrNothing = function (_n0) { +var author$project$Graphql$Generator$OptionalArgs$optionalArgOrNothing = function (_n0) { var name = _n0.name; var typeRef = _n0.typeRef; if (typeRef.b.$ === 'NonNullable') { @@ -7255,7 +7294,7 @@ var author$project$Graphqelm$Generator$OptionalArgs$optionalArgOrNothing = funct {name: name, typeOf: referrableType}); } }; -var author$project$Graphqelm$Generator$ModuleName$enumTypeName = F2( +var author$project$Graphql$Generator$ModuleName$enumTypeName = F2( function (_n0, name) { var apiSubmodule = _n0.apiSubmodule; return _Utils_ap( @@ -7263,11 +7302,11 @@ var author$project$Graphqelm$Generator$ModuleName$enumTypeName = F2( _List_fromArray( [ 'Enum', - author$project$Graphqelm$Parser$ClassCaseName$normalized(name), - author$project$Graphqelm$Parser$ClassCaseName$normalized(name) + author$project$Graphql$Parser$ClassCaseName$normalized(name), + author$project$Graphql$Parser$ClassCaseName$normalized(name) ])); }); -var author$project$Graphqelm$Generator$Decoder$generateTypeCommon = F4( +var author$project$Graphql$Generator$Decoder$generateTypeCommon = F4( function (fromInputObject, nullableString, apiSubmodule, _n0) { var referrableType = _n0.a; var isNullable = _n0.b; @@ -7307,13 +7346,13 @@ var author$project$Graphqelm$Generator$Decoder$generateTypeCommon = F4( ['Scalar']), _List_fromArray( [ - author$project$Graphqelm$Parser$ClassCaseName$normalized(customScalarName) + author$project$Graphql$Parser$ClassCaseName$normalized(customScalarName) ])))); return constructor; } case 'List': var typeRef = referrableType.a; - return '(List ' + (A3(author$project$Graphqelm$Generator$Decoder$generateType_, fromInputObject, apiSubmodule, typeRef) + ')'); + return '(List ' + (A3(author$project$Graphql$Generator$Decoder$generateType_, fromInputObject, apiSubmodule, typeRef) + ')'); case 'ObjectRef': var objectName = referrableType.a; return 'decodesTo'; @@ -7329,7 +7368,7 @@ var author$project$Graphqelm$Generator$Decoder$generateTypeCommon = F4( elm$core$String$join, '.', A2( - author$project$Graphqelm$Generator$ModuleName$enumTypeName, + author$project$Graphql$Generator$ModuleName$enumTypeName, {apiSubmodule: apiSubmodule}, enumName)); default: @@ -7339,32 +7378,32 @@ var author$project$Graphqelm$Generator$Decoder$generateTypeCommon = F4( '.', fromInputObject ? _List_fromArray( [ - author$project$Graphqelm$Parser$ClassCaseName$normalized(inputObjectName) + author$project$Graphql$Parser$ClassCaseName$normalized(inputObjectName) ]) : _Utils_ap( A2( - author$project$Graphqelm$Generator$ModuleName$inputObject, + author$project$Graphql$Generator$ModuleName$inputObject, {apiSubmodule: apiSubmodule}, inputObjectName), _List_fromArray( [ - author$project$Graphqelm$Parser$ClassCaseName$normalized(inputObjectName) + author$project$Graphql$Parser$ClassCaseName$normalized(inputObjectName) ]))); } }()); }); -var author$project$Graphqelm$Generator$Decoder$generateType_ = F3( +var author$project$Graphql$Generator$Decoder$generateType_ = F3( function (fromInputObject, apiSubmodule, typeRef) { - return A4(author$project$Graphqelm$Generator$Decoder$generateTypeCommon, fromInputObject, 'Maybe', apiSubmodule, typeRef); + return A4(author$project$Graphql$Generator$Decoder$generateTypeCommon, fromInputObject, 'Maybe', apiSubmodule, typeRef); }); -var author$project$Graphqelm$Generator$Decoder$generateType = F2( +var author$project$Graphql$Generator$Decoder$generateType = F2( function (apiSubmodule, typeRef) { - return A4(author$project$Graphqelm$Generator$Decoder$generateTypeCommon, false, 'Maybe', apiSubmodule, typeRef); + return A4(author$project$Graphql$Generator$Decoder$generateTypeCommon, false, 'Maybe', apiSubmodule, typeRef); }); var elm$core$List$singleton = function (value) { return _List_fromArray( [value]); }; -var author$project$Graphqelm$Generator$OptionalArgs$typeAlias = F2( +var author$project$Graphql$Generator$OptionalArgs$typeAlias = F2( function (apiSubmodule, optionalArgs) { return A2( lukewestby$elm_string_interpolate$String$Interpolate$interpolate, @@ -7378,16 +7417,16 @@ var author$project$Graphqelm$Generator$OptionalArgs$typeAlias = F2( function (_n0) { var name = _n0.name; var typeOf = _n0.typeOf; - return author$project$Graphqelm$Parser$CamelCaseName$normalized(name) + (' : OptionalArgument ' + A2( - author$project$Graphqelm$Generator$Decoder$generateType, + return author$project$Graphql$Parser$CamelCaseName$normalized(name) + (' : OptionalArgument ' + A2( + author$project$Graphql$Generator$Decoder$generateType, apiSubmodule, - A2(author$project$Graphqelm$Parser$Type$TypeReference, typeOf, author$project$Graphqelm$Parser$Type$NonNullable))); + A2(author$project$Graphql$Parser$Type$TypeReference, typeOf, author$project$Graphql$Parser$Type$NonNullable))); }, optionalArgs)))); }); -var author$project$Graphqelm$Generator$OptionalArgs$generate = F2( +var author$project$Graphql$Generator$OptionalArgs$generate = F2( function (apiSubmodule, allArgs) { - var _n0 = A2(elm$core$List$filterMap, author$project$Graphqelm$Generator$OptionalArgs$optionalArgOrNothing, allArgs); + var _n0 = A2(elm$core$List$filterMap, author$project$Graphql$Generator$OptionalArgs$optionalArgOrNothing, allArgs); if (!_n0.b) { return elm$core$Maybe$Nothing; } else { @@ -7396,7 +7435,7 @@ var author$project$Graphqelm$Generator$OptionalArgs$generate = F2( { annotatedArg: function (fieldName) { return { - annotation: author$project$Graphqelm$Generator$OptionalArgs$annotation(fieldName), + annotation: author$project$Graphql$Generator$OptionalArgs$annotation(fieldName), arg: 'fillInOptionals' }; }, @@ -7404,30 +7443,30 @@ var author$project$Graphqelm$Generator$OptionalArgs$generate = F2( [ _Utils_Tuple2( 'filledInOptionals', - 'fillInOptionals ' + author$project$Graphqelm$Generator$OptionalArgs$emptyRecord(optionalArgs)), + 'fillInOptionals ' + author$project$Graphql$Generator$OptionalArgs$emptyRecord(optionalArgs)), _Utils_Tuple2( 'optionalArgs', - A2(author$project$Graphqelm$Generator$OptionalArgs$argValues, apiSubmodule, optionalArgs) + '\n |> List.filterMap identity') + A2(author$project$Graphql$Generator$OptionalArgs$argValues, apiSubmodule, optionalArgs) + '\n |> List.filterMap identity') ]), typeAlias: { - body: A2(author$project$Graphqelm$Generator$OptionalArgs$typeAlias, apiSubmodule, optionalArgs), + body: A2(author$project$Graphql$Generator$OptionalArgs$typeAlias, apiSubmodule, optionalArgs), suffix: 'OptionalArguments' } }); } }); -var author$project$Graphqelm$Generator$Field$addOptionalArgs = F4( +var author$project$Graphql$Generator$Field$addOptionalArgs = F4( function (field, apiSubmodule, args, fieldGenerator) { - var _n0 = A2(author$project$Graphqelm$Generator$OptionalArgs$generate, apiSubmodule, args); + var _n0 = A2(author$project$Graphql$Generator$OptionalArgs$generate, apiSubmodule, args); if (_n0.$ === 'Just') { var annotatedArg = _n0.a.annotatedArg; var letBindings = _n0.a.letBindings; var typeAlias = _n0.a.typeAlias; return A2( - author$project$Graphqelm$Generator$Field$prependArg, + author$project$Graphql$Generator$Field$prependArg, annotatedArg( elm_community$string_extra$String$Extra$classify( - author$project$Graphqelm$Parser$CamelCaseName$raw(field.name))), + author$project$Graphql$Parser$CamelCaseName$raw(field.name))), _Utils_update( fieldGenerator, { @@ -7439,7 +7478,7 @@ var author$project$Graphqelm$Generator$Field$addOptionalArgs = F4( return fieldGenerator; } }); -var author$project$Graphqelm$Generator$RequiredArgs$requiredArgOrNothing = function (_n0) { +var author$project$Graphql$Generator$RequiredArgs$requiredArgOrNothing = function (_n0) { var name = _n0.name; var typeRef = _n0.typeRef; if (typeRef.b.$ === 'NonNullable') { @@ -7453,3688 +7492,98 @@ var author$project$Graphqelm$Generator$RequiredArgs$requiredArgOrNothing = funct return elm$core$Maybe$Nothing; } }; -var author$project$Graphqelm$Generator$RequiredArgs$requiredArgAnnotation = F2( +var author$project$Graphql$Generator$RequiredArgs$requiredArgAnnotation = F2( function (apiSubmodule, _n0) { var name = _n0.name; var typeRef = _n0.typeRef; return A2( - _elm_lang$core$Maybe$withDefault, - '', - A2( - _elm_lang$core$Maybe$map, - function (_p31) { - var _p32 = _p31; + lukewestby$elm_string_interpolate$String$Interpolate$interpolate, + '{0} : {1}', + _List_fromArray( + [ + author$project$Graphql$Parser$CamelCaseName$normalized(name), + A2(author$project$Graphql$Generator$Decoder$generateType, apiSubmodule, typeRef) + ])); + }); +var author$project$Graphql$Generator$RequiredArgs$requiredArgsAnnotation = F2( + function (apiSubmodule, requiredArgs) { + var annotations = A2( + elm$core$List$map, + author$project$Graphql$Generator$RequiredArgs$requiredArgAnnotation(apiSubmodule), + requiredArgs); + return '{ ' + (A2(elm$core$String$join, ', ', annotations) + ' }'); + }); +var author$project$Graphql$Generator$RequiredArgs$requiredArgString = F2( + function (apiSubmodule, _n0) { + var name = _n0.name; + var referrableType = _n0.referrableType; + var typeRef = _n0.typeRef; + return A2( + lukewestby$elm_string_interpolate$String$Interpolate$interpolate, + 'Argument.required \"{0}\" requiredArgs.{1} ({2})', + _List_fromArray( + [ + author$project$Graphql$Parser$CamelCaseName$raw(name), + author$project$Graphql$Parser$CamelCaseName$normalized(name), + A2(author$project$Graphql$Generator$Decoder$generateEncoder, apiSubmodule, typeRef) + ])); + }); +var author$project$Graphql$Generator$RequiredArgs$requiredArgsString = F2( + function (apiSubmodule, requiredArgs) { + var requiredArgContents = A2( + elm$core$List$map, + author$project$Graphql$Generator$RequiredArgs$requiredArgString(apiSubmodule), + requiredArgs); + return '[ ' + (A2(elm$core$String$join, ', ', requiredArgContents) + ' ]'); + }); +var author$project$Graphql$Generator$RequiredArgs$generate = F2( + function (apiSubmodule, args) { + var requiredArgs = A2(elm$core$List$filterMap, author$project$Graphql$Generator$RequiredArgs$requiredArgOrNothing, args); + return _Utils_eq(requiredArgs, _List_Nil) ? elm$core$Maybe$Nothing : elm$core$Maybe$Just( + { + annotation: function (fieldName) { return A2( - _elm_lang$core$String$cons, - mutator(_p32._0), - _p32._1); + lukewestby$elm_string_interpolate$String$Interpolate$interpolate, + '{0}RequiredArguments', + _List_fromArray( + [fieldName])); }, - _elm_lang$core$String$uncons(word))); - }); -var _elm_community$string_extra$String_Extra$toSentenceCase = function (word) { - return A2(_elm_community$string_extra$String_Extra$changeCase, _elm_lang$core$Char$toUpper, word); -}; -var _elm_community$string_extra$String_Extra$toTitleCase = function (ws) { - var uppercaseMatch = A3( - _elm_lang$core$Regex$replace, - _elm_lang$core$Regex$All, - _elm_lang$core$Regex$regex('\\w+'), - function (_p33) { - return _elm_community$string_extra$String_Extra$toSentenceCase( - function (_) { - return _.match; - }(_p33)); - }); - return A4( - _elm_lang$core$Regex$replace, - _elm_lang$core$Regex$All, - _elm_lang$core$Regex$regex('^([a-z])|\\s+([a-z])'), - function (_p34) { - return uppercaseMatch( - function (_) { - return _.match; - }(_p34)); - }, - ws); -}; -var _elm_community$string_extra$String_Extra$classify = function (string) { - return _elm_community$string_extra$String_Extra$toSentenceCase( - A3( - _elm_community$string_extra$String_Extra$replace, - ' ', - '', - _elm_community$string_extra$String_Extra$camelize( - A4( - _elm_lang$core$Regex$replace, - _elm_lang$core$Regex$All, - _elm_lang$core$Regex$regex('[\\W_]'), - _elm_lang$core$Basics$always(' '), - string)))); -}; -var _elm_community$string_extra$String_Extra$humanize = function (string) { - return _elm_community$string_extra$String_Extra$toSentenceCase( - _elm_lang$core$String$toLower( - _elm_lang$core$String$trim( - A4( - _elm_lang$core$Regex$replace, - _elm_lang$core$Regex$All, - _elm_lang$core$Regex$regex('_id$|[-_\\s]+'), - _elm_lang$core$Basics$always(' '), - A4( - _elm_lang$core$Regex$replace, - _elm_lang$core$Regex$All, - _elm_lang$core$Regex$regex('[A-Z]'), - function (_p35) { - return A2( - _elm_lang$core$String$append, - '-', - function (_) { - return _.match; - }(_p35)); - }, - string))))); -}; -var _elm_community$string_extra$String_Extra$decapitalize = function (word) { - return A2(_elm_community$string_extra$String_Extra$changeCase, _elm_lang$core$Char$toLower, word); -}; - -var _dillonkearns$elm_graphql$Graphql_Generator_Normalize$elmReservedWords = { - ctor: '::', - _0: 'as', - _1: { - ctor: '::', - _0: 'case', - _1: { - ctor: '::', - _0: 'else', - _1: { - ctor: '::', - _0: 'exposing', - _1: { - ctor: '::', - _0: 'if', - _1: { - ctor: '::', - _0: 'import', - _1: { - ctor: '::', - _0: 'in', - _1: { - ctor: '::', - _0: 'infix', - _1: { - ctor: '::', - _0: 'let', - _1: { - ctor: '::', - _0: 'module', - _1: { - ctor: '::', - _0: 'of', - _1: { - ctor: '::', - _0: 'port', - _1: { - ctor: '::', - _0: 'then', - _1: { - ctor: '::', - _0: 'type', - _1: { - ctor: '::', - _0: 'where', - _1: {ctor: '[]'} - } - } - } - } - } - } - } - } - } - } + list: A2(author$project$Graphql$Generator$RequiredArgs$requiredArgsString, apiSubmodule, requiredArgs), + typeAlias: { + body: A2(author$project$Graphql$Generator$RequiredArgs$requiredArgsAnnotation, apiSubmodule, requiredArgs), + suffix: 'RequiredArguments' } - } - } - } -}; -var _dillonkearns$elm_graphql$Graphql_Generator_Normalize$capitilize = function (string) { - var _p0 = _elm_lang$core$String$toList(string); - if (_p0.ctor === '::') { - return _elm_lang$core$String$fromList( - { - ctor: '::', - _0: _elm_lang$core$Char$toUpper(_p0._0), - _1: _p0._1 }); - } else { - return ''; - } -}; -var _dillonkearns$elm_graphql$Graphql_Generator_Normalize$isAllUpper = function (string) { - return _elm_lang$core$Native_Utils.eq( - _elm_lang$core$String$toUpper(string), - string); -}; -var _dillonkearns$elm_graphql$Graphql_Generator_Normalize$underscores = function (string) { - var _p1 = A2( - _elm_lang$core$Maybe$map, - function (_) { - return _.submatches; - }, - _elm_lang$core$List$head( - A3( - _elm_lang$core$Regex$find, - _elm_lang$core$Regex$All, - _elm_lang$core$Regex$regex('^(_*)([^_]?.*[^_]?)(_*)$'), - string))); - if (_p1.ctor === 'Just') { - if (((((((_p1._0.ctor === '::') && (_p1._0._0.ctor === 'Just')) && (_p1._0._1.ctor === '::')) && (_p1._0._1._0.ctor === 'Just')) && (_p1._0._1._1.ctor === '::')) && (_p1._0._1._1._0.ctor === 'Just')) && (_p1._0._1._1._1.ctor === '[]')) { - return {leading: _p1._0._0._0, trailing: _p1._0._1._1._0._0, remaining: _p1._0._1._0._0}; - } else { - return _elm_lang$core$Native_Utils.crashCase( - 'Graphql.Generator.Normalize', + }); +var author$project$Graphql$Generator$Field$addRequiredArgs = F4( + function (field, apiSubmodule, args, fieldGenerator) { + var _n0 = A2(author$project$Graphql$Generator$RequiredArgs$generate, apiSubmodule, args); + if (_n0.$ === 'Just') { + var annotation = _n0.a.annotation; + var list = _n0.a.list; + var typeAlias = _n0.a.typeAlias; + return A2( + author$project$Graphql$Generator$Field$prependArg, { - start: {line: 18, column: 5}, - end: {line: 29, column: 72} + annotation: annotation( + elm_community$string_extra$String$Extra$classify( + author$project$Graphql$Parser$CamelCaseName$raw(field.name))), + arg: 'requiredArgs' }, - _p1)( - A2(_elm_lang$core$Basics_ops['++'], 'Unexpected regex result for name ', string)); + _Utils_update( + fieldGenerator, + { + fieldArgs: _List_fromArray( + [list]), + typeAliases: A2(elm$core$List$cons, typeAlias, fieldGenerator.typeAliases) + })); + } else { + return fieldGenerator; } - } else { - return _elm_lang$core$Native_Utils.crashCase( - 'Graphql.Generator.Normalize', - { - start: {line: 18, column: 5}, - end: {line: 29, column: 72} - }, - _p1)('Got nothing'); - } -}; -var _dillonkearns$elm_graphql$Graphql_Generator_Normalize$capitalized = function (name) { - var group = _dillonkearns$elm_graphql$Graphql_Generator_Normalize$underscores(name); - return A2( - _elm_lang$core$Basics_ops['++'], - _dillonkearns$elm_graphql$Graphql_Generator_Normalize$isAllUpper(group.remaining) ? _elm_community$string_extra$String_Extra$classify( - _elm_lang$core$String$toLower(group.remaining)) : _dillonkearns$elm_graphql$Graphql_Generator_Normalize$capitilize(group.remaining), - A2(_elm_lang$core$Basics_ops['++'], group.leading, group.trailing)); -}; -var _dillonkearns$elm_graphql$Graphql_Generator_Normalize$normalizeIfElmReserved = function (name) { - return A2(_elm_lang$core$List$member, name, _dillonkearns$elm_graphql$Graphql_Generator_Normalize$elmReservedWords) ? A2(_elm_lang$core$Basics_ops['++'], name, '_') : name; -}; -var _dillonkearns$elm_graphql$Graphql_Generator_Normalize$decapitalized = function (name) { - return _dillonkearns$elm_graphql$Graphql_Generator_Normalize$normalizeIfElmReserved( - _elm_community$string_extra$String_Extra$decapitalize( - _dillonkearns$elm_graphql$Graphql_Generator_Normalize$capitalized(name))); -}; - -var _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$isBuiltIn = function (_p0) { - var _p1 = _p0; - return A2(_elm_lang$core$String$startsWith, '__', _p1._0) ? true : false; -}; -var _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized = function (_p2) { - var _p3 = _p2; - return _dillonkearns$elm_graphql$Graphql_Generator_Normalize$capitalized(_p3._0); -}; -var _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$raw = function (_p4) { - var _p5 = _p4; - return _p5._0; -}; -var _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$ClassCaseName = function (a) { - return {ctor: 'ClassCaseName', _0: a}; -}; -var _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$build = _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$ClassCaseName; - -var _dillonkearns$elm_graphql$Graphql_Generator_Context$context = function (_p0) { - var _p1 = _p0; - return { - query: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$build(_p1.query), - mutation: A2(_elm_lang$core$Maybe$map, _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$build, _p1.mutation), - subscription: A2(_elm_lang$core$Maybe$map, _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$build, _p1.subscription), - apiSubmodule: _p1.apiSubmodule, - interfaces: _p1.interfaces - }; -}; -var _dillonkearns$elm_graphql$Graphql_Generator_Context$Context = F5( - function (a, b, c, d, e) { - return {query: a, mutation: b, subscription: c, apiSubmodule: d, interfaces: e}; }); - -var _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$normalized = function (_p0) { - var _p1 = _p0; - return _dillonkearns$elm_graphql$Graphql_Generator_Normalize$decapitalized(_p1._0); -}; -var _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$raw = function (_p2) { - var _p3 = _p2; - return _p3._0; -}; -var _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$CamelCaseName = function (a) { - return {ctor: 'CamelCaseName', _0: a}; -}; -var _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$build = _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$CamelCaseName; - -var _dillonkearns$elm_graphql$Graphql_Parser_Scalar$Custom = function (a) { - return {ctor: 'Custom', _0: a}; -}; -var _dillonkearns$elm_graphql$Graphql_Parser_Scalar$Float = {ctor: 'Float'}; -var _dillonkearns$elm_graphql$Graphql_Parser_Scalar$Int = {ctor: 'Int'}; -var _dillonkearns$elm_graphql$Graphql_Parser_Scalar$String = {ctor: 'String'}; -var _dillonkearns$elm_graphql$Graphql_Parser_Scalar$Boolean = {ctor: 'Boolean'}; -var _dillonkearns$elm_graphql$Graphql_Parser_Scalar$parse = function (scalarName) { - var _p0 = scalarName; - switch (_p0) { - case 'String': - return _dillonkearns$elm_graphql$Graphql_Parser_Scalar$String; - case 'Boolean': - return _dillonkearns$elm_graphql$Graphql_Parser_Scalar$Boolean; - case 'Int': - return _dillonkearns$elm_graphql$Graphql_Parser_Scalar$Int; - case 'Float': - return _dillonkearns$elm_graphql$Graphql_Parser_Scalar$Float; - default: - return _dillonkearns$elm_graphql$Graphql_Parser_Scalar$Custom( - _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$build(scalarName)); - } -}; - -//import Maybe, Native.Array, Native.List, Native.Utils, Result // - -var _elm_lang$core$Native_Json = function() { - - -// CORE DECODERS - -function succeed(msg) -{ - return { - ctor: '', - tag: 'succeed', - msg: msg - }; -} - -function fail(msg) -{ - return { - ctor: '', - tag: 'fail', - msg: msg - }; -} - -function decodePrimitive(tag) -{ - return { - ctor: '', - tag: tag - }; -} - -function decodeContainer(tag, decoder) -{ - return { - ctor: '', - tag: tag, - decoder: decoder - }; -} - -function decodeNull(value) -{ - return { - ctor: '', - tag: 'null', - value: value - }; -} - -function decodeField(field, decoder) -{ - return { - ctor: '', - tag: 'field', - field: field, - decoder: decoder - }; -} - -function decodeIndex(index, decoder) -{ - return { - ctor: '', - tag: 'index', - index: index, - decoder: decoder - }; -} - -function decodeKeyValuePairs(decoder) -{ - return { - ctor: '', - tag: 'key-value', - decoder: decoder - }; -} - -function mapMany(f, decoders) -{ - return { - ctor: '', - tag: 'map-many', - func: f, - decoders: decoders - }; -} - -function andThen(callback, decoder) -{ - return { - ctor: '', - tag: 'andThen', - decoder: decoder, - callback: callback - }; -} - -function oneOf(decoders) -{ - return { - ctor: '', - tag: 'oneOf', - decoders: decoders - }; -} - - -// DECODING OBJECTS - -function map1(f, d1) -{ - return mapMany(f, [d1]); -} - -function map2(f, d1, d2) -{ - return mapMany(f, [d1, d2]); -} - -function map3(f, d1, d2, d3) -{ - return mapMany(f, [d1, d2, d3]); -} - -function map4(f, d1, d2, d3, d4) -{ - return mapMany(f, [d1, d2, d3, d4]); -} - -function map5(f, d1, d2, d3, d4, d5) -{ - return mapMany(f, [d1, d2, d3, d4, d5]); -} - -function map6(f, d1, d2, d3, d4, d5, d6) -{ - return mapMany(f, [d1, d2, d3, d4, d5, d6]); -} - -function map7(f, d1, d2, d3, d4, d5, d6, d7) -{ - return mapMany(f, [d1, d2, d3, d4, d5, d6, d7]); -} - -function map8(f, d1, d2, d3, d4, d5, d6, d7, d8) -{ - return mapMany(f, [d1, d2, d3, d4, d5, d6, d7, d8]); -} - - -// DECODE HELPERS - -function ok(value) -{ - return { tag: 'ok', value: value }; -} - -function badPrimitive(type, value) -{ - return { tag: 'primitive', type: type, value: value }; -} - -function badIndex(index, nestedProblems) -{ - return { tag: 'index', index: index, rest: nestedProblems }; -} - -function badField(field, nestedProblems) -{ - return { tag: 'field', field: field, rest: nestedProblems }; -} - -function badIndex(index, nestedProblems) -{ - return { tag: 'index', index: index, rest: nestedProblems }; -} - -function badOneOf(problems) -{ - return { tag: 'oneOf', problems: problems }; -} - -function bad(msg) -{ - return { tag: 'fail', msg: msg }; -} - -function badToString(problem) -{ - var context = '_'; - while (problem) - { - switch (problem.tag) - { - case 'primitive': - return 'Expecting ' + problem.type - + (context === '_' ? '' : ' at ' + context) - + ' but instead got: ' + jsToString(problem.value); - - case 'index': - context += '[' + problem.index + ']'; - problem = problem.rest; - break; - - case 'field': - context += '.' + problem.field; - problem = problem.rest; - break; - - case 'oneOf': - var problems = problem.problems; - for (var i = 0; i < problems.length; i++) - { - problems[i] = badToString(problems[i]); - } - return 'I ran into the following problems' - + (context === '_' ? '' : ' at ' + context) - + ':\n\n' + problems.join('\n'); - - case 'fail': - return 'I ran into a `fail` decoder' - + (context === '_' ? '' : ' at ' + context) - + ': ' + problem.msg; - } - } -} - -function jsToString(value) -{ - return value === undefined - ? 'undefined' - : JSON.stringify(value); -} - - -// DECODE - -function runOnString(decoder, string) -{ - var json; - try - { - json = JSON.parse(string); - } - catch (e) - { - return _elm_lang$core$Result$Err('Given an invalid JSON: ' + e.message); - } - return run(decoder, json); -} - -function run(decoder, value) -{ - var result = runHelp(decoder, value); - return (result.tag === 'ok') - ? _elm_lang$core$Result$Ok(result.value) - : _elm_lang$core$Result$Err(badToString(result)); -} - -function runHelp(decoder, value) -{ - switch (decoder.tag) - { - case 'bool': - return (typeof value === 'boolean') - ? ok(value) - : badPrimitive('a Bool', value); - - case 'int': - if (typeof value !== 'number') { - return badPrimitive('an Int', value); - } - - if (-2147483647 < value && value < 2147483647 && (value | 0) === value) { - return ok(value); - } - - if (isFinite(value) && !(value % 1)) { - return ok(value); - } - - return badPrimitive('an Int', value); - - case 'float': - return (typeof value === 'number') - ? ok(value) - : badPrimitive('a Float', value); - - case 'string': - return (typeof value === 'string') - ? ok(value) - : (value instanceof String) - ? ok(value + '') - : badPrimitive('a String', value); - - case 'null': - return (value === null) - ? ok(decoder.value) - : badPrimitive('null', value); - - case 'value': - return ok(value); - - case 'list': - if (!(value instanceof Array)) - { - return badPrimitive('a List', value); - } - - var list = _elm_lang$core$Native_List.Nil; - for (var i = value.length; i--; ) - { - var result = runHelp(decoder.decoder, value[i]); - if (result.tag !== 'ok') - { - return badIndex(i, result) - } - list = _elm_lang$core$Native_List.Cons(result.value, list); - } - return ok(list); - - case 'array': - if (!(value instanceof Array)) - { - return badPrimitive('an Array', value); - } - - var len = value.length; - var array = new Array(len); - for (var i = len; i--; ) - { - var result = runHelp(decoder.decoder, value[i]); - if (result.tag !== 'ok') - { - return badIndex(i, result); - } - array[i] = result.value; - } - return ok(_elm_lang$core$Native_Array.fromJSArray(array)); - - case 'maybe': - var result = runHelp(decoder.decoder, value); - return (result.tag === 'ok') - ? ok(_elm_lang$core$Maybe$Just(result.value)) - : ok(_elm_lang$core$Maybe$Nothing); - - case 'field': - var field = decoder.field; - if (typeof value !== 'object' || value === null || !(field in value)) - { - return badPrimitive('an object with a field named `' + field + '`', value); - } - - var result = runHelp(decoder.decoder, value[field]); - return (result.tag === 'ok') ? result : badField(field, result); - - case 'index': - var index = decoder.index; - if (!(value instanceof Array)) - { - return badPrimitive('an array', value); - } - if (index >= value.length) - { - return badPrimitive('a longer array. Need index ' + index + ' but there are only ' + value.length + ' entries', value); - } - - var result = runHelp(decoder.decoder, value[index]); - return (result.tag === 'ok') ? result : badIndex(index, result); - - case 'key-value': - if (typeof value !== 'object' || value === null || value instanceof Array) - { - return badPrimitive('an object', value); - } - - var keyValuePairs = _elm_lang$core$Native_List.Nil; - for (var key in value) - { - var result = runHelp(decoder.decoder, value[key]); - if (result.tag !== 'ok') - { - return badField(key, result); - } - var pair = _elm_lang$core$Native_Utils.Tuple2(key, result.value); - keyValuePairs = _elm_lang$core$Native_List.Cons(pair, keyValuePairs); - } - return ok(keyValuePairs); - - case 'map-many': - var answer = decoder.func; - var decoders = decoder.decoders; - for (var i = 0; i < decoders.length; i++) - { - var result = runHelp(decoders[i], value); - if (result.tag !== 'ok') - { - return result; - } - answer = answer(result.value); - } - return ok(answer); - - case 'andThen': - var result = runHelp(decoder.decoder, value); - return (result.tag !== 'ok') - ? result - : runHelp(decoder.callback(result.value), value); - - case 'oneOf': - var errors = []; - var temp = decoder.decoders; - while (temp.ctor !== '[]') - { - var result = runHelp(temp._0, value); - - if (result.tag === 'ok') - { - return result; - } - - errors.push(result); - - temp = temp._1; - } - return badOneOf(errors); - - case 'fail': - return bad(decoder.msg); - - case 'succeed': - return ok(decoder.msg); - } -} - - -// EQUALITY - -function equality(a, b) -{ - if (a === b) - { - return true; - } - - if (a.tag !== b.tag) - { - return false; - } - - switch (a.tag) - { - case 'succeed': - case 'fail': - return a.msg === b.msg; - - case 'bool': - case 'int': - case 'float': - case 'string': - case 'value': - return true; - - case 'null': - return a.value === b.value; - - case 'list': - case 'array': - case 'maybe': - case 'key-value': - return equality(a.decoder, b.decoder); - - case 'field': - return a.field === b.field && equality(a.decoder, b.decoder); - - case 'index': - return a.index === b.index && equality(a.decoder, b.decoder); - - case 'map-many': - if (a.func !== b.func) - { - return false; - } - return listEquality(a.decoders, b.decoders); - - case 'andThen': - return a.callback === b.callback && equality(a.decoder, b.decoder); - - case 'oneOf': - return listEquality(a.decoders, b.decoders); - } -} - -function listEquality(aDecoders, bDecoders) -{ - var len = aDecoders.length; - if (len !== bDecoders.length) - { - return false; - } - for (var i = 0; i < len; i++) - { - if (!equality(aDecoders[i], bDecoders[i])) - { - return false; - } - } - return true; -} - - -// ENCODE - -function encode(indentLevel, value) -{ - return JSON.stringify(value, null, indentLevel); -} - -function identity(value) -{ - return value; -} - -function encodeObject(keyValuePairs) -{ - var obj = {}; - while (keyValuePairs.ctor !== '[]') - { - var pair = keyValuePairs._0; - obj[pair._0] = pair._1; - keyValuePairs = keyValuePairs._1; - } - return obj; -} - -return { - encode: F2(encode), - runOnString: F2(runOnString), - run: F2(run), - - decodeNull: decodeNull, - decodePrimitive: decodePrimitive, - decodeContainer: F2(decodeContainer), - - decodeField: F2(decodeField), - decodeIndex: F2(decodeIndex), - - map1: F2(map1), - map2: F3(map2), - map3: F4(map3), - map4: F5(map4), - map5: F6(map5), - map6: F7(map6), - map7: F8(map7), - map8: F9(map8), - decodeKeyValuePairs: decodeKeyValuePairs, - - andThen: F2(andThen), - fail: fail, - succeed: succeed, - oneOf: oneOf, - - identity: identity, - encodeNull: null, - encodeArray: _elm_lang$core$Native_Array.toJSArray, - encodeList: _elm_lang$core$Native_List.toArray, - encodeObject: encodeObject, - - equality: equality -}; - -}(); - -var _elm_lang$core$Json_Encode$list = _elm_lang$core$Native_Json.encodeList; -var _elm_lang$core$Json_Encode$array = _elm_lang$core$Native_Json.encodeArray; -var _elm_lang$core$Json_Encode$object = _elm_lang$core$Native_Json.encodeObject; -var _elm_lang$core$Json_Encode$null = _elm_lang$core$Native_Json.encodeNull; -var _elm_lang$core$Json_Encode$bool = _elm_lang$core$Native_Json.identity; -var _elm_lang$core$Json_Encode$float = _elm_lang$core$Native_Json.identity; -var _elm_lang$core$Json_Encode$int = _elm_lang$core$Native_Json.identity; -var _elm_lang$core$Json_Encode$string = _elm_lang$core$Native_Json.identity; -var _elm_lang$core$Json_Encode$encode = _elm_lang$core$Native_Json.encode; -var _elm_lang$core$Json_Encode$Value = {ctor: 'Value'}; - -var _elm_lang$core$Json_Decode$null = _elm_lang$core$Native_Json.decodeNull; -var _elm_lang$core$Json_Decode$value = _elm_lang$core$Native_Json.decodePrimitive('value'); -var _elm_lang$core$Json_Decode$andThen = _elm_lang$core$Native_Json.andThen; -var _elm_lang$core$Json_Decode$fail = _elm_lang$core$Native_Json.fail; -var _elm_lang$core$Json_Decode$succeed = _elm_lang$core$Native_Json.succeed; -var _elm_lang$core$Json_Decode$lazy = function (thunk) { - return A2( - _elm_lang$core$Json_Decode$andThen, - thunk, - _elm_lang$core$Json_Decode$succeed( - {ctor: '_Tuple0'})); -}; -var _elm_lang$core$Json_Decode$decodeValue = _elm_lang$core$Native_Json.run; -var _elm_lang$core$Json_Decode$decodeString = _elm_lang$core$Native_Json.runOnString; -var _elm_lang$core$Json_Decode$map8 = _elm_lang$core$Native_Json.map8; -var _elm_lang$core$Json_Decode$map7 = _elm_lang$core$Native_Json.map7; -var _elm_lang$core$Json_Decode$map6 = _elm_lang$core$Native_Json.map6; -var _elm_lang$core$Json_Decode$map5 = _elm_lang$core$Native_Json.map5; -var _elm_lang$core$Json_Decode$map4 = _elm_lang$core$Native_Json.map4; -var _elm_lang$core$Json_Decode$map3 = _elm_lang$core$Native_Json.map3; -var _elm_lang$core$Json_Decode$map2 = _elm_lang$core$Native_Json.map2; -var _elm_lang$core$Json_Decode$map = _elm_lang$core$Native_Json.map1; -var _elm_lang$core$Json_Decode$oneOf = _elm_lang$core$Native_Json.oneOf; -var _elm_lang$core$Json_Decode$maybe = function (decoder) { - return A2(_elm_lang$core$Native_Json.decodeContainer, 'maybe', decoder); -}; -var _elm_lang$core$Json_Decode$index = _elm_lang$core$Native_Json.decodeIndex; -var _elm_lang$core$Json_Decode$field = _elm_lang$core$Native_Json.decodeField; -var _elm_lang$core$Json_Decode$at = F2( - function (fields, decoder) { - return A3(_elm_lang$core$List$foldr, _elm_lang$core$Json_Decode$field, decoder, fields); - }); -var _elm_lang$core$Json_Decode$keyValuePairs = _elm_lang$core$Native_Json.decodeKeyValuePairs; -var _elm_lang$core$Json_Decode$dict = function (decoder) { - return A2( - _elm_lang$core$Json_Decode$map, - _elm_lang$core$Dict$fromList, - _elm_lang$core$Json_Decode$keyValuePairs(decoder)); -}; -var _elm_lang$core$Json_Decode$array = function (decoder) { - return A2(_elm_lang$core$Native_Json.decodeContainer, 'array', decoder); -}; -var _elm_lang$core$Json_Decode$list = function (decoder) { - return A2(_elm_lang$core$Native_Json.decodeContainer, 'list', decoder); -}; -var _elm_lang$core$Json_Decode$nullable = function (decoder) { - return _elm_lang$core$Json_Decode$oneOf( - { - ctor: '::', - _0: _elm_lang$core$Json_Decode$null(_elm_lang$core$Maybe$Nothing), - _1: { - ctor: '::', - _0: A2(_elm_lang$core$Json_Decode$map, _elm_lang$core$Maybe$Just, decoder), - _1: {ctor: '[]'} - } - }); -}; -var _elm_lang$core$Json_Decode$float = _elm_lang$core$Native_Json.decodePrimitive('float'); -var _elm_lang$core$Json_Decode$int = _elm_lang$core$Native_Json.decodePrimitive('int'); -var _elm_lang$core$Json_Decode$bool = _elm_lang$core$Native_Json.decodePrimitive('bool'); -var _elm_lang$core$Json_Decode$string = _elm_lang$core$Native_Json.decodePrimitive('string'); -var _elm_lang$core$Json_Decode$Decoder = {ctor: 'Decoder'}; - -var _dillonkearns$elm_graphql$Graphql_Parser_TypeKind$Union = {ctor: 'Union'}; -var _dillonkearns$elm_graphql$Graphql_Parser_TypeKind$InputObject = {ctor: 'InputObject'}; -var _dillonkearns$elm_graphql$Graphql_Parser_TypeKind$Interface = {ctor: 'Interface'}; -var _dillonkearns$elm_graphql$Graphql_Parser_TypeKind$Enum = {ctor: 'Enum'}; -var _dillonkearns$elm_graphql$Graphql_Parser_TypeKind$Ignore = {ctor: 'Ignore'}; -var _dillonkearns$elm_graphql$Graphql_Parser_TypeKind$NonNull = {ctor: 'NonNull'}; -var _dillonkearns$elm_graphql$Graphql_Parser_TypeKind$List = {ctor: 'List'}; -var _dillonkearns$elm_graphql$Graphql_Parser_TypeKind$Object = {ctor: 'Object'}; -var _dillonkearns$elm_graphql$Graphql_Parser_TypeKind$Scalar = {ctor: 'Scalar'}; -var _dillonkearns$elm_graphql$Graphql_Parser_TypeKind$decoder = A2( - _elm_lang$core$Json_Decode$andThen, - function (string) { - var _p0 = string; - switch (_p0) { - case 'SCALAR': - return _elm_lang$core$Json_Decode$succeed(_dillonkearns$elm_graphql$Graphql_Parser_TypeKind$Scalar); - case 'OBJECT': - return _elm_lang$core$Json_Decode$succeed(_dillonkearns$elm_graphql$Graphql_Parser_TypeKind$Object); - case 'LIST': - return _elm_lang$core$Json_Decode$succeed(_dillonkearns$elm_graphql$Graphql_Parser_TypeKind$List); - case 'NON_NULL': - return _elm_lang$core$Json_Decode$succeed(_dillonkearns$elm_graphql$Graphql_Parser_TypeKind$NonNull); - case 'ENUM': - return _elm_lang$core$Json_Decode$succeed(_dillonkearns$elm_graphql$Graphql_Parser_TypeKind$Enum); - case 'INTERFACE': - return _elm_lang$core$Json_Decode$succeed(_dillonkearns$elm_graphql$Graphql_Parser_TypeKind$Interface); - case 'INPUT_OBJECT': - return _elm_lang$core$Json_Decode$succeed(_dillonkearns$elm_graphql$Graphql_Parser_TypeKind$InputObject); - case 'UNION': - return _elm_lang$core$Json_Decode$succeed(_dillonkearns$elm_graphql$Graphql_Parser_TypeKind$Union); - default: - return _elm_lang$core$Json_Decode$fail( - A2(_elm_lang$core$Basics_ops['++'], 'Invalid TypeKind', string)); - } - }, - _elm_lang$core$Json_Decode$string); - -var _dillonkearns$elm_graphql$Graphql_Parser_Type$expectString = function (maybeString) { - var _p0 = maybeString; - if (_p0.ctor === 'Just') { - return _p0._0; - } else { - return _elm_lang$core$Native_Utils.crashCase( - 'Graphql.Parser.Type', - { - start: {line: 265, column: 5}, - end: {line: 270, column: 58} - }, - _p0)('Expected string but got Nothing'); - } -}; -var _dillonkearns$elm_graphql$Graphql_Parser_Type$EnumValue = F2( - function (a, b) { - return {name: a, description: b}; - }); -var _dillonkearns$elm_graphql$Graphql_Parser_Type$enumValueDecoder = A3( - _elm_lang$core$Json_Decode$map2, - _dillonkearns$elm_graphql$Graphql_Parser_Type$EnumValue, - A2( - _elm_lang$core$Json_Decode$map, - _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$build, - A2(_elm_lang$core$Json_Decode$field, 'name', _elm_lang$core$Json_Decode$string)), - A2( - _elm_lang$core$Json_Decode$field, - 'description', - _elm_lang$core$Json_Decode$maybe(_elm_lang$core$Json_Decode$string))); -var _dillonkearns$elm_graphql$Graphql_Parser_Type$Arg = F3( - function (a, b, c) { - return {name: a, description: b, typeRef: c}; - }); -var _dillonkearns$elm_graphql$Graphql_Parser_Type$Field = F4( - function (a, b, c, d) { - return {name: a, description: b, typeRef: c, args: d}; - }); -var _dillonkearns$elm_graphql$Graphql_Parser_Type$RawField = F4( - function (a, b, c, d) { - return {name: a, description: b, ofType: c, args: d}; - }); -var _dillonkearns$elm_graphql$Graphql_Parser_Type$RawArg = F3( - function (a, b, c) { - return {name: a, description: b, ofType: c}; - }); -var _dillonkearns$elm_graphql$Graphql_Parser_Type$TypeDefinition = F3( - function (a, b, c) { - return {ctor: 'TypeDefinition', _0: a, _1: b, _2: c}; - }); -var _dillonkearns$elm_graphql$Graphql_Parser_Type$typeDefinition = F3( - function (name, definableType, description) { - return A3( - _dillonkearns$elm_graphql$Graphql_Parser_Type$TypeDefinition, - _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$build(name), - definableType, - description); - }); -var _dillonkearns$elm_graphql$Graphql_Parser_Type$InputObjectType = function (a) { - return {ctor: 'InputObjectType', _0: a}; -}; -var _dillonkearns$elm_graphql$Graphql_Parser_Type$createInputObject = F2( - function (inputObjectName, fields) { - return A3( - _dillonkearns$elm_graphql$Graphql_Parser_Type$typeDefinition, - inputObjectName, - _dillonkearns$elm_graphql$Graphql_Parser_Type$InputObjectType(fields), - _elm_lang$core$Maybe$Nothing); - }); -var _dillonkearns$elm_graphql$Graphql_Parser_Type$EnumType = function (a) { - return {ctor: 'EnumType', _0: a}; -}; -var _dillonkearns$elm_graphql$Graphql_Parser_Type$createEnum = F3( - function (enumName, description, enumValues) { - return A3( - _dillonkearns$elm_graphql$Graphql_Parser_Type$typeDefinition, - enumName, - _dillonkearns$elm_graphql$Graphql_Parser_Type$EnumType(enumValues), - description); - }); -var _dillonkearns$elm_graphql$Graphql_Parser_Type$enumDecoder = A4( - _elm_lang$core$Json_Decode$map3, - _dillonkearns$elm_graphql$Graphql_Parser_Type$createEnum, - A2(_elm_lang$core$Json_Decode$field, 'name', _elm_lang$core$Json_Decode$string), - _elm_lang$core$Json_Decode$maybe( - A2(_elm_lang$core$Json_Decode$field, 'description', _elm_lang$core$Json_Decode$string)), - A2( - _elm_lang$core$Json_Decode$field, - 'enumValues', - _elm_lang$core$Json_Decode$list(_dillonkearns$elm_graphql$Graphql_Parser_Type$enumValueDecoder))); -var _dillonkearns$elm_graphql$Graphql_Parser_Type$UnionType = function (a) { - return {ctor: 'UnionType', _0: a}; -}; -var _dillonkearns$elm_graphql$Graphql_Parser_Type$createUnion = F2( - function (interfaceName, possibleTypes) { - return A3( - _dillonkearns$elm_graphql$Graphql_Parser_Type$typeDefinition, - interfaceName, - _dillonkearns$elm_graphql$Graphql_Parser_Type$UnionType( - A2(_elm_lang$core$List$map, _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$build, possibleTypes)), - _elm_lang$core$Maybe$Nothing); - }); -var _dillonkearns$elm_graphql$Graphql_Parser_Type$unionDecoder = A3( - _elm_lang$core$Json_Decode$map2, - _dillonkearns$elm_graphql$Graphql_Parser_Type$createUnion, - A2(_elm_lang$core$Json_Decode$field, 'name', _elm_lang$core$Json_Decode$string), - A2( - _elm_lang$core$Json_Decode$field, - 'possibleTypes', - _elm_lang$core$Json_Decode$list( - A2(_elm_lang$core$Json_Decode$field, 'name', _elm_lang$core$Json_Decode$string)))); -var _dillonkearns$elm_graphql$Graphql_Parser_Type$InterfaceType = F2( - function (a, b) { - return {ctor: 'InterfaceType', _0: a, _1: b}; - }); -var _dillonkearns$elm_graphql$Graphql_Parser_Type$createInterface = F3( - function (interfaceName, fields, possibleTypes) { - return A3( - _dillonkearns$elm_graphql$Graphql_Parser_Type$typeDefinition, - interfaceName, - A2( - _dillonkearns$elm_graphql$Graphql_Parser_Type$InterfaceType, - fields, - A2(_elm_lang$core$List$map, _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$build, possibleTypes)), - _elm_lang$core$Maybe$Nothing); - }); -var _dillonkearns$elm_graphql$Graphql_Parser_Type$ObjectType = function (a) { - return {ctor: 'ObjectType', _0: a}; -}; -var _dillonkearns$elm_graphql$Graphql_Parser_Type$createObject = F2( - function (objectName, fields) { - return A3( - _dillonkearns$elm_graphql$Graphql_Parser_Type$typeDefinition, - objectName, - _dillonkearns$elm_graphql$Graphql_Parser_Type$ObjectType(fields), - _elm_lang$core$Maybe$Nothing); - }); -var _dillonkearns$elm_graphql$Graphql_Parser_Type$ScalarType = {ctor: 'ScalarType'}; -var _dillonkearns$elm_graphql$Graphql_Parser_Type$scalarDecoder = A2( - _elm_lang$core$Json_Decode$map, - function (scalarName) { - return A3(_dillonkearns$elm_graphql$Graphql_Parser_Type$typeDefinition, scalarName, _dillonkearns$elm_graphql$Graphql_Parser_Type$ScalarType, _elm_lang$core$Maybe$Nothing); - }, - A2(_elm_lang$core$Json_Decode$field, 'name', _elm_lang$core$Json_Decode$string)); -var _dillonkearns$elm_graphql$Graphql_Parser_Type$TypeReference = F2( - function (a, b) { - return {ctor: 'TypeReference', _0: a, _1: b}; - }); -var _dillonkearns$elm_graphql$Graphql_Parser_Type$InterfaceRef = function (a) { - return {ctor: 'InterfaceRef', _0: a}; -}; -var _dillonkearns$elm_graphql$Graphql_Parser_Type$UnionRef = function (a) { - return {ctor: 'UnionRef', _0: a}; -}; -var _dillonkearns$elm_graphql$Graphql_Parser_Type$InputObjectRef = function (a) { - return {ctor: 'InputObjectRef', _0: a}; -}; -var _dillonkearns$elm_graphql$Graphql_Parser_Type$ObjectRef = function (a) { - return {ctor: 'ObjectRef', _0: a}; -}; -var _dillonkearns$elm_graphql$Graphql_Parser_Type$EnumRef = function (a) { - return {ctor: 'EnumRef', _0: a}; -}; -var _dillonkearns$elm_graphql$Graphql_Parser_Type$List = function (a) { - return {ctor: 'List', _0: a}; -}; -var _dillonkearns$elm_graphql$Graphql_Parser_Type$Scalar = function (a) { - return {ctor: 'Scalar', _0: a}; -}; -var _dillonkearns$elm_graphql$Graphql_Parser_Type$NonNullable = {ctor: 'NonNullable'}; -var _dillonkearns$elm_graphql$Graphql_Parser_Type$Nullable = {ctor: 'Nullable'}; -var _dillonkearns$elm_graphql$Graphql_Parser_Type$ignoreRef = A2( - _dillonkearns$elm_graphql$Graphql_Parser_Type$TypeReference, - _dillonkearns$elm_graphql$Graphql_Parser_Type$Scalar(_dillonkearns$elm_graphql$Graphql_Parser_Scalar$String), - _dillonkearns$elm_graphql$Graphql_Parser_Type$Nullable); -var _dillonkearns$elm_graphql$Graphql_Parser_Type$parseRef = function (_p2) { - var _p3 = _p2; - var _p23 = _p3._0; - var _p4 = _p23.kind; - switch (_p4.ctor) { - case 'List': - var _p5 = _p23.ofType; - if (_p5.ctor === 'Just') { - return A2( - _dillonkearns$elm_graphql$Graphql_Parser_Type$TypeReference, - _dillonkearns$elm_graphql$Graphql_Parser_Type$List( - _dillonkearns$elm_graphql$Graphql_Parser_Type$parseRef(_p5._0)), - _dillonkearns$elm_graphql$Graphql_Parser_Type$Nullable); - } else { - return _elm_lang$core$Native_Utils.crashCase( - 'Graphql.Parser.Type', - { - start: {line: 277, column: 13}, - end: {line: 282, column: 73} - }, - _p5)('Missing nested type for List reference'); - } - case 'Scalar': - var _p7 = _p23.name; - if (_p7.ctor === 'Just') { - return A2( - _dillonkearns$elm_graphql$Graphql_Parser_Type$TypeReference, - _dillonkearns$elm_graphql$Graphql_Parser_Type$Scalar( - _dillonkearns$elm_graphql$Graphql_Parser_Scalar$parse(_p7._0)), - _dillonkearns$elm_graphql$Graphql_Parser_Type$Nullable); - } else { - return _elm_lang$core$Native_Utils.crashCase( - 'Graphql.Parser.Type', - { - start: {line: 285, column: 13}, - end: {line: 292, column: 82} - }, - _p7)('Should not get null names for scalar references'); - } - case 'Interface': - var _p9 = _p23.name; - if (_p9.ctor === 'Just') { - return A2( - _dillonkearns$elm_graphql$Graphql_Parser_Type$TypeReference, - _dillonkearns$elm_graphql$Graphql_Parser_Type$InterfaceRef(_p9._0), - _dillonkearns$elm_graphql$Graphql_Parser_Type$Nullable); - } else { - return _elm_lang$core$Native_Utils.crashCase( - 'Graphql.Parser.Type', - { - start: {line: 295, column: 13}, - end: {line: 300, column: 85} - }, - _p9)('Should not get null names for interface references'); - } - case 'Object': - var _p11 = _p23.name; - if (_p11.ctor === 'Just') { - return A2( - _dillonkearns$elm_graphql$Graphql_Parser_Type$TypeReference, - _dillonkearns$elm_graphql$Graphql_Parser_Type$ObjectRef(_p11._0), - _dillonkearns$elm_graphql$Graphql_Parser_Type$Nullable); - } else { - return _elm_lang$core$Native_Utils.crashCase( - 'Graphql.Parser.Type', - { - start: {line: 303, column: 13}, - end: {line: 308, column: 82} - }, - _p11)('Should not get null names for object references'); - } - case 'NonNull': - var _p13 = _p23.ofType; - if (_p13.ctor === 'Just') { - var _p18 = _p13._0._0; - var _p14 = {ctor: '_Tuple2', _0: _p18.kind, _1: _p18.name}; - switch (_p14._0.ctor) { - case 'Scalar': - return A2( - _dillonkearns$elm_graphql$Graphql_Parser_Type$TypeReference, - _dillonkearns$elm_graphql$Graphql_Parser_Type$Scalar( - _dillonkearns$elm_graphql$Graphql_Parser_Scalar$parse( - _dillonkearns$elm_graphql$Graphql_Parser_Type$expectString(_p14._1))), - _dillonkearns$elm_graphql$Graphql_Parser_Type$NonNullable); - case 'Object': - return A2( - _dillonkearns$elm_graphql$Graphql_Parser_Type$TypeReference, - _dillonkearns$elm_graphql$Graphql_Parser_Type$ObjectRef( - _dillonkearns$elm_graphql$Graphql_Parser_Type$expectString(_p14._1)), - _dillonkearns$elm_graphql$Graphql_Parser_Type$NonNullable); - case 'Interface': - return A2( - _dillonkearns$elm_graphql$Graphql_Parser_Type$TypeReference, - _dillonkearns$elm_graphql$Graphql_Parser_Type$InterfaceRef( - _dillonkearns$elm_graphql$Graphql_Parser_Type$expectString(_p14._1)), - _dillonkearns$elm_graphql$Graphql_Parser_Type$NonNullable); - case 'List': - var _p15 = _p18.ofType; - if (_p15.ctor === 'Just') { - return A2( - _dillonkearns$elm_graphql$Graphql_Parser_Type$TypeReference, - _dillonkearns$elm_graphql$Graphql_Parser_Type$List( - _dillonkearns$elm_graphql$Graphql_Parser_Type$parseRef(_p15._0)), - _dillonkearns$elm_graphql$Graphql_Parser_Type$NonNullable); - } else { - return _elm_lang$core$Native_Utils.crashCase( - 'Graphql.Parser.Type', - { - start: {line: 326, column: 29}, - end: {line: 331, column: 51} - }, - _p15)(''); - } - case 'NonNull': - return _elm_lang$core$Native_Utils.crashCase( - 'Graphql.Parser.Type', - { - start: {line: 313, column: 21}, - end: {line: 346, column: 102} - }, - _p14)('Can\'t have nested non-null types'); - case 'Ignore': - return _dillonkearns$elm_graphql$Graphql_Parser_Type$ignoreRef; - case 'Enum': - return A2( - _dillonkearns$elm_graphql$Graphql_Parser_Type$TypeReference, - _dillonkearns$elm_graphql$Graphql_Parser_Type$EnumRef( - _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$build( - _dillonkearns$elm_graphql$Graphql_Parser_Type$expectString(_p14._1))), - _dillonkearns$elm_graphql$Graphql_Parser_Type$NonNullable); - case 'InputObject': - return A2( - _dillonkearns$elm_graphql$Graphql_Parser_Type$TypeReference, - _dillonkearns$elm_graphql$Graphql_Parser_Type$InputObjectRef( - _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$build( - _dillonkearns$elm_graphql$Graphql_Parser_Type$expectString(_p14._1))), - _dillonkearns$elm_graphql$Graphql_Parser_Type$NonNullable); - default: - return A2( - _dillonkearns$elm_graphql$Graphql_Parser_Type$TypeReference, - _dillonkearns$elm_graphql$Graphql_Parser_Type$UnionRef( - _dillonkearns$elm_graphql$Graphql_Parser_Type$expectString(_p18.name)), - _dillonkearns$elm_graphql$Graphql_Parser_Type$NonNullable); - } - } else { - return _dillonkearns$elm_graphql$Graphql_Parser_Type$ignoreRef; - } - case 'Ignore': - return _dillonkearns$elm_graphql$Graphql_Parser_Type$ignoreRef; - case 'Enum': - var _p19 = _p23.name; - if (_p19.ctor === 'Just') { - return A2( - _dillonkearns$elm_graphql$Graphql_Parser_Type$TypeReference, - _dillonkearns$elm_graphql$Graphql_Parser_Type$EnumRef( - _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$build(_p19._0)), - _dillonkearns$elm_graphql$Graphql_Parser_Type$Nullable); - } else { - return _elm_lang$core$Native_Utils.crashCase( - 'Graphql.Parser.Type', - { - start: {line: 355, column: 13}, - end: {line: 360, column: 80} - }, - _p19)('Should not get null names for enum references'); - } - case 'InputObject': - var _p21 = _p23.name; - if (_p21.ctor === 'Just') { - return A2( - _dillonkearns$elm_graphql$Graphql_Parser_Type$TypeReference, - _dillonkearns$elm_graphql$Graphql_Parser_Type$InputObjectRef( - _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$build(_p21._0)), - _dillonkearns$elm_graphql$Graphql_Parser_Type$Nullable); - } else { - return _elm_lang$core$Native_Utils.crashCase( - 'Graphql.Parser.Type', - { - start: {line: 363, column: 13}, - end: {line: 368, column: 88} - }, - _p21)('Should not get null names for input object references'); - } - default: - return A2( - _dillonkearns$elm_graphql$Graphql_Parser_Type$TypeReference, - _dillonkearns$elm_graphql$Graphql_Parser_Type$UnionRef( - _dillonkearns$elm_graphql$Graphql_Parser_Type$expectString(_p23.name)), - _dillonkearns$elm_graphql$Graphql_Parser_Type$Nullable); - } -}; -var _dillonkearns$elm_graphql$Graphql_Parser_Type$parseField = function (_p24) { - var _p25 = _p24; - return { - name: _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$build(_p25.name), - description: _p25.description, - typeRef: _dillonkearns$elm_graphql$Graphql_Parser_Type$parseRef(_p25.ofType), - args: A2( - _elm_lang$core$List$map, - function (arg) { - return { - name: _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$build(arg.name), - description: arg.description, - typeRef: _dillonkearns$elm_graphql$Graphql_Parser_Type$parseRef(arg.ofType) - }; - }, - _p25.args) - }; -}; -var _dillonkearns$elm_graphql$Graphql_Parser_Type$RawTypeRef = function (a) { - return {ctor: 'RawTypeRef', _0: a}; -}; -var _dillonkearns$elm_graphql$Graphql_Parser_Type$createRawTypeRef = F3( - function (stringMaybe, typeKind, rawTypeRefMaybe) { - return _dillonkearns$elm_graphql$Graphql_Parser_Type$RawTypeRef( - {name: stringMaybe, kind: typeKind, ofType: rawTypeRefMaybe}); - }); -var _dillonkearns$elm_graphql$Graphql_Parser_Type$typeRefDecoder = A4( - _elm_lang$core$Json_Decode$map3, - _dillonkearns$elm_graphql$Graphql_Parser_Type$createRawTypeRef, - _elm_lang$core$Json_Decode$maybe( - A2(_elm_lang$core$Json_Decode$field, 'name', _elm_lang$core$Json_Decode$string)), - A2(_elm_lang$core$Json_Decode$field, 'kind', _dillonkearns$elm_graphql$Graphql_Parser_TypeKind$decoder), - _elm_lang$core$Json_Decode$maybe( - A2( - _elm_lang$core$Json_Decode$field, - 'ofType', - _elm_lang$core$Json_Decode$lazy( - function (_p26) { - return _dillonkearns$elm_graphql$Graphql_Parser_Type$typeRefDecoder; - })))); -var _dillonkearns$elm_graphql$Graphql_Parser_Type$inputField = A5( - _elm_lang$core$Json_Decode$map4, - _dillonkearns$elm_graphql$Graphql_Parser_Type$RawField, - A2(_elm_lang$core$Json_Decode$field, 'name', _elm_lang$core$Json_Decode$string), - A2( - _elm_lang$core$Json_Decode$field, - 'description', - _elm_lang$core$Json_Decode$maybe(_elm_lang$core$Json_Decode$string)), - A2(_elm_lang$core$Json_Decode$field, 'type', _dillonkearns$elm_graphql$Graphql_Parser_Type$typeRefDecoder), - _elm_lang$core$Json_Decode$succeed( - {ctor: '[]'})); -var _dillonkearns$elm_graphql$Graphql_Parser_Type$inputObjectDecoder = A3( - _elm_lang$core$Json_Decode$map2, - _dillonkearns$elm_graphql$Graphql_Parser_Type$createInputObject, - A2(_elm_lang$core$Json_Decode$field, 'name', _elm_lang$core$Json_Decode$string), - A2( - _elm_lang$core$Json_Decode$field, - 'inputFields', - _elm_lang$core$Json_Decode$list( - A2(_elm_lang$core$Json_Decode$map, _dillonkearns$elm_graphql$Graphql_Parser_Type$parseField, _dillonkearns$elm_graphql$Graphql_Parser_Type$inputField)))); -var _dillonkearns$elm_graphql$Graphql_Parser_Type$argDecoder = A4( - _elm_lang$core$Json_Decode$map3, - _dillonkearns$elm_graphql$Graphql_Parser_Type$RawArg, - A2(_elm_lang$core$Json_Decode$field, 'name', _elm_lang$core$Json_Decode$string), - A2( - _elm_lang$core$Json_Decode$field, - 'description', - _elm_lang$core$Json_Decode$maybe(_elm_lang$core$Json_Decode$string)), - A2(_elm_lang$core$Json_Decode$field, 'type', _dillonkearns$elm_graphql$Graphql_Parser_Type$typeRefDecoder)); -var _dillonkearns$elm_graphql$Graphql_Parser_Type$fieldDecoder = A5( - _elm_lang$core$Json_Decode$map4, - _dillonkearns$elm_graphql$Graphql_Parser_Type$RawField, - A2(_elm_lang$core$Json_Decode$field, 'name', _elm_lang$core$Json_Decode$string), - A2( - _elm_lang$core$Json_Decode$field, - 'description', - _elm_lang$core$Json_Decode$maybe(_elm_lang$core$Json_Decode$string)), - A2(_elm_lang$core$Json_Decode$field, 'type', _dillonkearns$elm_graphql$Graphql_Parser_Type$typeRefDecoder), - A2( - _elm_lang$core$Json_Decode$field, - 'args', - _elm_lang$core$Json_Decode$list(_dillonkearns$elm_graphql$Graphql_Parser_Type$argDecoder))); -var _dillonkearns$elm_graphql$Graphql_Parser_Type$interfaceDecoder = A4( - _elm_lang$core$Json_Decode$map3, - _dillonkearns$elm_graphql$Graphql_Parser_Type$createInterface, - A2(_elm_lang$core$Json_Decode$field, 'name', _elm_lang$core$Json_Decode$string), - A2( - _elm_lang$core$Json_Decode$field, - 'fields', - _elm_lang$core$Json_Decode$list( - A2(_elm_lang$core$Json_Decode$map, _dillonkearns$elm_graphql$Graphql_Parser_Type$parseField, _dillonkearns$elm_graphql$Graphql_Parser_Type$fieldDecoder))), - A2( - _elm_lang$core$Json_Decode$field, - 'possibleTypes', - _elm_lang$core$Json_Decode$list( - A2(_elm_lang$core$Json_Decode$field, 'name', _elm_lang$core$Json_Decode$string)))); -var _dillonkearns$elm_graphql$Graphql_Parser_Type$objectDecoder = A3( - _elm_lang$core$Json_Decode$map2, - _dillonkearns$elm_graphql$Graphql_Parser_Type$createObject, - A2(_elm_lang$core$Json_Decode$field, 'name', _elm_lang$core$Json_Decode$string), - A2( - _elm_lang$core$Json_Decode$field, - 'fields', - _elm_lang$core$Json_Decode$list( - A2(_elm_lang$core$Json_Decode$map, _dillonkearns$elm_graphql$Graphql_Parser_Type$parseField, _dillonkearns$elm_graphql$Graphql_Parser_Type$fieldDecoder)))); -var _dillonkearns$elm_graphql$Graphql_Parser_Type$decodeKind = function (kind) { - var _p27 = kind; - switch (_p27) { - case 'OBJECT': - return _dillonkearns$elm_graphql$Graphql_Parser_Type$objectDecoder; - case 'ENUM': - return _dillonkearns$elm_graphql$Graphql_Parser_Type$enumDecoder; - case 'SCALAR': - return _dillonkearns$elm_graphql$Graphql_Parser_Type$scalarDecoder; - case 'INTERFACE': - return _dillonkearns$elm_graphql$Graphql_Parser_Type$interfaceDecoder; - case 'UNION': - return _dillonkearns$elm_graphql$Graphql_Parser_Type$unionDecoder; - case 'INPUT_OBJECT': - return _dillonkearns$elm_graphql$Graphql_Parser_Type$inputObjectDecoder; - default: - return _elm_lang$core$Json_Decode$fail( - A2(_elm_lang$core$Basics_ops['++'], 'Unexpected kind ', kind)); - } -}; -var _dillonkearns$elm_graphql$Graphql_Parser_Type$decoder = A2( - _elm_lang$core$Json_Decode$andThen, - _dillonkearns$elm_graphql$Graphql_Parser_Type$decodeKind, - A2(_elm_lang$core$Json_Decode$field, 'kind', _elm_lang$core$Json_Decode$string)); - -var _dillonkearns$elm_graphql$Graphql_Generator_ModuleName$subscription = function (_p0) { - var _p1 = _p0; - return A2( - _elm_lang$core$Basics_ops['++'], - _p1.apiSubmodule, - { - ctor: '::', - _0: 'Subscription', - _1: {ctor: '[]'} - }); -}; -var _dillonkearns$elm_graphql$Graphql_Generator_ModuleName$mutation = function (_p2) { - var _p3 = _p2; - return A2( - _elm_lang$core$Basics_ops['++'], - _p3.apiSubmodule, - { - ctor: '::', - _0: 'Mutation', - _1: {ctor: '[]'} - }); -}; -var _dillonkearns$elm_graphql$Graphql_Generator_ModuleName$query = function (_p4) { - var _p5 = _p4; - return A2( - _elm_lang$core$Basics_ops['++'], - _p5.apiSubmodule, - { - ctor: '::', - _0: 'Query', - _1: {ctor: '[]'} - }); -}; -var _dillonkearns$elm_graphql$Graphql_Generator_ModuleName$enumTypeName = F2( - function (_p6, name) { - var _p7 = _p6; - return A2( - _elm_lang$core$Basics_ops['++'], - _p7.apiSubmodule, - { - ctor: '::', - _0: 'Enum', - _1: { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(name), - _1: { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(name), - _1: {ctor: '[]'} - } - } - }); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_ModuleName$enum = F2( - function (_p8, name) { - var _p9 = _p8; - return A2( - _elm_lang$core$Basics_ops['++'], - _p9.apiSubmodule, - { - ctor: '::', - _0: 'Enum', - _1: { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(name), - _1: {ctor: '[]'} - } - }); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_ModuleName$union = F2( - function (_p10, name) { - var _p11 = _p10; - return A2( - _elm_lang$core$Basics_ops['++'], - _p11.apiSubmodule, - { - ctor: '::', - _0: 'Union', - _1: { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(name), - _1: {ctor: '[]'} - } - }); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_ModuleName$interface = F2( - function (_p12, name) { - var _p13 = _p12; - return A2( - _elm_lang$core$Basics_ops['++'], - _p13.apiSubmodule, - { - ctor: '::', - _0: 'Interface', - _1: { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(name), - _1: {ctor: '[]'} - } - }); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_ModuleName$inputObject = F2( - function (_p14, name) { - var _p15 = _p14; - return A2( - _elm_lang$core$Basics_ops['++'], - _p15.apiSubmodule, - { - ctor: '::', - _0: 'InputObject', - _1: {ctor: '[]'} - }); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_ModuleName$object = F2( - function (_p16, name) { - var _p17 = _p16; - return _elm_lang$core$Native_Utils.eq(name, _p17.query) ? { - ctor: '::', - _0: 'RootQuery', - _1: {ctor: '[]'} - } : (_elm_lang$core$Native_Utils.eq( - _elm_lang$core$Maybe$Just(name), - _p17.mutation) ? { - ctor: '::', - _0: 'RootMutation', - _1: {ctor: '[]'} - } : (_elm_lang$core$Native_Utils.eq( - _elm_lang$core$Maybe$Just(name), - _p17.subscription) ? { - ctor: '::', - _0: 'RootSubscription', - _1: {ctor: '[]'} - } : A2( - _elm_lang$core$Basics_ops['++'], - _p17.apiSubmodule, - { - ctor: '::', - _0: 'Object', - _1: { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(name), - _1: {ctor: '[]'} - } - }))); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_ModuleName$generate = F2( - function (context, _p18) { - var _p19 = _p18; - var _p21 = _p19._0; - var _p20 = _p19._1; - switch (_p20.ctor) { - case 'ObjectType': - return _elm_lang$core$Native_Utils.eq(_p21, context.query) ? _dillonkearns$elm_graphql$Graphql_Generator_ModuleName$query(context) : (_elm_lang$core$Native_Utils.eq( - _elm_lang$core$Maybe$Just(_p21), - context.mutation) ? _dillonkearns$elm_graphql$Graphql_Generator_ModuleName$mutation(context) : (_elm_lang$core$Native_Utils.eq( - _elm_lang$core$Maybe$Just(_p21), - context.subscription) ? _dillonkearns$elm_graphql$Graphql_Generator_ModuleName$subscription(context) : A2(_dillonkearns$elm_graphql$Graphql_Generator_ModuleName$object, context, _p21))); - case 'ScalarType': - return {ctor: '[]'}; - case 'EnumType': - return A2(_dillonkearns$elm_graphql$Graphql_Generator_ModuleName$enum, context, _p21); - case 'InterfaceType': - return A2(_dillonkearns$elm_graphql$Graphql_Generator_ModuleName$interface, context, _p21); - case 'UnionType': - return A2(_dillonkearns$elm_graphql$Graphql_Generator_ModuleName$union, context, _p21); - default: - return A2(_dillonkearns$elm_graphql$Graphql_Generator_ModuleName$inputObject, context, _p21); - } - }); - -var _dillonkearns$elm_graphql$Graphql_Generator_Decoder$generateType_ = F3( - function (fromInputObject, apiSubmodule, typeRef) { - return A4(_dillonkearns$elm_graphql$Graphql_Generator_Decoder$generateTypeCommon, fromInputObject, 'Maybe', apiSubmodule, typeRef); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Decoder$generateTypeCommon = F4( - function (fromInputObject, nullableString, apiSubmodule, _p0) { - var _p1 = _p0; - return function (typeString) { - var _p2 = _p1._1; - if (_p2.ctor === 'Nullable') { - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '({0} {1})', - { - ctor: '::', - _0: nullableString, - _1: { - ctor: '::', - _0: typeString, - _1: {ctor: '[]'} - } - }); - } else { - return typeString; - } - }( - function () { - var _p3 = _p1._0; - switch (_p3.ctor) { - case 'Scalar': - var _p4 = _p3._0; - switch (_p4.ctor) { - case 'String': - return 'String'; - case 'Boolean': - return 'Bool'; - case 'Int': - return 'Int'; - case 'Float': - return 'Float'; - default: - var constructor = A2( - _elm_lang$core$String$join, - '.', - A2( - _elm_lang$core$Basics_ops['++'], - apiSubmodule, - A2( - _elm_lang$core$Basics_ops['++'], - { - ctor: '::', - _0: 'Scalar', - _1: {ctor: '[]'} - }, - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(_p4._0), - _1: {ctor: '[]'} - }))); - return constructor; - } - case 'List': - return A2( - _elm_lang$core$Basics_ops['++'], - '(List ', - A2( - _elm_lang$core$Basics_ops['++'], - A3(_dillonkearns$elm_graphql$Graphql_Generator_Decoder$generateType_, fromInputObject, apiSubmodule, _p3._0), - ')')); - case 'ObjectRef': - return 'decodesTo'; - case 'InterfaceRef': - return 'decodesTo'; - case 'UnionRef': - return 'decodesTo'; - case 'EnumRef': - return A2( - _elm_lang$core$String$join, - '.', - A2( - _dillonkearns$elm_graphql$Graphql_Generator_ModuleName$enumTypeName, - {apiSubmodule: apiSubmodule}, - _p3._0)); - default: - var _p5 = _p3._0; - return A2( - _elm_lang$core$String$join, - '.', - fromInputObject ? { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(_p5), - _1: {ctor: '[]'} - } : A2( - _elm_lang$core$Basics_ops['++'], - A2( - _dillonkearns$elm_graphql$Graphql_Generator_ModuleName$inputObject, - {apiSubmodule: apiSubmodule}, - _p5), - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(_p5), - _1: {ctor: '[]'} - })); - } - }()); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Decoder$generateTypeForInputObject = F2( - function (apiSubmodule, typeRef) { - return A4(_dillonkearns$elm_graphql$Graphql_Generator_Decoder$generateTypeCommon, true, 'OptionalArgument', apiSubmodule, typeRef); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Decoder$generateType = F2( - function (apiSubmodule, typeRef) { - return A4(_dillonkearns$elm_graphql$Graphql_Generator_Decoder$generateTypeCommon, false, 'Maybe', apiSubmodule, typeRef); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Decoder$generateEncoder_ = F3( - function (forInputObject, apiSubmodule, _p6) { - var _p7 = _p6; - var isNullableString = function () { - var _p8 = _p7._1; - if (_p8.ctor === 'Nullable') { - return ' |> Encode.maybe'; - } else { - return ''; - } - }(); - var _p9 = _p7._0; - switch (_p9.ctor) { - case 'Scalar': - var _p10 = _p9._0; - switch (_p10.ctor) { - case 'String': - return A2(_elm_lang$core$Basics_ops['++'], 'Encode.string', isNullableString); - case 'Boolean': - return A2(_elm_lang$core$Basics_ops['++'], 'Encode.bool', isNullableString); - case 'Int': - return A2(_elm_lang$core$Basics_ops['++'], 'Encode.int', isNullableString); - case 'Float': - return A2(_elm_lang$core$Basics_ops['++'], 'Encode.float', isNullableString); - default: - var constructor = A2( - _elm_lang$core$String$join, - '.', - A2( - _elm_lang$core$Basics_ops['++'], - apiSubmodule, - A2( - _elm_lang$core$Basics_ops['++'], - { - ctor: '::', - _0: 'Scalar', - _1: {ctor: '[]'} - }, - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(_p10._0), - _1: {ctor: '[]'} - }))); - return A2( - _elm_lang$core$Basics_ops['++'], - A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '(\\({0} raw) -> Encode.string raw)', - { - ctor: '::', - _0: constructor, - _1: {ctor: '[]'} - }), - isNullableString); - } - case 'List': - return A2( - _elm_lang$core$Basics_ops['++'], - A3(_dillonkearns$elm_graphql$Graphql_Generator_Decoder$generateEncoder_, forInputObject, apiSubmodule, _p9._0), - A2(_elm_lang$core$Basics_ops['++'], isNullableString, ' |> Encode.list')); - case 'ObjectRef': - return _elm_lang$core$Native_Utils.crashCase( - 'Graphql.Generator.Decoder', - { - start: {line: 91, column: 5}, - end: {line: 144, column: 36} - }, - _p9)('I don\'t expect to see object references as argument types.'); - case 'InterfaceRef': - return _elm_lang$core$Native_Utils.crashCase( - 'Graphql.Generator.Decoder', - { - start: {line: 91, column: 5}, - end: {line: 144, column: 36} - }, - _p9)('Interfaces are never valid inputs http://facebook.github.io/graphql/October2016/#sec-Interfaces'); - case 'UnionRef': - return _elm_lang$core$Native_Utils.crashCase( - 'Graphql.Generator.Decoder', - { - start: {line: 91, column: 5}, - end: {line: 144, column: 36} - }, - _p9)('Unions are never valid inputs http://facebook.github.io/graphql/October2016/#sec-Unions'); - case 'EnumRef': - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - A2(_elm_lang$core$Basics_ops['++'], '(Encode.enum {0})', isNullableString), - { - ctor: '::', - _0: A2( - _elm_lang$core$String$join, - '.', - A2( - _elm_lang$core$Basics_ops['++'], - A2( - _dillonkearns$elm_graphql$Graphql_Generator_ModuleName$enum, - {apiSubmodule: apiSubmodule}, - _p9._0), - { - ctor: '::', - _0: 'toString', - _1: {ctor: '[]'} - })), - _1: {ctor: '[]'} - }); - default: - var _p14 = _p9._0; - return A2( - _elm_lang$core$Basics_ops['++'], - A2( - _elm_lang$core$String$join, - '.', - forInputObject ? { - ctor: '::', - _0: A2( - _elm_lang$core$Basics_ops['++'], - 'encode', - _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(_p14)), - _1: {ctor: '[]'} - } : A2( - _elm_lang$core$Basics_ops['++'], - A2( - _dillonkearns$elm_graphql$Graphql_Generator_ModuleName$inputObject, - {apiSubmodule: apiSubmodule}, - _p14), - { - ctor: '::', - _0: A2( - _elm_lang$core$Basics_ops['++'], - 'encode', - _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(_p14)), - _1: {ctor: '[]'} - })), - isNullableString); - } - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Decoder$generateEncoder = _dillonkearns$elm_graphql$Graphql_Generator_Decoder$generateEncoder_(false); -var _dillonkearns$elm_graphql$Graphql_Generator_Decoder$generateEncoderLowLevel = F2( - function (apiSubmodule, referrableType) { - return A3( - _dillonkearns$elm_graphql$Graphql_Generator_Decoder$generateEncoder_, - true, - apiSubmodule, - A2(_dillonkearns$elm_graphql$Graphql_Parser_Type$TypeReference, referrableType, _dillonkearns$elm_graphql$Graphql_Parser_Type$NonNullable)); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Decoder$generateDecoder = F2( - function (apiSubmodule, _p15) { - var _p16 = _p15; - return A2( - _elm_lang$core$Basics_ops['++'], - function () { - var _p17 = _p16._0; - switch (_p17.ctor) { - case 'Scalar': - var _p18 = _p17._0; - switch (_p18.ctor) { - case 'String': - return { - ctor: '::', - _0: 'Decode.string', - _1: {ctor: '[]'} - }; - case 'Boolean': - return { - ctor: '::', - _0: 'Decode.bool', - _1: {ctor: '[]'} - }; - case 'Int': - return { - ctor: '::', - _0: 'Decode.int', - _1: {ctor: '[]'} - }; - case 'Float': - return { - ctor: '::', - _0: 'Decode.float', - _1: {ctor: '[]'} - }; - default: - var constructor = A2( - _elm_lang$core$String$join, - '.', - A2( - _elm_lang$core$Basics_ops['++'], - apiSubmodule, - A2( - _elm_lang$core$Basics_ops['++'], - { - ctor: '::', - _0: 'Scalar', - _1: {ctor: '[]'} - }, - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(_p18._0), - _1: {ctor: '[]'} - }))); - return { - ctor: '::', - _0: 'Decode.oneOf [ Decode.string, Decode.float |> Decode.map toString, Decode.int |> Decode.map toString, Decode.bool |> Decode.map toString ]', - _1: { - ctor: '::', - _0: A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - 'Decode.map {0}', - { - ctor: '::', - _0: constructor, - _1: {ctor: '[]'} - }), - _1: {ctor: '[]'} - } - }; - } - case 'List': - return A2( - _elm_lang$core$Basics_ops['++'], - A2(_dillonkearns$elm_graphql$Graphql_Generator_Decoder$generateDecoder, apiSubmodule, _p17._0), - { - ctor: '::', - _0: 'Decode.list', - _1: {ctor: '[]'} - }); - case 'ObjectRef': - return { - ctor: '::', - _0: 'identity', - _1: {ctor: '[]'} - }; - case 'InterfaceRef': - return { - ctor: '::', - _0: 'identity', - _1: {ctor: '[]'} - }; - case 'UnionRef': - return { - ctor: '::', - _0: 'identity', - _1: {ctor: '[]'} - }; - case 'EnumRef': - return { - ctor: '::', - _0: A2( - _elm_lang$core$String$join, - '.', - A2( - _elm_lang$core$Basics_ops['++'], - A2( - _dillonkearns$elm_graphql$Graphql_Generator_ModuleName$enum, - {apiSubmodule: apiSubmodule}, - _p17._0), - { - ctor: '::', - _0: 'decoder', - _1: {ctor: '[]'} - })), - _1: {ctor: '[]'} - }; - default: - return _elm_lang$core$Native_Utils.crashCase( - 'Graphql.Generator.Decoder', - { - start: {line: 12, column: 6}, - end: {line: 59, column: 98} - }, - _p17)('Input objects are only for input not responses, shouldn\'t need decoder.'); - } - }(), - function () { - var _p20 = _p16._1; - if (_p20.ctor === 'Nullable') { - return { - ctor: '::', - _0: 'Decode.nullable', - _1: {ctor: '[]'} - }; - } else { - return {ctor: '[]'}; - } - }()); - }); - -var _dillonkearns$elm_graphql$Graphql_Generator_DocComment$argDoc = function (_p0) { - var _p1 = _p0; - return A2( - _elm_lang$core$Maybe$map, - function (aDescription) { - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - ' - {0} - {1}', - { - ctor: '::', - _0: _p1.name, - _1: { - ctor: '::', - _0: aDescription, - _1: {ctor: '[]'} - } - }); - }, - _p1.description); -}; -var _dillonkearns$elm_graphql$Graphql_Generator_DocComment$argsDoc = function (args) { - var _p2 = A2(_elm_lang$core$List$filterMap, _dillonkearns$elm_graphql$Graphql_Generator_DocComment$argDoc, args); - if (_p2.ctor === '[]') { - return ''; - } else { - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '\n\n{0}\n', - { - ctor: '::', - _0: A2(_elm_lang$core$String$join, '\n', _p2), - _1: {ctor: '[]'} - }); - } -}; -var _dillonkearns$elm_graphql$Graphql_Generator_DocComment$hasDocs = F2( - function (mainDescription, itemDescriptions) { - var _p3 = mainDescription; - if (_p3.ctor === 'Just') { - return true; - } else { - return !_elm_lang$core$List$isEmpty( - A2( - _elm_lang$core$List$filterMap, - function (_) { - return _.description; - }, - itemDescriptions)); - } - }); -var _dillonkearns$elm_graphql$Graphql_Generator_DocComment$generate_ = F2( - function (mainDescription, itemDescriptions) { - return A2(_dillonkearns$elm_graphql$Graphql_Generator_DocComment$hasDocs, mainDescription, itemDescriptions) ? A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '{-|{0}{1}\n-}\n', - { - ctor: '::', - _0: A2( - _elm_lang$core$Maybe$withDefault, - '', - A2( - _elm_lang$core$Maybe$map, - function (description) { - return A2(_elm_lang$core$Basics_ops['++'], ' ', description); - }, - mainDescription)), - _1: { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Generator_DocComment$argsDoc(itemDescriptions), - _1: {ctor: '[]'} - } - }) : ''; - }); -var _dillonkearns$elm_graphql$Graphql_Generator_DocComment$generate = function (_p4) { - var _p5 = _p4; - return A2( - _dillonkearns$elm_graphql$Graphql_Generator_DocComment$generate_, - _p5.description, - A2( - _elm_lang$core$List$map, - function (arg) { - return _elm_lang$core$Native_Utils.update( - arg, - { - name: _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$normalized(arg.name) - }); - }, - _p5.args)); -}; -var _dillonkearns$elm_graphql$Graphql_Generator_DocComment$generateForEnum = F2( - function (description, enumValues) { - return A2( - _dillonkearns$elm_graphql$Graphql_Generator_DocComment$generate_, - description, - A2( - _elm_lang$core$List$map, - function (enumValue) { - return _elm_lang$core$Native_Utils.update( - enumValue, - { - name: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(enumValue.name) - }); - }, - enumValues)); - }); - -var _dillonkearns$elm_graphql$Graphql_Generator_Enum$enumDecoder = F2( - function (enumName, enumValues) { - return A2( - _elm_lang$core$Basics_ops['++'], - A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - 'decoder : Decoder {0}\ndecoder =\n Decode.string\n |> Decode.andThen\n (\\string ->\n case string of\n', - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(enumName), - _1: {ctor: '[]'} - }), - A2( - _elm_lang$core$Basics_ops['++'], - A2( - _elm_lang$core$String$join, - '\n\n', - A2( - _elm_lang$core$List$map, - function (enumValue) { - return A2( - _elm_lang$core$Basics_ops['++'], - ' \"', - A2( - _elm_lang$core$Basics_ops['++'], - _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$raw(enumValue), - A2( - _elm_lang$core$Basics_ops['++'], - '\" ->\n Decode.succeed ', - _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(enumValue)))); - }, - A2( - _elm_lang$core$List$map, - function (_) { - return _.name; - }, - enumValues))), - A2( - _elm_lang$core$Basics_ops['++'], - '\n\n _ ->\n Decode.fail (\"Invalid ', - A2( - _elm_lang$core$Basics_ops['++'], - _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(enumName), - ' type, \" ++ string ++ \" try re-running the @dillonkearns/elm-graphql CLI \")\n )\n ')))); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Enum$toStringCase = function (enumValue) { - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - ' {0} ->\n \"{1}\"\n', - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(enumValue.name), - _1: { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$raw(enumValue.name), - _1: {ctor: '[]'} - } - }); -}; -var _dillonkearns$elm_graphql$Graphql_Generator_Enum$enumToString = F2( - function (enumName, enumValues) { - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '{-| Convert from the union type representating the Enum to a string that the GraphQL server will recognize.\n-}\ntoString : {0} -> String\ntoString enum =\n case enum of\n{1}', - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(enumName), - _1: { - ctor: '::', - _0: A2( - _elm_lang$core$String$join, - '\n\n', - A2(_elm_lang$core$List$map, _dillonkearns$elm_graphql$Graphql_Generator_Enum$toStringCase, enumValues)), - _1: {ctor: '[]'} - } - }); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Enum$enumType = F2( - function (enumName, enumValues) { - return A2( - _elm_lang$core$Basics_ops['++'], - 'type ', - A2( - _elm_lang$core$Basics_ops['++'], - _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(enumName), - A2( - _elm_lang$core$Basics_ops['++'], - '\n = ', - A2( - _elm_lang$core$Basics_ops['++'], - A2( - _elm_lang$core$String$join, - '\n | ', - A2( - _elm_lang$core$List$map, - _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized, - A2( - _elm_lang$core$List$map, - function (_) { - return _.name; - }, - enumValues))), - '\n')))); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Enum$prepend = F4( - function (moduleName, enumName, enumValues, docComment) { - return A2( - _elm_lang$core$Basics_ops['++'], - A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - 'module {0} exposing (..)\n\nimport Json.Decode as Decode exposing (Decoder)\n\n\n', - { - ctor: '::', - _0: A2(_elm_lang$core$String$join, '.', moduleName), - _1: {ctor: '[]'} - }), - A2( - _elm_lang$core$Basics_ops['++'], - docComment, - A2( - _elm_lang$core$Basics_ops['++'], - A2(_dillonkearns$elm_graphql$Graphql_Generator_Enum$enumType, enumName, enumValues), - A2( - _elm_lang$core$Basics_ops['++'], - A2(_dillonkearns$elm_graphql$Graphql_Generator_Enum$enumDecoder, enumName, enumValues), - A2( - _elm_lang$core$Basics_ops['++'], - '\n\n', - A2(_dillonkearns$elm_graphql$Graphql_Generator_Enum$enumToString, enumName, enumValues)))))); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Enum$enumDocs = F2( - function (enumDescription, enumValues) { - return A2(_dillonkearns$elm_graphql$Graphql_Generator_DocComment$generateForEnum, enumDescription, enumValues); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Enum$generate = F4( - function (enumName, moduleName, enumValues, description) { - return A4( - _dillonkearns$elm_graphql$Graphql_Generator_Enum$prepend, - moduleName, - enumName, - enumValues, - A2(_dillonkearns$elm_graphql$Graphql_Generator_Enum$enumDocs, description, enumValues)); - }); - -var _dillonkearns$elm_graphql$Graphql_Generator_Let$generate = function (letBindings) { - var toLetString = function (_p0) { - var _p1 = _p0; - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - ' {0} =\n {1}', - { - ctor: '::', - _0: _p1._0, - _1: { - ctor: '::', - _0: _p1._1, - _1: {ctor: '[]'} - } - }); - }; - var letString = A2( - _elm_lang$core$String$join, - '\n\n', - A2(_elm_lang$core$List$map, toLetString, letBindings)); - return _elm_lang$core$Native_Utils.eq( - letBindings, - {ctor: '[]'}) ? '' : A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '\n let\n{0}\n in', - { - ctor: '::', - _0: letString, - _1: {ctor: '[]'} - }); -}; - -var _dillonkearns$elm_graphql$Graphql_Generator_OptionalArgs$optionalArgOrNothing = function (_p0) { - var _p1 = _p0; - var _p2 = _p1.typeRef; - if (_p2._1.ctor === 'NonNullable') { - return _elm_lang$core$Maybe$Nothing; - } else { - return _elm_lang$core$Maybe$Just( - {name: _p1.name, typeOf: _p2._0}); - } -}; -var _dillonkearns$elm_graphql$Graphql_Generator_OptionalArgs$typeAlias = F2( - function (apiSubmodule, optionalArgs) { - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '{ {0} }', - _elm_lang$core$List$singleton( - A2( - _elm_lang$core$String$join, - ', ', - A2( - _elm_lang$core$List$map, - function (_p3) { - var _p4 = _p3; - return A2( - _elm_lang$core$Basics_ops['++'], - _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$normalized(_p4.name), - A2( - _elm_lang$core$Basics_ops['++'], - ' : OptionalArgument ', - A2( - _dillonkearns$elm_graphql$Graphql_Generator_Decoder$generateType, - apiSubmodule, - A2(_dillonkearns$elm_graphql$Graphql_Parser_Type$TypeReference, _p4.typeOf, _dillonkearns$elm_graphql$Graphql_Parser_Type$NonNullable)))); - }, - optionalArgs)))); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_OptionalArgs$annotation = function (fieldName) { - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '({0}OptionalArguments -> {0}OptionalArguments)', - { - ctor: '::', - _0: fieldName, - _1: {ctor: '[]'} - }); -}; -var _dillonkearns$elm_graphql$Graphql_Generator_OptionalArgs$emptyRecord = function (optionalArgs) { - var recordEntries = A2( - _elm_lang$core$String$join, - ', ', - A2( - _elm_lang$core$List$map, - function (_p5) { - var _p6 = _p5; - return A2( - _elm_lang$core$Basics_ops['++'], - _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$normalized(_p6.name), - ' = Absent'); - }, - optionalArgs)); - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '{ {0} }', - { - ctor: '::', - _0: recordEntries, - _1: {ctor: '[]'} - }); -}; -var _dillonkearns$elm_graphql$Graphql_Generator_OptionalArgs$argValue = F2( - function (apiSubmodule, _p7) { - var _p8 = _p7; - var _p9 = _p8.name; - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - 'Argument.optional \"{0}\" filledInOptionals.{1} ({2})', - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$raw(_p9), - _1: { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$normalized(_p9), - _1: { - ctor: '::', - _0: A2( - _dillonkearns$elm_graphql$Graphql_Generator_Decoder$generateEncoder, - apiSubmodule, - A2(_dillonkearns$elm_graphql$Graphql_Parser_Type$TypeReference, _p8.typeOf, _dillonkearns$elm_graphql$Graphql_Parser_Type$NonNullable)), - _1: {ctor: '[]'} - } - } - }); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_OptionalArgs$argValues = F2( - function (apiSubmodule, optionalArgs) { - var values = A2( - _elm_lang$core$String$join, - ', ', - A2( - _elm_lang$core$List$map, - _dillonkearns$elm_graphql$Graphql_Generator_OptionalArgs$argValue(apiSubmodule), - optionalArgs)); - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '[ {0} ]', - { - ctor: '::', - _0: values, - _1: {ctor: '[]'} - }); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_OptionalArgs_ops = _dillonkearns$elm_graphql$Graphql_Generator_OptionalArgs_ops || {}; -_dillonkearns$elm_graphql$Graphql_Generator_OptionalArgs_ops['=>'] = F2( - function (v0, v1) { - return {ctor: '_Tuple2', _0: v0, _1: v1}; - }); -var _dillonkearns$elm_graphql$Graphql_Generator_OptionalArgs$generate = F2( - function (apiSubmodule, allArgs) { - var _p10 = A2(_elm_lang$core$List$filterMap, _dillonkearns$elm_graphql$Graphql_Generator_OptionalArgs$optionalArgOrNothing, allArgs); - if (_p10.ctor === '[]') { - return _elm_lang$core$Maybe$Nothing; - } else { - var _p11 = _p10; - return _elm_lang$core$Maybe$Just( - { - annotatedArg: function (fieldName) { - return { - annotation: _dillonkearns$elm_graphql$Graphql_Generator_OptionalArgs$annotation(fieldName), - arg: 'fillInOptionals' - }; - }, - letBindings: { - ctor: '::', - _0: A2( - _dillonkearns$elm_graphql$Graphql_Generator_OptionalArgs_ops['=>'], - 'filledInOptionals', - A2( - _elm_lang$core$Basics_ops['++'], - 'fillInOptionals ', - _dillonkearns$elm_graphql$Graphql_Generator_OptionalArgs$emptyRecord(_p11))), - _1: { - ctor: '::', - _0: A2( - _dillonkearns$elm_graphql$Graphql_Generator_OptionalArgs_ops['=>'], - 'optionalArgs', - A2( - _elm_lang$core$Basics_ops['++'], - A2(_dillonkearns$elm_graphql$Graphql_Generator_OptionalArgs$argValues, apiSubmodule, _p11), - '\n |> List.filterMap identity')), - _1: {ctor: '[]'} - } - }, - typeAlias: { - suffix: 'OptionalArguments', - body: A2(_dillonkearns$elm_graphql$Graphql_Generator_OptionalArgs$typeAlias, apiSubmodule, _p11) - } - }); - } - }); -var _dillonkearns$elm_graphql$Graphql_Generator_OptionalArgs$Result = F3( - function (a, b, c) { - return {annotatedArg: a, letBindings: b, typeAlias: c}; - }); -var _dillonkearns$elm_graphql$Graphql_Generator_OptionalArgs$OptionalArg = F2( - function (a, b) { - return {name: a, typeOf: b}; - }); - -var _dillonkearns$elm_graphql$Graphql_Generator_ReferenceLeaf$Scalar = {ctor: 'Scalar'}; -var _dillonkearns$elm_graphql$Graphql_Generator_ReferenceLeaf$Interface = {ctor: 'Interface'}; -var _dillonkearns$elm_graphql$Graphql_Generator_ReferenceLeaf$Union = {ctor: 'Union'}; -var _dillonkearns$elm_graphql$Graphql_Generator_ReferenceLeaf$Enum = {ctor: 'Enum'}; -var _dillonkearns$elm_graphql$Graphql_Generator_ReferenceLeaf$Object = {ctor: 'Object'}; -var _dillonkearns$elm_graphql$Graphql_Generator_ReferenceLeaf$get = function (_p0) { - get: - while (true) { - var _p1 = _p0; - var _p2 = _p1._0; - switch (_p2.ctor) { - case 'ObjectRef': - return _dillonkearns$elm_graphql$Graphql_Generator_ReferenceLeaf$Object; - case 'Scalar': - return _dillonkearns$elm_graphql$Graphql_Generator_ReferenceLeaf$Scalar; - case 'List': - var _v2 = _p2._0; - _p0 = _v2; - continue get; - case 'EnumRef': - return _dillonkearns$elm_graphql$Graphql_Generator_ReferenceLeaf$Enum; - case 'InputObjectRef': - return _elm_lang$core$Native_Utils.crashCase( - 'Graphql.Generator.ReferenceLeaf', - { - start: {line: 21, column: 5}, - end: {line: 41, column: 22} - }, - _p2)('TODO'); - case 'UnionRef': - return _dillonkearns$elm_graphql$Graphql_Generator_ReferenceLeaf$Union; - default: - return _dillonkearns$elm_graphql$Graphql_Generator_ReferenceLeaf$Interface; - } - } -}; - -var _dillonkearns$elm_graphql$Graphql_Generator_RequiredArgs$requiredArgAnnotation = F2( - function (apiSubmodule, _p0) { - var _p1 = _p0; - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '{0} : {1}', - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$normalized(_p1.name), - _1: { - ctor: '::', - _0: A2(_dillonkearns$elm_graphql$Graphql_Generator_Decoder$generateType, apiSubmodule, _p1.typeRef), - _1: {ctor: '[]'} - } - }); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_RequiredArgs$requiredArgsAnnotation = F2( - function (apiSubmodule, requiredArgs) { - var annotations = A2( - _elm_lang$core$List$map, - _dillonkearns$elm_graphql$Graphql_Generator_RequiredArgs$requiredArgAnnotation(apiSubmodule), - requiredArgs); - return A2( - _elm_lang$core$Basics_ops['++'], - '{ ', - A2( - _elm_lang$core$Basics_ops['++'], - A2(_elm_lang$core$String$join, ', ', annotations), - ' }')); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_RequiredArgs$requiredArgString = F2( - function (apiSubmodule, _p2) { - var _p3 = _p2; - var _p4 = _p3.name; - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - 'Argument.required \"{0}\" requiredArgs.{1} ({2})', - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$raw(_p4), - _1: { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$normalized(_p4), - _1: { - ctor: '::', - _0: A2(_dillonkearns$elm_graphql$Graphql_Generator_Decoder$generateEncoder, apiSubmodule, _p3.typeRef), - _1: {ctor: '[]'} - } - } - }); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_RequiredArgs$requiredArgsString = F2( - function (apiSubmodule, requiredArgs) { - var requiredArgContents = A2( - _elm_lang$core$List$map, - _dillonkearns$elm_graphql$Graphql_Generator_RequiredArgs$requiredArgString(apiSubmodule), - requiredArgs); - return A2( - _elm_lang$core$Basics_ops['++'], - '[ ', - A2( - _elm_lang$core$Basics_ops['++'], - A2(_elm_lang$core$String$join, ', ', requiredArgContents), - ' ]')); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_RequiredArgs$requiredArgOrNothing = function (_p5) { - var _p6 = _p5; - var _p8 = _p6.typeRef; - var _p7 = _p8; - if (_p7._1.ctor === 'NonNullable') { - return _elm_lang$core$Maybe$Just( - {name: _p6.name, referrableType: _p7._0, typeRef: _p8}); - } else { - return _elm_lang$core$Maybe$Nothing; - } -}; -var _dillonkearns$elm_graphql$Graphql_Generator_RequiredArgs$generate = F2( - function (apiSubmodule, args) { - var requiredArgs = A2(_elm_lang$core$List$filterMap, _dillonkearns$elm_graphql$Graphql_Generator_RequiredArgs$requiredArgOrNothing, args); - return _elm_lang$core$Native_Utils.eq( - requiredArgs, - {ctor: '[]'}) ? _elm_lang$core$Maybe$Nothing : _elm_lang$core$Maybe$Just( - { - annotation: function (fieldName) { - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '{0}RequiredArguments', - { - ctor: '::', - _0: fieldName, - _1: {ctor: '[]'} - }); - }, - list: A2(_dillonkearns$elm_graphql$Graphql_Generator_RequiredArgs$requiredArgsString, apiSubmodule, requiredArgs), - typeAlias: { - body: A2(_dillonkearns$elm_graphql$Graphql_Generator_RequiredArgs$requiredArgsAnnotation, apiSubmodule, requiredArgs), - suffix: 'RequiredArguments' - } - }); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_RequiredArgs$Result = F3( - function (a, b, c) { - return {annotation: a, list: b, typeAlias: c}; - }); -var _dillonkearns$elm_graphql$Graphql_Generator_RequiredArgs$RequiredArg = F3( - function (a, b, c) { - return {name: a, referrableType: b, typeRef: c}; - }); - -var _dillonkearns$elm_graphql$Graphql_Generator_Field$initScalarField = F2( - function (apiSubmodule, typeRef) { - return { - annotatedArgs: {ctor: '[]'}, - fieldArgs: {ctor: '[]'}, - decoderAnnotation: A2(_dillonkearns$elm_graphql$Graphql_Generator_Decoder$generateType, apiSubmodule, typeRef), - decoder: A2( - _elm_lang$core$String$join, - ' |> ', - A2(_dillonkearns$elm_graphql$Graphql_Generator_Decoder$generateDecoder, apiSubmodule, typeRef)), - otherThing: '.fieldDecoder', - letBindings: {ctor: '[]'}, - objectDecoderChain: _elm_lang$core$Maybe$Nothing, - typeAliases: {ctor: '[]'} - }; - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Field$prependArg = F2( - function (_p0, fieldGenerator) { - var _p1 = _p0; - return _elm_lang$core$Native_Utils.update( - fieldGenerator, - { - annotatedArgs: {ctor: '::', _0: _p1, _1: fieldGenerator.annotatedArgs} - }); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Field$objectThing = F4( - function (_p2, typeRef, refName, objectOrInterface) { - var _p3 = _p2; - var _p8 = _p3; - var _p7 = _p3.apiSubmodule; - var typeLock = function () { - var _p4 = _dillonkearns$elm_graphql$Graphql_Generator_ReferenceLeaf$get(typeRef); - switch (_p4.ctor) { - case 'Object': - return A2( - _elm_lang$core$String$join, - '.', - A2( - _dillonkearns$elm_graphql$Graphql_Generator_ModuleName$object, - _p8, - _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$build(refName))); - case 'Interface': - return A2( - _elm_lang$core$String$join, - '.', - A2( - _dillonkearns$elm_graphql$Graphql_Generator_ModuleName$interface, - _p8, - _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$build(refName))); - case 'Enum': - return _elm_lang$core$Native_Utils.crashCase( - 'Graphql.Generator.Field', - { - start: {line: 185, column: 13}, - end: {line: 199, column: 39} - }, - _p4)('TODO'); - case 'Union': - return A2( - _elm_lang$core$String$join, - '.', - A2( - _dillonkearns$elm_graphql$Graphql_Generator_ModuleName$union, - _p8, - _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$build(refName))); - default: - return _elm_lang$core$Native_Utils.crashCase( - 'Graphql.Generator.Field', - { - start: {line: 185, column: 13}, - end: {line: 199, column: 39} - }, - _p4)('TODO'); - } - }(); - var objectArgAnnotation = A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - 'SelectionSet decodesTo {0}', - { - ctor: '::', - _0: typeLock, - _1: {ctor: '[]'} - }); - return A2( - _dillonkearns$elm_graphql$Graphql_Generator_Field$prependArg, - {annotation: objectArgAnnotation, arg: 'object'}, - { - annotatedArgs: {ctor: '[]'}, - fieldArgs: {ctor: '[]'}, - decoderAnnotation: A2(_dillonkearns$elm_graphql$Graphql_Generator_Decoder$generateType, _p7, typeRef), - decoder: 'object', - otherThing: '.selectionField', - letBindings: {ctor: '[]'}, - objectDecoderChain: _elm_lang$core$Maybe$Just( - A2( - _elm_lang$core$Basics_ops['++'], - ' (', - A2( - _elm_lang$core$Basics_ops['++'], - A2( - _elm_lang$core$String$join, - ' >> ', - A2(_dillonkearns$elm_graphql$Graphql_Generator_Decoder$generateDecoder, _p7, typeRef)), - ')'))), - typeAliases: {ctor: '[]'} - }); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Field$addOptionalArgs = F4( - function (field, apiSubmodule, args, fieldGenerator) { - var _p9 = A2(_dillonkearns$elm_graphql$Graphql_Generator_OptionalArgs$generate, apiSubmodule, args); - if (_p9.ctor === 'Just') { - return A2( - _dillonkearns$elm_graphql$Graphql_Generator_Field$prependArg, - _p9._0.annotatedArg( - _elm_community$string_extra$String_Extra$classify( - _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$raw(field.name))), - _elm_lang$core$Native_Utils.update( - fieldGenerator, - { - fieldArgs: {ctor: '::', _0: 'optionalArgs', _1: fieldGenerator.fieldArgs}, - letBindings: A2(_elm_lang$core$Basics_ops['++'], fieldGenerator.letBindings, _p9._0.letBindings), - typeAliases: {ctor: '::', _0: _p9._0.typeAlias, _1: fieldGenerator.typeAliases} - })); - } else { - return fieldGenerator; - } - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Field$addRequiredArgs = F4( - function (field, apiSubmodule, args, fieldGenerator) { - var _p10 = A2(_dillonkearns$elm_graphql$Graphql_Generator_RequiredArgs$generate, apiSubmodule, args); - if (_p10.ctor === 'Just') { - return A2( - _dillonkearns$elm_graphql$Graphql_Generator_Field$prependArg, - { - annotation: _p10._0.annotation( - _elm_community$string_extra$String_Extra$classify( - _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$raw(field.name))), - arg: 'requiredArgs' - }, - _elm_lang$core$Native_Utils.update( - fieldGenerator, - { - fieldArgs: { - ctor: '::', - _0: _p10._0.list, - _1: {ctor: '[]'} - }, - typeAliases: {ctor: '::', _0: _p10._0.typeAlias, _1: fieldGenerator.typeAliases} - })); - } else { - return fieldGenerator; - } - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Field$fieldArgsString = function (_p11) { - var _p12 = _p11; - var _p14 = _p12.fieldArgs; - var _p13 = _p14; - if (_p13.ctor === '[]') { - return '[]'; - } else { - if (_p13._1.ctor === '[]') { - return _p13._0; - } else { - return A2( - _elm_lang$core$Basics_ops['++'], - '(', - A2( - _elm_lang$core$Basics_ops['++'], - A2(_elm_lang$core$String$join, ' ++ ', _p14), - ')')); - } - } -}; -var _dillonkearns$elm_graphql$Graphql_Generator_Field$argsListString = function (_p15) { - var _p16 = _p15; - var _p17 = _p16.annotatedArgs; - return _elm_lang$core$Native_Utils.eq( - _p17, - {ctor: '[]'}) ? '' : A2( - _elm_lang$core$Basics_ops['++'], - A2( - _elm_lang$core$String$join, - ' ', - A2( - _elm_lang$core$List$map, - function (_) { - return _.arg; - }, - _p17)), - ' '); -}; -var _dillonkearns$elm_graphql$Graphql_Generator_Field$typeAliasesToString = F2( - function (field, fieldGenerator) { - return _elm_lang$core$Native_Utils.eq( - fieldGenerator.typeAliases, - {ctor: '[]'}) ? _elm_lang$core$Maybe$Nothing : _elm_lang$core$Maybe$Just( - A2( - _elm_lang$core$String$join, - '\n\n', - A2( - _elm_lang$core$List$map, - function (_p18) { - var _p19 = _p18; - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - 'type alias {0}{1} = {2}', - { - ctor: '::', - _0: _elm_community$string_extra$String_Extra$classify( - _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$raw(field.name)), - _1: { - ctor: '::', - _0: _p19.suffix, - _1: { - ctor: '::', - _0: _p19.body, - _1: {ctor: '[]'} - } - } - }); - }, - fieldGenerator.typeAliases))); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Field$fieldGeneratorToString = F3( - function (returnAnnotation, field, fieldGenerator) { - var fieldTypeAnnotation = A2( - _elm_lang$core$String$join, - ' -> ', - A2( - _elm_lang$core$Basics_ops['++'], - A2( - _elm_lang$core$List$map, - function (_) { - return _.annotation; - }, - fieldGenerator.annotatedArgs), - { - ctor: '::', - _0: returnAnnotation, - _1: {ctor: '[]'} - })); - return A2( - _elm_lang$core$String$join, - '\n\n', - A2( - _elm_lang$core$List$filterMap, - _elm_lang$core$Basics$identity, - { - ctor: '::', - _0: A2(_dillonkearns$elm_graphql$Graphql_Generator_Field$typeAliasesToString, field, fieldGenerator), - _1: { - ctor: '::', - _0: _elm_lang$core$Maybe$Just( - A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '{9}{6} : {3}\n{6} {4}={7}\n {5} \"{0}\" {1} ({2}){8}\n', - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$raw(field.name), - _1: { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Generator_Field$fieldArgsString(fieldGenerator), - _1: { - ctor: '::', - _0: fieldGenerator.decoder, - _1: { - ctor: '::', - _0: fieldTypeAnnotation, - _1: { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Generator_Field$argsListString(fieldGenerator), - _1: { - ctor: '::', - _0: A2(_elm_lang$core$Basics_ops['++'], 'Object', fieldGenerator.otherThing), - _1: { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$normalized(field.name), - _1: { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Generator_Let$generate(fieldGenerator.letBindings), - _1: { - ctor: '::', - _0: A2(_elm_lang$core$Maybe$withDefault, '', fieldGenerator.objectDecoderChain), - _1: { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Generator_DocComment$generate(field), - _1: {ctor: '[]'} - } - } - } - } - } - } - } - } - } - })), - _1: {ctor: '[]'} - } - })); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Field$forObject_ = F4( - function (context, thisObjectName, field, fieldGenerator) { - return A3( - _dillonkearns$elm_graphql$Graphql_Generator_Field$fieldGeneratorToString, - A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - 'Field {0} {1}', - { - ctor: '::', - _0: fieldGenerator.decoderAnnotation, - _1: { - ctor: '::', - _0: A2(_elm_lang$core$String$join, '.', thisObjectName), - _1: {ctor: '[]'} - } - }), - field, - fieldGenerator); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Field$FieldGenerator = F8( - function (a, b, c, d, e, f, g, h) { - return {annotatedArgs: a, decoderAnnotation: b, decoder: c, fieldArgs: d, otherThing: e, letBindings: f, objectDecoderChain: g, typeAliases: h}; - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Field$AnnotatedArg = F2( - function (a, b) { - return {annotation: a, arg: b}; - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Field$Interface = {ctor: 'Interface'}; -var _dillonkearns$elm_graphql$Graphql_Generator_Field$Object = {ctor: 'Object'}; -var _dillonkearns$elm_graphql$Graphql_Generator_Field$ScalarLeaf = {ctor: 'ScalarLeaf'}; -var _dillonkearns$elm_graphql$Graphql_Generator_Field$EnumLeaf = {ctor: 'EnumLeaf'}; -var _dillonkearns$elm_graphql$Graphql_Generator_Field$UnionLeaf = function (a) { - return {ctor: 'UnionLeaf', _0: a}; -}; -var _dillonkearns$elm_graphql$Graphql_Generator_Field$InterfaceLeaf = function (a) { - return {ctor: 'InterfaceLeaf', _0: a}; -}; -var _dillonkearns$elm_graphql$Graphql_Generator_Field$ObjectLeaf = function (a) { - return {ctor: 'ObjectLeaf', _0: a}; -}; -var _dillonkearns$elm_graphql$Graphql_Generator_Field$leafType = function (_p20) { - leafType: - while (true) { - var _p21 = _p20; - var _p22 = _p21._0; - switch (_p22.ctor) { - case 'ObjectRef': - return _dillonkearns$elm_graphql$Graphql_Generator_Field$ObjectLeaf(_p22._0); - case 'InterfaceRef': - return _dillonkearns$elm_graphql$Graphql_Generator_Field$InterfaceLeaf(_p22._0); - case 'UnionRef': - return _dillonkearns$elm_graphql$Graphql_Generator_Field$UnionLeaf(_p22._0); - case 'Scalar': - return _dillonkearns$elm_graphql$Graphql_Generator_Field$ScalarLeaf; - case 'List': - var _v11 = _p22._0; - _p20 = _v11; - continue leafType; - case 'EnumRef': - return _dillonkearns$elm_graphql$Graphql_Generator_Field$EnumLeaf; - default: - return _elm_lang$core$Native_Utils.crashCase( - 'Graphql.Generator.Field', - { - start: {line: 242, column: 5}, - end: {line: 262, column: 42} - }, - _p22)('Unexpected type'); - } - } -}; -var _dillonkearns$elm_graphql$Graphql_Generator_Field$init = F3( - function (_p25, fieldName, _p24) { - var _p26 = _p25; - var _p31 = _p26; - var _p30 = _p26.apiSubmodule; - var _p27 = _p24; - var _p29 = _p27; - var _p28 = _dillonkearns$elm_graphql$Graphql_Generator_Field$leafType(_p29); - switch (_p28.ctor) { - case 'ObjectLeaf': - return A4(_dillonkearns$elm_graphql$Graphql_Generator_Field$objectThing, _p31, _p29, _p28._0, _dillonkearns$elm_graphql$Graphql_Generator_Field$Object); - case 'InterfaceLeaf': - return A4(_dillonkearns$elm_graphql$Graphql_Generator_Field$objectThing, _p31, _p29, _p28._0, _dillonkearns$elm_graphql$Graphql_Generator_Field$Interface); - case 'UnionLeaf': - return A4(_dillonkearns$elm_graphql$Graphql_Generator_Field$objectThing, _p31, _p29, _p28._0, _dillonkearns$elm_graphql$Graphql_Generator_Field$Interface); - case 'EnumLeaf': - return A2(_dillonkearns$elm_graphql$Graphql_Generator_Field$initScalarField, _p30, _p29); - default: - return A2(_dillonkearns$elm_graphql$Graphql_Generator_Field$initScalarField, _p30, _p29); - } - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Field$toFieldGenerator = F2( - function (_p32, field) { - var _p33 = _p32; - var _p34 = _p33.apiSubmodule; - return A4( - _dillonkearns$elm_graphql$Graphql_Generator_Field$addOptionalArgs, - field, - _p34, - field.args, - A4( - _dillonkearns$elm_graphql$Graphql_Generator_Field$addRequiredArgs, - field, - _p34, - field.args, - A3(_dillonkearns$elm_graphql$Graphql_Generator_Field$init, _p33, field.name, field.typeRef))); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Field$generateForObject = F3( - function (context, thisObjectName, field) { - return A4( - _dillonkearns$elm_graphql$Graphql_Generator_Field$forObject_, - context, - A2(_dillonkearns$elm_graphql$Graphql_Generator_ModuleName$object, context, thisObjectName), - field, - A2(_dillonkearns$elm_graphql$Graphql_Generator_Field$toFieldGenerator, context, field)); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Field$generateForInterface = F3( - function (context, thisObjectName, field) { - return A4( - _dillonkearns$elm_graphql$Graphql_Generator_Field$forObject_, - context, - A2( - _dillonkearns$elm_graphql$Graphql_Generator_ModuleName$interface, - context, - _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$build(thisObjectName)), - field, - A2(_dillonkearns$elm_graphql$Graphql_Generator_Field$toFieldGenerator, context, field)); - }); - -var _dillonkearns$elm_graphql$Graphql_Generator_Imports$imports = F2( - function (apiSubmodule, _p0) { - imports: - while (true) { - var _p1 = _p0; - var _p2 = _p1._0; - switch (_p2.ctor) { - case 'Scalar': - return _elm_lang$core$Maybe$Nothing; - case 'List': - var _v2 = apiSubmodule, - _v3 = _p2._0; - apiSubmodule = _v2; - _p0 = _v3; - continue imports; - case 'ObjectRef': - return _elm_lang$core$Maybe$Nothing; - case 'InterfaceRef': - return _elm_lang$core$Maybe$Nothing; - case 'EnumRef': - return _elm_lang$core$Maybe$Just( - A2( - _dillonkearns$elm_graphql$Graphql_Generator_ModuleName$enum, - {apiSubmodule: apiSubmodule}, - _p2._0)); - case 'InputObjectRef': - return _elm_lang$core$Maybe$Nothing; - default: - return _elm_lang$core$Maybe$Nothing; - } - } - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Imports$toImportString = function (moduleName) { - return A2(_elm_lang$core$Basics_ops['++'], 'import ', moduleName); -}; -var _dillonkearns$elm_graphql$Graphql_Generator_Imports$toModuleName = function (modulePath) { - return A2(_elm_lang$core$String$join, '.', modulePath); -}; -var _dillonkearns$elm_graphql$Graphql_Generator_Imports$importsWithoutSelf = F3( - function (apiSubmodule, importingFrom, typeRefs) { - return A2( - _elm_lang$core$List$filter, - function (moduleName) { - return !_elm_lang$core$Native_Utils.eq(moduleName, importingFrom); - }, - A2( - _elm_lang$core$List$filterMap, - _dillonkearns$elm_graphql$Graphql_Generator_Imports$imports(apiSubmodule), - typeRefs)); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Imports$getArgRefs = function (_p3) { - var _p4 = _p3; - return A2( - _elm_lang$core$List$map, - function (_) { - return _.typeRef; - }, - _p4.args); -}; -var _dillonkearns$elm_graphql$Graphql_Generator_Imports$allRefs = function (fields) { - return A2( - _elm_lang$core$Basics_ops['++'], - A2(_elm_lang$core$List$concatMap, _dillonkearns$elm_graphql$Graphql_Generator_Imports$getArgRefs, fields), - A2( - _elm_lang$core$List$map, - function (_p5) { - var _p6 = _p5; - return _p6.typeRef; - }, - fields)); -}; -var _dillonkearns$elm_graphql$Graphql_Generator_Imports$importsString = F3( - function (apiSubmodule, importingFrom, typeRefs) { - return A2( - _elm_lang$core$String$join, - '\n', - A2( - _elm_lang$core$List$map, - _dillonkearns$elm_graphql$Graphql_Generator_Imports$toImportString, - A2( - _elm_lang$core$List$map, - _dillonkearns$elm_graphql$Graphql_Generator_Imports$toModuleName, - A3( - _dillonkearns$elm_graphql$Graphql_Generator_Imports$importsWithoutSelf, - apiSubmodule, - importingFrom, - _dillonkearns$elm_graphql$Graphql_Generator_Imports$allRefs(typeRefs))))); - }); - -var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile_Details$InputObjectDetails = F4( - function (a, b, c, d) { - return {definableType: a, fields: b, name: c, hasLoop: d}; - }); - -var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile_Constructor$compact = _elm_lang$core$List$filterMap(_elm_lang$core$Basics$identity); -var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile_Constructor$when = F2( - function (condition, value) { - return condition ? _elm_lang$core$Maybe$Just(value) : _elm_lang$core$Maybe$Nothing; - }); -var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile_Constructor$aliasEntry = F2( - function (_p0, field) { - var _p1 = _p0; - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '{0} : {1}', - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$normalized(field.name), - _1: { - ctor: '::', - _0: A2(_dillonkearns$elm_graphql$Graphql_Generator_Decoder$generateTypeForInputObject, _p1.apiSubmodule, field.typeRef), - _1: {ctor: '[]'} - } - }); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile_Constructor$filledOptionalsRecord = function (optionalFields) { - return A2( - _elm_lang$core$String$join, - ', ', - A2( - _elm_lang$core$List$map, - function (fieldName) { - return A2( - _elm_lang$core$Basics_ops['++'], - _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$normalized(fieldName), - ' = Absent'); - }, - A2( - _elm_lang$core$List$map, - function (_) { - return _.name; - }, - optionalFields))); -}; -var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile_Constructor$constructorFieldsAlias = F3( - function (nameThing, context, fields) { - return (_elm_lang$core$Native_Utils.cmp( - _elm_lang$core$List$length(fields), - 0) > 0) ? A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - 'type alias {0} =\n { {1} }', - { - ctor: '::', - _0: nameThing, - _1: { - ctor: '::', - _0: A2( - _elm_lang$core$String$join, - ', ', - A2( - _elm_lang$core$List$map, - _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile_Constructor$aliasEntry(context), - fields)), - _1: {ctor: '[]'} - } - }) : ''; - }); -var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile_Constructor$generate = F2( - function (context, _p2) { - var _p3 = _p2; - var _p9 = _p3.name; - var _p8 = _p3.fields; - var returnRecord = A2( - _elm_lang$core$String$join, - ', ', - A2( - _elm_lang$core$List$map, - function (field) { - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '{0} = {1}.{0}', - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$normalized(field.name), - _1: { - ctor: '::', - _0: function () { - var _p4 = field.typeRef; - var _p5 = _p4._1; - if (_p5.ctor === 'Nullable') { - return 'optionals'; - } else { - return 'required'; - } - }(), - _1: {ctor: '[]'} - } - }); - }, - _p8)); - var requiredFields = A2( - _elm_lang$core$List$filter, - function (field) { - var _p6 = field.typeRef; - return _elm_lang$core$Native_Utils.eq(_p6._1, _dillonkearns$elm_graphql$Graphql_Parser_Type$NonNullable); - }, - _p8); - var optionalFields = A2( - _elm_lang$core$List$filter, - function (field) { - var _p7 = field.typeRef; - return _elm_lang$core$Native_Utils.eq(_p7._1, _dillonkearns$elm_graphql$Graphql_Parser_Type$Nullable); - }, - _p8); - var annotation = A2( - _dillonkearns$elm_graphql$Graphql_Generator_AnnotatedArg$toString, - A2( - _elm_lang$core$Basics_ops['++'], - 'build', - _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(_p9)), - A2( - _dillonkearns$elm_graphql$Graphql_Generator_AnnotatedArg$buildWithArgs, - _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile_Constructor$compact( - { - ctor: '::', - _0: A2( - _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile_Constructor$when, - _elm_lang$core$Native_Utils.cmp( - _elm_lang$core$List$length(requiredFields), - 0) > 0, - { - ctor: '_Tuple2', - _0: A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '{0}RequiredFields', - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(_p9), - _1: {ctor: '[]'} - }), - _1: 'required' - }), - _1: { - ctor: '::', - _0: A2( - _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile_Constructor$when, - _elm_lang$core$Native_Utils.cmp( - _elm_lang$core$List$length(optionalFields), - 0) > 0, - { - ctor: '_Tuple2', - _0: A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '({0}OptionalFields -> {0}OptionalFields)', - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(_p9), - _1: {ctor: '[]'} - }), - _1: 'fillOptionals' - }), - _1: {ctor: '[]'} - } - }), - _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(_p9))); - var letClause = _dillonkearns$elm_graphql$Graphql_Generator_Let$generate( - _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile_Constructor$compact( - { - ctor: '::', - _0: A2( - _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile_Constructor$when, - _elm_lang$core$Native_Utils.cmp( - _elm_lang$core$List$length(optionalFields), - 0) > 0, - { - ctor: '_Tuple2', - _0: 'optionals', - _1: A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '\n fillOptionals\n { {0} }', - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile_Constructor$filledOptionalsRecord(optionalFields), - _1: {ctor: '[]'} - }) - }), - _1: {ctor: '[]'} - })); - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '{0}{1}\n {2}{ {3} }\n\n{4}\n{5}\n', - { - ctor: '::', - _0: annotation, - _1: { - ctor: '::', - _0: letClause, - _1: { - ctor: '::', - _0: _p3.hasLoop ? _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(_p9) : '', - _1: { - ctor: '::', - _0: returnRecord, - _1: { - ctor: '::', - _0: A3( - _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile_Constructor$constructorFieldsAlias, - A2( - _elm_lang$core$Basics_ops['++'], - _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(_p9), - 'RequiredFields'), - context, - requiredFields), - _1: { - ctor: '::', - _0: A3( - _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile_Constructor$constructorFieldsAlias, - A2( - _elm_lang$core$Basics_ops['++'], - _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(_p9), - 'OptionalFields'), - context, - optionalFields), - _1: {ctor: '[]'} - } - } - } - } - } - }); - }); - -var _elm_lang$core$Set$foldr = F3( - function (f, b, _p0) { - var _p1 = _p0; - return A3( - _elm_lang$core$Dict$foldr, - F3( - function (k, _p2, b) { - return A2(f, k, b); - }), - b, - _p1._0); - }); -var _elm_lang$core$Set$foldl = F3( - function (f, b, _p3) { - var _p4 = _p3; - return A3( - _elm_lang$core$Dict$foldl, - F3( - function (k, _p5, b) { - return A2(f, k, b); - }), - b, - _p4._0); - }); -var _elm_lang$core$Set$toList = function (_p6) { - var _p7 = _p6; - return _elm_lang$core$Dict$keys(_p7._0); -}; -var _elm_lang$core$Set$size = function (_p8) { - var _p9 = _p8; - return _elm_lang$core$Dict$size(_p9._0); -}; -var _elm_lang$core$Set$member = F2( - function (k, _p10) { - var _p11 = _p10; - return A2(_elm_lang$core$Dict$member, k, _p11._0); - }); -var _elm_lang$core$Set$isEmpty = function (_p12) { - var _p13 = _p12; - return _elm_lang$core$Dict$isEmpty(_p13._0); -}; -var _elm_lang$core$Set$Set_elm_builtin = function (a) { - return {ctor: 'Set_elm_builtin', _0: a}; -}; -var _elm_lang$core$Set$empty = _elm_lang$core$Set$Set_elm_builtin(_elm_lang$core$Dict$empty); -var _elm_lang$core$Set$singleton = function (k) { - return _elm_lang$core$Set$Set_elm_builtin( - A2( - _elm_lang$core$Dict$singleton, - k, - {ctor: '_Tuple0'})); -}; -var _elm_lang$core$Set$insert = F2( - function (k, _p14) { - var _p15 = _p14; - return _elm_lang$core$Set$Set_elm_builtin( - A3( - _elm_lang$core$Dict$insert, - k, - {ctor: '_Tuple0'}, - _p15._0)); - }); -var _elm_lang$core$Set$fromList = function (xs) { - return A3(_elm_lang$core$List$foldl, _elm_lang$core$Set$insert, _elm_lang$core$Set$empty, xs); -}; -var _elm_lang$core$Set$map = F2( - function (f, s) { - return _elm_lang$core$Set$fromList( - A2( - _elm_lang$core$List$map, - f, - _elm_lang$core$Set$toList(s))); - }); -var _elm_lang$core$Set$remove = F2( - function (k, _p16) { - var _p17 = _p16; - return _elm_lang$core$Set$Set_elm_builtin( - A2(_elm_lang$core$Dict$remove, k, _p17._0)); - }); -var _elm_lang$core$Set$union = F2( - function (_p19, _p18) { - var _p20 = _p19; - var _p21 = _p18; - return _elm_lang$core$Set$Set_elm_builtin( - A2(_elm_lang$core$Dict$union, _p20._0, _p21._0)); - }); -var _elm_lang$core$Set$intersect = F2( - function (_p23, _p22) { - var _p24 = _p23; - var _p25 = _p22; - return _elm_lang$core$Set$Set_elm_builtin( - A2(_elm_lang$core$Dict$intersect, _p24._0, _p25._0)); - }); -var _elm_lang$core$Set$diff = F2( - function (_p27, _p26) { - var _p28 = _p27; - var _p29 = _p26; - return _elm_lang$core$Set$Set_elm_builtin( - A2(_elm_lang$core$Dict$diff, _p28._0, _p29._0)); - }); -var _elm_lang$core$Set$filter = F2( - function (p, _p30) { - var _p31 = _p30; - return _elm_lang$core$Set$Set_elm_builtin( - A2( - _elm_lang$core$Dict$filter, - F2( - function (k, _p32) { - return p(k); - }), - _p31._0)); - }); -var _elm_lang$core$Set$partition = F2( - function (p, _p33) { - var _p34 = _p33; - var _p35 = A2( - _elm_lang$core$Dict$partition, - F2( - function (k, _p36) { - return p(k); - }), - _p34._0); - var p1 = _p35._0; - var p2 = _p35._1; - return { - ctor: '_Tuple2', - _0: _elm_lang$core$Set$Set_elm_builtin(p1), - _1: _elm_lang$core$Set$Set_elm_builtin(p2) - }; - }); - -var _elm_community$list_extra$List_Extra$greedyGroupsOfWithStep = F3( - function (size, step, xs) { - var okayXs = _elm_lang$core$Native_Utils.cmp( - _elm_lang$core$List$length(xs), - 0) > 0; - var okayArgs = (_elm_lang$core$Native_Utils.cmp(size, 0) > 0) && (_elm_lang$core$Native_Utils.cmp(step, 0) > 0); - var xs_ = A2(_elm_lang$core$List$drop, step, xs); - var group = A2(_elm_lang$core$List$take, size, xs); - return (okayArgs && okayXs) ? { - ctor: '::', - _0: group, - _1: A3(_elm_community$list_extra$List_Extra$greedyGroupsOfWithStep, size, step, xs_) - } : {ctor: '[]'}; - }); -var _elm_community$list_extra$List_Extra$greedyGroupsOf = F2( - function (size, xs) { - return A3(_elm_community$list_extra$List_Extra$greedyGroupsOfWithStep, size, size, xs); - }); -var _elm_community$list_extra$List_Extra$groupsOfWithStep = F3( - function (size, step, xs) { - var okayArgs = (_elm_lang$core$Native_Utils.cmp(size, 0) > 0) && (_elm_lang$core$Native_Utils.cmp(step, 0) > 0); - var xs_ = A2(_elm_lang$core$List$drop, step, xs); - var group = A2(_elm_lang$core$List$take, size, xs); - var okayLength = _elm_lang$core$Native_Utils.eq( - size, - _elm_lang$core$List$length(group)); - return (okayArgs && okayLength) ? { - ctor: '::', - _0: group, - _1: A3(_elm_community$list_extra$List_Extra$groupsOfWithStep, size, step, xs_) - } : {ctor: '[]'}; - }); -var _elm_community$list_extra$List_Extra$groupsOf = F2( - function (size, xs) { - return A3(_elm_community$list_extra$List_Extra$groupsOfWithStep, size, size, xs); - }); -var _elm_community$list_extra$List_Extra$zip5 = _elm_lang$core$List$map5( - F5( - function (v0, v1, v2, v3, v4) { - return {ctor: '_Tuple5', _0: v0, _1: v1, _2: v2, _3: v3, _4: v4}; - })); -var _elm_community$list_extra$List_Extra$zip4 = _elm_lang$core$List$map4( - F4( - function (v0, v1, v2, v3) { - return {ctor: '_Tuple4', _0: v0, _1: v1, _2: v2, _3: v3}; - })); -var _elm_community$list_extra$List_Extra$zip3 = _elm_lang$core$List$map3( - F3( - function (v0, v1, v2) { - return {ctor: '_Tuple3', _0: v0, _1: v1, _2: v2}; - })); -var _elm_community$list_extra$List_Extra$zip = _elm_lang$core$List$map2( - F2( - function (v0, v1) { - return {ctor: '_Tuple2', _0: v0, _1: v1}; - })); -var _elm_community$list_extra$List_Extra$isSubsequenceOf = F2( - function (subseq, list) { - isSubsequenceOf: - while (true) { - var _p0 = {ctor: '_Tuple2', _0: subseq, _1: list}; - if (_p0._0.ctor === '[]') { - return true; - } else { - if (_p0._1.ctor === '[]') { - return false; - } else { - var _p1 = _p0._1._1; - if (_elm_lang$core$Native_Utils.eq(_p0._0._0, _p0._1._0)) { - var _v1 = _p0._0._1, - _v2 = _p1; - subseq = _v1; - list = _v2; - continue isSubsequenceOf; - } else { - var _v3 = subseq, - _v4 = _p1; - subseq = _v3; - list = _v4; - continue isSubsequenceOf; - } - } - } - } - }); -var author$project$Graphqelm$Generator$RequiredArgs$requiredArgsAnnotation = F2( - function (apiSubmodule, requiredArgs) { - var annotations = A2( - elm$core$List$map, - author$project$Graphqelm$Generator$RequiredArgs$requiredArgAnnotation(apiSubmodule), - requiredArgs); - return '{ ' + (A2(elm$core$String$join, ', ', annotations) + ' }'); - }); -var author$project$Graphqelm$Generator$RequiredArgs$requiredArgString = F2( - function (apiSubmodule, _n0) { - var name = _n0.name; - var referrableType = _n0.referrableType; - var typeRef = _n0.typeRef; - return A2( - lukewestby$elm_string_interpolate$String$Interpolate$interpolate, - 'Argument.required \"{0}\" requiredArgs.{1} ({2})', - _List_fromArray( - [ - author$project$Graphqelm$Parser$CamelCaseName$raw(name), - author$project$Graphqelm$Parser$CamelCaseName$normalized(name), - A2(author$project$Graphqelm$Generator$Decoder$generateEncoder, apiSubmodule, typeRef) - ])); - }); -var author$project$Graphqelm$Generator$RequiredArgs$requiredArgsString = F2( - function (apiSubmodule, requiredArgs) { - var requiredArgContents = A2( - elm$core$List$map, - author$project$Graphqelm$Generator$RequiredArgs$requiredArgString(apiSubmodule), - requiredArgs); - return '[ ' + (A2(elm$core$String$join, ', ', requiredArgContents) + ' ]'); - }); -var author$project$Graphqelm$Generator$RequiredArgs$generate = F2( - function (apiSubmodule, args) { - var requiredArgs = A2(elm$core$List$filterMap, author$project$Graphqelm$Generator$RequiredArgs$requiredArgOrNothing, args); - return _Utils_eq(requiredArgs, _List_Nil) ? elm$core$Maybe$Nothing : elm$core$Maybe$Just( - { - annotation: function (fieldName) { - return A2( - lukewestby$elm_string_interpolate$String$Interpolate$interpolate, - '{0}RequiredArguments', - _List_fromArray( - [fieldName])); - }, - list: A2(author$project$Graphqelm$Generator$RequiredArgs$requiredArgsString, apiSubmodule, requiredArgs), - typeAlias: { - body: A2(author$project$Graphqelm$Generator$RequiredArgs$requiredArgsAnnotation, apiSubmodule, requiredArgs), - suffix: 'RequiredArguments' - } - }); - }); -var author$project$Graphqelm$Generator$Field$addRequiredArgs = F4( - function (field, apiSubmodule, args, fieldGenerator) { - var _n0 = A2(author$project$Graphqelm$Generator$RequiredArgs$generate, apiSubmodule, args); - if (_n0.$ === 'Just') { - var annotation = _n0.a.annotation; - var list = _n0.a.list; - var typeAlias = _n0.a.typeAlias; - return A2( - author$project$Graphqelm$Generator$Field$prependArg, - { - annotation: annotation( - elm_community$string_extra$String$Extra$classify( - author$project$Graphqelm$Parser$CamelCaseName$raw(field.name))), - arg: 'requiredArgs' - }, - _Utils_update( - fieldGenerator, - { - fieldArgs: _List_fromArray( - [list]), - typeAliases: A2(elm$core$List$cons, typeAlias, fieldGenerator.typeAliases) - })); - } else { - return fieldGenerator; - } - }); -var author$project$Graphqelm$Generator$Field$Interface = {$: 'Interface'}; -var author$project$Graphqelm$Generator$Field$Object = {$: 'Object'}; -var author$project$Graphqelm$Generator$Decoder$generateDecoder = F2( +var author$project$Graphql$Generator$Field$Interface = {$: 'Interface'}; +var author$project$Graphql$Generator$Field$Object = {$: 'Object'}; +var author$project$Graphql$Generator$Decoder$generateDecoder = F2( function (apiSubmodule, _n0) { var referrableType = _n0.a; var isNullable = _n0.b; @@ -11168,11 +7617,11 @@ var author$project$Graphqelm$Generator$Decoder$generateDecoder = F2( ['Scalar']), _List_fromArray( [ - author$project$Graphqelm$Parser$ClassCaseName$normalized(customScalarName) + author$project$Graphql$Parser$ClassCaseName$normalized(customScalarName) ])))); return _List_fromArray( [ - 'Decode.oneOf [ Decode.string, Decode.float |> Decode.map String.fromFloat, Decode.int |> Decode.map String.fromInt, Decode.bool |> Decode.map (\\bool -> if bool then \"True\" else \"False\" ) ]', + 'Decode.oneOf [ Decode.string, Decode.float |> Decode.map toString, Decode.int |> Decode.map toString, Decode.bool |> Decode.map toString ]', A2( lukewestby$elm_string_interpolate$String$Interpolate$interpolate, 'Decode.map {0}', @@ -11183,7 +7632,7 @@ var author$project$Graphqelm$Generator$Decoder$generateDecoder = F2( case 'List': var listTypeRef = referrableType.a; return _Utils_ap( - A2(author$project$Graphqelm$Generator$Decoder$generateDecoder, apiSubmodule, listTypeRef), + A2(author$project$Graphql$Generator$Decoder$generateDecoder, apiSubmodule, listTypeRef), _List_fromArray( ['Decode.list'])); case 'ObjectRef': @@ -11207,7 +7656,7 @@ var author$project$Graphqelm$Generator$Decoder$generateDecoder = F2( '.', _Utils_ap( A2( - author$project$Graphqelm$Generator$ModuleName$enum, + author$project$Graphql$Generator$ModuleName$enum, {apiSubmodule: apiSubmodule}, enumName), _List_fromArray( @@ -11215,7 +7664,7 @@ var author$project$Graphqelm$Generator$Decoder$generateDecoder = F2( ]); default: return _Debug_todo( - 'Graphqelm.Generator.Decoder', + 'Graphql.Generator.Decoder', { start: {line: 59, column: 13}, end: {line: 59, column: 23} @@ -11231,15 +7680,15 @@ var author$project$Graphqelm$Generator$Decoder$generateDecoder = F2( } }()); }); -var author$project$Graphqelm$Generator$Field$initScalarField = F2( +var author$project$Graphql$Generator$Field$initScalarField = F2( function (apiSubmodule, typeRef) { return { annotatedArgs: _List_Nil, decoder: A2( elm$core$String$join, ' |> ', - A2(author$project$Graphqelm$Generator$Decoder$generateDecoder, apiSubmodule, typeRef)), - decoderAnnotation: A2(author$project$Graphqelm$Generator$Decoder$generateType, apiSubmodule, typeRef), + A2(author$project$Graphql$Generator$Decoder$generateDecoder, apiSubmodule, typeRef)), + decoderAnnotation: A2(author$project$Graphql$Generator$Decoder$generateType, apiSubmodule, typeRef), fieldArgs: _List_Nil, letBindings: _List_Nil, objectDecoderChain: elm$core$Maybe$Nothing, @@ -11247,18 +7696,18 @@ var author$project$Graphqelm$Generator$Field$initScalarField = F2( typeAliases: _List_Nil }; }); -var author$project$Graphqelm$Generator$Field$EnumLeaf = {$: 'EnumLeaf'}; -var author$project$Graphqelm$Generator$Field$InterfaceLeaf = function (a) { +var author$project$Graphql$Generator$Field$EnumLeaf = {$: 'EnumLeaf'}; +var author$project$Graphql$Generator$Field$InterfaceLeaf = function (a) { return {$: 'InterfaceLeaf', a: a}; }; -var author$project$Graphqelm$Generator$Field$ObjectLeaf = function (a) { +var author$project$Graphql$Generator$Field$ObjectLeaf = function (a) { return {$: 'ObjectLeaf', a: a}; }; -var author$project$Graphqelm$Generator$Field$ScalarLeaf = {$: 'ScalarLeaf'}; -var author$project$Graphqelm$Generator$Field$UnionLeaf = function (a) { +var author$project$Graphql$Generator$Field$ScalarLeaf = {$: 'ScalarLeaf'}; +var author$project$Graphql$Generator$Field$UnionLeaf = function (a) { return {$: 'UnionLeaf', a: a}; }; -var author$project$Graphqelm$Generator$Field$leafType = function (_n0) { +var author$project$Graphql$Generator$Field$leafType = function (_n0) { leafType: while (true) { var referrableType = _n0.a; @@ -11266,25 +7715,25 @@ var author$project$Graphqelm$Generator$Field$leafType = function (_n0) { switch (referrableType.$) { case 'ObjectRef': var refName = referrableType.a; - return author$project$Graphqelm$Generator$Field$ObjectLeaf(refName); + return author$project$Graphql$Generator$Field$ObjectLeaf(refName); case 'InterfaceRef': var refName = referrableType.a; - return author$project$Graphqelm$Generator$Field$InterfaceLeaf(refName); + return author$project$Graphql$Generator$Field$InterfaceLeaf(refName); case 'UnionRef': var refName = referrableType.a; - return author$project$Graphqelm$Generator$Field$UnionLeaf(refName); + return author$project$Graphql$Generator$Field$UnionLeaf(refName); case 'Scalar': - return author$project$Graphqelm$Generator$Field$ScalarLeaf; + return author$project$Graphql$Generator$Field$ScalarLeaf; case 'List': var nestedReferrableType = referrableType.a; var $temp$_n0 = nestedReferrableType; _n0 = $temp$_n0; continue leafType; case 'EnumRef': - return author$project$Graphqelm$Generator$Field$EnumLeaf; + return author$project$Graphql$Generator$Field$EnumLeaf; default: return _Debug_todo( - 'Graphqelm.Generator.Field', + 'Graphql.Generator.Field', { start: {line: 264, column: 13}, end: {line: 264, column: 23} @@ -11292,7 +7741,7 @@ var author$project$Graphqelm$Generator$Field$leafType = function (_n0) { } } }; -var author$project$Graphqelm$Generator$ModuleName$interface = F2( +var author$project$Graphql$Generator$ModuleName$interface = F2( function (_n0, name) { var apiSubmodule = _n0.apiSubmodule; return _Utils_ap( @@ -11300,10 +7749,10 @@ var author$project$Graphqelm$Generator$ModuleName$interface = F2( _List_fromArray( [ 'Interface', - author$project$Graphqelm$Parser$ClassCaseName$normalized(name) + author$project$Graphql$Parser$ClassCaseName$normalized(name) ])); }); -var author$project$Graphqelm$Generator$ModuleName$object = F2( +var author$project$Graphql$Generator$ModuleName$object = F2( function (context, name) { return _Utils_eq(name, context.query) ? _List_fromArray( ['RootQuery']) : (_Utils_eq( @@ -11317,10 +7766,10 @@ var author$project$Graphqelm$Generator$ModuleName$object = F2( _List_fromArray( [ 'Object', - author$project$Graphqelm$Parser$ClassCaseName$normalized(name) + author$project$Graphql$Parser$ClassCaseName$normalized(name) ])))); }); -var author$project$Graphqelm$Generator$ModuleName$union = F2( +var author$project$Graphql$Generator$ModuleName$union = F2( function (_n0, name) { var apiSubmodule = _n0.apiSubmodule; return _Utils_ap( @@ -11328,74 +7777,74 @@ var author$project$Graphqelm$Generator$ModuleName$union = F2( _List_fromArray( [ 'Union', - author$project$Graphqelm$Parser$ClassCaseName$normalized(name) + author$project$Graphql$Parser$ClassCaseName$normalized(name) ])); }); -var author$project$Graphqelm$Generator$ReferenceLeaf$Enum = {$: 'Enum'}; -var author$project$Graphqelm$Generator$ReferenceLeaf$Interface = {$: 'Interface'}; -var author$project$Graphqelm$Generator$ReferenceLeaf$Object = {$: 'Object'}; -var author$project$Graphqelm$Generator$ReferenceLeaf$Scalar = {$: 'Scalar'}; -var author$project$Graphqelm$Generator$ReferenceLeaf$Union = {$: 'Union'}; -var author$project$Graphqelm$Generator$ReferenceLeaf$get = function (_n0) { +var author$project$Graphql$Generator$ReferenceLeaf$Enum = {$: 'Enum'}; +var author$project$Graphql$Generator$ReferenceLeaf$Interface = {$: 'Interface'}; +var author$project$Graphql$Generator$ReferenceLeaf$Object = {$: 'Object'}; +var author$project$Graphql$Generator$ReferenceLeaf$Scalar = {$: 'Scalar'}; +var author$project$Graphql$Generator$ReferenceLeaf$Union = {$: 'Union'}; +var author$project$Graphql$Generator$ReferenceLeaf$get = function (_n0) { get: while (true) { var referrableType = _n0.a; var isNullable = _n0.b; switch (referrableType.$) { case 'ObjectRef': - return author$project$Graphqelm$Generator$ReferenceLeaf$Object; + return author$project$Graphql$Generator$ReferenceLeaf$Object; case 'Scalar': - return author$project$Graphqelm$Generator$ReferenceLeaf$Scalar; + return author$project$Graphql$Generator$ReferenceLeaf$Scalar; case 'List': var nestedType = referrableType.a; var $temp$_n0 = nestedType; _n0 = $temp$_n0; continue get; case 'EnumRef': - return author$project$Graphqelm$Generator$ReferenceLeaf$Enum; + return author$project$Graphql$Generator$ReferenceLeaf$Enum; case 'InputObjectRef': return _Debug_todo( - 'Graphqelm.Generator.ReferenceLeaf', + 'Graphql.Generator.ReferenceLeaf', { start: {line: 35, column: 13}, end: {line: 35, column: 23} })('TODO'); case 'UnionRef': - return author$project$Graphqelm$Generator$ReferenceLeaf$Union; + return author$project$Graphql$Generator$ReferenceLeaf$Union; default: - return author$project$Graphqelm$Generator$ReferenceLeaf$Interface; + return author$project$Graphql$Generator$ReferenceLeaf$Interface; } } }; -var author$project$Graphqelm$Parser$ClassCaseName$ClassCaseName = function (a) { +var author$project$Graphql$Parser$ClassCaseName$ClassCaseName = function (a) { return {$: 'ClassCaseName', a: a}; }; -var author$project$Graphqelm$Parser$ClassCaseName$build = author$project$Graphqelm$Parser$ClassCaseName$ClassCaseName; -var author$project$Graphqelm$Generator$Field$objectThing = F4( +var author$project$Graphql$Parser$ClassCaseName$build = author$project$Graphql$Parser$ClassCaseName$ClassCaseName; +var author$project$Graphql$Generator$Field$objectThing = F4( function (context, typeRef, refName, objectOrInterface) { var apiSubmodule = context.apiSubmodule; var typeLock = function () { - var _n0 = author$project$Graphqelm$Generator$ReferenceLeaf$get(typeRef); + var _n0 = author$project$Graphql$Generator$ReferenceLeaf$get(typeRef); switch (_n0.$) { case 'Object': return A2( elm$core$String$join, '.', A2( - author$project$Graphqelm$Generator$ModuleName$object, + author$project$Graphql$Generator$ModuleName$object, context, - author$project$Graphqelm$Parser$ClassCaseName$build(refName))); + author$project$Graphql$Parser$ClassCaseName$build(refName))); case 'Interface': return A2( elm$core$String$join, '.', A2( - author$project$Graphqelm$Generator$ModuleName$interface, + author$project$Graphql$Generator$ModuleName$interface, context, - author$project$Graphqelm$Parser$ClassCaseName$build(refName))); + author$project$Graphql$Parser$ClassCaseName$build(refName))); case 'Enum': return _Debug_todo( - 'Graphqelm.Generator.Field', + 'Graphql.Generator.Field', { start: {line: 195, column: 21}, end: {line: 195, column: 31} @@ -11405,12 +7854,12 @@ var author$project$Graphqelm$Generator$Field$objectThing = F4( elm$core$String$join, '.', A2( - author$project$Graphqelm$Generator$ModuleName$union, + author$project$Graphql$Generator$ModuleName$union, context, - author$project$Graphqelm$Parser$ClassCaseName$build(refName))); + author$project$Graphql$Parser$ClassCaseName$build(refName))); default: return _Debug_todo( - 'Graphqelm.Generator.Field', + 'Graphql.Generator.Field', { start: {line: 201, column: 21}, end: {line: 201, column: 31} @@ -11423,99 +7872,99 @@ var author$project$Graphqelm$Generator$Field$objectThing = F4( _List_fromArray( [typeLock])); return A2( - author$project$Graphqelm$Generator$Field$prependArg, - {annotation: objectArgAnnotation, arg: 'object_'}, + author$project$Graphql$Generator$Field$prependArg, + {annotation: objectArgAnnotation, arg: 'object'}, { annotatedArgs: _List_Nil, - decoder: 'object_', - decoderAnnotation: A2(author$project$Graphqelm$Generator$Decoder$generateType, apiSubmodule, typeRef), + decoder: 'object', + decoderAnnotation: A2(author$project$Graphql$Generator$Decoder$generateType, apiSubmodule, typeRef), fieldArgs: _List_Nil, letBindings: _List_Nil, objectDecoderChain: elm$core$Maybe$Just( ' (' + (A2( elm$core$String$join, ' >> ', - A2(author$project$Graphqelm$Generator$Decoder$generateDecoder, apiSubmodule, typeRef)) + ')')), + A2(author$project$Graphql$Generator$Decoder$generateDecoder, apiSubmodule, typeRef)) + ')')), otherThing: '.selectionField', typeAliases: _List_Nil }); }); -var author$project$Graphqelm$Generator$Field$init = F3( +var author$project$Graphql$Generator$Field$init = F3( function (context, fieldName, typeRef) { var apiSubmodule = context.apiSubmodule; var referrableType = typeRef.a; var isNullable = typeRef.b; - var _n0 = author$project$Graphqelm$Generator$Field$leafType(typeRef); + var _n0 = author$project$Graphql$Generator$Field$leafType(typeRef); switch (_n0.$) { case 'ObjectLeaf': var refName = _n0.a; - return A4(author$project$Graphqelm$Generator$Field$objectThing, context, typeRef, refName, author$project$Graphqelm$Generator$Field$Object); + return A4(author$project$Graphql$Generator$Field$objectThing, context, typeRef, refName, author$project$Graphql$Generator$Field$Object); case 'InterfaceLeaf': var refName = _n0.a; - return A4(author$project$Graphqelm$Generator$Field$objectThing, context, typeRef, refName, author$project$Graphqelm$Generator$Field$Interface); + return A4(author$project$Graphql$Generator$Field$objectThing, context, typeRef, refName, author$project$Graphql$Generator$Field$Interface); case 'UnionLeaf': var refName = _n0.a; - return A4(author$project$Graphqelm$Generator$Field$objectThing, context, typeRef, refName, author$project$Graphqelm$Generator$Field$Interface); + return A4(author$project$Graphql$Generator$Field$objectThing, context, typeRef, refName, author$project$Graphql$Generator$Field$Interface); case 'EnumLeaf': - return A2(author$project$Graphqelm$Generator$Field$initScalarField, apiSubmodule, typeRef); + return A2(author$project$Graphql$Generator$Field$initScalarField, apiSubmodule, typeRef); default: - return A2(author$project$Graphqelm$Generator$Field$initScalarField, apiSubmodule, typeRef); + return A2(author$project$Graphql$Generator$Field$initScalarField, apiSubmodule, typeRef); } }); -var author$project$Graphqelm$Generator$Field$toFieldGenerator = F2( +var author$project$Graphql$Generator$Field$toFieldGenerator = F2( function (context, field) { var apiSubmodule = context.apiSubmodule; return A4( - author$project$Graphqelm$Generator$Field$addOptionalArgs, + author$project$Graphql$Generator$Field$addOptionalArgs, field, apiSubmodule, field.args, A4( - author$project$Graphqelm$Generator$Field$addRequiredArgs, + author$project$Graphql$Generator$Field$addRequiredArgs, field, apiSubmodule, field.args, - A3(author$project$Graphqelm$Generator$Field$init, context, field.name, field.typeRef))); + A3(author$project$Graphql$Generator$Field$init, context, field.name, field.typeRef))); }); -var author$project$Graphqelm$Generator$Field$generateForInterface = F3( +var author$project$Graphql$Generator$Field$generateForInterface = F3( function (context, thisObjectName, field) { return A4( - author$project$Graphqelm$Generator$Field$forObject_, + author$project$Graphql$Generator$Field$forObject_, context, A2( - author$project$Graphqelm$Generator$ModuleName$interface, + author$project$Graphql$Generator$ModuleName$interface, context, - author$project$Graphqelm$Parser$ClassCaseName$build(thisObjectName)), + author$project$Graphql$Parser$ClassCaseName$build(thisObjectName)), field, - A2(author$project$Graphqelm$Generator$Field$toFieldGenerator, context, field)); + A2(author$project$Graphql$Generator$Field$toFieldGenerator, context, field)); }); -var author$project$Graphqelm$Generator$Interface$fragment = F3( +var author$project$Graphql$Generator$Interface$fragment = F3( function (context, moduleName, interfaceImplementor) { return A2( lukewestby$elm_string_interpolate$String$Interpolate$interpolate, 'on{0} : SelectionSet decodesTo {2} -> FragmentSelectionSet decodesTo {3}\non{0} (SelectionSet fields decoder) =\n FragmentSelectionSet "{1}" fields decoder\n', _List_fromArray( [ - author$project$Graphqelm$Parser$ClassCaseName$normalized(interfaceImplementor), - author$project$Graphqelm$Parser$ClassCaseName$raw(interfaceImplementor), + author$project$Graphql$Parser$ClassCaseName$normalized(interfaceImplementor), + author$project$Graphql$Parser$ClassCaseName$raw(interfaceImplementor), A2( elm$core$String$join, '.', - A2(author$project$Graphqelm$Generator$ModuleName$object, context, interfaceImplementor)), + A2(author$project$Graphql$Generator$ModuleName$object, context, interfaceImplementor)), A2(elm$core$String$join, '.', moduleName) ])); }); -var author$project$Graphqelm$Generator$Interface$fragments = F3( +var author$project$Graphql$Generator$Interface$fragments = F3( function (context, implementors, moduleName) { return A2( elm$core$String$join, '\n\n', A2( elm$core$List$map, - A2(author$project$Graphqelm$Generator$Interface$fragment, context, moduleName), + A2(author$project$Graphql$Generator$Interface$fragment, context, moduleName), implementors)); }); -var author$project$Graphqelm$Generator$Imports$getArgRefs = function (_n0) { +var author$project$Graphql$Generator$Imports$getArgRefs = function (_n0) { var args = _n0.args; return A2( elm$core$List$map, @@ -11540,9 +7989,9 @@ var elm$core$List$concatMap = F2( return elm$core$List$concat( A2(elm$core$List$map, f, list)); }); -var author$project$Graphqelm$Generator$Imports$allRefs = function (fields) { +var author$project$Graphql$Generator$Imports$allRefs = function (fields) { return _Utils_ap( - A2(elm$core$List$concatMap, author$project$Graphqelm$Generator$Imports$getArgRefs, fields), + A2(elm$core$List$concatMap, author$project$Graphql$Generator$Imports$getArgRefs, fields), A2( elm$core$List$map, function (_n0) { @@ -11551,7 +8000,7 @@ var author$project$Graphqelm$Generator$Imports$allRefs = function (fields) { }, fields)); }; -var author$project$Graphqelm$Generator$Imports$imports = F2( +var author$project$Graphql$Generator$Imports$imports = F2( function (apiSubmodule, _n0) { imports: while (true) { @@ -11577,7 +8026,7 @@ var author$project$Graphqelm$Generator$Imports$imports = F2( var enumName = referrableType.a; return elm$core$Maybe$Just( A2( - author$project$Graphqelm$Generator$ModuleName$enum, + author$project$Graphql$Generator$ModuleName$enum, {apiSubmodule: apiSubmodule}, enumName)); case 'InputObjectRef': @@ -11589,7 +8038,7 @@ var author$project$Graphqelm$Generator$Imports$imports = F2( } } }); -var author$project$Graphqelm$Generator$Imports$importsWithoutSelf = F3( +var author$project$Graphql$Generator$Imports$importsWithoutSelf = F3( function (apiSubmodule, importingFrom, typeRefs) { return A2( elm$core$List$filter, @@ -11598,42 +8047,42 @@ var author$project$Graphqelm$Generator$Imports$importsWithoutSelf = F3( }, A2( elm$core$List$filterMap, - author$project$Graphqelm$Generator$Imports$imports(apiSubmodule), + author$project$Graphql$Generator$Imports$imports(apiSubmodule), typeRefs)); }); -var author$project$Graphqelm$Generator$Imports$toImportString = function (moduleName) { +var author$project$Graphql$Generator$Imports$toImportString = function (moduleName) { return 'import ' + moduleName; }; -var author$project$Graphqelm$Generator$Imports$toModuleName = function (modulePath) { +var author$project$Graphql$Generator$Imports$toModuleName = function (modulePath) { return A2(elm$core$String$join, '.', modulePath); }; -var author$project$Graphqelm$Generator$Imports$importsString = F3( +var author$project$Graphql$Generator$Imports$importsString = F3( function (apiSubmodule, importingFrom, typeRefs) { return A2( elm$core$String$join, '\n', A2( elm$core$List$map, - author$project$Graphqelm$Generator$Imports$toImportString, + author$project$Graphql$Generator$Imports$toImportString, A2( elm$core$List$map, - author$project$Graphqelm$Generator$Imports$toModuleName, + author$project$Graphql$Generator$Imports$toModuleName, A3( - author$project$Graphqelm$Generator$Imports$importsWithoutSelf, + author$project$Graphql$Generator$Imports$importsWithoutSelf, apiSubmodule, importingFrom, - author$project$Graphqelm$Generator$Imports$allRefs(typeRefs))))); + author$project$Graphql$Generator$Imports$allRefs(typeRefs))))); }); -var author$project$Graphqelm$Generator$Interface$prepend = F3( +var author$project$Graphql$Generator$Interface$prepend = F3( function (_n0, moduleName, fields) { var apiSubmodule = _n0.apiSubmodule; return A2( lukewestby$elm_string_interpolate$String$Interpolate$interpolate, - 'module {0} exposing (..)\n\nimport Graphqelm.Internal.Builder.Argument as Argument exposing (Argument)\nimport Graphqelm.Field as Field exposing (Field)\nimport Graphqelm.Internal.Builder.Object as Object\nimport Graphqelm.SelectionSet exposing (FragmentSelectionSet(..), SelectionSet(..))\nimport Graphqelm.OptionalArgument exposing (OptionalArgument(..))\nimport {2}.Object\nimport {2}.Interface\nimport {2}.Union\nimport {2}.Scalar\nimport {2}.InputObject\nimport Json.Decode as Decode\nimport Graphqelm.Internal.Encode as Encode exposing (Value)\n{1}\n\n{-| Select only common fields from the interface.\n-}\ncommonSelection : (a -> constructor) -> SelectionSet (a -> constructor) {0}\ncommonSelection constructor =\n Object.selection constructor\n\n\n{-| Select both common and type-specific fields from the interface.\n-}\nselection : (Maybe typeSpecific -> a -> constructor) -> List (FragmentSelectionSet typeSpecific {0}) -> SelectionSet (a -> constructor) {0}\nselection constructor typeSpecificDecoders =\n Object.interfaceSelection typeSpecificDecoders constructor\n', + 'module {0} exposing (..)\n\nimport Graphql.Internal.Builder.Argument as Argument exposing (Argument)\nimport Graphql.Field as Field exposing (Field)\nimport Graphql.Internal.Builder.Object as Object\nimport Graphql.SelectionSet exposing (FragmentSelectionSet(FragmentSelectionSet), SelectionSet(SelectionSet))\nimport Graphql.OptionalArgument exposing (OptionalArgument(Absent))\nimport {2}.Object\nimport {2}.Interface\nimport {2}.Union\nimport {2}.Scalar\nimport {2}.InputObject\nimport Json.Decode as Decode\nimport Graphql.Internal.Encode as Encode exposing (Value)\n{1}\n\n{-| Select only common fields from the interface.\n-}\ncommonSelection : (a -> constructor) -> SelectionSet (a -> constructor) {0}\ncommonSelection constructor =\n Object.selection constructor\n\n\n{-| Select both common and type-specific fields from the interface.\n-}\nselection : (Maybe typeSpecific -> a -> constructor) -> List (FragmentSelectionSet typeSpecific {0}) -> SelectionSet (a -> constructor) {0}\nselection constructor typeSpecificDecoders =\n Object.interfaceSelection typeSpecificDecoders constructor\n', _List_fromArray( [ A2(elm$core$String$join, '.', moduleName), - A3(author$project$Graphqelm$Generator$Imports$importsString, apiSubmodule, moduleName, fields), + A3(author$project$Graphql$Generator$Imports$importsString, apiSubmodule, moduleName, fields), A2(elm$core$String$join, '.', apiSubmodule) ])); }); @@ -11668,13 +8117,13 @@ var elm$core$Dict$get = F2( } } }); -var author$project$Graphqelm$Generator$Interface$generate = F4( +var author$project$Graphql$Generator$Interface$generate = F4( function (context, name, moduleName, fields) { return _Utils_ap( - A3(author$project$Graphqelm$Generator$Interface$prepend, context, moduleName, fields), + A3(author$project$Graphql$Generator$Interface$prepend, context, moduleName, fields), _Utils_ap( A3( - author$project$Graphqelm$Generator$Interface$fragments, + author$project$Graphql$Generator$Interface$fragments, context, A2( elm$core$Maybe$withDefault, @@ -11686,31 +8135,31 @@ var author$project$Graphqelm$Generator$Interface$generate = F4( '\n\n', A2( elm$core$List$map, - A2(author$project$Graphqelm$Generator$Field$generateForInterface, context, name), + A2(author$project$Graphql$Generator$Field$generateForInterface, context, name), fields)))); }); -var author$project$Graphqelm$Generator$ModuleName$mutation = function (_n0) { +var author$project$Graphql$Generator$ModuleName$mutation = function (_n0) { var apiSubmodule = _n0.apiSubmodule; return _Utils_ap( apiSubmodule, _List_fromArray( ['Mutation'])); }; -var author$project$Graphqelm$Generator$ModuleName$query = function (_n0) { +var author$project$Graphql$Generator$ModuleName$query = function (_n0) { var apiSubmodule = _n0.apiSubmodule; return _Utils_ap( apiSubmodule, _List_fromArray( ['Query'])); }; -var author$project$Graphqelm$Generator$ModuleName$subscription = function (_n0) { +var author$project$Graphql$Generator$ModuleName$subscription = function (_n0) { var apiSubmodule = _n0.apiSubmodule; return _Utils_ap( apiSubmodule, _List_fromArray( ['Subscription'])); }; -var author$project$Graphqelm$Generator$ModuleName$generate = F2( +var author$project$Graphql$Generator$ModuleName$generate = F2( function (context, _n0) { var name = _n0.a; var definableType = _n0.b; @@ -11718,208 +8167,208 @@ var author$project$Graphqelm$Generator$ModuleName$generate = F2( switch (definableType.$) { case 'ObjectType': var fields = definableType.a; - return _Utils_eq(name, context.query) ? author$project$Graphqelm$Generator$ModuleName$query(context) : (_Utils_eq( + return _Utils_eq(name, context.query) ? author$project$Graphql$Generator$ModuleName$query(context) : (_Utils_eq( elm$core$Maybe$Just(name), - context.mutation) ? author$project$Graphqelm$Generator$ModuleName$mutation(context) : (_Utils_eq( + context.mutation) ? author$project$Graphql$Generator$ModuleName$mutation(context) : (_Utils_eq( elm$core$Maybe$Just(name), - context.subscription) ? author$project$Graphqelm$Generator$ModuleName$subscription(context) : A2(author$project$Graphqelm$Generator$ModuleName$object, context, name))); + context.subscription) ? author$project$Graphql$Generator$ModuleName$subscription(context) : A2(author$project$Graphql$Generator$ModuleName$object, context, name))); case 'ScalarType': return _List_Nil; case 'EnumType': var enumValues = definableType.a; - return A2(author$project$Graphqelm$Generator$ModuleName$enum, context, name); + return A2(author$project$Graphql$Generator$ModuleName$enum, context, name); case 'InterfaceType': var fields = definableType.a; var possibleTypes = definableType.b; - return A2(author$project$Graphqelm$Generator$ModuleName$interface, context, name); + return A2(author$project$Graphql$Generator$ModuleName$interface, context, name); case 'UnionType': var possibleTypes = definableType.a; - return A2(author$project$Graphqelm$Generator$ModuleName$union, context, name); + return A2(author$project$Graphql$Generator$ModuleName$union, context, name); default: - return A2(author$project$Graphqelm$Generator$ModuleName$inputObject, context, name); + return A2(author$project$Graphql$Generator$ModuleName$inputObject, context, name); } }); -var author$project$Graphqelm$Generator$Field$generateForObject = F3( +var author$project$Graphql$Generator$Field$generateForObject = F3( function (context, thisObjectName, field) { return A4( - author$project$Graphqelm$Generator$Field$forObject_, + author$project$Graphql$Generator$Field$forObject_, context, - A2(author$project$Graphqelm$Generator$ModuleName$object, context, thisObjectName), + A2(author$project$Graphql$Generator$ModuleName$object, context, thisObjectName), field, - A2(author$project$Graphqelm$Generator$Field$toFieldGenerator, context, field)); + A2(author$project$Graphql$Generator$Field$toFieldGenerator, context, field)); }); -var author$project$Graphqelm$Generator$StaticImports$all = function (_n0) { +var author$project$Graphql$Generator$StaticImports$all = function (_n0) { var apiSubmodule = _n0.apiSubmodule; return A2( lukewestby$elm_string_interpolate$String$Interpolate$interpolate, - 'import Graphqelm.Internal.Builder.Argument as Argument exposing (Argument)\nimport Graphqelm.Field as Field exposing (Field)\nimport Graphqelm.Internal.Builder.Object as Object\nimport Graphqelm.Internal.Encode as Encode exposing (Value)\nimport Graphqelm.Operation exposing (RootMutation, RootQuery, RootSubscription)\nimport Graphqelm.OptionalArgument exposing (OptionalArgument(..))\nimport Graphqelm.SelectionSet exposing (SelectionSet)\nimport Json.Decode as Decode exposing (Decoder)\nimport {0}.Object\nimport {0}.Interface\nimport {0}.Union\nimport {0}.Scalar\nimport {0}.InputObject\nimport Graphqelm.Internal.Builder.Object as Object\nimport Graphqelm.OptionalArgument exposing (OptionalArgument(..))\nimport Graphqelm.SelectionSet exposing (SelectionSet)\nimport Graphqelm.Operation exposing (RootMutation, RootQuery, RootSubscription)\nimport Json.Decode as Decode exposing (Decoder)\nimport Graphqelm.Internal.Encode as Encode exposing (Value)', + 'import Graphql.Internal.Builder.Argument as Argument exposing (Argument)\nimport Graphql.Field as Field exposing (Field)\nimport Graphql.Internal.Builder.Object as Object\nimport Graphql.Internal.Encode as Encode exposing (Value)\nimport Graphql.Operation exposing (RootMutation, RootQuery, RootSubscription)\nimport Graphql.OptionalArgument exposing (OptionalArgument(Absent))\nimport Graphql.SelectionSet exposing (SelectionSet)\nimport Json.Decode as Decode exposing (Decoder)\nimport {0}.Object\nimport {0}.Interface\nimport {0}.Union\nimport {0}.Scalar\nimport {0}.InputObject\nimport Graphql.Internal.Builder.Object as Object\nimport Graphql.OptionalArgument exposing (OptionalArgument(Absent))\nimport Graphql.SelectionSet exposing (SelectionSet)\nimport Graphql.Operation exposing (RootMutation, RootQuery, RootSubscription)\nimport Json.Decode as Decode exposing (Decoder)\nimport Graphql.Internal.Encode as Encode exposing (Value)', _List_fromArray( [ A2(elm$core$String$join, '.', apiSubmodule) ])); }; -var author$project$Graphqelm$Generator$Mutation$prepend = F3( +var author$project$Graphql$Generator$Mutation$prepend = F3( function (context, moduleName, fields) { var apiSubmodule = context.apiSubmodule; return A2( lukewestby$elm_string_interpolate$String$Interpolate$interpolate, - 'module {0} exposing (..)\n\n{2}\n{1}\n\n\n{-| Select fields to build up a top-level mutation. The request can be sent with\nfunctions from `Graphqelm.Http`.\n-}\nselection : (a -> constructor) -> SelectionSet (a -> constructor) RootMutation\nselection constructor =\n Object.selection constructor\n', + 'module {0} exposing (..)\n\n{2}\n{1}\n\n\n{-| Select fields to build up a top-level mutation. The request can be sent with\nfunctions from `Graphql.Http`.\n-}\nselection : (a -> constructor) -> SelectionSet (a -> constructor) RootMutation\nselection constructor =\n Object.selection constructor\n', _List_fromArray( [ A2(elm$core$String$join, '.', moduleName), - A3(author$project$Graphqelm$Generator$Imports$importsString, apiSubmodule, moduleName, fields), - author$project$Graphqelm$Generator$StaticImports$all(context) + A3(author$project$Graphql$Generator$Imports$importsString, apiSubmodule, moduleName, fields), + author$project$Graphql$Generator$StaticImports$all(context) ])); }); -var author$project$Graphqelm$Generator$Mutation$generate = F3( +var author$project$Graphql$Generator$Mutation$generate = F3( function (context, moduleName, fields) { return _Utils_ap( - A3(author$project$Graphqelm$Generator$Mutation$prepend, context, moduleName, fields), + A3(author$project$Graphql$Generator$Mutation$prepend, context, moduleName, fields), A2( elm$core$String$join, '\n\n', A2( elm$core$List$map, A2( - author$project$Graphqelm$Generator$Field$generateForObject, + author$project$Graphql$Generator$Field$generateForObject, context, A2( elm$core$Maybe$withDefault, - author$project$Graphqelm$Parser$ClassCaseName$build(''), + author$project$Graphql$Parser$ClassCaseName$build(''), context.mutation)), fields))); }); -var author$project$Graphqelm$Generator$Object$prepend = F3( +var author$project$Graphql$Generator$Object$prepend = F3( function (_n0, moduleName, fields) { var apiSubmodule = _n0.apiSubmodule; return A2( lukewestby$elm_string_interpolate$String$Interpolate$interpolate, - 'module {0} exposing (..)\n\nimport Graphqelm.Internal.Builder.Argument as Argument exposing (Argument)\nimport Graphqelm.Field as Field exposing (Field)\nimport Graphqelm.Internal.Builder.Object as Object\nimport Graphqelm.SelectionSet exposing (SelectionSet)\nimport Graphqelm.OptionalArgument exposing (OptionalArgument(..))\nimport {2}.Object\nimport {2}.Interface\nimport {2}.Union\nimport {2}.Scalar\nimport {2}.InputObject\nimport Json.Decode as Decode\nimport Graphqelm.Internal.Encode as Encode exposing (Value)\n{1}\n\n\n{-| Select fields to build up a SelectionSet for this object.\n-}\nselection : (a -> constructor) -> SelectionSet (a -> constructor) {0}\nselection constructor =\n Object.selection constructor\n', + 'module {0} exposing (..)\n\nimport Graphql.Internal.Builder.Argument as Argument exposing (Argument)\nimport Graphql.Field as Field exposing (Field)\nimport Graphql.Internal.Builder.Object as Object\nimport Graphql.SelectionSet exposing (SelectionSet)\nimport Graphql.OptionalArgument exposing (OptionalArgument(Absent))\nimport {2}.Object\nimport {2}.Interface\nimport {2}.Union\nimport {2}.Scalar\nimport {2}.InputObject\nimport Json.Decode as Decode\nimport Graphql.Internal.Encode as Encode exposing (Value)\n{1}\n\n\n{-| Select fields to build up a SelectionSet for this object.\n-}\nselection : (a -> constructor) -> SelectionSet (a -> constructor) {0}\nselection constructor =\n Object.selection constructor\n', _List_fromArray( [ A2(elm$core$String$join, '.', moduleName), - A3(author$project$Graphqelm$Generator$Imports$importsString, apiSubmodule, moduleName, fields), + A3(author$project$Graphql$Generator$Imports$importsString, apiSubmodule, moduleName, fields), A2(elm$core$String$join, '.', apiSubmodule) ])); }); -var author$project$Graphqelm$Generator$Object$generate = F4( +var author$project$Graphql$Generator$Object$generate = F4( function (context, name, moduleName, fields) { return _Utils_ap( - A3(author$project$Graphqelm$Generator$Object$prepend, context, moduleName, fields), + A3(author$project$Graphql$Generator$Object$prepend, context, moduleName, fields), A2( elm$core$String$join, '\n\n', A2( elm$core$List$map, - A2(author$project$Graphqelm$Generator$Field$generateForObject, context, name), + A2(author$project$Graphql$Generator$Field$generateForObject, context, name), fields))); }); -var author$project$Graphqelm$Generator$Query$prepend = F3( +var author$project$Graphql$Generator$Query$prepend = F3( function (context, moduleName, fields) { var apiSubmodule = context.apiSubmodule; return A2( lukewestby$elm_string_interpolate$String$Interpolate$interpolate, - 'module {0} exposing (..)\n\n{2}\n{1}\n\n\n{-| Select fields to build up a top-level query. The request can be sent with\nfunctions from `Graphqelm.Http`.\n-}\nselection : (a -> constructor) -> SelectionSet (a -> constructor) RootQuery\nselection constructor =\n Object.selection constructor\n', + 'module {0} exposing (..)\n\n{2}\n{1}\n\n\n{-| Select fields to build up a top-level query. The request can be sent with\nfunctions from `Graphql.Http`.\n-}\nselection : (a -> constructor) -> SelectionSet (a -> constructor) RootQuery\nselection constructor =\n Object.selection constructor\n', _List_fromArray( [ A2(elm$core$String$join, '.', moduleName), - A3(author$project$Graphqelm$Generator$Imports$importsString, apiSubmodule, moduleName, fields), - author$project$Graphqelm$Generator$StaticImports$all(context) + A3(author$project$Graphql$Generator$Imports$importsString, apiSubmodule, moduleName, fields), + author$project$Graphql$Generator$StaticImports$all(context) ])); }); -var author$project$Graphqelm$Generator$Query$generate = F3( +var author$project$Graphql$Generator$Query$generate = F3( function (context, moduleName, fields) { return _Utils_ap( - A3(author$project$Graphqelm$Generator$Query$prepend, context, moduleName, fields), + A3(author$project$Graphql$Generator$Query$prepend, context, moduleName, fields), A2( elm$core$String$join, '\n\n', A2( elm$core$List$map, - A2(author$project$Graphqelm$Generator$Field$generateForObject, context, context.query), + A2(author$project$Graphql$Generator$Field$generateForObject, context, context.query), fields))); }); -var author$project$Graphqelm$Generator$Subscription$prepend = F3( +var author$project$Graphql$Generator$Subscription$prepend = F3( function (context, moduleName, fields) { var apiSubmodule = context.apiSubmodule; return A2( lukewestby$elm_string_interpolate$String$Interpolate$interpolate, - 'module {0} exposing (..)\n\n{2}\n{1}\n\n\n{-| Select fields to build up a top-level mutation. The request can be sent with\nfunctions from `Graphqelm.Http`.\n-}\nselection : (a -> constructor) -> SelectionSet (a -> constructor) RootSubscription\nselection constructor =\n Object.selection constructor\n', + 'module {0} exposing (..)\n\n{2}\n{1}\n\n\n{-| Select fields to build up a top-level mutation. The request can be sent with\nfunctions from `Graphql.Http`.\n-}\nselection : (a -> constructor) -> SelectionSet (a -> constructor) RootSubscription\nselection constructor =\n Object.selection constructor\n', _List_fromArray( [ A2(elm$core$String$join, '.', moduleName), - A3(author$project$Graphqelm$Generator$Imports$importsString, apiSubmodule, moduleName, fields), - author$project$Graphqelm$Generator$StaticImports$all(context) + A3(author$project$Graphql$Generator$Imports$importsString, apiSubmodule, moduleName, fields), + author$project$Graphql$Generator$StaticImports$all(context) ])); }); -var author$project$Graphqelm$Generator$Subscription$generate = F3( +var author$project$Graphql$Generator$Subscription$generate = F3( function (context, moduleName, fields) { return _Utils_ap( - A3(author$project$Graphqelm$Generator$Subscription$prepend, context, moduleName, fields), + A3(author$project$Graphql$Generator$Subscription$prepend, context, moduleName, fields), A2( elm$core$String$join, '\n\n', A2( elm$core$List$map, A2( - author$project$Graphqelm$Generator$Field$generateForObject, + author$project$Graphql$Generator$Field$generateForObject, context, A2( elm$core$Maybe$withDefault, - author$project$Graphqelm$Parser$ClassCaseName$build(''), + author$project$Graphql$Parser$ClassCaseName$build(''), context.subscription)), fields))); }); -var author$project$Graphqelm$Generator$Union$fragment = F3( +var author$project$Graphql$Generator$Union$fragment = F3( function (context, moduleName, interfaceImplementor) { return A2( lukewestby$elm_string_interpolate$String$Interpolate$interpolate, 'on{0} : SelectionSet decodesTo {2} -> FragmentSelectionSet decodesTo {3}\non{0} (SelectionSet fields decoder) =\n FragmentSelectionSet "{1}" fields decoder\n', _List_fromArray( [ - author$project$Graphqelm$Parser$ClassCaseName$normalized(interfaceImplementor), - author$project$Graphqelm$Parser$ClassCaseName$raw(interfaceImplementor), + author$project$Graphql$Parser$ClassCaseName$normalized(interfaceImplementor), + author$project$Graphql$Parser$ClassCaseName$raw(interfaceImplementor), A2( elm$core$String$join, '.', - A2(author$project$Graphqelm$Generator$ModuleName$object, context, interfaceImplementor)), + A2(author$project$Graphql$Generator$ModuleName$object, context, interfaceImplementor)), A2(elm$core$String$join, '.', moduleName) ])); }); -var author$project$Graphqelm$Generator$Union$fragments = F3( +var author$project$Graphql$Generator$Union$fragments = F3( function (context, implementors, moduleName) { return A2( elm$core$String$join, '\n\n', A2( elm$core$List$map, - A2(author$project$Graphqelm$Generator$Union$fragment, context, moduleName), + A2(author$project$Graphql$Generator$Union$fragment, context, moduleName), implementors)); }); -var author$project$Graphqelm$Generator$Union$prepend = F2( +var author$project$Graphql$Generator$Union$prepend = F2( function (_n0, moduleName) { var apiSubmodule = _n0.apiSubmodule; return A2( lukewestby$elm_string_interpolate$String$Interpolate$interpolate, - 'module {0} exposing (..)\n\nimport Graphqelm.Internal.Builder.Argument as Argument exposing (Argument)\nimport Graphqelm.Field as Field exposing (Field)\nimport Graphqelm.Internal.Builder.Object as Object\nimport Graphqelm.SelectionSet exposing (FragmentSelectionSet(..), SelectionSet(..))\nimport Graphqelm.OptionalArgument exposing (OptionalArgument(..))\nimport {1}.Object\nimport {1}.Interface\nimport {1}.Union\nimport {1}.Scalar\nimport {1}.InputObject\nimport Json.Decode as Decode\nimport Graphqelm.Internal.Encode as Encode exposing (Value)\n\n\nselection : (Maybe typeSpecific -> constructor) -> List (FragmentSelectionSet typeSpecific {0}) -> SelectionSet constructor {0}\nselection constructor typeSpecificDecoders =\n Object.unionSelection typeSpecificDecoders constructor\n', + 'module {0} exposing (..)\n\nimport Graphql.Internal.Builder.Argument as Argument exposing (Argument)\nimport Graphql.Field as Field exposing (Field)\nimport Graphql.Internal.Builder.Object as Object\nimport Graphql.SelectionSet exposing (FragmentSelectionSet(FragmentSelectionSet), SelectionSet(SelectionSet))\nimport Graphql.OptionalArgument exposing (OptionalArgument(Absent))\nimport {1}.Object\nimport {1}.Interface\nimport {1}.Union\nimport {1}.Scalar\nimport {1}.InputObject\nimport Json.Decode as Decode\nimport Graphql.Internal.Encode as Encode exposing (Value)\n\n\nselection : (Maybe typeSpecific -> constructor) -> List (FragmentSelectionSet typeSpecific {0}) -> SelectionSet constructor {0}\nselection constructor typeSpecificDecoders =\n Object.unionSelection typeSpecificDecoders constructor\n', _List_fromArray( [ A2(elm$core$String$join, '.', moduleName), A2(elm$core$String$join, '.', apiSubmodule) ])); }); -var author$project$Graphqelm$Generator$Union$generate = F4( +var author$project$Graphql$Generator$Union$generate = F4( function (context, name, moduleName, possibleTypes) { return _Utils_ap( - A2(author$project$Graphqelm$Generator$Union$prepend, context, moduleName), - A3(author$project$Graphqelm$Generator$Union$fragments, context, possibleTypes, moduleName)); + A2(author$project$Graphql$Generator$Union$prepend, context, moduleName), + A3(author$project$Graphql$Generator$Union$fragments, context, possibleTypes, moduleName)); }); -var author$project$Graphqelm$Generator$Group$toPair = F2( +var author$project$Graphql$Generator$Group$toPair = F2( function (context, definition) { var name = definition.a; var definableType = definition.b; var description = definition.c; - var moduleName = A2(author$project$Graphqelm$Generator$ModuleName$generate, context, definition); + var moduleName = A2(author$project$Graphql$Generator$ModuleName$generate, context, definition); return A2( elm$core$Maybe$map, function (fileContents) { @@ -11930,49 +8379,49 @@ var author$project$Graphqelm$Generator$Group$toPair = F2( case 'ObjectType': var fields = definableType.a; return _Utils_eq(name, context.query) ? elm$core$Maybe$Just( - A3(author$project$Graphqelm$Generator$Query$generate, context, moduleName, fields)) : (_Utils_eq( + A3(author$project$Graphql$Generator$Query$generate, context, moduleName, fields)) : (_Utils_eq( elm$core$Maybe$Just(name), context.mutation) ? elm$core$Maybe$Just( - A3(author$project$Graphqelm$Generator$Mutation$generate, context, moduleName, fields)) : (_Utils_eq( + A3(author$project$Graphql$Generator$Mutation$generate, context, moduleName, fields)) : (_Utils_eq( elm$core$Maybe$Just(name), context.subscription) ? elm$core$Maybe$Just( - A3(author$project$Graphqelm$Generator$Subscription$generate, context, moduleName, fields)) : elm$core$Maybe$Just( - A4(author$project$Graphqelm$Generator$Object$generate, context, name, moduleName, fields)))); + A3(author$project$Graphql$Generator$Subscription$generate, context, moduleName, fields)) : elm$core$Maybe$Just( + A4(author$project$Graphql$Generator$Object$generate, context, name, moduleName, fields)))); case 'ScalarType': return elm$core$Maybe$Nothing; case 'EnumType': var enumValues = definableType.a; return elm$core$Maybe$Just( - A4(author$project$Graphqelm$Generator$Enum$generate, name, moduleName, enumValues, description)); + A4(author$project$Graphql$Generator$Enum$generate, name, moduleName, enumValues, description)); case 'InterfaceType': var fields = definableType.a; var possibleTypes = definableType.b; return elm$core$Maybe$Just( A4( - author$project$Graphqelm$Generator$Interface$generate, + author$project$Graphql$Generator$Interface$generate, context, - author$project$Graphqelm$Parser$ClassCaseName$raw(name), + author$project$Graphql$Parser$ClassCaseName$raw(name), moduleName, fields)); case 'UnionType': var possibleTypes = definableType.a; return elm$core$Maybe$Just( - A4(author$project$Graphqelm$Generator$Union$generate, context, name, moduleName, possibleTypes)); + A4(author$project$Graphql$Generator$Union$generate, context, name, moduleName, possibleTypes)); default: var fields = definableType.a; return elm$core$Maybe$Nothing; } }()); }); -var author$project$Graphqelm$Generator$Decoder$generateEncoderLowLevel = F2( +var author$project$Graphql$Generator$Decoder$generateEncoderLowLevel = F2( function (apiSubmodule, referrableType) { return A3( - author$project$Graphqelm$Generator$Decoder$generateEncoder_, + author$project$Graphql$Generator$Decoder$generateEncoder_, true, apiSubmodule, - A2(author$project$Graphqelm$Parser$Type$TypeReference, referrableType, author$project$Graphqelm$Parser$Type$NonNullable)); + A2(author$project$Graphql$Parser$Type$TypeReference, referrableType, author$project$Graphql$Parser$Type$NonNullable)); }); -var author$project$Graphqelm$Generator$InputObjectFile$encoderFunction = F2( +var author$project$Graphql$Generator$InputObjectFile$encoderFunction = F2( function (_n0, field) { var apiSubmodule = _n0.apiSubmodule; var _n1 = field.typeRef; @@ -11985,7 +8434,7 @@ var author$project$Graphqelm$Generator$InputObjectFile$encoderFunction = F2( ' input.{0} |> Just', _List_fromArray( [ - author$project$Graphqelm$Parser$CamelCaseName$normalized(field.name) + author$project$Graphql$Parser$CamelCaseName$normalized(field.name) ])); } else { return A2( @@ -11993,7 +8442,7 @@ var author$project$Graphqelm$Generator$InputObjectFile$encoderFunction = F2( ' |> Encode.optional input.{0}', _List_fromArray( [ - author$project$Graphqelm$Parser$CamelCaseName$normalized(field.name) + author$project$Graphql$Parser$CamelCaseName$normalized(field.name) ])); } }(); @@ -12002,22 +8451,22 @@ var author$project$Graphqelm$Generator$InputObjectFile$encoderFunction = F2( '({0}) {1}', _List_fromArray( [ - A2(author$project$Graphqelm$Generator$Decoder$generateEncoderLowLevel, apiSubmodule, referrableType), + A2(author$project$Graphql$Generator$Decoder$generateEncoderLowLevel, apiSubmodule, referrableType), filledOptionalsRecord_ ])); }); -var author$project$Graphqelm$Generator$InputObjectFile$encoderForField = F2( +var author$project$Graphql$Generator$InputObjectFile$encoderForField = F2( function (context, field) { return A2( lukewestby$elm_string_interpolate$String$Interpolate$interpolate, '( "{0}", {1} )', _List_fromArray( [ - author$project$Graphqelm$Parser$CamelCaseName$raw(field.name), - A2(author$project$Graphqelm$Generator$InputObjectFile$encoderFunction, context, field) + author$project$Graphql$Parser$CamelCaseName$raw(field.name), + A2(author$project$Graphql$Generator$InputObjectFile$encoderFunction, context, field) ])); }); -var author$project$Graphqelm$Generator$InputObjectFile$encoder = F2( +var author$project$Graphql$Generator$InputObjectFile$encoder = F2( function (context, _n0) { var name = _n0.name; var fields = _n0.fields; @@ -12027,29 +8476,29 @@ var author$project$Graphqelm$Generator$InputObjectFile$encoder = F2( '({0} input)', _List_fromArray( [ - author$project$Graphqelm$Parser$ClassCaseName$normalized(name) + author$project$Graphql$Parser$ClassCaseName$normalized(name) ])) : 'input'; return A2( lukewestby$elm_string_interpolate$String$Interpolate$interpolate, '{-| Encode a {0} into a value that can be used as an argument.\n-}\nencode{0} : {0} -> Value\nencode{0} {1} =\n Encode.maybeObject\n [ {2} ]', _List_fromArray( [ - author$project$Graphqelm$Parser$ClassCaseName$normalized(name), + author$project$Graphql$Parser$ClassCaseName$normalized(name), parameter, A2( elm$core$String$join, ', ', A2( elm$core$List$map, - author$project$Graphqelm$Generator$InputObjectFile$encoderForField(context), + author$project$Graphql$Generator$InputObjectFile$encoderForField(context), fields)) ])); }); -var author$project$Graphqelm$Generator$Decoder$generateTypeForInputObject = F2( +var author$project$Graphql$Generator$Decoder$generateTypeForInputObject = F2( function (apiSubmodule, typeRef) { - return A4(author$project$Graphqelm$Generator$Decoder$generateTypeCommon, true, 'OptionalArgument', apiSubmodule, typeRef); + return A4(author$project$Graphql$Generator$Decoder$generateTypeCommon, true, 'OptionalArgument', apiSubmodule, typeRef); }); -var author$project$Graphqelm$Generator$InputObjectFile$aliasEntry = F2( +var author$project$Graphql$Generator$InputObjectFile$aliasEntry = F2( function (_n0, field) { var apiSubmodule = _n0.apiSubmodule; return A2( @@ -12057,56 +8506,56 @@ var author$project$Graphqelm$Generator$InputObjectFile$aliasEntry = F2( '{0} : {1}', _List_fromArray( [ - author$project$Graphqelm$Parser$CamelCaseName$normalized(field.name), - A2(author$project$Graphqelm$Generator$Decoder$generateTypeForInputObject, apiSubmodule, field.typeRef) + author$project$Graphql$Parser$CamelCaseName$normalized(field.name), + A2(author$project$Graphql$Generator$Decoder$generateTypeForInputObject, apiSubmodule, field.typeRef) ])); }); -var author$project$Graphqelm$Generator$InputObjectFile$typeAlias = F2( +var author$project$Graphql$Generator$InputObjectFile$typeAlias = F2( function (context, _n0) { var name = _n0.name; var fields = _n0.fields; var hasLoop = _n0.hasLoop; return hasLoop ? A2( lukewestby$elm_string_interpolate$String$Interpolate$interpolate, - '{-| Type alias for the `{0}` attributes. Note that this type\nneeds to use the `{0}` type (not just a plain type alias) because it has\nreferences to itself either directly (recursive) or indirectly (circular). See\n.\n-}\ntype alias {0}Raw =\n { {1} }\n\n\n{-| Type for the {0} input object.\n-}\ntype {0}\n = {0} {0}Raw\n ', + '{-| Type alias for the `{0}` attributes. Note that this type\nneeds to use the `{0}` type (not just a plain type alias) because it has\nreferences to itself either directly (recursive) or indirectly (circular). See\n.\n-}\ntype alias {0}Raw =\n { {1} }\n\n\n{-| Type for the {0} input object.\n-}\ntype {0}\n = {0} {0}Raw\n ', _List_fromArray( [ - author$project$Graphqelm$Parser$ClassCaseName$normalized(name), + author$project$Graphql$Parser$ClassCaseName$normalized(name), A2( elm$core$String$join, ', ', A2( elm$core$List$map, - author$project$Graphqelm$Generator$InputObjectFile$aliasEntry(context), + author$project$Graphql$Generator$InputObjectFile$aliasEntry(context), fields)) ])) : A2( lukewestby$elm_string_interpolate$String$Interpolate$interpolate, '{-| Type for the {0} input object.\n-}\ntype alias {0} =\n { {1} }\n ', _List_fromArray( [ - author$project$Graphqelm$Parser$ClassCaseName$normalized(name), + author$project$Graphql$Parser$ClassCaseName$normalized(name), A2( elm$core$String$join, ', ', A2( elm$core$List$map, - author$project$Graphqelm$Generator$InputObjectFile$aliasEntry(context), + author$project$Graphql$Generator$InputObjectFile$aliasEntry(context), fields)) ])); }); -var author$project$Graphqelm$Generator$AnnotatedArg$AnnotatedArgs = F2( +var author$project$Graphql$Generator$AnnotatedArg$AnnotatedArgs = F2( function (args, returnAnnotation) { return {args: args, returnAnnotation: returnAnnotation}; }); -var author$project$Graphqelm$Generator$AnnotatedArg$buildWithArgs = F2( +var author$project$Graphql$Generator$AnnotatedArg$buildWithArgs = F2( function (args, returnAnnotation) { - return A2(author$project$Graphqelm$Generator$AnnotatedArg$AnnotatedArgs, args, returnAnnotation); + return A2(author$project$Graphql$Generator$AnnotatedArg$AnnotatedArgs, args, returnAnnotation); }); var elm$core$Tuple$second = function (_n0) { var y = _n0.b; return y; }; -var author$project$Graphqelm$Generator$AnnotatedArg$toString = F2( +var author$project$Graphql$Generator$AnnotatedArg$toString = F2( function (functionName, _n0) { var args = _n0.args; var returnAnnotation = _n0.returnAnnotation; @@ -12133,8 +8582,8 @@ var author$project$Graphqelm$Generator$AnnotatedArg$toString = F2( A2(elm$core$String$join, ' ', parameterNames) ])); }); -var author$project$Graphqelm$Generator$InputObjectFile$Constructor$compact = elm$core$List$filterMap(elm$core$Basics$identity); -var author$project$Graphqelm$Generator$InputObjectFile$Constructor$aliasEntry = F2( +var author$project$Graphql$Generator$InputObjectFile$Constructor$compact = elm$core$List$filterMap(elm$core$Basics$identity); +var author$project$Graphql$Generator$InputObjectFile$Constructor$aliasEntry = F2( function (_n0, field) { var apiSubmodule = _n0.apiSubmodule; return A2( @@ -12142,8 +8591,8 @@ var author$project$Graphqelm$Generator$InputObjectFile$Constructor$aliasEntry = '{0} : {1}', _List_fromArray( [ - author$project$Graphqelm$Parser$CamelCaseName$normalized(field.name), - A2(author$project$Graphqelm$Generator$Decoder$generateTypeForInputObject, apiSubmodule, field.typeRef) + author$project$Graphql$Parser$CamelCaseName$normalized(field.name), + A2(author$project$Graphql$Generator$Decoder$generateTypeForInputObject, apiSubmodule, field.typeRef) ])); }); var elm$core$List$length = function (xs) { @@ -12156,7 +8605,7 @@ var elm$core$List$length = function (xs) { 0, xs); }; -var author$project$Graphqelm$Generator$InputObjectFile$Constructor$constructorFieldsAlias = F3( +var author$project$Graphql$Generator$InputObjectFile$Constructor$constructorFieldsAlias = F3( function (nameThing, context, fields) { return (elm$core$List$length(fields) > 0) ? A2( lukewestby$elm_string_interpolate$String$Interpolate$interpolate, @@ -12169,18 +8618,18 @@ var author$project$Graphqelm$Generator$InputObjectFile$Constructor$constructorFi ', ', A2( elm$core$List$map, - author$project$Graphqelm$Generator$InputObjectFile$Constructor$aliasEntry(context), + author$project$Graphql$Generator$InputObjectFile$Constructor$aliasEntry(context), fields)) ])) : ''; }); -var author$project$Graphqelm$Generator$InputObjectFile$Constructor$filledOptionalsRecord = function (optionalFields) { +var author$project$Graphql$Generator$InputObjectFile$Constructor$filledOptionalsRecord = function (optionalFields) { return A2( elm$core$String$join, ', ', A2( elm$core$List$map, function (fieldName) { - return author$project$Graphqelm$Parser$CamelCaseName$normalized(fieldName) + ' = Absent'; + return author$project$Graphql$Parser$CamelCaseName$normalized(fieldName) + ' = Absent'; }, A2( elm$core$List$map, @@ -12189,12 +8638,12 @@ var author$project$Graphqelm$Generator$InputObjectFile$Constructor$filledOptiona }, optionalFields))); }; -var author$project$Graphqelm$Generator$InputObjectFile$Constructor$when = F2( +var author$project$Graphql$Generator$InputObjectFile$Constructor$when = F2( function (condition, value) { return condition ? elm$core$Maybe$Just(value) : elm$core$Maybe$Nothing; }); -var author$project$Graphqelm$Parser$Type$Nullable = {$: 'Nullable'}; -var author$project$Graphqelm$Generator$InputObjectFile$Constructor$generate = F2( +var author$project$Graphql$Parser$Type$Nullable = {$: 'Nullable'}; +var author$project$Graphql$Generator$InputObjectFile$Constructor$generate = F2( function (context, _n0) { var name = _n0.name; var fields = _n0.fields; @@ -12210,7 +8659,7 @@ var author$project$Graphqelm$Generator$InputObjectFile$Constructor$generate = F2 '{0} = {1}.{0}', _List_fromArray( [ - author$project$Graphqelm$Parser$CamelCaseName$normalized(field.name), + author$project$Graphql$Parser$CamelCaseName$normalized(field.name), function () { var _n3 = field.typeRef; var referrableType = _n3.a; @@ -12230,7 +8679,7 @@ var author$project$Graphqelm$Generator$InputObjectFile$Constructor$generate = F2 var _n2 = field.typeRef; var referrableType = _n2.a; var isNullable = _n2.b; - return _Utils_eq(isNullable, author$project$Graphqelm$Parser$Type$NonNullable); + return _Utils_eq(isNullable, author$project$Graphql$Parser$Type$NonNullable); }, fields); var optionalFields = A2( @@ -12239,15 +8688,15 @@ var author$project$Graphqelm$Generator$InputObjectFile$Constructor$generate = F2 var _n1 = field.typeRef; var referrableType = _n1.a; var isNullable = _n1.b; - return _Utils_eq(isNullable, author$project$Graphqelm$Parser$Type$Nullable); + return _Utils_eq(isNullable, author$project$Graphql$Parser$Type$Nullable); }, fields); - var letClause = author$project$Graphqelm$Generator$Let$generate( - author$project$Graphqelm$Generator$InputObjectFile$Constructor$compact( + var letClause = author$project$Graphql$Generator$Let$generate( + author$project$Graphql$Generator$InputObjectFile$Constructor$compact( _List_fromArray( [ A2( - author$project$Graphqelm$Generator$InputObjectFile$Constructor$when, + author$project$Graphql$Generator$InputObjectFile$Constructor$when, elm$core$List$length(optionalFields) > 0, _Utils_Tuple2( 'optionals', @@ -12256,19 +8705,19 @@ var author$project$Graphqelm$Generator$InputObjectFile$Constructor$generate = F2 '\n fillOptionals\n { {0} }', _List_fromArray( [ - author$project$Graphqelm$Generator$InputObjectFile$Constructor$filledOptionalsRecord(optionalFields) + author$project$Graphql$Generator$InputObjectFile$Constructor$filledOptionalsRecord(optionalFields) ])))) ]))); var annotation = A2( - author$project$Graphqelm$Generator$AnnotatedArg$toString, - 'build' + author$project$Graphqelm$Parser$ClassCaseName$normalized(name), + author$project$Graphql$Generator$AnnotatedArg$toString, + 'build' + author$project$Graphql$Parser$ClassCaseName$normalized(name), A2( - author$project$Graphqelm$Generator$AnnotatedArg$buildWithArgs, - author$project$Graphqelm$Generator$InputObjectFile$Constructor$compact( + author$project$Graphql$Generator$AnnotatedArg$buildWithArgs, + author$project$Graphql$Generator$InputObjectFile$Constructor$compact( _List_fromArray( [ A2( - author$project$Graphqelm$Generator$InputObjectFile$Constructor$when, + author$project$Graphql$Generator$InputObjectFile$Constructor$when, elm$core$List$length(requiredFields) > 0, _Utils_Tuple2( A2( @@ -12276,11 +8725,11 @@ var author$project$Graphqelm$Generator$InputObjectFile$Constructor$generate = F2 '{0}RequiredFields', _List_fromArray( [ - author$project$Graphqelm$Parser$ClassCaseName$normalized(name) + author$project$Graphql$Parser$ClassCaseName$normalized(name) ])), 'required')), A2( - author$project$Graphqelm$Generator$InputObjectFile$Constructor$when, + author$project$Graphql$Generator$InputObjectFile$Constructor$when, elm$core$List$length(optionalFields) > 0, _Utils_Tuple2( A2( @@ -12288,11 +8737,11 @@ var author$project$Graphqelm$Generator$InputObjectFile$Constructor$generate = F2 '({0}OptionalFields -> {0}OptionalFields)', _List_fromArray( [ - author$project$Graphqelm$Parser$ClassCaseName$normalized(name) + author$project$Graphql$Parser$ClassCaseName$normalized(name) ])), 'fillOptionals')) ])), - author$project$Graphqelm$Parser$ClassCaseName$normalized(name))); + author$project$Graphql$Parser$ClassCaseName$normalized(name))); return A2( lukewestby$elm_string_interpolate$String$Interpolate$interpolate, '{0}{1}\n {2}{ {3} }\n\n{4}\n{5}\n', @@ -12300,41 +8749,56 @@ var author$project$Graphqelm$Generator$InputObjectFile$Constructor$generate = F2 [ annotation, letClause, - hasLoop ? author$project$Graphqelm$Parser$ClassCaseName$normalized(name) : '', + hasLoop ? author$project$Graphql$Parser$ClassCaseName$normalized(name) : '', returnRecord, A3( - author$project$Graphqelm$Generator$InputObjectFile$Constructor$constructorFieldsAlias, - author$project$Graphqelm$Parser$ClassCaseName$normalized(name) + 'RequiredFields', + author$project$Graphql$Generator$InputObjectFile$Constructor$constructorFieldsAlias, + author$project$Graphql$Parser$ClassCaseName$normalized(name) + 'RequiredFields', context, requiredFields), A3( - author$project$Graphqelm$Generator$InputObjectFile$Constructor$constructorFieldsAlias, - author$project$Graphqelm$Parser$ClassCaseName$normalized(name) + 'OptionalFields', + author$project$Graphql$Generator$InputObjectFile$Constructor$constructorFieldsAlias, + author$project$Graphql$Parser$ClassCaseName$normalized(name) + 'OptionalFields', context, optionalFields) ])); }); -var author$project$Graphqelm$Generator$InputObjectFile$generateEncoderAndAlias = F2( +var author$project$Graphql$Generator$InputObjectFile$generateEncoderAndAlias = F2( function (context, inputObjectDetails) { return A2( elm$core$String$join, '\n\n', _List_fromArray( [ - A2(author$project$Graphqelm$Generator$InputObjectFile$Constructor$generate, context, inputObjectDetails), - A2(author$project$Graphqelm$Generator$InputObjectFile$typeAlias, context, inputObjectDetails), - A2(author$project$Graphqelm$Generator$InputObjectFile$encoder, context, inputObjectDetails) + A2(author$project$Graphql$Generator$InputObjectFile$Constructor$generate, context, inputObjectDetails), + A2(author$project$Graphql$Generator$InputObjectFile$typeAlias, context, inputObjectDetails), + A2(author$project$Graphql$Generator$InputObjectFile$encoder, context, inputObjectDetails) ])); }); -var author$project$Graphqelm$Generator$InputObjectFile$moduleName = function (_n0) { +var author$project$Graphql$Generator$InputObjectFile$moduleName = function (_n0) { var apiSubmodule = _n0.apiSubmodule; return _Utils_ap( apiSubmodule, _List_fromArray( ['InputObject'])); }; - -var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectLoops$hasRecursiveRef = F2( +var author$project$Graphql$Generator$InputObjectFile$generateImports = F2( + function (context, fields) { + var apiSubmodule = context.apiSubmodule; + return A2( + lukewestby$elm_string_interpolate$String$Interpolate$interpolate, + 'import Graphql.Internal.Builder.Argument as Argument exposing (Argument)\nimport Graphql.Field as Field exposing (Field)\nimport Graphql.Internal.Builder.Object as Object\nimport Graphql.SelectionSet exposing (SelectionSet)\nimport Graphql.OptionalArgument exposing (OptionalArgument(Absent))\nimport {1}.Object\nimport {1}.Interface\nimport {1}.Union\nimport {1}.Scalar\nimport Json.Decode as Decode\nimport Graphql.Internal.Encode as Encode exposing (Value)\n{0}\n', + _List_fromArray( + [ + A3( + author$project$Graphql$Generator$Imports$importsString, + apiSubmodule, + author$project$Graphql$Generator$InputObjectFile$moduleName(context), + fields), + A2(elm$core$String$join, '.', apiSubmodule) + ])); + }); +var author$project$Graphql$Generator$InputObjectLoops$hasRecursiveRef = F2( function (inputObjectName, referrableType) { hasRecursiveRef: while (true) { @@ -12364,19 +8828,21 @@ var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectLoops$hasRecursiveRef } } }); -var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectLoops$fieldIsRecursive = F2( +var author$project$Graphql$Generator$InputObjectLoops$fieldIsRecursive = F2( function (inputObjectName, field) { - var _p2 = field.typeRef; - return A2(_dillonkearns$elm_graphql$Graphql_Generator_InputObjectLoops$hasRecursiveRef, inputObjectName, _p2._0); + var _n0 = field.typeRef; + var referrableType = _n0.a; + var isNullable = _n0.b; + return A2(author$project$Graphql$Generator$InputObjectLoops$hasRecursiveRef, inputObjectName, referrableType); }); -var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectLoops$isRecursive = F2( +var author$project$Graphql$Generator$InputObjectLoops$isRecursive = F2( function (inputObjectName, fields) { return A2( - _elm_lang$core$List$any, - _dillonkearns$elm_graphql$Graphql_Generator_InputObjectLoops$fieldIsRecursive(inputObjectName), + elm$core$List$any, + author$project$Graphql$Generator$InputObjectLoops$fieldIsRecursive(inputObjectName), fields); }); -var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectLoops$lookupInputObject = F2( +var author$project$Graphql$Generator$InputObjectLoops$lookupInputObject = F2( function (typeDefs, inputObjectName) { return elm$core$List$head( A2( @@ -12395,797 +8861,952 @@ var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectLoops$lookupInputObje }, typeDefs)); }); -var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectLoops$fieldIsCircular_ = F4( - function (visitedNames, typeDefs, inputObjectName, fieldTypeRef) { - fieldIsCircular_: - while (true) { - var alreadyVisitedThis = _elm_community$list_extra$List_Extra$allDifferent( - A2(_elm_lang$core$List$map, _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$raw, visitedNames)); - var _p7 = fieldTypeRef; - var _p8 = _p7._0; - switch (_p8.ctor) { - case 'InputObjectRef': - var _p9 = A2(_dillonkearns$elm_graphql$Graphql_Generator_InputObjectLoops$lookupInputObject, typeDefs, _p8._0); - if (_p9.ctor === 'Just') { - var _p10 = _p9._0._1; - return (!alreadyVisitedThis) || (A2(_dillonkearns$elm_graphql$Graphql_Generator_InputObjectLoops$isRecursive, inputObjectName, _p10) || A2( - _elm_lang$core$List$any, - A3( - _dillonkearns$elm_graphql$Graphql_Generator_InputObjectLoops$fieldIsCircular_, - {ctor: '::', _0: inputObjectName, _1: visitedNames}, - typeDefs, - inputObjectName), - A2( - elm$core$List$map, - function ($) { - return $.typeRef; - }, - fields))); - } else { - return false; - } - case 'List': - var listTypeRef = referrableType.a; - var $temp$visitedNames = A2(elm$core$List$cons, inputObjectName, visitedNames), - $temp$typeDefs = typeDefs, - $temp$inputObjectName = inputObjectName, - $temp$fieldTypeRef = listTypeRef; - visitedNames = $temp$visitedNames; - typeDefs = $temp$typeDefs; - inputObjectName = $temp$inputObjectName; - fieldTypeRef = $temp$fieldTypeRef; - continue fieldIsCircular_; - default: - return false; - } - } - }); -var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectLoops$fieldIsCircular = F3( - function (typeDefs, inputObjectName, fieldTypeRef) { - return A4( - _dillonkearns$elm_graphql$Graphql_Generator_InputObjectLoops$fieldIsCircular_, - {ctor: '[]'}, - typeDefs, - inputObjectName, - fieldTypeRef); +var elm$core$Set$Set_elm_builtin = function (a) { + return {$: 'Set_elm_builtin', a: a}; +}; +var elm$core$Set$empty = elm$core$Set$Set_elm_builtin(elm$core$Dict$empty); +var elm$core$Set$insert = F2( + function (key, _n0) { + var dict = _n0.a; + return elm$core$Set$Set_elm_builtin( + A3(elm$core$Dict$insert, key, _Utils_Tuple0, dict)); }); -var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectLoops$hasLoop = F2( - function (typeDefs, _p11) { - var _p12 = _p11; - var _p13 = _p12._1; - if (_p13.ctor === 'InputObjectType') { - return A2( - _elm_lang$core$List$any, - A2(_dillonkearns$elm_graphql$Graphql_Generator_InputObjectLoops$fieldIsCircular, typeDefs, _p12._0), - A2( - elm$core$List$map, - function ($) { - return $.typeRef; - }, - fields)); +var elm$core$Dict$member = F2( + function (key, dict) { + var _n0 = A2(elm$core$Dict$get, key, dict); + if (_n0.$ === 'Just') { + return true; } else { return false; } }); -var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectLoops$any = function (typeDefs) { - return A2( - _elm_lang$core$List$any, - _dillonkearns$elm_graphql$Graphql_Generator_InputObjectLoops$hasLoop(typeDefs), - typeDefs); -}; - -var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile$isInputObject = F2( - function (typeDefs, _p0) { - var _p1 = _p0; - var _p3 = _p1._1; - var _p2 = _p3; - if (_p2.ctor === 'InputObjectType') { - return _elm_lang$core$Maybe$Just( - { - name: _p1._0, - definableType: _p3, - fields: _p2._0, - hasLoop: A2(_dillonkearns$elm_graphql$Graphql_Generator_InputObjectLoops$hasLoop, typeDefs, _p1) - }); - } else { - return _elm_lang$core$Maybe$Nothing; - } +var elm$core$Set$member = F2( + function (key, _n0) { + var dict = _n0.a; + return A2(elm$core$Dict$member, key, dict); }); -var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile$encoderFunction = F2( - function (_p4, field) { - var _p5 = _p4; - var _p6 = field.typeRef; - var filledOptionalsRecord = function () { - var _p7 = _p6._1; - if (_p7.ctor === 'NonNullable') { - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - ' input.{0} |> Just', - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$normalized(field.name), - _1: {ctor: '[]'} - }); +var elm_community$list_extra$List$Extra$uniqueHelp = F4( + function (f, existing, remaining, accumulator) { + uniqueHelp: + while (true) { + if (!remaining.b) { + return elm$core$List$reverse(accumulator); } else { - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - ' |> Encode.optional input.{0}', - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$normalized(field.name), - _1: {ctor: '[]'} - }); - } - }(); - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '({0}) {1}', - { - ctor: '::', - _0: A2(_dillonkearns$elm_graphql$Graphql_Generator_Decoder$generateEncoderLowLevel, _p5.apiSubmodule, _p6._0), - _1: { - ctor: '::', - _0: filledOptionalsRecord, - _1: {ctor: '[]'} - } - }); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile$encoderForField = F2( - function (context, field) { - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '( \"{0}\", {1} )', - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$raw(field.name), - _1: { - ctor: '::', - _0: A2(_dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile$encoderFunction, context, field), - _1: {ctor: '[]'} - } - }); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile$encoder = F2( - function (context, _p8) { - var _p9 = _p8; - var _p10 = _p9.name; - var parameter = _p9.hasLoop ? A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '({0} input)', - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(_p10), - _1: {ctor: '[]'} - }) : 'input'; - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '{-| Encode a {0} into a value that can be used as an argument.\n-}\nencode{0} : {0} -> Value\nencode{0} {1} =\n Encode.maybeObject\n [ {2} ]', - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(_p10), - _1: { - ctor: '::', - _0: parameter, - _1: { - ctor: '::', - _0: A2( - _elm_lang$core$String$join, - ', ', - A2( - _elm_lang$core$List$map, - _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile$encoderForField(context), - _p9.fields)), - _1: {ctor: '[]'} - } - } - }); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile$aliasEntry = F2( - function (_p11, field) { - var _p12 = _p11; - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '{0} : {1}', - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$normalized(field.name), - _1: { - ctor: '::', - _0: A2(_dillonkearns$elm_graphql$Graphql_Generator_Decoder$generateTypeForInputObject, _p12.apiSubmodule, field.typeRef), - _1: {ctor: '[]'} - } - }); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile$typeAlias = F2( - function (context, _p13) { - var _p14 = _p13; - var _p16 = _p14.name; - var _p15 = _p14.fields; - return _p14.hasLoop ? A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '{-| Type alias for the `{0}` attributes. Note that this type\nneeds to use the `{0}` type (not just a plain type alias) because it has\nreferences to itself either directly (recursive) or indirectly (circular). See\n.\n-}\ntype alias {0}Raw =\n { {1} }\n\n\n{-| Type for the {0} input object.\n-}\ntype {0}\n = {0} {0}Raw\n ', - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(_p16), - _1: { - ctor: '::', - _0: A2( - _elm_lang$core$String$join, - ', ', - A2( - _elm_lang$core$List$map, - _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile$aliasEntry(context), - _p15)), - _1: {ctor: '[]'} - } - }) : A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - '{-| Type for the {0} input object.\n-}\ntype alias {0} =\n { {1} }\n ', - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(_p16), - _1: { - ctor: '::', - _0: A2( - _elm_lang$core$String$join, - ', ', - A2( - _elm_lang$core$List$map, - _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile$aliasEntry(context), - _p15)), - _1: {ctor: '[]'} - } - }); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile$filledOptionalsRecord = function (optionalFields) { - return A2( - _elm_lang$core$String$join, - ', ', - A2( - _elm_lang$core$List$map, - function (fieldName) { - return A2( - _elm_lang$core$Basics_ops['++'], - _dillonkearns$elm_graphql$Graphql_Parser_CamelCaseName$normalized(fieldName), - ' = Absent'); - }, - A2( - _elm_lang$core$List$map, - function (_) { - return _.name; - }, - optionalFields))); -}; -var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile$generateEncoderAndAlias = F2( - function (context, inputObjectDetails) { - return A2( - _elm_lang$core$String$join, - '\n\n', - { - ctor: '::', - _0: A2(_dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile_Constructor$generate, context, inputObjectDetails), - _1: { - ctor: '::', - _0: A2(_dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile$typeAlias, context, inputObjectDetails), - _1: { - ctor: '::', - _0: A2(_dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile$encoder, context, inputObjectDetails), - _1: {ctor: '[]'} - } + var first = remaining.a; + var rest = remaining.b; + var computedFirst = f(first); + if (A2(elm$core$Set$member, computedFirst, existing)) { + var $temp$f = f, + $temp$existing = existing, + $temp$remaining = rest, + $temp$accumulator = accumulator; + f = $temp$f; + existing = $temp$existing; + remaining = $temp$remaining; + accumulator = $temp$accumulator; + continue uniqueHelp; + } else { + var $temp$f = f, + $temp$existing = A2(elm$core$Set$insert, computedFirst, existing), + $temp$remaining = rest, + $temp$accumulator = A2(elm$core$List$cons, first, accumulator); + f = $temp$f; + existing = $temp$existing; + remaining = $temp$remaining; + accumulator = $temp$accumulator; + continue uniqueHelp; } - }); + } + } }); -var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile$moduleName = function (_p17) { - var _p18 = _p17; - return A2( - _elm_lang$core$Basics_ops['++'], - _p18.apiSubmodule, - { - ctor: '::', - _0: 'InputObject', - _1: {ctor: '[]'} - }); +var elm_community$list_extra$List$Extra$uniqueBy = F2( + function (f, list) { + return A4(elm_community$list_extra$List$Extra$uniqueHelp, f, elm$core$Set$empty, list, _List_Nil); + }); +var elm_community$list_extra$List$Extra$allDifferentBy = F2( + function (f, list) { + return _Utils_eq( + elm$core$List$length(list), + elm$core$List$length( + A2(elm_community$list_extra$List$Extra$uniqueBy, f, list))); + }); +var elm_community$list_extra$List$Extra$allDifferent = function (list) { + return A2(elm_community$list_extra$List$Extra$allDifferentBy, elm$core$Basics$identity, list); }; -var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile$generateImports = F2( - function (_p19, fields) { - var _p20 = _p19; - var _p21 = _p20.apiSubmodule; - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - 'import Graphql.Internal.Builder.Argument as Argument exposing (Argument)\nimport Graphql.Field as Field exposing (Field)\nimport Graphql.Internal.Builder.Object as Object\nimport Graphql.SelectionSet exposing (SelectionSet)\nimport Graphql.OptionalArgument exposing (OptionalArgument(Absent))\nimport {1}.Object\nimport {1}.Interface\nimport {1}.Union\nimport {1}.Scalar\nimport Json.Decode as Decode\nimport Graphql.Internal.Encode as Encode exposing (Value)\n{0}\n', - { - ctor: '::', - _0: A3( - _dillonkearns$elm_graphql$Graphql_Generator_Imports$importsString, - _p21, - _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile$moduleName(_p20), - fields), - _1: { - ctor: '::', - _0: A2(_elm_lang$core$String$join, '.', _p21), - _1: {ctor: '[]'} - } - }); +var author$project$Graphql$Generator$InputObjectLoops$fieldIsCircular_ = F4( + function (visitedNames, typeDefs, inputObjectName, fieldTypeRef) { + fieldIsCircular_: + while (true) { + var alreadyVisitedThis = elm_community$list_extra$List$Extra$allDifferent( + A2(elm$core$List$map, author$project$Graphql$Parser$ClassCaseName$raw, visitedNames)); + var referrableType = fieldTypeRef.a; + var isNullable = fieldTypeRef.b; + switch (referrableType.$) { + case 'InputObjectRef': + var inputObjectRefName = referrableType.a; + var _n2 = A2(author$project$Graphql$Generator$InputObjectLoops$lookupInputObject, typeDefs, inputObjectRefName); + if (_n2.$ === 'Just') { + var _n3 = _n2.a; + var name = _n3.a; + var fields = _n3.b; + return (!alreadyVisitedThis) || (A2(author$project$Graphql$Generator$InputObjectLoops$isRecursive, inputObjectName, fields) || A2( + elm$core$List$any, + A3( + author$project$Graphql$Generator$InputObjectLoops$fieldIsCircular_, + A2(elm$core$List$cons, inputObjectName, visitedNames), + typeDefs, + inputObjectName), + A2( + elm$core$List$map, + function ($) { + return $.typeRef; + }, + fields))); + } else { + return false; + } + case 'List': + var listTypeRef = referrableType.a; + var $temp$visitedNames = A2(elm$core$List$cons, inputObjectName, visitedNames), + $temp$typeDefs = typeDefs, + $temp$inputObjectName = inputObjectName, + $temp$fieldTypeRef = listTypeRef; + visitedNames = $temp$visitedNames; + typeDefs = $temp$typeDefs; + inputObjectName = $temp$inputObjectName; + fieldTypeRef = $temp$fieldTypeRef; + continue fieldIsCircular_; + default: + return false; + } + } + }); +var author$project$Graphql$Generator$InputObjectLoops$fieldIsCircular = F3( + function (typeDefs, inputObjectName, fieldTypeRef) { + return A4(author$project$Graphql$Generator$InputObjectLoops$fieldIsCircular_, _List_Nil, typeDefs, inputObjectName, fieldTypeRef); + }); +var author$project$Graphql$Generator$InputObjectLoops$hasLoop = F2( + function (typeDefs, _n0) { + var name = _n0.a; + var definableType = _n0.b; + var description = _n0.c; + if (definableType.$ === 'InputObjectType') { + var fields = definableType.a; + return A2( + elm$core$List$any, + A2(author$project$Graphql$Generator$InputObjectLoops$fieldIsCircular, typeDefs, name), + A2( + elm$core$List$map, + function ($) { + return $.typeRef; + }, + fields)); + } else { + return false; + } + }); +var author$project$Graphql$Generator$InputObjectFile$isInputObject = F2( + function (typeDefs, typeDef) { + var name = typeDef.a; + var definableType = typeDef.b; + var description = typeDef.c; + if (definableType.$ === 'InputObjectType') { + var fields = definableType.a; + return elm$core$Maybe$Just( + { + definableType: definableType, + fields: fields, + hasLoop: A2(author$project$Graphql$Generator$InputObjectLoops$hasLoop, typeDefs, typeDef), + name: name + }); + } else { + return elm$core$Maybe$Nothing; + } }); -var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile$generateFileContents = F2( +var author$project$Graphql$Generator$InputObjectFile$generateFileContents = F2( function (context, typeDefinitions) { var typesToGenerate = A2( - _elm_lang$core$List$filterMap, - _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile$isInputObject(typeDefinitions), + elm$core$List$filterMap, + author$project$Graphql$Generator$InputObjectFile$isInputObject(typeDefinitions), typeDefinitions); var fields = A2( - _elm_lang$core$List$concatMap, - function (_) { - return _.fields; + elm$core$List$concatMap, + function ($) { + return $.fields; }, typesToGenerate); - return _elm_lang$core$Native_Utils.eq( - typesToGenerate, - {ctor: '[]'}) ? A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - 'module {0} exposing (..)\n\n\nplaceholder : String\nplaceholder =\n \"\"\n', - { - ctor: '::', - _0: A2( - _elm_lang$core$String$join, + return _Utils_eq(typesToGenerate, _List_Nil) ? A2( + lukewestby$elm_string_interpolate$String$Interpolate$interpolate, + 'module {0} exposing (..)\n\n\nplaceholder : String\nplaceholder =\n ""\n', + _List_fromArray( + [ + A2( + elm$core$String$join, '.', - _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile$moduleName(context)), - _1: {ctor: '[]'} - }) : A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, + author$project$Graphql$Generator$InputObjectFile$moduleName(context)) + ])) : A2( + lukewestby$elm_string_interpolate$String$Interpolate$interpolate, 'module {0} exposing (..)\n\n\n{1}\n\n\n{2}\n', - { - ctor: '::', - _0: A2( - _elm_lang$core$String$join, + _List_fromArray( + [ + A2( + elm$core$String$join, '.', - _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile$moduleName(context)), - _1: { - ctor: '::', - _0: A2(_dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile$generateImports, context, fields), - _1: { - ctor: '::', - _0: A2( - _elm_lang$core$String$join, - '\n\n\n', - A2( - _elm_lang$core$List$map, - _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile$generateEncoderAndAlias(context), - typesToGenerate)), - _1: {ctor: '[]'} - } - } - }); + author$project$Graphql$Generator$InputObjectFile$moduleName(context)), + A2(author$project$Graphql$Generator$InputObjectFile$generateImports, context, fields), + A2( + elm$core$String$join, + '\n\n\n', + A2( + elm$core$List$map, + author$project$Graphql$Generator$InputObjectFile$generateEncoderAndAlias(context), + typesToGenerate)) + ])); }); -var _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile$generate = F2( +var author$project$Graphql$Generator$InputObjectFile$generate = F2( function (context, typeDefinitions) { - return { - ctor: '_Tuple2', - _0: _dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile$moduleName(context), - _1: A2(_dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile$generateFileContents, context, typeDefinitions) - }; + return _Utils_Tuple2( + author$project$Graphql$Generator$InputObjectFile$moduleName(context), + A2(author$project$Graphql$Generator$InputObjectFile$generateFileContents, context, typeDefinitions)); }); - -var _dillonkearns$elm_graphql$Graphql_Generator_Interface$prepend = F3( - function (_p0, moduleName, fields) { - var _p1 = _p0; - var _p2 = _p1.apiSubmodule; - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - 'module {0} exposing (..)\n\nimport Graphql.Internal.Builder.Argument as Argument exposing (Argument)\nimport Graphql.Field as Field exposing (Field)\nimport Graphql.Internal.Builder.Object as Object\nimport Graphql.SelectionSet exposing (FragmentSelectionSet(FragmentSelectionSet), SelectionSet(SelectionSet))\nimport Graphql.OptionalArgument exposing (OptionalArgument(Absent))\nimport {2}.Object\nimport {2}.Interface\nimport {2}.Union\nimport {2}.Scalar\nimport {2}.InputObject\nimport Json.Decode as Decode\nimport Graphql.Internal.Encode as Encode exposing (Value)\n{1}\n\n{-| Select only common fields from the interface.\n-}\ncommonSelection : (a -> constructor) -> SelectionSet (a -> constructor) {0}\ncommonSelection constructor =\n Object.selection constructor\n\n\n{-| Select both common and type-specific fields from the interface.\n-}\nselection : (Maybe typeSpecific -> a -> constructor) -> List (FragmentSelectionSet typeSpecific {0}) -> SelectionSet (a -> constructor) {0}\nselection constructor typeSpecificDecoders =\n Object.interfaceSelection typeSpecificDecoders constructor\n', - { - ctor: '::', - _0: A2(_elm_lang$core$String$join, '.', moduleName), - _1: { - ctor: '::', - _0: A3(_dillonkearns$elm_graphql$Graphql_Generator_Imports$importsString, _p2, moduleName, fields), - _1: { - ctor: '::', - _0: A2(_elm_lang$core$String$join, '.', _p2), - _1: {ctor: '[]'} - } - } - }); +var author$project$Graphql$Generator$Scalar$generateType = function (name) { + return A2( + lukewestby$elm_string_interpolate$String$Interpolate$interpolate, + 'type {0}\n = {0} String', + _List_fromArray( + [ + author$project$Graphql$Parser$ClassCaseName$normalized(name) + ])); +}; +var author$project$Graphql$Generator$Scalar$builtInNames = _List_fromArray( + ['Boolean', 'String', 'Int', 'Float']); +var author$project$Graphql$Generator$Scalar$isBuiltIn = function (name) { + return A2( + elm$core$List$member, + author$project$Graphql$Parser$ClassCaseName$raw(name), + author$project$Graphql$Generator$Scalar$builtInNames); +}; +var author$project$Graphql$Generator$Scalar$isScalar = function (definableType) { + if (definableType.$ === 'ScalarType') { + return true; + } else { + return false; + } +}; +var elm$core$Basics$and = _Basics_and; +var author$project$Graphql$Generator$Scalar$include = function (_n0) { + var name = _n0.a; + var definableType = _n0.b; + var description = _n0.c; + return author$project$Graphql$Generator$Scalar$isScalar(definableType) && (!author$project$Graphql$Generator$Scalar$isBuiltIn(name)); +}; +var author$project$Graphql$Generator$Scalar$fileContents = F2( + function (apiSubmodule, typeDefinitions) { + var typesToGenerate = A2( + elm$core$List$map, + function (_n0) { + var name = _n0.a; + var definableType = _n0.b; + var description = _n0.c; + return name; + }, + A2(elm$core$List$filter, author$project$Graphql$Generator$Scalar$include, typeDefinitions)); + var moduleName = A2( + elm$core$String$join, + '.', + _Utils_ap( + apiSubmodule, + _List_fromArray( + ['Scalar']))); + return _Utils_eq(typesToGenerate, _List_Nil) ? A2( + lukewestby$elm_string_interpolate$String$Interpolate$interpolate, + 'module {0} exposing (..)\n\n\nplaceholder : String\nplaceholder =\n ""\n', + _List_fromArray( + [moduleName])) : A2( + lukewestby$elm_string_interpolate$String$Interpolate$interpolate, + 'module {0} exposing (..)\n\n\n{1}\n', + _List_fromArray( + [ + moduleName, + A2( + elm$core$String$join, + '\n\n\n', + A2(elm$core$List$map, author$project$Graphql$Generator$Scalar$generateType, typesToGenerate)) + ])); }); -var _dillonkearns$elm_graphql$Graphql_Generator_Interface$fragment = F3( - function (context, moduleName, interfaceImplementor) { - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - 'on{0} : SelectionSet decodesTo {2} -> FragmentSelectionSet decodesTo {3}\non{0} (SelectionSet fields decoder) =\n FragmentSelectionSet \"{1}\" fields decoder\n', - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(interfaceImplementor), - _1: { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$raw(interfaceImplementor), - _1: { - ctor: '::', - _0: A2( - _elm_lang$core$String$join, +var author$project$Graphql$Generator$Scalar$generate = F2( + function (apiSubmodule, typeDefs) { + return _Utils_Tuple2( + _Utils_ap( + apiSubmodule, + _List_fromArray( + ['Scalar'])), + A2(author$project$Graphql$Generator$Scalar$fileContents, apiSubmodule, typeDefs)); + }); +var author$project$Graphql$Generator$TypeLockDefinitions$generateType = function (name) { + return A2( + lukewestby$elm_string_interpolate$String$Interpolate$interpolate, + 'type {0}\n = {0}', + _List_fromArray( + [ + author$project$Graphql$Parser$ClassCaseName$normalized(name) + ])); +}; +var author$project$Graphql$Generator$TypeLockDefinitions$generateCommon = F4( + function (typeName, includeName, apiSubmodule, typeDefinitions) { + return function (fileContents) { + return _Utils_Tuple2( + _Utils_ap( + apiSubmodule, + _List_fromArray( + [typeName])), + fileContents); + }( + function () { + var typesToGenerate = A2( + elm$core$List$map, + function (_n0) { + var name = _n0.a; + var definableType = _n0.b; + var description = _n0.c; + return name; + }, + A2(elm$core$List$filter, includeName, typeDefinitions)); + return _Utils_eq(typesToGenerate, _List_Nil) ? A2( + lukewestby$elm_string_interpolate$String$Interpolate$interpolate, + 'module {0} exposing (..)\n\n\nplaceholder : String\nplaceholder =\n ""\n', + _List_fromArray( + [ + A2( + elm$core$String$join, '.', - A2(_dillonkearns$elm_graphql$Graphql_Generator_ModuleName$object, context, interfaceImplementor)), - _1: { - ctor: '::', - _0: A2(_elm_lang$core$String$join, '.', moduleName), - _1: {ctor: '[]'} - } - } - } - }); + _Utils_ap( + apiSubmodule, + _List_fromArray( + [typeName]))) + ])) : A2( + lukewestby$elm_string_interpolate$String$Interpolate$interpolate, + 'module {0} exposing (..)\n\n\n{1}\n', + _List_fromArray( + [ + A2( + elm$core$String$join, + '.', + _Utils_ap( + apiSubmodule, + _List_fromArray( + [typeName]))), + A2( + elm$core$String$join, + '\n\n\n', + A2(elm$core$List$map, author$project$Graphql$Generator$TypeLockDefinitions$generateType, typesToGenerate)) + ])); + }()); }); -var _dillonkearns$elm_graphql$Graphql_Generator_Interface$fragments = F3( - function (context, implementors, moduleName) { - return A2( - _elm_lang$core$String$join, - '\n\n', - A2( - _elm_lang$core$List$map, - A2(_dillonkearns$elm_graphql$Graphql_Generator_Interface$fragment, context, moduleName), - implementors)); +var author$project$Graphql$Generator$TypeLockDefinitions$interfaceName = function (_n0) { + var name = _n0.a; + var definableType = _n0.b; + var description = _n0.c; + if (definableType.$ === 'InterfaceType') { + return true; + } else { + return false; + } +}; +var author$project$Graphql$Generator$TypeLockDefinitions$objectName = function (_n0) { + var name = _n0.a; + var definableType = _n0.b; + var description = _n0.c; + if (definableType.$ === 'ObjectType') { + return true; + } else { + return false; + } +}; +var author$project$Graphql$Generator$TypeLockDefinitions$unionName = function (_n0) { + var name = _n0.a; + var definableType = _n0.b; + var description = _n0.c; + if (definableType.$ === 'UnionType') { + return true; + } else { + return false; + } +}; +var author$project$Graphql$Generator$TypeLockDefinitions$generate = F2( + function (apiSubmodule, typeDefs) { + return _List_fromArray( + [ + A4(author$project$Graphql$Generator$TypeLockDefinitions$generateCommon, 'Union', author$project$Graphql$Generator$TypeLockDefinitions$unionName, apiSubmodule, typeDefs), + A4(author$project$Graphql$Generator$TypeLockDefinitions$generateCommon, 'Object', author$project$Graphql$Generator$TypeLockDefinitions$objectName, apiSubmodule, typeDefs), + A4(author$project$Graphql$Generator$TypeLockDefinitions$generateCommon, 'Interface', author$project$Graphql$Generator$TypeLockDefinitions$interfaceName, apiSubmodule, typeDefs) + ]); + }); +var elm$core$Tuple$mapFirst = F2( + function (func, _n0) { + var x = _n0.a; + var y = _n0.b; + return _Utils_Tuple2( + func(x), + y); }); -var _dillonkearns$elm_graphql$Graphql_Generator_Interface$generate = F4( - function (context, name, moduleName, fields) { - return A2( - _elm_lang$core$Basics_ops['++'], - A3(_dillonkearns$elm_graphql$Graphql_Generator_Interface$prepend, context, moduleName, fields), +var author$project$Graphql$Generator$Group$generateFiles = F2( + function (apiSubmodule, _n0) { + var typeDefinitions = _n0.typeDefinitions; + var queryObjectName = _n0.queryObjectName; + var mutationObjectName = _n0.mutationObjectName; + var subscriptionObjectName = _n0.subscriptionObjectName; + var context = { + apiSubmodule: apiSubmodule, + interfaces: author$project$Graphql$Generator$Group$interfacePossibleTypesDict(typeDefinitions), + mutation: A2(elm$core$Maybe$map, author$project$Graphql$Parser$ClassCaseName$build, mutationObjectName), + query: author$project$Graphql$Parser$ClassCaseName$build(queryObjectName), + subscription: A2(elm$core$Maybe$map, author$project$Graphql$Parser$ClassCaseName$build, subscriptionObjectName) + }; + var scalarDefinitions = A2( + author$project$Graphql$Generator$Scalar$generate, + apiSubmodule, A2( - _elm_lang$core$Basics_ops['++'], - A3( - _dillonkearns$elm_graphql$Graphql_Generator_Interface$fragments, - context, - A2( - _elm_lang$core$Maybe$withDefault, - {ctor: '[]'}, - A2(_elm_lang$core$Dict$get, name, context.interfaces)), - moduleName), + author$project$Graphql$Generator$Group$excludeSubscription, + context, A2( - _elm_lang$core$String$join, - '\n\n', - A2( - _elm_lang$core$List$map, - A2(_dillonkearns$elm_graphql$Graphql_Generator_Field$generateForInterface, context, name), - fields)))); - }); - -var _dillonkearns$elm_graphql$Graphql_Generator_StaticImports$all = function (_p0) { - var _p1 = _p0; - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - 'import Graphql.Internal.Builder.Argument as Argument exposing (Argument)\nimport Graphql.Field as Field exposing (Field)\nimport Graphql.Internal.Builder.Object as Object\nimport Graphql.Internal.Encode as Encode exposing (Value)\nimport Graphql.Operation exposing (RootMutation, RootQuery, RootSubscription)\nimport Graphql.OptionalArgument exposing (OptionalArgument(Absent))\nimport Graphql.SelectionSet exposing (SelectionSet)\nimport Json.Decode as Decode exposing (Decoder)\nimport {0}.Object\nimport {0}.Interface\nimport {0}.Union\nimport {0}.Scalar\nimport {0}.InputObject\nimport Graphql.Internal.Builder.Object as Object\nimport Graphql.OptionalArgument exposing (OptionalArgument(Absent))\nimport Graphql.SelectionSet exposing (SelectionSet)\nimport Graphql.Operation exposing (RootMutation, RootQuery, RootSubscription)\nimport Json.Decode as Decode exposing (Decoder)\nimport Graphql.Internal.Encode as Encode exposing (Value)', - { - ctor: '::', - _0: A2(_elm_lang$core$String$join, '.', _p1.apiSubmodule), - _1: {ctor: '[]'} - }); -}; - -var _dillonkearns$elm_graphql$Graphql_Generator_Mutation$prepend = F3( - function (_p0, moduleName, fields) { - var _p1 = _p0; - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - 'module {0} exposing (..)\n\n{2}\n{1}\n\n\n{-| Select fields to build up a top-level mutation. The request can be sent with\nfunctions from `Graphql.Http`.\n-}\nselection : (a -> constructor) -> SelectionSet (a -> constructor) RootMutation\nselection constructor =\n Object.selection constructor\n', - { - ctor: '::', - _0: A2(_elm_lang$core$String$join, '.', moduleName), - _1: { - ctor: '::', - _0: A3(_dillonkearns$elm_graphql$Graphql_Generator_Imports$importsString, _p1.apiSubmodule, moduleName, fields), - _1: { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Generator_StaticImports$all(_p1), - _1: {ctor: '[]'} - } - } - }); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Mutation$generate = F3( - function (context, moduleName, fields) { - return A2( - _elm_lang$core$Basics_ops['++'], - A3(_dillonkearns$elm_graphql$Graphql_Generator_Mutation$prepend, context, moduleName, fields), + author$project$Graphql$Generator$Group$excludeMutation, + context, + A2( + author$project$Graphql$Generator$Group$excludeQuery, + context, + author$project$Graphql$Generator$Group$excludeBuiltIns(typeDefinitions))))); + var typeLockDefinitions = A2( + author$project$Graphql$Generator$TypeLockDefinitions$generate, + apiSubmodule, A2( - _elm_lang$core$String$join, - '\n\n', + author$project$Graphql$Generator$Group$excludeSubscription, + context, A2( - _elm_lang$core$List$map, + author$project$Graphql$Generator$Group$excludeMutation, + context, A2( - _dillonkearns$elm_graphql$Graphql_Generator_Field$generateForObject, + author$project$Graphql$Generator$Group$excludeQuery, context, + author$project$Graphql$Generator$Group$excludeBuiltIns(typeDefinitions))))); + return elm$core$Dict$fromList( + A2( + elm$core$List$map, + elm$core$Tuple$mapFirst(author$project$Graphql$Generator$Group$moduleToFileName), + A2( + elm$core$List$append, + _List_fromArray( + [scalarDefinitions]), + A2( + elm$core$List$append, + _List_fromArray( + [ + A2(author$project$Graphql$Generator$InputObjectFile$generate, context, typeDefinitions) + ]), A2( - _elm_lang$core$Maybe$withDefault, - _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$build(''), - context.mutation)), - fields))); + elm$core$List$append, + typeLockDefinitions, + A2( + elm$core$List$filterMap, + author$project$Graphql$Generator$Group$toPair(context), + author$project$Graphql$Generator$Group$excludeBuiltIns(typeDefinitions))))))); }); - -var _dillonkearns$elm_graphql$Graphql_Generator_Object$prepend = F3( - function (_p0, moduleName, fields) { - var _p1 = _p0; - var _p2 = _p1.apiSubmodule; - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - 'module {0} exposing (..)\n\nimport Graphql.Internal.Builder.Argument as Argument exposing (Argument)\nimport Graphql.Field as Field exposing (Field)\nimport Graphql.Internal.Builder.Object as Object\nimport Graphql.SelectionSet exposing (SelectionSet)\nimport Graphql.OptionalArgument exposing (OptionalArgument(Absent))\nimport {2}.Object\nimport {2}.Interface\nimport {2}.Union\nimport {2}.Scalar\nimport {2}.InputObject\nimport Json.Decode as Decode\nimport Graphql.Internal.Encode as Encode exposing (Value)\n{1}\n\n\n{-| Select fields to build up a SelectionSet for this object.\n-}\nselection : (a -> constructor) -> SelectionSet (a -> constructor) {0}\nselection constructor =\n Object.selection constructor\n', - { - ctor: '::', - _0: A2(_elm_lang$core$String$join, '.', moduleName), - _1: { - ctor: '::', - _0: A3(_dillonkearns$elm_graphql$Graphql_Generator_Imports$importsString, _p2, moduleName, fields), - _1: { - ctor: '::', - _0: A2(_elm_lang$core$String$join, '.', _p2), - _1: {ctor: '[]'} - } - } - }); +var author$project$Graphql$Generator$Group$typeDefName = function (_n0) { + var name = _n0.a; + var definableType = _n0.b; + var description = _n0.c; + return author$project$Graphql$Parser$ClassCaseName$normalized(name); +}; +var elm$core$List$sortBy = _List_sortBy; +var author$project$Graphql$Generator$Group$sortedIntrospectionData = F4( + function (typeDefinitions, queryObjectName, mutationObjectName, subscriptionObjectName) { + return { + mutationObjectName: mutationObjectName, + queryObjectName: queryObjectName, + subscriptionObjectName: subscriptionObjectName, + typeDefinitions: A2(elm$core$List$sortBy, author$project$Graphql$Generator$Group$typeDefName, typeDefinitions) + }; }); -var _dillonkearns$elm_graphql$Graphql_Generator_Object$generate = F4( - function (context, name, moduleName, fields) { - return A2( - _elm_lang$core$Basics_ops['++'], - A3(_dillonkearns$elm_graphql$Graphql_Generator_Object$prepend, context, moduleName, fields), - A2( - _elm_lang$core$String$join, - '\n\n', - A2( - _elm_lang$core$List$map, - A2(_dillonkearns$elm_graphql$Graphql_Generator_Field$generateForObject, context, name), - fields))); +var author$project$Graphql$Parser$Type$EnumType = function (a) { + return {$: 'EnumType', a: a}; +}; +var author$project$Graphql$Parser$Type$TypeDefinition = F3( + function (a, b, c) { + return {$: 'TypeDefinition', a: a, b: b, c: c}; }); - -var _dillonkearns$elm_graphql$Graphql_Generator_Query$prepend = F3( - function (_p0, moduleName, fields) { - var _p1 = _p0; - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - 'module {0} exposing (..)\n\n{2}\n{1}\n\n\n{-| Select fields to build up a top-level query. The request can be sent with\nfunctions from `Graphql.Http`.\n-}\nselection : (a -> constructor) -> SelectionSet (a -> constructor) RootQuery\nselection constructor =\n Object.selection constructor\n', - { - ctor: '::', - _0: A2(_elm_lang$core$String$join, '.', moduleName), - _1: { - ctor: '::', - _0: A3(_dillonkearns$elm_graphql$Graphql_Generator_Imports$importsString, _p1.apiSubmodule, moduleName, fields), - _1: { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Generator_StaticImports$all(_p1), - _1: {ctor: '[]'} - } - } - }); +var author$project$Graphql$Parser$Type$typeDefinition = F3( + function (name, definableType, description) { + return A3( + author$project$Graphql$Parser$Type$TypeDefinition, + author$project$Graphql$Parser$ClassCaseName$build(name), + definableType, + description); }); -var _dillonkearns$elm_graphql$Graphql_Generator_Query$generate = F3( - function (context, moduleName, fields) { - return A2( - _elm_lang$core$Basics_ops['++'], - A3(_dillonkearns$elm_graphql$Graphql_Generator_Query$prepend, context, moduleName, fields), - A2( - _elm_lang$core$String$join, - '\n\n', - A2( - _elm_lang$core$List$map, - A2(_dillonkearns$elm_graphql$Graphql_Generator_Field$generateForObject, context, context.query), - fields))); +var author$project$Graphql$Parser$Type$createEnum = F3( + function (enumName, description, enumValues) { + return A3( + author$project$Graphql$Parser$Type$typeDefinition, + enumName, + author$project$Graphql$Parser$Type$EnumType(enumValues), + description); }); - -var _dillonkearns$elm_graphql$Graphql_Generator_Scalar$generateType = function (name) { - return A2( - lukewestby$elm_string_interpolate$String$Interpolate$interpolate, - 'type {0}\n = {0} String', - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(name), - _1: {ctor: '[]'} - }); +var author$project$Graphql$Parser$Type$EnumValue = F2( + function (name, description) { + return {description: description, name: name}; + }); +var elm$core$Basics$idiv = _Basics_idiv; +var elm$core$Elm$JsArray$initialize = _JsArray_initialize; +var elm$core$Array$initializeHelp = F5( + function (fn, fromIndex, len, nodeList, tail) { + initializeHelp: + while (true) { + if (fromIndex < 0) { + return A2( + elm$core$Array$builderToArray, + false, + {nodeList: nodeList, nodeListSize: (len / elm$core$Array$branchFactor) | 0, tail: tail}); + } else { + var leaf = elm$core$Array$Leaf( + A3(elm$core$Elm$JsArray$initialize, elm$core$Array$branchFactor, fromIndex, fn)); + var $temp$fn = fn, + $temp$fromIndex = fromIndex - elm$core$Array$branchFactor, + $temp$len = len, + $temp$nodeList = A2(elm$core$List$cons, leaf, nodeList), + $temp$tail = tail; + fn = $temp$fn; + fromIndex = $temp$fromIndex; + len = $temp$len; + nodeList = $temp$nodeList; + tail = $temp$tail; + continue initializeHelp; + } + } + }); +var elm$core$Basics$le = _Utils_le; +var elm$core$Basics$remainderBy = _Basics_remainderBy; +var elm$core$Array$initialize = F2( + function (len, fn) { + if (len <= 0) { + return elm$core$Array$empty; + } else { + var tailLen = len % elm$core$Array$branchFactor; + var tail = A3(elm$core$Elm$JsArray$initialize, tailLen, len - tailLen, fn); + var initialFromIndex = (len - tailLen) - elm$core$Array$branchFactor; + return A5(elm$core$Array$initializeHelp, fn, initialFromIndex, len, _List_Nil, tail); + } + }); +var elm$core$Result$Err = function (a) { + return {$: 'Err', a: a}; }; -var _dillonkearns$elm_graphql$Graphql_Generator_Scalar$isScalar = function (definableType) { - var _p0 = definableType; - if (_p0.ctor === 'ScalarType') { +var elm$core$Result$Ok = function (a) { + return {$: 'Ok', a: a}; +}; +var elm$core$Result$isOk = function (result) { + if (result.$ === 'Ok') { return true; } else { return false; } }; -var _dillonkearns$elm_graphql$Graphql_Generator_Scalar$builtInNames = { - ctor: '::', - _0: 'Boolean', - _1: { - ctor: '::', - _0: 'String', - _1: { - ctor: '::', - _0: 'Int', - _1: { - ctor: '::', - _0: 'Float', - _1: {ctor: '[]'} +var elm$json$Json$Decode$Failure = F2( + function (a, b) { + return {$: 'Failure', a: a, b: b}; + }); +var elm$json$Json$Decode$Field = F2( + function (a, b) { + return {$: 'Field', a: a, b: b}; + }); +var elm$json$Json$Decode$Index = F2( + function (a, b) { + return {$: 'Index', a: a, b: b}; + }); +var elm$json$Json$Decode$OneOf = function (a) { + return {$: 'OneOf', a: a}; +}; +var elm$core$Char$toCode = _Char_toCode; +var elm$core$Char$isLower = function (_char) { + var code = elm$core$Char$toCode(_char); + return (97 <= code) && (code <= 122); +}; +var elm$core$Char$isUpper = function (_char) { + var code = elm$core$Char$toCode(_char); + return (code <= 90) && (65 <= code); +}; +var elm$core$Char$isAlpha = function (_char) { + return elm$core$Char$isLower(_char) || elm$core$Char$isUpper(_char); +}; +var elm$core$Char$isDigit = function (_char) { + var code = elm$core$Char$toCode(_char); + return (code <= 57) && (48 <= code); +}; +var elm$core$Char$isAlphaNum = function (_char) { + return elm$core$Char$isLower(_char) || (elm$core$Char$isUpper(_char) || elm$core$Char$isDigit(_char)); +}; +var elm$core$List$map2 = _List_map2; +var elm$core$List$rangeHelp = F3( + function (lo, hi, list) { + rangeHelp: + while (true) { + if (_Utils_cmp(lo, hi) < 1) { + var $temp$lo = lo, + $temp$hi = hi - 1, + $temp$list = A2(elm$core$List$cons, hi, list); + lo = $temp$lo; + hi = $temp$hi; + list = $temp$list; + continue rangeHelp; + } else { + return list; } } - } -}; -var _dillonkearns$elm_graphql$Graphql_Generator_Scalar$isBuiltIn = function (name) { + }); +var elm$core$List$range = F2( + function (lo, hi) { + return A3(elm$core$List$rangeHelp, lo, hi, _List_Nil); + }); +var elm$core$List$indexedMap = F2( + function (f, xs) { + return A3( + elm$core$List$map2, + f, + A2( + elm$core$List$range, + 0, + elm$core$List$length(xs) - 1), + xs); + }); +var elm$core$String$all = _String_all; +var elm$core$String$fromInt = _String_fromNumber; +var elm$core$String$split = F2( + function (sep, string) { + return _List_fromArray( + A2(_String_split, sep, string)); + }); +var elm$json$Json$Decode$indent = function (str) { return A2( - _elm_lang$core$List$member, - _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$raw(name), - _dillonkearns$elm_graphql$Graphql_Generator_Scalar$builtInNames); + elm$core$String$join, + '\n ', + A2(elm$core$String$split, '\n', str)); }; -var _dillonkearns$elm_graphql$Graphql_Generator_Scalar$include = function (_p1) { - var _p2 = _p1; - return _dillonkearns$elm_graphql$Graphql_Generator_Scalar$isScalar(_p2._1) && (!_dillonkearns$elm_graphql$Graphql_Generator_Scalar$isBuiltIn(_p2._0)); +var elm$json$Json$Encode$encode = _Json_encode; +var elm$json$Json$Decode$errorOneOf = F2( + function (i, error) { + return '\n\n(' + (elm$core$String$fromInt(i + 1) + (') ' + elm$json$Json$Decode$indent( + elm$json$Json$Decode$errorToString(error)))); + }); +var elm$json$Json$Decode$errorToString = function (error) { + return A2(elm$json$Json$Decode$errorToStringHelp, error, _List_Nil); }; -var _dillonkearns$elm_graphql$Graphql_Generator_Scalar$fileContents = F2( - function (apiSubmodule, typeDefinitions) { - var typesToGenerate = A2( - elm$core$List$map, - function (_n0) { - var name = _n0.a; - var definableType = _n0.b; - var description = _n0.c; - return name; - }, - A2(elm$core$List$filter, author$project$Graphqelm$Generator$Scalar$include, typeDefinitions)); - var moduleName = A2( - elm$core$String$join, - '.', - _Utils_ap( - apiSubmodule, - { - ctor: '::', - _0: 'Scalar', - _1: {ctor: '[]'} - })); - var typesToGenerate = A2( - _elm_lang$core$List$map, - function (_p3) { - var _p4 = _p3; - return _p4._0; - }, - A2(_elm_lang$core$List$filter, _dillonkearns$elm_graphql$Graphql_Generator_Scalar$include, typeDefinitions)); - return _elm_lang$core$Native_Utils.eq( - typesToGenerate, - {ctor: '[]'}) ? A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - 'module {0} exposing (..)\n\n\nplaceholder : String\nplaceholder =\n \"\"\n', - { - ctor: '::', - _0: moduleName, - _1: {ctor: '[]'} - }) : A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - 'module {0} exposing (..)\n\n\n{1}\n', - { - ctor: '::', - _0: moduleName, - _1: { - ctor: '::', - _0: A2( - _elm_lang$core$String$join, - '\n\n\n', - A2(_elm_lang$core$List$map, _dillonkearns$elm_graphql$Graphql_Generator_Scalar$generateType, typesToGenerate)), - _1: {ctor: '[]'} - } - }); +var elm$json$Json$Decode$errorToStringHelp = F2( + function (error, context) { + errorToStringHelp: + while (true) { + switch (error.$) { + case 'Field': + var f = error.a; + var err = error.b; + var isSimple = function () { + var _n1 = elm$core$String$uncons(f); + if (_n1.$ === 'Nothing') { + return false; + } else { + var _n2 = _n1.a; + var _char = _n2.a; + var rest = _n2.b; + return elm$core$Char$isAlpha(_char) && A2(elm$core$String$all, elm$core$Char$isAlphaNum, rest); + } + }(); + var fieldName = isSimple ? ('.' + f) : ('[\'' + (f + '\']')); + var $temp$error = err, + $temp$context = A2(elm$core$List$cons, fieldName, context); + error = $temp$error; + context = $temp$context; + continue errorToStringHelp; + case 'Index': + var i = error.a; + var err = error.b; + var indexName = '[' + (elm$core$String$fromInt(i) + ']'); + var $temp$error = err, + $temp$context = A2(elm$core$List$cons, indexName, context); + error = $temp$error; + context = $temp$context; + continue errorToStringHelp; + case 'OneOf': + var errors = error.a; + if (!errors.b) { + return 'Ran into a Json.Decode.oneOf with no possibilities' + function () { + if (!context.b) { + return '!'; + } else { + return ' at json' + A2( + elm$core$String$join, + '', + elm$core$List$reverse(context)); + } + }(); + } else { + if (!errors.b.b) { + var err = errors.a; + var $temp$error = err, + $temp$context = context; + error = $temp$error; + context = $temp$context; + continue errorToStringHelp; + } else { + var starter = function () { + if (!context.b) { + return 'Json.Decode.oneOf'; + } else { + return 'The Json.Decode.oneOf at json' + A2( + elm$core$String$join, + '', + elm$core$List$reverse(context)); + } + }(); + var introduction = starter + (' failed in the following ' + (elm$core$String$fromInt( + elm$core$List$length(errors)) + ' ways:')); + return A2( + elm$core$String$join, + '\n\n', + A2( + elm$core$List$cons, + introduction, + A2(elm$core$List$indexedMap, elm$json$Json$Decode$errorOneOf, errors))); + } + } + default: + var msg = error.a; + var json = error.b; + var introduction = function () { + if (!context.b) { + return 'Problem with the given value:\n\n'; + } else { + return 'Problem with the value at json' + (A2( + elm$core$String$join, + '', + elm$core$List$reverse(context)) + ':\n\n '); + } + }(); + return introduction + (elm$json$Json$Decode$indent( + A2(elm$json$Json$Encode$encode, 4, json)) + ('\n\n' + msg)); + } + } }); -var _dillonkearns$elm_graphql$Graphql_Generator_Scalar$generate = F2( - function (apiSubmodule, typeDefs) { - return _Utils_Tuple2( - _Utils_ap( - apiSubmodule, - { - ctor: '::', - _0: 'Scalar', - _1: {ctor: '[]'} - }), - _1: A2(_dillonkearns$elm_graphql$Graphql_Generator_Scalar$fileContents, apiSubmodule, typeDefs) - }; +var elm$json$Json$Decode$field = _Json_decodeField; +var elm$json$Json$Decode$map = _Json_map1; +var elm$json$Json$Decode$map2 = _Json_map2; +var elm$json$Json$Decode$oneOf = _Json_oneOf; +var elm$json$Json$Decode$succeed = _Json_succeed; +var elm$json$Json$Decode$maybe = function (decoder) { + return elm$json$Json$Decode$oneOf( + _List_fromArray( + [ + A2(elm$json$Json$Decode$map, elm$core$Maybe$Just, decoder), + elm$json$Json$Decode$succeed(elm$core$Maybe$Nothing) + ])); +}; +var elm$json$Json$Decode$string = _Json_decodeString; +var author$project$Graphql$Parser$Type$enumValueDecoder = A3( + elm$json$Json$Decode$map2, + author$project$Graphql$Parser$Type$EnumValue, + A2( + elm$json$Json$Decode$map, + author$project$Graphql$Parser$ClassCaseName$build, + A2(elm$json$Json$Decode$field, 'name', elm$json$Json$Decode$string)), + A2( + elm$json$Json$Decode$field, + 'description', + elm$json$Json$Decode$maybe(elm$json$Json$Decode$string))); +var elm$json$Json$Decode$list = _Json_decodeList; +var elm$json$Json$Decode$map3 = _Json_map3; +var author$project$Graphql$Parser$Type$enumDecoder = A4( + elm$json$Json$Decode$map3, + author$project$Graphql$Parser$Type$createEnum, + A2(elm$json$Json$Decode$field, 'name', elm$json$Json$Decode$string), + elm$json$Json$Decode$maybe( + A2(elm$json$Json$Decode$field, 'description', elm$json$Json$Decode$string)), + A2( + elm$json$Json$Decode$field, + 'enumValues', + elm$json$Json$Decode$list(author$project$Graphql$Parser$Type$enumValueDecoder))); +var author$project$Graphql$Parser$Type$InputObjectType = function (a) { + return {$: 'InputObjectType', a: a}; +}; +var author$project$Graphql$Parser$Type$createInputObject = F2( + function (inputObjectName, fields) { + return A3( + author$project$Graphql$Parser$Type$typeDefinition, + inputObjectName, + author$project$Graphql$Parser$Type$InputObjectType(fields), + elm$core$Maybe$Nothing); }); - -var _dillonkearns$elm_graphql$Graphql_Generator_Subscription$prepend = F3( - function (_p0, moduleName, fields) { - var _p1 = _p0; - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - 'module {0} exposing (..)\n\n{2}\n{1}\n\n\n{-| Select fields to build up a top-level mutation. The request can be sent with\nfunctions from `Graphql.Http`.\n-}\nselection : (a -> constructor) -> SelectionSet (a -> constructor) RootSubscription\nselection constructor =\n Object.selection constructor\n', - { - ctor: '::', - _0: A2(_elm_lang$core$String$join, '.', moduleName), - _1: { - ctor: '::', - _0: A3(_dillonkearns$elm_graphql$Graphql_Generator_Imports$importsString, _p1.apiSubmodule, moduleName, fields), - _1: { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Generator_StaticImports$all(_p1), - _1: {ctor: '[]'} - } - } - }); +var author$project$Graphql$Parser$Type$RawField = F4( + function (name, description, ofType, args) { + return {args: args, description: description, name: name, ofType: ofType}; }); -var _dillonkearns$elm_graphql$Graphql_Generator_Subscription$generate = F3( - function (context, moduleName, fields) { - return A2( - _elm_lang$core$Basics_ops['++'], - A3(_dillonkearns$elm_graphql$Graphql_Generator_Subscription$prepend, context, moduleName, fields), +var author$project$Graphql$Parser$Type$RawTypeRef = function (a) { + return {$: 'RawTypeRef', a: a}; +}; +var author$project$Graphql$Parser$Type$createRawTypeRef = F3( + function (stringMaybe, typeKind, rawTypeRefMaybe) { + return author$project$Graphql$Parser$Type$RawTypeRef( + {kind: typeKind, name: stringMaybe, ofType: rawTypeRefMaybe}); + }); +var author$project$Graphql$Parser$TypeKind$Enum = {$: 'Enum'}; +var author$project$Graphql$Parser$TypeKind$InputObject = {$: 'InputObject'}; +var author$project$Graphql$Parser$TypeKind$Interface = {$: 'Interface'}; +var author$project$Graphql$Parser$TypeKind$List = {$: 'List'}; +var author$project$Graphql$Parser$TypeKind$NonNull = {$: 'NonNull'}; +var author$project$Graphql$Parser$TypeKind$Object = {$: 'Object'}; +var author$project$Graphql$Parser$TypeKind$Scalar = {$: 'Scalar'}; +var author$project$Graphql$Parser$TypeKind$Union = {$: 'Union'}; +var elm$json$Json$Decode$andThen = _Json_andThen; +var elm$json$Json$Decode$fail = _Json_fail; +var author$project$Graphql$Parser$TypeKind$decoder = A2( + elm$json$Json$Decode$andThen, + function (string) { + switch (string) { + case 'SCALAR': + return elm$json$Json$Decode$succeed(author$project$Graphql$Parser$TypeKind$Scalar); + case 'OBJECT': + return elm$json$Json$Decode$succeed(author$project$Graphql$Parser$TypeKind$Object); + case 'LIST': + return elm$json$Json$Decode$succeed(author$project$Graphql$Parser$TypeKind$List); + case 'NON_NULL': + return elm$json$Json$Decode$succeed(author$project$Graphql$Parser$TypeKind$NonNull); + case 'ENUM': + return elm$json$Json$Decode$succeed(author$project$Graphql$Parser$TypeKind$Enum); + case 'INTERFACE': + return elm$json$Json$Decode$succeed(author$project$Graphql$Parser$TypeKind$Interface); + case 'INPUT_OBJECT': + return elm$json$Json$Decode$succeed(author$project$Graphql$Parser$TypeKind$InputObject); + case 'UNION': + return elm$json$Json$Decode$succeed(author$project$Graphql$Parser$TypeKind$Union); + default: + return elm$json$Json$Decode$fail('Invalid TypeKind' + string); + } + }, + elm$json$Json$Decode$string); +var elm$json$Json$Decode$lazy = function (thunk) { + return A2( + elm$json$Json$Decode$andThen, + thunk, + elm$json$Json$Decode$succeed(_Utils_Tuple0)); +}; +function author$project$Graphql$Parser$Type$cyclic$typeRefDecoder() { + return A4( + elm$json$Json$Decode$map3, + author$project$Graphql$Parser$Type$createRawTypeRef, + elm$json$Json$Decode$maybe( + A2(elm$json$Json$Decode$field, 'name', elm$json$Json$Decode$string)), + A2(elm$json$Json$Decode$field, 'kind', author$project$Graphql$Parser$TypeKind$decoder), + elm$json$Json$Decode$maybe( A2( - _elm_lang$core$String$join, - '\n\n', - A2( - _elm_lang$core$List$map, - A2( - _dillonkearns$elm_graphql$Graphql_Generator_Field$generateForObject, - context, - A2( - _elm_lang$core$Maybe$withDefault, - _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$build(''), - context.subscription)), - fields))); - }); - -var _dillonkearns$elm_graphql$Graphql_Generator_TypeLockDefinitions$interfaceName = function (_p0) { - var _p1 = _p0; - var _p2 = _p1._1; - if (_p2.ctor === 'InterfaceType') { - return true; - } else { - return false; + elm$json$Json$Decode$field, + 'ofType', + elm$json$Json$Decode$lazy( + function (_n0) { + return author$project$Graphql$Parser$Type$cyclic$typeRefDecoder(); + })))); +} +try { + var author$project$Graphql$Parser$Type$typeRefDecoder = author$project$Graphql$Parser$Type$cyclic$typeRefDecoder(); + author$project$Graphql$Parser$Type$cyclic$typeRefDecoder = function () { + return author$project$Graphql$Parser$Type$typeRefDecoder; + }; +} catch ($) { +throw 'Some top-level definitions from `Graphql.Parser.Type` are causing infinite recursion:\n\n ┌─────┐\n │ typeRefDecoder\n └─────┘\n\nThese errors are very tricky, so read https://elm-lang.org/0.19.0/halting-problem to learn how to fix it!';} +var elm$json$Json$Decode$map4 = _Json_map4; +var author$project$Graphql$Parser$Type$inputField = A5( + elm$json$Json$Decode$map4, + author$project$Graphql$Parser$Type$RawField, + A2(elm$json$Json$Decode$field, 'name', elm$json$Json$Decode$string), + A2( + elm$json$Json$Decode$field, + 'description', + elm$json$Json$Decode$maybe(elm$json$Json$Decode$string)), + A2(elm$json$Json$Decode$field, 'type', author$project$Graphql$Parser$Type$typeRefDecoder), + elm$json$Json$Decode$succeed(_List_Nil)); +var author$project$Graphql$Parser$CamelCaseName$CamelCaseName = function (a) { + return {$: 'CamelCaseName', a: a}; +}; +var author$project$Graphql$Parser$CamelCaseName$build = author$project$Graphql$Parser$CamelCaseName$CamelCaseName; +var author$project$Graphql$Parser$Scalar$Boolean = {$: 'Boolean'}; +var author$project$Graphql$Parser$Scalar$Custom = function (a) { + return {$: 'Custom', a: a}; +}; +var author$project$Graphql$Parser$Scalar$Float = {$: 'Float'}; +var author$project$Graphql$Parser$Scalar$Int = {$: 'Int'}; +var author$project$Graphql$Parser$Scalar$String = {$: 'String'}; +var author$project$Graphql$Parser$Scalar$parse = function (scalarName) { + switch (scalarName) { + case 'String': + return author$project$Graphql$Parser$Scalar$String; + case 'Boolean': + return author$project$Graphql$Parser$Scalar$Boolean; + case 'Int': + return author$project$Graphql$Parser$Scalar$Int; + case 'Float': + return author$project$Graphql$Parser$Scalar$Float; + default: + return author$project$Graphql$Parser$Scalar$Custom( + author$project$Graphql$Parser$ClassCaseName$build(scalarName)); } }; -var _dillonkearns$elm_graphql$Graphql_Generator_TypeLockDefinitions$unionName = function (_p3) { - var _p4 = _p3; - var _p5 = _p4._1; - if (_p5.ctor === 'UnionType') { - return true; - } else { - return false; - } +var author$project$Graphql$Parser$Type$EnumRef = function (a) { + return {$: 'EnumRef', a: a}; }; -var _dillonkearns$elm_graphql$Graphql_Generator_TypeLockDefinitions$objectName = function (_p6) { - var _p7 = _p6; - var _p8 = _p7._1; - if (_p8.ctor === 'ObjectType') { - return true; - } else { - return false; - } +var author$project$Graphql$Parser$Type$InputObjectRef = function (a) { + return {$: 'InputObjectRef', a: a}; }; -var _dillonkearns$elm_graphql$Graphql_Generator_TypeLockDefinitions$generateType = function (name) { - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - 'type {0}\n = {0}', - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(name), - _1: {ctor: '[]'} - }); +var author$project$Graphql$Parser$Type$InterfaceRef = function (a) { + return {$: 'InterfaceRef', a: a}; }; -var _dillonkearns$elm_graphql$Graphql_Generator_TypeLockDefinitions$generateCommon = F4( - function (typeName, includeName, apiSubmodule, typeDefinitions) { - return function (fileContents) { - return { - ctor: '_Tuple2', - _0: A2( - _elm_lang$core$Basics_ops['++'], - apiSubmodule, - { - ctor: '::', - _0: typeName, - _1: {ctor: '[]'} - }), - _1: fileContents - }; - }( - function () { - var typesToGenerate = A2( - _elm_lang$core$List$map, - function (_p9) { - var _p10 = _p9; - return _p10._0; - }, - A2(_elm_lang$core$List$filter, includeName, typeDefinitions)); - return _elm_lang$core$Native_Utils.eq( - typesToGenerate, - {ctor: '[]'}) ? A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - 'module {0} exposing (..)\n\n\nplaceholder : String\nplaceholder =\n \"\"\n', +var author$project$Graphql$Parser$Type$List = function (a) { + return {$: 'List', a: a}; +}; +var author$project$Graphql$Parser$Type$ObjectRef = function (a) { + return {$: 'ObjectRef', a: a}; +}; +var author$project$Graphql$Parser$Type$Scalar = function (a) { + return {$: 'Scalar', a: a}; +}; +var author$project$Graphql$Parser$Type$UnionRef = function (a) { + return {$: 'UnionRef', a: a}; +}; +var author$project$Graphql$Parser$Type$expectString = function (maybeString) { + if (maybeString.$ === 'Just') { + var string = maybeString.a; + return string; + } else { + return _Debug_todo( + 'Graphql.Parser.Type', + { + start: {line: 270, column: 13}, + end: {line: 270, column: 23} + })('Expected string but got Nothing'); + } +}; +var author$project$Graphql$Parser$Type$ignoreRef = A2( + author$project$Graphql$Parser$Type$TypeReference, + author$project$Graphql$Parser$Type$Scalar(author$project$Graphql$Parser$Scalar$String), + author$project$Graphql$Parser$Type$Nullable); +var author$project$Graphql$Parser$Type$parseRef = function (_n0) { + var rawTypeRef = _n0.a; + var _n1 = rawTypeRef.kind; + switch (_n1.$) { + case 'List': + var _n2 = rawTypeRef.ofType; + if (_n2.$ === 'Just') { + var nestedOfType = _n2.a; + return A2( + author$project$Graphql$Parser$Type$TypeReference, + author$project$Graphql$Parser$Type$List( + author$project$Graphql$Parser$Type$parseRef(nestedOfType)), + author$project$Graphql$Parser$Type$Nullable); + } else { + return _Debug_todo( + 'Graphql.Parser.Type', { start: {line: 282, column: 21}, end: {line: 282, column: 31} @@ -13196,346 +9817,354 @@ var _dillonkearns$elm_graphql$Graphql_Generator_TypeLockDefinitions$generateComm if (_n3.$ === 'Just') { var scalarName = _n3.a; return A2( - author$project$Graphqelm$Parser$Type$TypeReference, - author$project$Graphqelm$Parser$Type$Scalar( - author$project$Graphqelm$Parser$Scalar$parse(scalarName)), - author$project$Graphqelm$Parser$Type$Nullable); + author$project$Graphql$Parser$Type$TypeReference, + author$project$Graphql$Parser$Type$Scalar( + author$project$Graphql$Parser$Scalar$parse(scalarName)), + author$project$Graphql$Parser$Type$Nullable); } else { return _Debug_todo( - 'Graphqelm.Parser.Type', + 'Graphql.Parser.Type', { - ctor: '::', - _0: A2( - _elm_lang$core$String$join, - '.', - A2( - _elm_lang$core$Basics_ops['++'], - apiSubmodule, - { - ctor: '::', - _0: typeName, - _1: {ctor: '[]'} - })), - _1: { - ctor: '::', - _0: A2( - _elm_lang$core$String$join, - '\n\n\n', - A2(_elm_lang$core$List$map, _dillonkearns$elm_graphql$Graphql_Generator_TypeLockDefinitions$generateType, typesToGenerate)), - _1: {ctor: '[]'} - } - }); - }()); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_TypeLockDefinitions$generate = F2( - function (apiSubmodule, typeDefs) { - return { - ctor: '::', - _0: A4(_dillonkearns$elm_graphql$Graphql_Generator_TypeLockDefinitions$generateCommon, 'Union', _dillonkearns$elm_graphql$Graphql_Generator_TypeLockDefinitions$unionName, apiSubmodule, typeDefs), - _1: { - ctor: '::', - _0: A4(_dillonkearns$elm_graphql$Graphql_Generator_TypeLockDefinitions$generateCommon, 'Object', _dillonkearns$elm_graphql$Graphql_Generator_TypeLockDefinitions$objectName, apiSubmodule, typeDefs), - _1: { - ctor: '::', - _0: A4(_dillonkearns$elm_graphql$Graphql_Generator_TypeLockDefinitions$generateCommon, 'Interface', _dillonkearns$elm_graphql$Graphql_Generator_TypeLockDefinitions$interfaceName, apiSubmodule, typeDefs), - _1: {ctor: '[]'} - } + start: {line: 292, column: 21}, + end: {line: 292, column: 31} + })('Should not get null names for scalar references'); } - }; - }); - -var _dillonkearns$elm_graphql$Graphql_Generator_Union$prepend = F2( - function (_p0, moduleName) { - var _p1 = _p0; - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - 'module {0} exposing (..)\n\nimport Graphql.Internal.Builder.Argument as Argument exposing (Argument)\nimport Graphql.Field as Field exposing (Field)\nimport Graphql.Internal.Builder.Object as Object\nimport Graphql.SelectionSet exposing (FragmentSelectionSet(FragmentSelectionSet), SelectionSet(SelectionSet))\nimport Graphql.OptionalArgument exposing (OptionalArgument(Absent))\nimport {1}.Object\nimport {1}.Interface\nimport {1}.Union\nimport {1}.Scalar\nimport {1}.InputObject\nimport Json.Decode as Decode\nimport Graphql.Internal.Encode as Encode exposing (Value)\n\n\nselection : (Maybe typeSpecific -> constructor) -> List (FragmentSelectionSet typeSpecific {0}) -> SelectionSet constructor {0}\nselection constructor typeSpecificDecoders =\n Object.unionSelection typeSpecificDecoders constructor\n', - { - ctor: '::', - _0: A2(_elm_lang$core$String$join, '.', moduleName), - _1: { - ctor: '::', - _0: A2(_elm_lang$core$String$join, '.', _p1.apiSubmodule), - _1: {ctor: '[]'} - } - }); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Union$fragment = F3( - function (context, moduleName, interfaceImplementor) { - return A2( - _lukewestby$elm_string_interpolate$String_Interpolate$interpolate, - 'on{0} : SelectionSet decodesTo {2} -> FragmentSelectionSet decodesTo {3}\non{0} (SelectionSet fields decoder) =\n FragmentSelectionSet \"{1}\" fields decoder\n', - { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(interfaceImplementor), - _1: { - ctor: '::', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$raw(interfaceImplementor), - _1: { - ctor: '::', - _0: A2( - _elm_lang$core$String$join, - '.', - A2(_dillonkearns$elm_graphql$Graphql_Generator_ModuleName$object, context, interfaceImplementor)), - _1: { - ctor: '::', - _0: A2(_elm_lang$core$String$join, '.', moduleName), - _1: {ctor: '[]'} + case 'Interface': + var _n4 = rawTypeRef.name; + if (_n4.$ === 'Just') { + var interfaceName = _n4.a; + return A2( + author$project$Graphql$Parser$Type$TypeReference, + author$project$Graphql$Parser$Type$InterfaceRef(interfaceName), + author$project$Graphql$Parser$Type$Nullable); + } else { + return _Debug_todo( + 'Graphql.Parser.Type', + { + start: {line: 300, column: 21}, + end: {line: 300, column: 31} + })('Should not get null names for interface references'); + } + case 'Object': + var _n5 = rawTypeRef.name; + if (_n5.$ === 'Just') { + var objectName = _n5.a; + return A2( + author$project$Graphql$Parser$Type$TypeReference, + author$project$Graphql$Parser$Type$ObjectRef(objectName), + author$project$Graphql$Parser$Type$Nullable); + } else { + return _Debug_todo( + 'Graphql.Parser.Type', + { + start: {line: 308, column: 21}, + end: {line: 308, column: 31} + })('Should not get null names for object references'); + } + case 'NonNull': + var _n6 = rawTypeRef.ofType; + if (_n6.$ === 'Just') { + var actualOfType = _n6.a.a; + var _n7 = _Utils_Tuple2(actualOfType.kind, actualOfType.name); + switch (_n7.a.$) { + case 'Scalar': + var _n8 = _n7.a; + var scalarName = _n7.b; + return A2( + author$project$Graphql$Parser$Type$TypeReference, + author$project$Graphql$Parser$Type$Scalar( + author$project$Graphql$Parser$Scalar$parse( + author$project$Graphql$Parser$Type$expectString(scalarName))), + author$project$Graphql$Parser$Type$NonNullable); + case 'Object': + var _n9 = _n7.a; + var objectName = _n7.b; + return A2( + author$project$Graphql$Parser$Type$TypeReference, + author$project$Graphql$Parser$Type$ObjectRef( + author$project$Graphql$Parser$Type$expectString(objectName)), + author$project$Graphql$Parser$Type$NonNullable); + case 'Interface': + var _n10 = _n7.a; + var interfaceName = _n7.b; + return A2( + author$project$Graphql$Parser$Type$TypeReference, + author$project$Graphql$Parser$Type$InterfaceRef( + author$project$Graphql$Parser$Type$expectString(interfaceName)), + author$project$Graphql$Parser$Type$NonNullable); + case 'List': + var _n11 = _n7.a; + var _n12 = actualOfType.ofType; + if (_n12.$ === 'Just') { + var nestedOfType = _n12.a; + return A2( + author$project$Graphql$Parser$Type$TypeReference, + author$project$Graphql$Parser$Type$List( + author$project$Graphql$Parser$Type$parseRef(nestedOfType)), + author$project$Graphql$Parser$Type$NonNullable); + } else { + return _Debug_todo( + 'Graphql.Parser.Type', + { + start: {line: 331, column: 37}, + end: {line: 331, column: 47} + })(''); } - } - } - }); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Union$fragments = F3( - function (context, implementors, moduleName) { - return A2( - _elm_lang$core$String$join, - '\n\n', - A2( - _elm_lang$core$List$map, - A2(_dillonkearns$elm_graphql$Graphql_Generator_Union$fragment, context, moduleName), - implementors)); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Union$generate = F4( - function (context, name, moduleName, possibleTypes) { - return A2( - _elm_lang$core$Basics_ops['++'], - A2(_dillonkearns$elm_graphql$Graphql_Generator_Union$prepend, context, moduleName), - A3(_dillonkearns$elm_graphql$Graphql_Generator_Union$fragments, context, possibleTypes, moduleName)); - }); - -var _dillonkearns$elm_graphql$Graphql_Generator_Group$toPair = F2( - function (context, _p0) { - var _p1 = _p0; - var _p4 = _p1._0; - var moduleName = A2(_dillonkearns$elm_graphql$Graphql_Generator_ModuleName$generate, context, _p1); - return A2( - _elm_lang$core$Maybe$map, - function (fileContents) { - return {ctor: '_Tuple2', _0: moduleName, _1: fileContents}; - }, - function () { - var _p2 = _p1._1; - switch (_p2.ctor) { - case 'ObjectType': - var _p3 = _p2._0; - return _elm_lang$core$Native_Utils.eq(_p4, context.query) ? _elm_lang$core$Maybe$Just( - A3(_dillonkearns$elm_graphql$Graphql_Generator_Query$generate, context, moduleName, _p3)) : (_elm_lang$core$Native_Utils.eq( - _elm_lang$core$Maybe$Just(_p4), - context.mutation) ? _elm_lang$core$Maybe$Just( - A3(_dillonkearns$elm_graphql$Graphql_Generator_Mutation$generate, context, moduleName, _p3)) : (_elm_lang$core$Native_Utils.eq( - _elm_lang$core$Maybe$Just(_p4), - context.subscription) ? _elm_lang$core$Maybe$Just( - A3(_dillonkearns$elm_graphql$Graphql_Generator_Subscription$generate, context, moduleName, _p3)) : _elm_lang$core$Maybe$Just( - A4(_dillonkearns$elm_graphql$Graphql_Generator_Object$generate, context, _p4, moduleName, _p3)))); - case 'ScalarType': - return _elm_lang$core$Maybe$Nothing; - case 'EnumType': - return _elm_lang$core$Maybe$Just( - A4(_dillonkearns$elm_graphql$Graphql_Generator_Enum$generate, _p4, moduleName, _p2._0, _p1._2)); - case 'InterfaceType': - return _elm_lang$core$Maybe$Just( - A4( - _dillonkearns$elm_graphql$Graphql_Generator_Interface$generate, - context, - _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$raw(_p4), - moduleName, - _p2._0)); - case 'UnionType': - return _elm_lang$core$Maybe$Just( - A4(_dillonkearns$elm_graphql$Graphql_Generator_Union$generate, context, _p4, moduleName, _p2._0)); + case 'NonNull': + var _n13 = _n7.a; + return _Debug_todo( + 'Graphql.Parser.Type', + { + start: {line: 334, column: 29}, + end: {line: 334, column: 39} + })('Can\'t have nested non-null types'); + case 'Ignore': + var _n14 = _n7.a; + return author$project$Graphql$Parser$Type$ignoreRef; + case 'Enum': + var _n15 = _n7.a; + var enumName = _n7.b; + return A2( + author$project$Graphql$Parser$Type$TypeReference, + author$project$Graphql$Parser$Type$EnumRef( + author$project$Graphql$Parser$ClassCaseName$build( + author$project$Graphql$Parser$Type$expectString(enumName))), + author$project$Graphql$Parser$Type$NonNullable); + case 'InputObject': + var _n16 = _n7.a; + var inputObjectName = _n7.b; + return A2( + author$project$Graphql$Parser$Type$TypeReference, + author$project$Graphql$Parser$Type$InputObjectRef( + author$project$Graphql$Parser$ClassCaseName$build( + author$project$Graphql$Parser$Type$expectString(inputObjectName))), + author$project$Graphql$Parser$Type$NonNullable); default: var _n17 = _n7.a; return A2( - author$project$Graphqelm$Parser$Type$TypeReference, - author$project$Graphqelm$Parser$Type$UnionRef( - author$project$Graphqelm$Parser$Type$expectString(actualOfType.name)), - author$project$Graphqelm$Parser$Type$NonNullable); + author$project$Graphql$Parser$Type$TypeReference, + author$project$Graphql$Parser$Type$UnionRef( + author$project$Graphql$Parser$Type$expectString(actualOfType.name)), + author$project$Graphql$Parser$Type$NonNullable); } - }()); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Group$moduleToFileName = function (modulePath) { - return A2( - _elm_lang$core$Basics_ops['++'], - A2(_elm_lang$core$String$join, '/', modulePath), - '.elm'); -}; -var _dillonkearns$elm_graphql$Graphql_Generator_Group$excludeSubscription = F2( - function (_p5, typeDefinitions) { - var _p6 = _p5; - var _p7 = _p6.subscription; - if (_p7.ctor === 'Just') { - return A2( - _elm_lang$core$List$filter, - function (_p8) { - var _p9 = _p8; - return !_elm_lang$core$Native_Utils.eq(_p9._0, _p7._0); - }, - typeDefinitions); - } else { - return typeDefinitions; - } - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Group$excludeMutation = F2( - function (_p10, typeDefinitions) { - var _p11 = _p10; - var _p12 = _p11.mutation; - if (_p12.ctor === 'Just') { + } else { + return author$project$Graphql$Parser$Type$ignoreRef; + } + case 'Ignore': + return author$project$Graphql$Parser$Type$ignoreRef; + case 'Enum': + var _n18 = rawTypeRef.name; + if (_n18.$ === 'Just') { + var objectName = _n18.a; + return A2( + author$project$Graphql$Parser$Type$TypeReference, + author$project$Graphql$Parser$Type$EnumRef( + author$project$Graphql$Parser$ClassCaseName$build(objectName)), + author$project$Graphql$Parser$Type$Nullable); + } else { + return _Debug_todo( + 'Graphql.Parser.Type', + { + start: {line: 360, column: 21}, + end: {line: 360, column: 31} + })('Should not get null names for enum references'); + } + case 'InputObject': + var _n19 = rawTypeRef.name; + if (_n19.$ === 'Just') { + var inputObjectName = _n19.a; + return A2( + author$project$Graphql$Parser$Type$TypeReference, + author$project$Graphql$Parser$Type$InputObjectRef( + author$project$Graphql$Parser$ClassCaseName$build(inputObjectName)), + author$project$Graphql$Parser$Type$Nullable); + } else { + return _Debug_todo( + 'Graphql.Parser.Type', + { + start: {line: 368, column: 21}, + end: {line: 368, column: 31} + })('Should not get null names for input object references'); + } + default: return A2( - _elm_lang$core$List$filter, - function (_p13) { - var _p14 = _p13; - return !_elm_lang$core$Native_Utils.eq(_p14._0, _p12._0); - }, - typeDefinitions); - } else { - return typeDefinitions; - } - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Group$excludeQuery = F2( - function (_p15, typeDefinitions) { - var _p16 = _p15; - return A2( - _elm_lang$core$List$filter, - function (_p17) { - var _p18 = _p17; - return !_elm_lang$core$Native_Utils.eq(_p18._0, _p16.query); - }, - typeDefinitions); - }); -var _dillonkearns$elm_graphql$Graphql_Generator_Group$excludeBuiltIns = function (typeDefinitions) { - return A2( - _elm_lang$core$List$filter, - function (_p19) { - var _p20 = _p19; - return !_dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$isBuiltIn(_p20._0); - }, - typeDefinitions); + author$project$Graphql$Parser$Type$TypeReference, + author$project$Graphql$Parser$Type$UnionRef( + author$project$Graphql$Parser$Type$expectString(rawTypeRef.name)), + author$project$Graphql$Parser$Type$Nullable); + } }; -var _dillonkearns$elm_graphql$Graphql_Generator_Group$interfacePossibleTypesDict = function (typeDefs) { - return _elm_lang$core$Dict$fromList( - A2( - _elm_lang$core$List$filterMap, - function (_p21) { - var _p22 = _p21; - var _p23 = _p22._1; - if (_p23.ctor === 'InterfaceType') { - return _elm_lang$core$Maybe$Just( - { - ctor: '_Tuple2', - _0: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$raw(_p22._0), - _1: _p23._1 - }); - } else { - return _elm_lang$core$Maybe$Nothing; - } +var author$project$Graphql$Parser$Type$parseField = function (_n0) { + var name = _n0.name; + var ofType = _n0.ofType; + var args = _n0.args; + var description = _n0.description; + return { + args: A2( + elm$core$List$map, + function (arg) { + return { + description: arg.description, + name: author$project$Graphql$Parser$CamelCaseName$build(arg.name), + typeRef: author$project$Graphql$Parser$Type$parseRef(arg.ofType) + }; }, args), description: description, - name: author$project$Graphqelm$Parser$CamelCaseName$build(name), - typeRef: author$project$Graphqelm$Parser$Type$parseRef(ofType) + name: author$project$Graphql$Parser$CamelCaseName$build(name), + typeRef: author$project$Graphql$Parser$Type$parseRef(ofType) }; }; -var _dillonkearns$elm_graphql$Graphql_Generator_Group$generateFiles = F2( - function (apiSubmodule, _p24) { - var _p25 = _p24; - var _p26 = _p25.typeDefinitions; - var context = { - query: _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$build(_p25.queryObjectName), - mutation: A2(_elm_lang$core$Maybe$map, _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$build, _p25.mutationObjectName), - subscription: A2(_elm_lang$core$Maybe$map, _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$build, _p25.subscriptionObjectName), - apiSubmodule: apiSubmodule, - interfaces: _dillonkearns$elm_graphql$Graphql_Generator_Group$interfacePossibleTypesDict(_p26) - }; - var typeLockDefinitions = A2( - _dillonkearns$elm_graphql$Graphql_Generator_TypeLockDefinitions$generate, - apiSubmodule, - A2( - _dillonkearns$elm_graphql$Graphql_Generator_Group$excludeSubscription, - context, - A2( - _dillonkearns$elm_graphql$Graphql_Generator_Group$excludeMutation, - context, - A2( - _dillonkearns$elm_graphql$Graphql_Generator_Group$excludeQuery, - context, - _dillonkearns$elm_graphql$Graphql_Generator_Group$excludeBuiltIns(_p26))))); - var scalarDefinitions = A2( - _dillonkearns$elm_graphql$Graphql_Generator_Scalar$generate, - apiSubmodule, - A2( - _dillonkearns$elm_graphql$Graphql_Generator_Group$excludeSubscription, - context, - A2( - _dillonkearns$elm_graphql$Graphql_Generator_Group$excludeMutation, - context, - A2( - _dillonkearns$elm_graphql$Graphql_Generator_Group$excludeQuery, - context, - _dillonkearns$elm_graphql$Graphql_Generator_Group$excludeBuiltIns(_p26))))); - return _elm_lang$core$Dict$fromList( +var author$project$Graphql$Parser$Type$inputObjectDecoder = A3( + elm$json$Json$Decode$map2, + author$project$Graphql$Parser$Type$createInputObject, + A2(elm$json$Json$Decode$field, 'name', elm$json$Json$Decode$string), + A2( + elm$json$Json$Decode$field, + 'inputFields', + elm$json$Json$Decode$list( + A2(elm$json$Json$Decode$map, author$project$Graphql$Parser$Type$parseField, author$project$Graphql$Parser$Type$inputField)))); +var author$project$Graphql$Parser$Type$InterfaceType = F2( + function (a, b) { + return {$: 'InterfaceType', a: a, b: b}; + }); +var author$project$Graphql$Parser$Type$createInterface = F3( + function (interfaceName, fields, possibleTypes) { + return A3( + author$project$Graphql$Parser$Type$typeDefinition, + interfaceName, A2( - _elm_lang$core$List$map, - _elm_lang$core$Tuple$mapFirst(_dillonkearns$elm_graphql$Graphql_Generator_Group$moduleToFileName), - A2( - _elm_lang$core$List$append, - { - ctor: '::', - _0: scalarDefinitions, - _1: {ctor: '[]'} - }, - A2( - _elm_lang$core$List$append, - { - ctor: '::', - _0: A2(_dillonkearns$elm_graphql$Graphql_Generator_InputObjectFile$generate, context, _p26), - _1: {ctor: '[]'} - }, - A2( - _elm_lang$core$List$append, - typeLockDefinitions, - A2( - _elm_lang$core$List$filterMap, - _dillonkearns$elm_graphql$Graphql_Generator_Group$toPair(context), - _dillonkearns$elm_graphql$Graphql_Generator_Group$excludeBuiltIns(_p26))))))); + author$project$Graphql$Parser$Type$InterfaceType, + fields, + A2(elm$core$List$map, author$project$Graphql$Parser$ClassCaseName$build, possibleTypes)), + elm$core$Maybe$Nothing); + }); +var author$project$Graphql$Parser$Type$RawArg = F3( + function (name, description, ofType) { + return {description: description, name: name, ofType: ofType}; }); -var _dillonkearns$elm_graphql$Graphql_Generator_Group$typeDefName = function (_p27) { - var _p28 = _p27; - return _dillonkearns$elm_graphql$Graphql_Parser_ClassCaseName$normalized(_p28._0); +var author$project$Graphql$Parser$Type$argDecoder = A4( + elm$json$Json$Decode$map3, + author$project$Graphql$Parser$Type$RawArg, + A2(elm$json$Json$Decode$field, 'name', elm$json$Json$Decode$string), + A2( + elm$json$Json$Decode$field, + 'description', + elm$json$Json$Decode$maybe(elm$json$Json$Decode$string)), + A2(elm$json$Json$Decode$field, 'type', author$project$Graphql$Parser$Type$typeRefDecoder)); +var author$project$Graphql$Parser$Type$fieldDecoder = A5( + elm$json$Json$Decode$map4, + author$project$Graphql$Parser$Type$RawField, + A2(elm$json$Json$Decode$field, 'name', elm$json$Json$Decode$string), + A2( + elm$json$Json$Decode$field, + 'description', + elm$json$Json$Decode$maybe(elm$json$Json$Decode$string)), + A2(elm$json$Json$Decode$field, 'type', author$project$Graphql$Parser$Type$typeRefDecoder), + A2( + elm$json$Json$Decode$field, + 'args', + elm$json$Json$Decode$list(author$project$Graphql$Parser$Type$argDecoder))); +var author$project$Graphql$Parser$Type$interfaceDecoder = A4( + elm$json$Json$Decode$map3, + author$project$Graphql$Parser$Type$createInterface, + A2(elm$json$Json$Decode$field, 'name', elm$json$Json$Decode$string), + A2( + elm$json$Json$Decode$field, + 'fields', + elm$json$Json$Decode$list( + A2(elm$json$Json$Decode$map, author$project$Graphql$Parser$Type$parseField, author$project$Graphql$Parser$Type$fieldDecoder))), + A2( + elm$json$Json$Decode$field, + 'possibleTypes', + elm$json$Json$Decode$list( + A2(elm$json$Json$Decode$field, 'name', elm$json$Json$Decode$string)))); +var author$project$Graphql$Parser$Type$ObjectType = function (a) { + return {$: 'ObjectType', a: a}; }; -var _dillonkearns$elm_graphql$Graphql_Generator_Group$sortedIntrospectionData = F4( - function (typeDefinitions, queryObjectName, mutationObjectName, subscriptionObjectName) { - return { - typeDefinitions: A2(_elm_lang$core$List$sortBy, _dillonkearns$elm_graphql$Graphql_Generator_Group$typeDefName, typeDefinitions), - queryObjectName: queryObjectName, - mutationObjectName: mutationObjectName, - subscriptionObjectName: subscriptionObjectName - }; +var author$project$Graphql$Parser$Type$createObject = F2( + function (objectName, fields) { + return A3( + author$project$Graphql$Parser$Type$typeDefinition, + objectName, + author$project$Graphql$Parser$Type$ObjectType(fields), + elm$core$Maybe$Nothing); }); -var _dillonkearns$elm_graphql$Graphql_Generator_Group$IntrospectionData = F4( - function (a, b, c, d) { - return {typeDefinitions: a, queryObjectName: b, mutationObjectName: c, subscriptionObjectName: d}; +var author$project$Graphql$Parser$Type$objectDecoder = A3( + elm$json$Json$Decode$map2, + author$project$Graphql$Parser$Type$createObject, + A2(elm$json$Json$Decode$field, 'name', elm$json$Json$Decode$string), + A2( + elm$json$Json$Decode$field, + 'fields', + elm$json$Json$Decode$list( + A2(elm$json$Json$Decode$map, author$project$Graphql$Parser$Type$parseField, author$project$Graphql$Parser$Type$fieldDecoder)))); +var author$project$Graphql$Parser$Type$ScalarType = {$: 'ScalarType'}; +var author$project$Graphql$Parser$Type$scalarDecoder = A2( + elm$json$Json$Decode$map, + function (scalarName) { + return A3(author$project$Graphql$Parser$Type$typeDefinition, scalarName, author$project$Graphql$Parser$Type$ScalarType, elm$core$Maybe$Nothing); + }, + A2(elm$json$Json$Decode$field, 'name', elm$json$Json$Decode$string)); +var author$project$Graphql$Parser$Type$UnionType = function (a) { + return {$: 'UnionType', a: a}; +}; +var author$project$Graphql$Parser$Type$createUnion = F2( + function (interfaceName, possibleTypes) { + return A3( + author$project$Graphql$Parser$Type$typeDefinition, + interfaceName, + author$project$Graphql$Parser$Type$UnionType( + A2(elm$core$List$map, author$project$Graphql$Parser$ClassCaseName$build, possibleTypes)), + elm$core$Maybe$Nothing); + }); +var author$project$Graphql$Parser$Type$unionDecoder = A3( + elm$json$Json$Decode$map2, + author$project$Graphql$Parser$Type$createUnion, + A2(elm$json$Json$Decode$field, 'name', elm$json$Json$Decode$string), + A2( + elm$json$Json$Decode$field, + 'possibleTypes', + elm$json$Json$Decode$list( + A2(elm$json$Json$Decode$field, 'name', elm$json$Json$Decode$string)))); +var author$project$Graphql$Parser$Type$decodeKind = function (kind) { + switch (kind) { + case 'OBJECT': + return author$project$Graphql$Parser$Type$objectDecoder; + case 'ENUM': + return author$project$Graphql$Parser$Type$enumDecoder; + case 'SCALAR': + return author$project$Graphql$Parser$Type$scalarDecoder; + case 'INTERFACE': + return author$project$Graphql$Parser$Type$interfaceDecoder; + case 'UNION': + return author$project$Graphql$Parser$Type$unionDecoder; + case 'INPUT_OBJECT': + return author$project$Graphql$Parser$Type$inputObjectDecoder; + default: + return elm$json$Json$Decode$fail('Unexpected kind ' + kind); + } +}; +var author$project$Graphql$Parser$Type$decoder = A2( + elm$json$Json$Decode$andThen, + author$project$Graphql$Parser$Type$decodeKind, + A2(elm$json$Json$Decode$field, 'kind', elm$json$Json$Decode$string)); +var elm$json$Json$Decode$at = F2( + function (fields, decoder) { + return A3(elm$core$List$foldr, elm$json$Json$Decode$field, decoder, fields); }); - -var _dillonkearns$elm_graphql$Graphql_Parser$decoder = function (baseModule) { +var author$project$Graphql$Parser$decoder = function (baseModule) { return A2( - _elm_lang$core$Json_Decode$map, - _dillonkearns$elm_graphql$Graphql_Generator_Group$generateFiles(baseModule), + elm$json$Json$Decode$map, + author$project$Graphql$Generator$Group$generateFiles(baseModule), A5( - _elm_lang$core$Json_Decode$map4, - _dillonkearns$elm_graphql$Graphql_Generator_Group$sortedIntrospectionData, + elm$json$Json$Decode$map4, + author$project$Graphql$Generator$Group$sortedIntrospectionData, A2( - _elm_lang$core$Json_Decode$at, - { - ctor: '::', - _0: '__schema', - _1: { - ctor: '::', - _0: 'types', - _1: {ctor: '[]'} - } - }, - _elm_lang$core$Json_Decode$list(_dillonkearns$elm_graphql$Graphql_Parser_Type$decoder)), + elm$json$Json$Decode$at, + _List_fromArray( + ['__schema', 'types']), + elm$json$Json$Decode$list(author$project$Graphql$Parser$Type$decoder)), A2( elm$json$Json$Decode$at, _List_fromArray( @@ -13571,25 +10200,34 @@ var elm$json$Json$Encode$object = function (pairs) { _Json_emptyObject(_Utils_Tuple0), pairs)); }; - -var _dillonkearns$elm_graphql$Main$workaround = _elm_lang$core$Json_Decode$string; -var _dillonkearns$elm_graphql$Main$generatedFiles = _elm_lang$core$Native_Platform.outgoingPort( - 'generatedFiles', - function (v) { - return v; +var elm_community$json_extra$Json$Encode$Extra$dict = F2( + function (toKey, toValue) { + return A2( + elm$core$Basics$composeR, + elm$core$Dict$toList, + A2( + elm$core$Basics$composeR, + elm$core$List$map( + function (_n0) { + var key = _n0.a; + var value = _n0.b; + return _Utils_Tuple2( + toKey(key), + toValue(value)); + }), + elm$json$Json$Encode$object)); }); -var _dillonkearns$elm_graphql$Main$init = function (flags) { - var _p0 = A2( - _elm_lang$core$Json_Decode$decodeValue, - _dillonkearns$elm_graphql$Graphql_Parser$decoder(flags.baseModule), +var author$project$Main$init = function (flags) { + var _n0 = A2( + elm$json$Json$Decode$decodeValue, + author$project$Graphql$Parser$decoder(flags.baseModule), flags.data); - if (_p0.ctor === 'Ok') { - return { - ctor: '_Tuple2', - _0: {ctor: '_Tuple0'}, - _1: _dillonkearns$elm_graphql$Main$generatedFiles( - A3(_elm_community$json_extra$Json_Encode_Extra$dict, _elm_lang$core$Basics$identity, _elm_lang$core$Json_Encode$string, _p0._0)) - }; + if (_n0.$ === 'Ok') { + var fields = _n0.a; + return _Utils_Tuple2( + _Utils_Tuple0, + author$project$Main$generatedFiles( + A3(elm_community$json_extra$Json$Encode$Extra$dict, elm$core$Basics$identity, elm$json$Json$Encode$string, fields))); } else { var error = _n0.a; return _Debug_todo( @@ -13601,9 +10239,18 @@ var _dillonkearns$elm_graphql$Main$init = function (flags) { 'Got error ' + elm$core$Debug$toString(error)); } }; -var _dillonkearns$elm_graphql$Main$main = _elm_lang$core$Platform$programWithFlags( +var elm$core$Platform$worker = _Platform_worker; +var elm$core$Platform$Cmd$batch = _Platform_batch; +var elm$core$Platform$Cmd$none = elm$core$Platform$Cmd$batch(_List_Nil); +var elm$core$Platform$Sub$batch = _Platform_batch; +var elm$core$Platform$Sub$none = elm$core$Platform$Sub$batch(_List_Nil); +var elm$json$Json$Decode$value = _Json_decodeValue; +var author$project$Main$main = elm$core$Platform$worker( { - init: _dillonkearns$elm_graphql$Main$init, + init: author$project$Main$init, + subscriptions: function (_n0) { + return elm$core$Platform$Sub$none; + }, update: F2( function (msg, model) { return _Utils_Tuple2(model, elm$core$Platform$Cmd$none); @@ -13624,53 +10271,7 @@ _Platform_export({'Main':{'init':author$project$Main$main( 'baseModule', elm$json$Json$Decode$list(elm$json$Json$Decode$string))); }, - A2( - _elm_lang$core$Json_Decode$field, - 'baseModule', - _elm_lang$core$Json_Decode$list(_elm_lang$core$Json_Decode$string)))); -var _dillonkearns$elm_graphql$Main$Flags = F2( - function (a, b) { - return {data: a, baseModule: b}; - }); - -var Elm = {}; -Elm['Main'] = Elm['Main'] || {}; -if (typeof _dillonkearns$elm_graphql$Main$main !== 'undefined') { - _dillonkearns$elm_graphql$Main$main(Elm['Main'], 'Main', undefined); -} - -if (true) -{ - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() { return Elm; }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - return; -} - -if (true) -{ - module['exports'] = Elm; - return; -} - -var globalElm = this['Elm']; -if (typeof globalElm === "undefined") -{ - this['Elm'] = Elm; - return; -} - -for (var publicModule in Elm) -{ - if (publicModule in globalElm) - { - throw new Error('There are two Elm modules called `' + publicModule + '` on this page! Rename one of them.'); - } - globalElm[publicModule] = Elm[publicModule]; -} - -}).call(this); - - + A2(elm$json$Json$Decode$field, 'data', elm$json$Json$Decode$value)))(0)}});}(this)); /***/ }), /* 31 */ @@ -19168,13 +15769,13 @@ function slice (args) { /* 74 */ /***/ (function(module, exports) { -module.exports = {"name":"@dillonkearns/elm-graphql","version":"3.1.12","scripts":{"build":"webpack","elm-nuke":"rm -rf elm-stuff && elm package install -y && cd tests && rm -rf elm-stuff && elm package install -y && cd ..","start":"cd examples && elm-live src/GithubComplex.elm --open --output=elm.js","test":"elm-test","gen:starwars":"npm run build && ./bin/elm-graphql https://elm-graphql.herokuapp.com --base Swapi --output examples/src","gen:normalize_test":"npm run build && cd ete_tests && ../bin/elm-graphql http://localhost:4000 --base Normalize && cd -","gen:github":"npm run build && ./bin/elm-graphql --introspection-file examples/github-schema.json --base Github --output examples/src","approve":"npm run build && npm link && elm-graphql --introspection-file examples/github-schema.json --base Github --output examples/src && elm-graphql https://elm-graphql.herokuapp.com/api --base Swapi --output examples/src && echo 'Ensuring documentation is valid...' && elm-make --docs=documentation.json && echo 'Confirming that examples folder is clean...' && (git diff --exit-code -- examples || (echo 'FAILURE' && echo 'examples code has changed. Commit changes to approve.' && exit 1)) && echo 'SUCCESS'","elm-analyse":"elm-analyse --serve"},"keywords":["elm","graphql"],"repository":"https://github.com/dillonkearns/elm-graphql","author":"Dillon Kearns","license":"BSD-3-Clause","devDependencies":{"@types/fs-extra":"^5.0.0","@types/glob":"^5.0.34","@types/minimist":"^1.2.0","@types/node":"^8.5.2","@types/request":"^2.0.9","@types/webpack":"^3.8.1","elm":"^0.18.0","elm-analyse":"^0.13.3","elm-hot-loader":"0.5.4","elm-test":"^0.18.12","elm-live":"^2.7.5","elm-webpack-loader":"^4.3.1","fs-extra":"^5.0.0","ts-loader":"^3.2.0","typescript":"^2.6.2","webpack":"^3.10.0"},"dependencies":{"elm-format":"^0.7.0-exp","glob":"^7.1.2","graphql-request":"^1.4.0","minimist":"^1.2.0","request":"^2.83.0"},"bin":{"elm-graphql":"bin/elm-graphql"}} +module.exports = {"name":"@dillonkearns/elm-graphql","version":"0.0.1","scripts":{"build":"webpack","elm-nuke":"rm -rf elm-stuff && elm package install -y && cd tests && rm -rf elm-stuff && elm package install -y && cd ..","start":"cd examples && elm-live src/GithubComplex.elm --open --output=elm.js","test":"elm-test","gen:starwars":"npm run build && ./bin/elm-graphql https://elm-graphql.herokuapp.com --base Swapi --output examples/src","gen:normalize_test":"npm run build && cd ete_tests && ../bin/elm-graphql http://localhost:4000 --base Normalize && cd -","gen:github":"npm run build && ./bin/elm-graphql --introspection-file examples/github-schema.json --base Github --output examples/src","approve":"npm run build && npm link && elm-graphql --introspection-file examples/github-schema.json --base Github --output examples/src && elm-graphql https://elm-graphql.herokuapp.com/api --base Swapi --output examples/src && echo 'Ensuring documentation is valid...' && elm-make --docs=documentation.json && echo 'Confirming that examples folder is clean...' && (git diff --exit-code -- examples || (echo 'FAILURE' && echo 'examples code has changed. Commit changes to approve.' && exit 1)) && echo 'SUCCESS'","elm-analyse":"elm-analyse --serve"},"keywords":["elm","graphql"],"repository":"https://github.com/dillonkearns/elm-graphql","author":"Dillon Kearns","license":"BSD-3-Clause","devDependencies":{"@types/fs-extra":"^5.0.0","@types/glob":"^5.0.34","@types/minimist":"^1.2.0","@types/node":"^8.5.2","@types/request":"^2.0.9","@types/webpack":"^3.8.1","elm":"^0.19.0","elm-analyse":"^0.13.3","elm-hot-loader":"0.5.4","elm-live":"^2.7.5","elm-test":"^0.19.0-beta4","elm-webpack-loader":"https://github.com/xtian/elm-webpack-loader.git#0.19","fs-extra":"^5.0.0","ts-loader":"^3.2.0","typescript":"^2.6.2","webpack":"^3.10.0"},"dependencies":{"elm-format":"^0.8.0-rc3","glob":"^7.1.2","graphql-request":"^1.4.0","minimist":"^1.2.0","request":"^2.83.0"},"bin":{"elm-graphql":"bin/elm-graphql"}} /***/ }), /* 75 */ /***/ (function(module, exports) { -module.exports = {"version":"11.2.0","summary":"Type-safe GraphQL queries in Elm.","repository":"https://github.com/dillonkearns/elm-graphql.git","license":"BSD3","source-directories":["src"],"exposed-modules":["Graphql.Operation","Graphql.Http","Graphql.SelectionSet","Graphql.Internal.Encode","Graphql.Document","Graphql.Field","Graphql.Internal.Builder.Argument","Graphql.Internal.Builder.Object","Graphql.OptionalArgument","Graphql.Http.GraphqlError","Graphql.Subscription","Graphql.Subscription.Protocol"],"dependencies":{"elm-community/json-extra":"2.6.0 <= v < 3.0.0","elm-community/list-extra":"7.0.1 <= v < 8.0.0","elm-community/string-extra":"1.4.0 <= v < 2.0.0","elm-lang/core":"5.0.0 <= v < 6.0.0","elm-lang/http":"1.0.0 <= v < 2.0.0","elm-lang/websocket":"1.0.2 <= v < 2.0.0","lukewestby/elm-string-interpolate":"1.0.2 <= v < 2.0.0"},"elm-version":"0.18.0 <= v < 0.19.0"} +module.exports = {"type":"package","name":"dillonkearns/graphqelm","summary":"Type-safe GraphQL queries in Elm.","license":"BSD-3-Clause","version":"11.2.0","exposed-modules":["Graphql.Operation","Graphql.Http","Graphql.SelectionSet","Graphql.Internal.Encode","Graphql.Document","Graphql.Field","Graphql.Internal.Builder.Argument","Graphql.Internal.Builder.Object","Graphql.OptionalArgument","Graphql.Http.GraphqlError","Graphql.Subscription","Graphql.Subscription.Protocol"],"elm-version":"0.19.0 <= v < 0.20.0","dependencies":{"elm/core":"1.0.0 <= v < 2.0.0","elm/http":"1.0.0 <= v < 2.0.0","elm/json":"1.0.0 <= v < 2.0.0","elm/time":"1.0.0 <= v < 2.0.0","elm/url":"1.0.0 <= v < 2.0.0","elm-community/list-extra":"7.0.0 <= v < 9.0.0","lukewestby/elm-string-interpolate":"1.0.3 <= v < 2.0.0"},"test-dependencies":{"elm/html":"1.0.0 <= v < 2.0.0","elm-explorations/test":"1.0.0 <= v < 2.0.0"}} /***/ }) /******/ ]); \ No newline at end of file diff --git a/elm-package.json b/elm-package.json deleted file mode 100644 index bad06efb6..000000000 --- a/elm-package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "version": "1.0.0", - "summary": "Type-safe GraphQL queries in Elm.", - "repository": "https://github.com/dillonkearns/elm-graphql.git", - "license": "BSD3", - "source-directories": [ - "src" - ], - "exposed-modules": [ - "Graphql.Operation", - "Graphql.Http", - "Graphql.SelectionSet", - "Graphql.Internal.Encode", - "Graphql.Document", - "Graphql.Field", - "Graphql.Internal.Builder.Argument", - "Graphql.Internal.Builder.Object", - "Graphql.OptionalArgument", - "Graphql.Http.GraphqlError", - "Graphql.Subscription", - "Graphql.Subscription.Protocol" - ], - "dependencies": { - "elm-community/json-extra": "2.6.0 <= v < 3.0.0", - "elm-community/list-extra": "7.0.1 <= v < 8.0.0", - "elm-community/string-extra": "1.4.0 <= v < 2.0.0", - "elm-lang/core": "5.0.0 <= v < 6.0.0", - "elm-lang/http": "1.0.0 <= v < 2.0.0", - "elm-lang/websocket": "1.0.2 <= v < 2.0.0", - "lukewestby/elm-string-interpolate": "1.0.2 <= v < 2.0.0" - }, - "elm-version": "0.18.0 <= v < 0.19.0" -} diff --git a/generator/index.html b/generator/index.html new file mode 100644 index 000000000..36e0ce74d --- /dev/null +++ b/generator/index.html @@ -0,0 +1,6898 @@ + + + + + Main + + + +
+ + + \ No newline at end of file diff --git a/generator/src/Graphql/Generator/Decoder.elm b/generator/src/Graphql/Generator/Decoder.elm index 9f515cc9f..3c5929fdb 100644 --- a/generator/src/Graphql/Generator/Decoder.elm +++ b/generator/src/Graphql/Generator/Decoder.elm @@ -56,7 +56,7 @@ generateDecoder apiSubmodule (Type.TypeReference referrableType isNullable) = ] Type.InputObjectRef _ -> - Debug.crash "Input objects are only for input not responses, shouldn't need decoder." + Debug.todo "Input objects are only for input not responses, shouldn't need decoder." ) ++ (case isNullable of Type.Nullable -> @@ -117,13 +117,13 @@ generateEncoder_ forInputObject apiSubmodule (Type.TypeReference referrableType generateEncoder_ forInputObject apiSubmodule typeRef ++ isNullableString ++ " |> Encode.list" Type.ObjectRef objectName -> - Debug.crash "I don't expect to see object references as argument types." + Debug.todo "I don't expect to see object references as argument types." Type.InterfaceRef interfaceName -> - Debug.crash "Interfaces are never valid inputs http://facebook.github.io/graphql/October2016/#sec-Interfaces" + Debug.todo "Interfaces are never valid inputs http://facebook.github.io/graphql/October2016/#sec-Interfaces" Type.UnionRef _ -> - Debug.crash "Unions are never valid inputs http://facebook.github.io/graphql/October2016/#sec-Unions" + Debug.todo "Unions are never valid inputs http://facebook.github.io/graphql/October2016/#sec-Unions" Type.EnumRef enumName -> interpolate ("(Encode.enum {0})" ++ isNullableString) @@ -135,6 +135,7 @@ generateEncoder_ forInputObject apiSubmodule (Type.TypeReference referrableType Type.InputObjectRef inputObjectName -> ((if forInputObject then [ "encode" ++ ClassCaseName.normalized inputObjectName ] + else ModuleName.inputObject { apiSubmodule = apiSubmodule } inputObjectName ++ [ "encode" ++ ClassCaseName.normalized inputObjectName ] @@ -205,6 +206,7 @@ generateTypeCommon fromInputObject nullableString apiSubmodule (Type.TypeReferen Type.InputObjectRef inputObjectName -> (if fromInputObject then [ ClassCaseName.normalized inputObjectName ] + else ModuleName.inputObject { apiSubmodule = apiSubmodule } inputObjectName ++ [ ClassCaseName.normalized inputObjectName ] diff --git a/generator/src/Graphql/Generator/DocComment.elm b/generator/src/Graphql/Generator/DocComment.elm index 986019c4e..ab806ca8f 100644 --- a/generator/src/Graphql/Generator/DocComment.elm +++ b/generator/src/Graphql/Generator/DocComment.elm @@ -6,7 +6,11 @@ import Graphql.Parser.Type as Type exposing (EnumValue, Field) import String.Interpolate exposing (interpolate) -hasDocs : Maybe String -> List { item | name : String, description : Maybe String } -> Bool +type alias ItemDescription = + { name : String, description : Maybe String } + + +hasDocs : Maybe String -> List ItemDescription -> Bool hasDocs mainDescription itemDescriptions = case mainDescription of Just string -> @@ -20,26 +24,27 @@ hasDocs mainDescription itemDescriptions = generate : Field -> String generate { description, args } = - generate_ description (args |> List.map (\arg -> { arg | name = arg.name |> CamelCaseName.normalized })) + generate_ description (args |> List.map (\arg -> { name = arg.name |> CamelCaseName.normalized, description = arg.description })) -generate_ : Maybe String -> List { item | name : String, description : Maybe String } -> String +generate_ : Maybe String -> List ItemDescription -> String generate_ mainDescription itemDescriptions = if hasDocs mainDescription itemDescriptions then interpolate """{-|{0}{1} -} """ [ mainDescription |> Maybe.map (\description -> " " ++ description) |> Maybe.withDefault "", argsDoc itemDescriptions ] + else "" generateForEnum : Maybe String -> List EnumValue -> String generateForEnum description enumValues = - generate_ description (enumValues |> List.map (\enumValue -> { enumValue | name = enumValue.name |> ClassCaseName.normalized })) + generate_ description (enumValues |> List.map (\enumValue -> { name = enumValue.name |> ClassCaseName.normalized, description = enumValue.description })) -argsDoc : List { item | name : String, description : Maybe String } -> String +argsDoc : List ItemDescription -> String argsDoc args = case List.filterMap argDoc args of [] -> @@ -49,7 +54,7 @@ argsDoc args = interpolate "\n\n{0}\n" [ argDocs |> String.join "\n" ] -argDoc : { item | name : String, description : Maybe String } -> Maybe String +argDoc : ItemDescription -> Maybe String argDoc { name, description } = Maybe.map (\aDescription -> diff --git a/generator/src/Graphql/Generator/Field.elm b/generator/src/Graphql/Generator/Field.elm index 948d776b2..f7f588ecc 100644 --- a/generator/src/Graphql/Generator/Field.elm +++ b/generator/src/Graphql/Generator/Field.elm @@ -11,8 +11,8 @@ import Graphql.Generator.RequiredArgs import Graphql.Parser.CamelCaseName as CamelCaseName exposing (CamelCaseName) import Graphql.Parser.ClassCaseName as ClassCaseName exposing (ClassCaseName) import Graphql.Parser.Type as Type exposing (TypeReference) -import String.Interpolate exposing (interpolate) import String.Extra +import String.Interpolate exposing (interpolate) type alias FieldGenerator = @@ -86,6 +86,7 @@ typeAliasesToString : Type.Field -> FieldGenerator -> Maybe String typeAliasesToString field fieldGenerator = if fieldGenerator.typeAliases == [] then Nothing + else fieldGenerator.typeAliases |> List.map @@ -106,6 +107,7 @@ argsListString : { fieldGenerator | annotatedArgs : List AnnotatedArg } -> Strin argsListString { annotatedArgs } = if annotatedArgs == [] then "" + else (annotatedArgs |> List.map .arg |> String.join " ") ++ " " @@ -190,13 +192,13 @@ objectThing ({ apiSubmodule } as context) typeRef refName objectOrInterface = ModuleName.interface context (ClassCaseName.build refName) |> String.join "." ReferenceLeaf.Enum -> - Debug.crash "TODO" + Debug.todo "TODO" ReferenceLeaf.Union -> ModuleName.union context (ClassCaseName.build refName) |> String.join "." ReferenceLeaf.Scalar -> - Debug.crash "TODO" + Debug.todo "TODO" objectArgAnnotation = interpolate @@ -259,7 +261,7 @@ leafType (Type.TypeReference referrableType isNullable) = EnumLeaf Type.InputObjectRef _ -> - Debug.crash "Unexpected type" + Debug.todo "Unexpected type" init : Context -> CamelCaseName -> TypeReference -> FieldGenerator diff --git a/generator/src/Graphql/Generator/Group.elm b/generator/src/Graphql/Generator/Group.elm index 66af11eb3..a203e0f42 100644 --- a/generator/src/Graphql/Generator/Group.elm +++ b/generator/src/Graphql/Generator/Group.elm @@ -14,7 +14,7 @@ import Graphql.Generator.Subscription import Graphql.Generator.TypeLockDefinitions as TypeLockDefinitions import Graphql.Generator.Union import Graphql.Parser.ClassCaseName as ClassCaseName exposing (ClassCaseName) -import Graphql.Parser.Type as Type exposing (TypeDefinition(TypeDefinition)) +import Graphql.Parser.Type as Type exposing (TypeDefinition(..)) type alias IntrospectionData = @@ -148,12 +148,15 @@ toPair context ((Type.TypeDefinition name definableType description) as definiti if name == context.query then Graphql.Generator.Query.generate context moduleName fields |> Just + else if Just name == context.mutation then Graphql.Generator.Mutation.generate context moduleName fields |> Just + else if Just name == context.subscription then Graphql.Generator.Subscription.generate context moduleName fields |> Just + else Graphql.Generator.Object.generate context name moduleName fields |> Just diff --git a/generator/src/Graphql/Generator/InputObjectFile.elm b/generator/src/Graphql/Generator/InputObjectFile.elm index 16b78268f..eb521812f 100644 --- a/generator/src/Graphql/Generator/InputObjectFile.elm +++ b/generator/src/Graphql/Generator/InputObjectFile.elm @@ -8,7 +8,7 @@ import Graphql.Generator.InputObjectFile.Details exposing (InputObjectDetails) import Graphql.Generator.InputObjectLoops as InputObjectLoops import Graphql.Parser.CamelCaseName as CamelCaseName exposing (CamelCaseName) import Graphql.Parser.ClassCaseName as ClassCaseName exposing (ClassCaseName) -import Graphql.Parser.Type as Type exposing (TypeDefinition(TypeDefinition)) +import Graphql.Parser.Type as Type exposing (TypeDefinition(..)) import String.Interpolate exposing (interpolate) @@ -45,6 +45,7 @@ placeholder = "" """ [ moduleName context |> String.join "." ] + else interpolate """module {0} exposing (..) @@ -100,6 +101,7 @@ type {0} [ ClassCaseName.normalized name , List.map (aliasEntry context) fields |> String.join ", " ] + else interpolate """{-| Type for the {0} input object. -} @@ -125,6 +127,7 @@ encoder context { name, fields, hasLoop } = parameter = if hasLoop then interpolate "({0} input)" [ ClassCaseName.normalized name ] + else "input" in @@ -153,7 +156,7 @@ encoderFunction { apiSubmodule } field = case field.typeRef of Type.TypeReference referrableType isNullable -> let - filledOptionalsRecord = + filledOptionalsRecord_ = case isNullable of Type.NonNullable -> interpolate " input.{0} |> Just" [ CamelCaseName.normalized field.name ] @@ -163,7 +166,7 @@ encoderFunction { apiSubmodule } field = in interpolate "({0}) {1}" [ Decoder.generateEncoderLowLevel apiSubmodule referrableType - , filledOptionalsRecord + , filledOptionalsRecord_ ] diff --git a/generator/src/Graphql/Generator/InputObjectFile/Constructor.elm b/generator/src/Graphql/Generator/InputObjectFile/Constructor.elm index 5e8cdb0a9..05b0c3ee5 100644 --- a/generator/src/Graphql/Generator/InputObjectFile/Constructor.elm +++ b/generator/src/Graphql/Generator/InputObjectFile/Constructor.elm @@ -7,7 +7,7 @@ import Graphql.Generator.InputObjectFile.Details exposing (InputObjectDetails) import Graphql.Generator.Let as Let import Graphql.Parser.CamelCaseName as CamelCaseName exposing (CamelCaseName) import Graphql.Parser.ClassCaseName as ClassCaseName exposing (ClassCaseName) -import Graphql.Parser.Type as Type exposing (TypeDefinition(TypeDefinition)) +import Graphql.Parser.Type as Type exposing (TypeDefinition(..)) import String.Interpolate exposing (interpolate) @@ -90,6 +90,7 @@ generate context { name, fields, hasLoop } = , letClause , if hasLoop then ClassCaseName.normalized name + else "" , returnRecord @@ -105,6 +106,7 @@ constructorFieldsAlias nameThing context fields = """type alias {0} = { {1} }""" [ nameThing, List.map (aliasEntry context) fields |> String.join ", " ] + else "" @@ -129,6 +131,7 @@ when : Bool -> value -> Maybe value when condition value = if condition then Just value + else Nothing diff --git a/generator/src/Graphql/Generator/InputObjectFile/Details.elm b/generator/src/Graphql/Generator/InputObjectFile/Details.elm index 8b914ef62..dcd204cf6 100644 --- a/generator/src/Graphql/Generator/InputObjectFile/Details.elm +++ b/generator/src/Graphql/Generator/InputObjectFile/Details.elm @@ -1,7 +1,7 @@ module Graphql.Generator.InputObjectFile.Details exposing (InputObjectDetails) import Graphql.Parser.ClassCaseName as ClassCaseName exposing (ClassCaseName) -import Graphql.Parser.Type as Type exposing (TypeDefinition(TypeDefinition)) +import Graphql.Parser.Type as Type exposing (TypeDefinition(..)) type alias InputObjectDetails = diff --git a/generator/src/Graphql/Generator/InputObjectLoops.elm b/generator/src/Graphql/Generator/InputObjectLoops.elm index 296e3a6b4..125497b9f 100644 --- a/generator/src/Graphql/Generator/InputObjectLoops.elm +++ b/generator/src/Graphql/Generator/InputObjectLoops.elm @@ -1,7 +1,7 @@ module Graphql.Generator.InputObjectLoops exposing (any, hasLoop) import Graphql.Parser.ClassCaseName as ClassCaseName exposing (ClassCaseName) -import Graphql.Parser.Type as Type exposing (DefinableType(..), Field, IsNullable(NonNullable), ReferrableType(InputObjectRef), TypeDefinition(TypeDefinition), TypeReference(TypeReference)) +import Graphql.Parser.Type as Type exposing (DefinableType(..), Field, IsNullable(..), ReferrableType(..), TypeDefinition(..), TypeReference(..)) import List.Extra @@ -65,6 +65,7 @@ lookupInputObject typeDefs inputObjectName = InputObjectType fields -> if name == inputObjectName then Just ( name, fields ) + else Nothing diff --git a/generator/src/Graphql/Generator/ModuleName.elm b/generator/src/Graphql/Generator/ModuleName.elm index 4b9e6e876..c9e862387 100644 --- a/generator/src/Graphql/Generator/ModuleName.elm +++ b/generator/src/Graphql/Generator/ModuleName.elm @@ -2,7 +2,7 @@ module Graphql.Generator.ModuleName exposing (enum, enumTypeName, generate, inpu import Graphql.Generator.Context exposing (Context) import Graphql.Parser.ClassCaseName as ClassCaseName exposing (ClassCaseName) -import Graphql.Parser.Type as Type exposing (TypeDefinition(TypeDefinition)) +import Graphql.Parser.Type as Type exposing (TypeDefinition(..)) generate : Context -> TypeDefinition -> List String @@ -11,10 +11,13 @@ generate context (Type.TypeDefinition name definableType description) = Type.ObjectType fields -> if name == context.query then query context + else if Just name == context.mutation then mutation context + else if Just name == context.subscription then subscription context + else object context name @@ -35,15 +38,18 @@ generate context (Type.TypeDefinition name definableType description) = object : Context -> ClassCaseName -> List String -object { query, mutation, apiSubmodule, subscription } name = - if name == query then +object context name = + if name == context.query then [ "RootQuery" ] - else if Just name == mutation then + + else if Just name == context.mutation then [ "RootMutation" ] - else if Just name == subscription then + + else if Just name == context.subscription then [ "RootSubscription" ] + else - apiSubmodule ++ [ "Object", ClassCaseName.normalized name ] + context.apiSubmodule ++ [ "Object", ClassCaseName.normalized name ] inputObject : { context | apiSubmodule : List String } -> ClassCaseName -> List String diff --git a/generator/src/Graphql/Generator/Normalize.elm b/generator/src/Graphql/Generator/Normalize.elm index b9ca2f4ac..8c58d47b5 100644 --- a/generator/src/Graphql/Generator/Normalize.elm +++ b/generator/src/Graphql/Generator/Normalize.elm @@ -9,13 +9,18 @@ normalizeIfElmReserved : String -> String normalizeIfElmReserved name = if List.member name elmReservedWords then name ++ "_" + else name underscores : String -> { leading : String, trailing : String, remaining : String } underscores string = - case Regex.find Regex.All (Regex.regex "^(_*)([^_]?.*[^_]?)(_*)$") string |> List.head |> Maybe.map .submatches of + let + regexFromString = + Regex.fromString >> Maybe.withDefault Regex.never + in + case Regex.find (regexFromString "^(_*)([^_]?.*[^_]?)(_*)$") string |> List.head |> Maybe.map .submatches of Just [ Just leading, Just remaining, Just trailing ] -> { leading = leading , trailing = trailing @@ -23,10 +28,10 @@ underscores string = } Nothing -> - Debug.crash "Got nothing" + Debug.todo "Got nothing" _ -> - Debug.crash ("Unexpected regex result for name " ++ string) + Debug.todo ("Unexpected regex result for name " ++ string) isAllUpper : String -> Bool @@ -55,6 +60,7 @@ capitalized name = group.remaining |> String.toLower |> String.Extra.classify + else group.remaining |> capitilize diff --git a/generator/src/Graphql/Generator/OptionalArgs.elm b/generator/src/Graphql/Generator/OptionalArgs.elm index 5684af696..81daf0492 100644 --- a/generator/src/Graphql/Generator/OptionalArgs.elm +++ b/generator/src/Graphql/Generator/OptionalArgs.elm @@ -25,11 +25,6 @@ type alias OptionalArg = } -(=>) : a -> b -> ( a, b ) -(=>) = - (,) - - generate : List String -> List Type.Arg -> Maybe Result generate apiSubmodule allArgs = case List.filterMap optionalArgOrNothing allArgs of @@ -44,11 +39,11 @@ generate apiSubmodule allArgs = , arg = "fillInOptionals" } , letBindings = - [ "filledInOptionals" => ("fillInOptionals " ++ emptyRecord optionalArgs) - , "optionalArgs" - => (argValues apiSubmodule optionalArgs - ++ "\n |> List.filterMap identity" - ) + [ ( "filledInOptionals", "fillInOptionals " ++ emptyRecord optionalArgs ) + , ( "optionalArgs" + , argValues apiSubmodule optionalArgs + ++ "\n |> List.filterMap identity" + ) ] , typeAlias = { suffix = "OptionalArguments", body = typeAlias apiSubmodule optionalArgs } } diff --git a/generator/src/Graphql/Generator/ReferenceLeaf.elm b/generator/src/Graphql/Generator/ReferenceLeaf.elm index 8911ea03d..7a9e6cd9a 100644 --- a/generator/src/Graphql/Generator/ReferenceLeaf.elm +++ b/generator/src/Graphql/Generator/ReferenceLeaf.elm @@ -1,6 +1,6 @@ module Graphql.Generator.ReferenceLeaf exposing (ReferenceLeaf(..), get) -import Graphql.Parser.Type as Type exposing (TypeReference(TypeReference)) +import Graphql.Parser.Type as Type exposing (TypeReference(..)) type ReferenceLeaf @@ -32,7 +32,7 @@ get (TypeReference referrableType isNullable) = Enum Type.InputObjectRef _ -> - Debug.crash "TODO" + Debug.todo "TODO" Type.UnionRef _ -> Union diff --git a/generator/src/Graphql/Generator/Scalar.elm b/generator/src/Graphql/Generator/Scalar.elm index 1d2d90857..542fd854e 100644 --- a/generator/src/Graphql/Generator/Scalar.elm +++ b/generator/src/Graphql/Generator/Scalar.elm @@ -1,7 +1,7 @@ module Graphql.Generator.Scalar exposing (generate) import Graphql.Parser.ClassCaseName as ClassCaseName exposing (ClassCaseName) -import Graphql.Parser.Type as Type exposing (TypeDefinition(TypeDefinition)) +import Graphql.Parser.Type as Type exposing (TypeDefinition(..)) import String.Interpolate exposing (interpolate) @@ -70,6 +70,7 @@ placeholder = "" """ [ moduleName ] + else interpolate """module {0} exposing (..) diff --git a/generator/src/Graphql/Generator/TypeLockDefinitions.elm b/generator/src/Graphql/Generator/TypeLockDefinitions.elm index d62205c4f..8ea2742c1 100644 --- a/generator/src/Graphql/Generator/TypeLockDefinitions.elm +++ b/generator/src/Graphql/Generator/TypeLockDefinitions.elm @@ -1,7 +1,7 @@ module Graphql.Generator.TypeLockDefinitions exposing (generate) import Graphql.Parser.ClassCaseName as ClassCaseName exposing (ClassCaseName) -import Graphql.Parser.Type as Type exposing (TypeDefinition(TypeDefinition)) +import Graphql.Parser.Type as Type exposing (TypeDefinition(..)) import String.Interpolate exposing (interpolate) @@ -31,6 +31,7 @@ placeholder = "" """ [ apiSubmodule ++ [ typeName ] |> String.join "." ] + else interpolate """module {0} exposing (..) diff --git a/src/Graphql/Parser.elm b/generator/src/Graphql/Parser.elm similarity index 100% rename from src/Graphql/Parser.elm rename to generator/src/Graphql/Parser.elm diff --git a/src/Graphql/Parser/CamelCaseName.elm b/generator/src/Graphql/Parser/CamelCaseName.elm similarity index 100% rename from src/Graphql/Parser/CamelCaseName.elm rename to generator/src/Graphql/Parser/CamelCaseName.elm diff --git a/src/Graphql/Parser/ClassCaseName.elm b/generator/src/Graphql/Parser/ClassCaseName.elm similarity index 100% rename from src/Graphql/Parser/ClassCaseName.elm rename to generator/src/Graphql/Parser/ClassCaseName.elm diff --git a/src/Graphql/Parser/Scalar.elm b/generator/src/Graphql/Parser/Scalar.elm similarity index 100% rename from src/Graphql/Parser/Scalar.elm rename to generator/src/Graphql/Parser/Scalar.elm diff --git a/src/Graphql/Parser/Type.elm b/generator/src/Graphql/Parser/Type.elm similarity index 93% rename from src/Graphql/Parser/Type.elm rename to generator/src/Graphql/Parser/Type.elm index 72ab45d97..a495c2534 100644 --- a/src/Graphql/Parser/Type.elm +++ b/generator/src/Graphql/Parser/Type.elm @@ -5,10 +5,10 @@ module Graphql.Parser.Type , EnumValue , Field , IsNullable(..) - , RawTypeRef(RawTypeRef) + , RawTypeRef(..) , ReferrableType(..) - , TypeDefinition(TypeDefinition) - , TypeReference(TypeReference) + , TypeDefinition(..) + , TypeReference(..) , decoder , parseRef , typeDefinition @@ -267,7 +267,7 @@ expectString maybeString = string Nothing -> - Debug.crash "Expected string but got Nothing" + Debug.todo "Expected string but got Nothing" parseRef : RawTypeRef -> TypeReference @@ -279,7 +279,7 @@ parseRef (RawTypeRef rawTypeRef) = TypeReference (List (parseRef nestedOfType)) Nullable Nothing -> - Debug.crash "Missing nested type for List reference" + Debug.todo "Missing nested type for List reference" TypeKind.Scalar -> case rawTypeRef.name of @@ -289,7 +289,7 @@ parseRef (RawTypeRef rawTypeRef) = Nullable Nothing -> - Debug.crash "Should not get null names for scalar references" + Debug.todo "Should not get null names for scalar references" TypeKind.Interface -> case rawTypeRef.name of @@ -297,7 +297,7 @@ parseRef (RawTypeRef rawTypeRef) = TypeReference (InterfaceRef interfaceName) Nullable Nothing -> - Debug.crash "Should not get null names for interface references" + Debug.todo "Should not get null names for interface references" TypeKind.Object -> case rawTypeRef.name of @@ -305,7 +305,7 @@ parseRef (RawTypeRef rawTypeRef) = TypeReference (ObjectRef objectName) Nullable Nothing -> - Debug.crash "Should not get null names for object references" + Debug.todo "Should not get null names for object references" TypeKind.NonNull -> case rawTypeRef.ofType of @@ -328,10 +328,10 @@ parseRef (RawTypeRef rawTypeRef) = TypeReference (List (parseRef nestedOfType)) NonNullable Nothing -> - Debug.crash "" + Debug.todo "" ( TypeKind.NonNull, _ ) -> - Debug.crash "Can't have nested non-null types" + Debug.todo "Can't have nested non-null types" ( TypeKind.Ignore, _ ) -> ignoreRef @@ -357,7 +357,7 @@ parseRef (RawTypeRef rawTypeRef) = TypeReference (objectName |> ClassCaseName.build |> EnumRef) Nullable Nothing -> - Debug.crash "Should not get null names for enum references" + Debug.todo "Should not get null names for enum references" TypeKind.InputObject -> case rawTypeRef.name of @@ -365,7 +365,7 @@ parseRef (RawTypeRef rawTypeRef) = TypeReference (inputObjectName |> ClassCaseName.build |> InputObjectRef) Nullable Nothing -> - Debug.crash "Should not get null names for input object references" + Debug.todo "Should not get null names for input object references" TypeKind.Union -> TypeReference (UnionRef (expectString rawTypeRef.name)) Nullable diff --git a/src/Graphql/Parser/TypeKind.elm b/generator/src/Graphql/Parser/TypeKind.elm similarity index 100% rename from src/Graphql/Parser/TypeKind.elm rename to generator/src/Graphql/Parser/TypeKind.elm diff --git a/src/elm-graphql.ts b/generator/src/elm-graphql.ts similarity index 95% rename from src/elm-graphql.ts rename to generator/src/elm-graphql.ts index 074bccacf..4f48f0402 100644 --- a/src/elm-graphql.ts +++ b/generator/src/elm-graphql.ts @@ -1,4 +1,4 @@ -const Elm = require("./Main.elm"); +const { Elm } = require("./Main.elm"); import * as fs from "fs-extra"; import { GraphQLClient } from "graphql-request"; import * as http from "http"; @@ -8,8 +8,8 @@ import { writeFile } from "./formatted-write"; import { introspectionQuery } from "./introspection-query"; import * as glob from "glob"; import * as path from "path"; -const npmPackageVersion = require("../package.json").version; -const elmPackageVersion = require("../elm-package.json").version; +const npmPackageVersion = require("../../package.json").version; +const elmPackageVersion = require("../../elm.json").version; const usage = `Usage: elm-graphql url # generate files based on the schema at \`url\` in folder ./src/Api @@ -104,7 +104,7 @@ warnIfContainsNonGenerated(prependBasePath("/")); const onDataAvailable = (data: {}) => { console.log("Generating files..."); - let app = Elm.Main.worker({ data, baseModule }); + let app = Elm.Main.init({ flags: { data, baseModule } }); app.ports.generatedFiles.subscribe(function(generatedFile: any) { removeGenerated(prependBasePath("/")); fs.mkdirpSync(prependBasePath("InputObject")); diff --git a/generator/src/graphqelm.ts b/generator/src/graphqelm.ts deleted file mode 100644 index d1a8bda11..000000000 --- a/generator/src/graphqelm.ts +++ /dev/null @@ -1,148 +0,0 @@ -const { Elm } = require('./Main.elm') -import * as fs from 'fs-extra' -import { GraphQLClient } from 'graphql-request' -import * as http from 'http' -import * as minimist from 'minimist' -import * as request from 'request' -import { writeFile } from './formatted-write' -import { introspectionQuery } from './introspection-query' -import * as glob from 'glob' -import * as path from 'path' -const npmPackageVersion = require('../../package.json').version -const elmPackageVersion = require('../../elm.json').version - -const usage = `Usage: - graphqelm url # generate files based on the schema at \`url\` in folder ./src/Api - graphqelm url --base My.Api.Submodule # generate files based on the schema at \`url\` in folder ./src/My/Api/Submodule - graphqelm url --output path/to/src # generates code within path/to/src/Api - graphqelm url --output path/to/src --base My.Api.Submodule # generates code within path/to/src/My/Api/Submodule - graphqelm url --excludeDeprecated # excludes deprecated enums and fields (they are included by default) - - # Schema file instead of URL - graphqelm --introspection-file path/to/introspection-response.json - - graphqelm --version # print the current graphqelm version and target elm package version - graphqelm url [--header 'headerKey: header value'...] # you can supply multiple header args` - -function isGenerated(path: string): boolean { - return ( - fs - .readFileSync(path) - .indexOf( - 'Do not manually edit this file, it was auto-generated by Graphqelm' - ) >= 0 - ) -} -function warnIfContainsNonGenerated(path: string): void { - const files: string[] = glob.sync(path + '/**/*.elm') - const nonGenerated = files.filter(file => !isGenerated(file)) - - if (nonGenerated.length > 0) { - console.log( - 'Graphqelm found some files that it did not generate. Please move or delete the following files and run graphqelm again.', - nonGenerated - ) - process.exit(1) - } -} - -function removeGenerated(path: string): void { - glob.sync(path + '/**/*.elm').forEach(fs.unlinkSync) -} - -const targetComment = `-- Do not manually edit this file, it was auto-generated by Graphqelm --- https://github.com/dillonkearns/graphqelm -` -const args = minimist(process.argv.slice(2)) -if (args.version) { - console.log('npm version ', npmPackageVersion) - console.log( - `Targeting elm package dillonkearns/graphqelm@${elmPackageVersion}` - ) - process.exit(0) -} -const baseArgRegex = /^[A-Z][A-Za-z_]*(\.[A-Z][A-Za-z_]*)*$/ -const baseModuleArg: undefined | string = args.base -const outputPath: string = args.output || './src' -function isValidBaseArg(baseArg: string): boolean { - return !!baseArg.match(baseArgRegex) -} -if (baseModuleArg && !isValidBaseArg(baseModuleArg)) { - console.log( - `--base was '${baseModuleArg}' but must be in format ${baseArgRegex}` - ) - process.exit(1) -} -const excludeDeprecated: boolean = - args.excludeDeprecated === null || args.excludeDeprecated === undefined - ? false - : args.excludeDeprecated -const headerArg: undefined | string | [string] = args.header -const addHeader = (object: any, header: string) => { - const [headerKey, headerValue] = header.split(':') - object[headerKey] = headerValue - return object -} -let headers = {} -if (typeof headerArg === 'string') { - addHeader(headers, headerArg) -} else if (headerArg == undefined) { -} else { - headerArg.forEach(header => { - addHeader(headers, header) - }) -} -const baseModule = baseModuleArg ? baseModuleArg.split('.') : ['Api'] -function prependBasePath(suffixPath: string): string { - return path.join(outputPath, baseModule.join('/'), suffixPath) -} -const graphqlUrl: undefined | string = args._[0] -const introspectionFile: undefined | string = args['introspection-file'] -if (!(graphqlUrl || introspectionFile)) { - console.log(usage) - process.exit(0) -} -warnIfContainsNonGenerated(prependBasePath('/')) - -const onDataAvailable = (data: {}) => { - console.log('Generating files...') - let app = Elm.Main.init({ flags: { data, baseModule } }) - app.ports.generatedFiles.subscribe(function(generatedFile: any) { - removeGenerated(prependBasePath('/')) - fs.mkdirpSync(prependBasePath('InputObject')) - fs.mkdirpSync(prependBasePath('Object')) - fs.mkdirpSync(prependBasePath('Interface')) - fs.mkdirpSync(prependBasePath('Union')) - fs.mkdirpSync(prependBasePath('Enum')) - for (let key in generatedFile) { - let filePath = path.join(outputPath, key) - let value = generatedFile[key] - writeFile(filePath, targetComment + value) - } - fs.writeFileSync( - prependBasePath('graphqelm-metadata.json'), - `{"targetElmPackageVersion": "${elmPackageVersion}", "generatedByNpmPackageVersion": "${npmPackageVersion}"}` - ) - console.log('Success!') - }) -} -if (introspectionFile) { - const introspectionFileJson = JSON.parse( - fs.readFileSync(introspectionFile).toString() - ) - onDataAvailable(introspectionFileJson.data || introspectionFileJson) -} else { - console.log('Fetching GraphQL schema...') - new GraphQLClient(graphqlUrl, { - mode: 'cors', - headers: headers - }) - .request(introspectionQuery, { includeDeprecated: !excludeDeprecated }) - .then(data => { - onDataAvailable(data) - }) - .catch(err => { - console.log(err.response || err) - process.exit(1) - }) -} diff --git a/package-lock.json b/package-lock.json index 24cbd5532..dd466c8a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@dillonkearns/elm-graphql", - "version": "3.1.12", + "version": "0.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -185,14 +185,12 @@ "ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" }, "ansi-styles": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" }, "anymatch": { "version": "1.3.2", @@ -321,7 +319,6 @@ "version": "2.6.1", "resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz", "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", - "dev": true, "requires": { "lodash": "^4.17.10" } @@ -600,6 +597,7 @@ "version": "0.1.4", "resolved": "https://registry.npmjs.org/binwrap/-/binwrap-0.1.4.tgz", "integrity": "sha1-yh94cDAiElGPoksHcm+cUKFcdVk=", + "dev": true, "requires": { "request": "^2.81.0", "request-promise": "^4.2.0", @@ -607,37 +605,6 @@ "unzip": "^0.1.11" } }, - "bl": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/bl/-/bl-1.1.2.tgz", - "integrity": "sha1-/cqHGplxOqANGeO7ukHER4emU5g=", - "dev": true, - "requires": { - "readable-stream": "~2.0.5" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "readable-stream": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", - "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "~1.0.0", - "process-nextick-args": "~1.0.6", - "string_decoder": "~0.10.x", - "util-deprecate": "~1.0.1" - } - } - } - }, "block-stream": { "version": "0.0.9", "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", @@ -708,7 +675,6 @@ "version": "2.10.1", "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", - "dev": true, "requires": { "hoek": "2.x.x" } @@ -1102,7 +1068,6 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, "requires": { "ansi-styles": "^2.2.1", "escape-string-regexp": "^1.0.2", @@ -1251,8 +1216,7 @@ "commander": { "version": "2.17.1", "resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz", - "integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==", - "dev": true + "integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==" }, "component-emitter": { "version": "1.2.1", @@ -1433,7 +1397,6 @@ "version": "2.0.5", "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", - "dev": true, "requires": { "boom": "2.x.x" } @@ -1725,35 +1688,28 @@ "integrity": "sha512-CYgewByRByMOilPk5/yrW1mtflaS/vp+026gwb0EEX6aqUl+TGYoTSTW+uf44XB/FOKgUauV3TDH3Bl0IHZ8Ag==", "dev": true, "requires": { - "mkdirp": "0.5.1", - "promise": "7.1.1", - "request": "2.74.0", - "tar": "2.2.1" + "binwrap": "0.1.4" }, "dependencies": { "assert-plus": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", - "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=", - "dev": true + "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=" }, "aws-sign2": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", - "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=", - "dev": true + "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=" }, "caseless": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", - "integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=", - "dev": true + "integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=" }, "form-data": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/form-data/-/form-data-1.0.1.tgz", "integrity": "sha1-rjFduaSQf6BlUCMEpm13M0de43w=", - "dev": true, "requires": { "async": "^2.0.1", "combined-stream": "^1.0.5", @@ -1764,7 +1720,6 @@ "version": "2.0.6", "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", "integrity": "sha1-zcvAgYgmWtEZtqWnyKtw7s+10n0=", - "dev": true, "requires": { "chalk": "^1.1.1", "commander": "^2.9.0", @@ -1776,7 +1731,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", - "dev": true, "requires": { "assert-plus": "^0.2.0", "jsprim": "^1.2.2", @@ -1786,30 +1740,25 @@ "node-uuid": { "version": "1.4.8", "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.8.tgz", - "integrity": "sha1-sEDrCSOWivq/jTL7HxfxFn/auQc=", - "dev": true + "integrity": "sha1-sEDrCSOWivq/jTL7HxfxFn/auQc=" }, "oauth-sign": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", - "dev": true + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" }, "qs": { "version": "6.2.3", "resolved": "https://registry.npmjs.org/qs/-/qs-6.2.3.tgz", - "integrity": "sha1-HPyyXBCpsrSDBT/zn138kjOQjP4=", - "dev": true + "integrity": "sha1-HPyyXBCpsrSDBT/zn138kjOQjP4=" }, "request": { "version": "2.74.0", "resolved": "https://registry.npmjs.org/request/-/request-2.74.0.tgz", "integrity": "sha1-dpPKdou7DqXIzgjAhKRe+gW4kqs=", - "dev": true, "requires": { "aws-sign2": "~0.6.0", "aws4": "^1.2.1", - "bl": "~1.1.2", "caseless": "~0.11.0", "combined-stream": "~1.0.5", "extend": "~3.0.0", @@ -1834,7 +1783,6 @@ "version": "2.3.4", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", - "dev": true, "requires": { "punycode": "^1.4.1" } @@ -1842,8 +1790,7 @@ "tunnel-agent": { "version": "0.4.3", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", - "integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us=", - "dev": true + "integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us=" } } }, @@ -2001,7 +1948,21 @@ "resolved": "https://registry.npmjs.org/elm-format/-/elm-format-0.8.0-rc3.tgz", "integrity": "sha512-6LI7PzYwf3q9spXi8PJ8u6fH6zhNoWy8ntp3IPydV2qCrj79yDZSQJ0WFgFdEFMWbU8v4zt4RYyope1ybajuuQ==", "requires": { - "binwrap": "^0.1.4" + "binwrap": "^0.2.0" + }, + "dependencies": { + "binwrap": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/binwrap/-/binwrap-0.2.0.tgz", + "integrity": "sha512-HUspivC8zPE37KJQ0S4zsNHUpymzQBinmpdMoa+JwmB6Mi+p30ywVZJcillYpbQmiX2wLykaaDJxXmwZkbaZGA==", + "requires": { + "mustache": "^2.3.0", + "request": "^2.87.0", + "request-promise": "^4.2.0", + "tar": "^2.2.1", + "unzip-stream": "^0.3.0" + } + } } }, "elm-hot-loader": { @@ -2038,6 +1999,7 @@ "chalk": "2.1.0", "chokidar": "1.6.0", "cross-spawn": "4.0.0", + "elmi-to-json": "0.19.0-rc3", "find-parent-dir": "^0.3.0", "firstline": "1.2.1", "fs-extra": "0.30.0", @@ -2046,7 +2008,7 @@ "lodash": "4.13.1", "minimist": "^1.2.0", "murmur-hash-js": "1.0.0", - "node-elm-compiler": "4.3.3", + "node-elm-compiler": "5.0.0-alpha1", "split": "^1.0.1", "supports-color": "4.2.0", "xmlbuilder": "^8.2.2" @@ -3012,28 +2974,17 @@ } }, "elm-webpack-loader": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/elm-webpack-loader/-/elm-webpack-loader-4.5.0.tgz", - "integrity": "sha512-bhzj9Aa6GqNRSCUddMwc0CqfCqtSMZFbyUaCt979xl8wPul2zfwYE4w6WRjMXZZx6RFlN9QTDcti9PJQQ0XQNQ==", + "version": "git+https://github.com/xtian/elm-webpack-loader.git#f8c56b5f2ba46fcc513ee711bc023bb8595faa80", + "from": "git+https://github.com/xtian/elm-webpack-loader.git#0.19", "dev": true, "requires": { - "elm": "^0.18.0", + "elm": "^0.19.0", "glob": "^7.1.1", "loader-utils": "^1.0.2", - "node-elm-compiler": "^4.5.0", + "node-elm-compiler": "^5.0.0-alpha1", "yargs": "^6.5.0" }, "dependencies": { - "cross-spawn": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.0.tgz", - "integrity": "sha1-glR3SrR4a4xbPPTfumbOVjkywlI=", - "dev": true, - "requires": { - "lru-cache": "^4.0.1", - "which": "^1.2.9" - } - }, "loader-utils": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.1.0.tgz", @@ -3044,23 +2995,29 @@ "emojis-list": "^2.0.0", "json5": "^0.5.0" } - }, - "lodash": { - "version": "4.14.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.14.2.tgz", - "integrity": "sha1-u8zOY3OkAPv9CoxnykL20e9BZDI=", - "dev": true - }, - "node-elm-compiler": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/node-elm-compiler/-/node-elm-compiler-4.5.0.tgz", - "integrity": "sha512-XlyiHxqBizqEHaYj4UaO5/qmxeh1Ir/M02RLKsIgHBR7Z8snwoXfdpVntlfF64mcAGkuA1KY0CJsqk0IpAfyLQ==", + } + } + }, + "elmi-to-json": { + "version": "0.19.0-rc3", + "resolved": "https://registry.npmjs.org/elmi-to-json/-/elmi-to-json-0.19.0-rc3.tgz", + "integrity": "sha512-eIuoK947xjPcuZUY0ssmTpzTauadPX6Wekix7Nmw7RO08t3l8LKHTrUgUoA1M8dwwFOKuTL6RCAI9bNruzBN0g==", + "dev": true, + "requires": { + "binwrap": "^0.2.0-rc2" + }, + "dependencies": { + "binwrap": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/binwrap/-/binwrap-0.2.0.tgz", + "integrity": "sha512-HUspivC8zPE37KJQ0S4zsNHUpymzQBinmpdMoa+JwmB6Mi+p30ywVZJcillYpbQmiX2wLykaaDJxXmwZkbaZGA==", "dev": true, "requires": { - "cross-spawn": "4.0.0", - "find-elm-dependencies": "1.0.2", - "lodash": "4.14.2", - "temp": "^0.8.3" + "mustache": "^2.3.0", + "request": "^2.87.0", + "request-promise": "^4.2.0", + "tar": "^2.2.1", + "unzip-stream": "^0.3.0" } } } @@ -3187,8 +3144,7 @@ "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, "escope": { "version": "3.6.0", @@ -4276,14 +4232,12 @@ "generate-function": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", - "integrity": "sha1-aFj+fAlpt9TpCTM3ZHrHn2DfvnQ=", - "dev": true + "integrity": "sha1-aFj+fAlpt9TpCTM3ZHrHn2DfvnQ=" }, "generate-object-property": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=", - "dev": true, "requires": { "is-property": "^1.0.0" } @@ -4407,7 +4361,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "dev": true, "requires": { "ansi-regex": "^2.0.0" } @@ -4519,7 +4472,6 @@ "version": "3.1.3", "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", - "dev": true, "requires": { "boom": "2.x.x", "cryptiles": "2.x.x", @@ -4541,8 +4493,7 @@ "hoek": { "version": "2.16.3", "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", - "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", - "dev": true + "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=" }, "hosted-git-info": { "version": "2.7.1", @@ -4889,14 +4840,12 @@ "is-my-ip-valid": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-my-ip-valid/-/is-my-ip-valid-1.0.0.tgz", - "integrity": "sha512-gmh/eWXROncUzRnIa1Ubrt5b8ep/MGSnfAUI3aRp+sqTCs1tv1Isl8d8F6JmkN3dXKc3ehZMrtiPN9eL03NuaQ==", - "dev": true + "integrity": "sha512-gmh/eWXROncUzRnIa1Ubrt5b8ep/MGSnfAUI3aRp+sqTCs1tv1Isl8d8F6JmkN3dXKc3ehZMrtiPN9eL03NuaQ==" }, "is-my-json-valid": { "version": "2.19.0", "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.19.0.tgz", "integrity": "sha512-mG0f/unGX1HZ5ep4uhRaPOS8EkAY8/j6mDRMJrutq4CqhoJWYp7qAlonIPy3TV7p3ju4TK9fo/PbnoksWmsp5Q==", - "dev": true, "requires": { "generate-function": "^2.0.0", "generate-object-property": "^1.1.0", @@ -4946,8 +4895,7 @@ "is-property": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", - "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=", - "dev": true + "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=" }, "is-stream": { "version": "1.1.0", @@ -4975,7 +4923,8 @@ "isarray": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true }, "isexe": { "version": "2.0.0", @@ -5071,8 +5020,7 @@ "jsonpointer": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", - "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=", - "dev": true + "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=" }, "jsprim": { "version": "1.4.1", @@ -5650,7 +5598,8 @@ "natives": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/natives/-/natives-1.1.4.tgz", - "integrity": "sha512-Q29yeg9aFKwhLVdkTAejM/HvYG0Y1Am1+HUkFQGn5k2j8GS+v60TVmZh6nujpEAj/qql+wGUrlryO8bF+b1jEg==" + "integrity": "sha512-Q29yeg9aFKwhLVdkTAejM/HvYG0Y1Am1+HUkFQGn5k2j8GS+v60TVmZh6nujpEAj/qql+wGUrlryO8bF+b1jEg==", + "dev": true }, "negotiator": { "version": "0.6.1", @@ -6242,14 +6191,12 @@ "pinkie": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", - "dev": true + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" }, "pinkie-promise": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", - "dev": true, "requires": { "pinkie": "^2.0.0" } @@ -6301,15 +6248,6 @@ "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", "dev": true }, - "promise": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/promise/-/promise-7.1.1.tgz", - "integrity": "sha1-SJZUxpJha4qlWwck+oCbt9tJxb8=", - "dev": true, - "requires": { - "asap": "~2.0.3" - } - }, "proxy-addr": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-1.1.5.tgz", @@ -6542,6 +6480,7 @@ "version": "1.0.34", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "dev": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.1", @@ -7108,7 +7047,6 @@ "version": "1.0.9", "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", - "dev": true, "requires": { "hoek": "2.x.x" } @@ -7525,19 +7463,18 @@ "string_decoder": { "version": "0.10.31", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true }, "stringstream": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.6.tgz", - "integrity": "sha512-87GEBAkegbBcweToUrdzf3eLhWNg06FJTebl4BVJz/JgWy8CvEr9dRtX5qWphiynMSQlxxi+QqN0z5T32SLlhA==", - "dev": true + "integrity": "sha512-87GEBAkegbBcweToUrdzf3eLhWNg06FJTebl4BVJz/JgWy8CvEr9dRtX5qWphiynMSQlxxi+QqN0z5T32SLlhA==" }, "strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, "requires": { "ansi-regex": "^2.0.0" } @@ -7591,8 +7528,7 @@ "supports-color": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" }, "syntax-error": { "version": "1.4.0", @@ -8439,6 +8375,15 @@ } } }, + "unzip-stream": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/unzip-stream/-/unzip-stream-0.3.0.tgz", + "integrity": "sha512-NG1h/MdGIX3HzyqMjyj1laBCmlPYhcO4xEy7gEqqzGiSLw7XqDQCnY4nYSn5XSaH8mQ6TFkaujrO8d/PIZN85A==", + "requires": { + "binary": "^0.3.0", + "mkdirp": "^0.5.1" + } + }, "upath": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/upath/-/upath-1.1.0.tgz", @@ -9493,8 +9438,7 @@ "xtend": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", - "dev": true + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" }, "y18n": { "version": "3.2.1", diff --git a/webpack.config.ts b/webpack.config.ts index e7801334d..9a66396d9 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -2,7 +2,7 @@ const webpack = require("webpack"); const path = require("path"); module.exports = { - entry: "./src/elm-graphql.ts", + entry: "./generator/src/elm-graphql.ts", target: "node", resolve: { extensions: [".ts", ".js", ".json"] @@ -23,7 +23,7 @@ module.exports = { use: [ { loader: "elm-webpack-loader", - options: {} + options: { cwd: './generator' } } ] },