@dillonkearns/elm-graphql
Version:
<img src="https://cdn.jsdelivr.net/gh/martimatix/logo-graphqelm/logo.svg" alt="dillonearns/elm-graphql logo" width="40%" align="right">
1 lines • 7.8 kB
JSON
{"id":"3jpK","dependencies":[{"name":"/home/travis/build/dillonkearns/elm-graphql/tsconfig.json","includedInParent":true,"mtime":1558740283667},{"name":"/home/travis/build/dillonkearns/elm-graphql/package.json","includedInParent":true,"mtime":1558740283663},{"name":"./Main.elm","loc":{"line":45,"column":18},"parent":"/home/travis/build/dillonkearns/elm-graphql/generator/src/elm-graphql.ts","resolved":"/home/travis/build/dillonkearns/elm-graphql/generator/src/Main.elm"},{"name":"fs-extra","loc":{"line":46,"column":30},"parent":"/home/travis/build/dillonkearns/elm-graphql/generator/src/elm-graphql.ts","resolved":"/home/travis/build/dillonkearns/elm-graphql/node_modules/fs-extra/lib/index.js"},{"name":"graphql-request","loc":{"line":47,"column":32},"parent":"/home/travis/build/dillonkearns/elm-graphql/generator/src/elm-graphql.ts","resolved":"/home/travis/build/dillonkearns/elm-graphql/node_modules/graphql-request/dist/src/index.js"},{"name":"./formatted-write","loc":{"line":48,"column":32},"parent":"/home/travis/build/dillonkearns/elm-graphql/generator/src/elm-graphql.ts","resolved":"/home/travis/build/dillonkearns/elm-graphql/generator/src/formatted-write.ts"},{"name":"./introspection-query","loc":{"line":49,"column":36},"parent":"/home/travis/build/dillonkearns/elm-graphql/generator/src/elm-graphql.ts","resolved":"/home/travis/build/dillonkearns/elm-graphql/generator/src/introspection-query.ts"},{"name":"./cli/generated-code-handler","loc":{"line":52,"column":39},"parent":"/home/travis/build/dillonkearns/elm-graphql/generator/src/elm-graphql.ts","resolved":"/home/travis/build/dillonkearns/elm-graphql/generator/src/cli/generated-code-handler.ts"},{"name":"../../package.json","loc":{"line":53,"column":32},"parent":"/home/travis/build/dillonkearns/elm-graphql/generator/src/elm-graphql.ts","resolved":"/home/travis/build/dillonkearns/elm-graphql/package.json"},{"name":"../../elm.json","loc":{"line":54,"column":32},"parent":"/home/travis/build/dillonkearns/elm-graphql/generator/src/elm-graphql.ts","resolved":"/home/travis/build/dillonkearns/elm-graphql/elm.json"}],"generated":{"js":"\"use strict\";var e=this&&this.__awaiter||function(e,n,t,r){return new(t||(t=Promise))(function(o,a){function i(e){try{c(r.next(e))}catch(n){a(n)}}function s(e){try{c(r.throw(e))}catch(n){a(n)}}function c(e){e.done?o(e.value):new t(function(n){n(e.value)}).then(i,s)}c((r=r.apply(e,n||[])).next())})},n=this&&this.__generator||function(e,n){var t,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},\"function\"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(t)throw new TypeError(\"Generator is already executing.\");for(;i;)try{if(t=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=n.call(e,i)}catch(s){a=[6,s],r=0}finally{t=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},t=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)Object.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n.default=e,n};Object.defineProperty(exports,\"__esModule\",{value:!0});var r=require(\"./Main.elm\").Elm,o=t(require(\"fs-extra\")),a=require(\"graphql-request\"),i=require(\"./formatted-write\"),s=require(\"./introspection-query\"),c=t(require(\"path\")),l=t(require(\"child_process\")),u=require(\"./cli/generated-code-handler\"),h=require(\"../../package.json\").version,p=require(\"../../elm.json\").version,d=\"-- Do not manually edit this file, it was auto-generated by dillonkearns/elm-graphql\\n-- https://github.com/dillonkearns/elm-graphql\\n\",f=\"npm version \"+h+\"\\nTargeting elm package dillonkearns/elm-graphql@\"+p;function m(e,n,t){return c.join(t,n.join(\"/\"),e)}var y=r.Main.init({flags:{argv:process.argv,versionMessage:f}});function g(e,n,t){t.forEach(function(t){o.mkdirpSync(m(t,e,n))})}function v(t,r,o,a){console.log(\"Generating files...\"),y.ports.generatedFiles.subscribe(function(t){return e(this,void 0,void 0,function(){return n(this,function(e){switch(e.label){case 0:return u.removeGenerated(m(\"/\",o,r)),g(o,r,[\"InputObject\",\"Object\",\"Interface\",\"Union\",\"Enum\"]),[4,Promise.all(w(r,t)).catch(function(e){console.error(\"Error writing files\",e)})];case 1:return e.sent(),x(o,r),i.applyElmFormat(m(\"/\",o,r)),a&&b(r,o,a),console.log(\"Success!\"),[2]}})})}),y.ports.generateFiles.send(t)}function b(e,n,t){var r=c.join.apply(c,[e].concat(n,[\"VerifyScalarCodecs.elm\"]));try{l.execSync(\"elm make \"+r+\" --output=/dev/null\",{stdio:\"pipe\"})}catch(o){console.error(o.message),console.error(\"--------------------------------------------\\n INVALID SCALAR DECODERS FILE\\n--------------------------------------------\\n\\nYour custom scalar decoders module, `\"+t+\"`, is invalid.\\n\\nThis is because either:\\n\\n1) This is the first time you've run this CLI with the `--scalar-codecs` option.\\n In this case, get a valid file, you can start by copy-pasting `\"+n.join(\".\")+\".ScalarCodecs`. Then change the module name to `\"+t+\"`\\n and you have a valid starting point!\\n2) You added or renamed a Custom Scalar in your GraphQL schema.\\n To handle the new Custom Scalar, you can copy the relevant entries from `\"+t+\"`.\\n\\nCheck the following:\\n * You have a module called `\"+t+\"`\\n * The module is somewhere in your elm path (check the `source-directories` in your `elm.json`)\\n\\n You must:\\n * Have a type for every custom scalar\\n * Expose each of these types\\n * Expose a `decoders` value\\n\\n Above the dashes (----) there are some details that might help you debug the issue. Remember, you can always\\n copy-paste the `\"+n.join(\".\")+\".ScalarCodecs` module to get a valid file.\\n\\n After you've copy pasted the template file, or tried fixing the file,\\n re-run this CLI command to make sure it is valid.\\n \"),process.exit(1)}}function w(e,n){return Object.entries(n).map(function(n){var t=n[0],r=n[1],a=c.join(e,t);return o.writeFile(a,d+r)})}function x(e,n){o.writeFileSync(m(\"elm-graphql-metadata.json\",e,n),'{\"targetElmPackageVersion\": \"'+p+'\", \"generatedByNpmPackageVersion\": \"'+h+'\"}')}y.ports.printAndExitFailure.subscribe(function(e){console.log(e),process.exit(1)}),y.ports.printAndExitSuccess.subscribe(function(e){console.log(e),process.exit(0)}),y.ports.introspectSchemaFromFile.subscribe(function(e){var n=e.introspectionFilePath,t=e.outputPath,r=e.baseModule,a=e.customDecodersModule;u.warnAndExitIfContainsNonGenerated({baseModule:r,outputPath:t});var i=JSON.parse(o.readFileSync(n).toString());v(i.data||i,t,r,a)}),y.ports.introspectSchemaFromUrl.subscribe(function(e){var n=e.graphqlUrl,t=e.excludeDeprecated,r=e.outputPath,o=e.baseModule,i=e.headers,c=e.customDecodersModule;u.warnAndExitIfContainsNonGenerated({baseModule:o,outputPath:r}),console.log(\"Fetching GraphQL schema...\"),new a.GraphQLClient(n,{mode:\"cors\",headers:i}).request(s.introspectionQuery,{includeDeprecated:!t}).then(function(e){v(e,r,o,c)}).catch(function(e){console.log(e.response||e),process.exit(1)})});"},"sourceMaps":null,"error":null,"hash":"9e4a0bda673be6d267802511faee4f85","cacheData":{"env":{}}}