@graphql-inspector/coverage-command 0.0.0-canary.0fd8c6a → 0.0.0-canary.36b26d2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,7 +12,7 @@ const fs = require('fs');
12
12
 
13
13
  function handler({ schema, documents, silent, writePath, }) {
14
14
  const shouldWrite = typeof writePath !== 'undefined';
15
- const coverage = core.coverage(schema, documents.map((doc) => new graphql.Source(graphql.print(doc.document), doc.location)));
15
+ const coverage = core.coverage(schema, documents.map(doc => new graphql.Source(graphql.print(doc.document), doc.location)));
16
16
  if (silent !== true) {
17
17
  renderCoverage(coverage);
18
18
  }
@@ -37,7 +37,7 @@ function handler({ schema, documents, silent, writePath, }) {
37
37
  }
38
38
  }
39
39
  }
40
- const index = commands.createCommand((api) => {
40
+ const index = commands.createCommand(api => {
41
41
  const { loaders } = api;
42
42
  return {
43
43
  command: 'coverage <documents> <schema>',
@@ -68,14 +68,19 @@ const index = commands.createCommand((api) => {
68
68
  });
69
69
  },
70
70
  handler(args) {
71
+ var _a;
71
72
  return tslib.__awaiter(this, void 0, void 0, function* () {
72
73
  const writePath = args.write;
73
74
  const silent = args.silent;
74
75
  const { headers, token } = commands.parseGlobalArgs(args);
76
+ const apolloFederation = args.federation || false;
77
+ const aws = args.aws || false;
78
+ const method = ((_a = args.method) === null || _a === void 0 ? void 0 : _a.toUpperCase()) || 'POST';
75
79
  const schema = yield loaders.loadSchema(args.schema, {
76
80
  token,
77
81
  headers,
78
- });
82
+ method,
83
+ }, apolloFederation, aws);
79
84
  const documents = yield loaders.loadDocuments(args.documents);
80
85
  return handler({ schema, documents, silent, writePath });
81
86
  });
@@ -90,25 +95,15 @@ function renderCoverage(coverage) {
90
95
  for (const typeName in coverage.types) {
91
96
  if (coverage.types.hasOwnProperty(typeName)) {
92
97
  const typeCoverage = coverage.types[typeName];
93
- logger.Logger.log([
94
- logger.chalk.grey(core.getTypePrefix(typeCoverage.type)),
95
- logger.chalk.bold(`${typeName}`),
96
- logger.chalk.grey('{'),
97
- ].join(' '));
98
+ logger.Logger.log([logger.chalk.grey(core.getTypePrefix(typeCoverage.type)), logger.chalk.bold(`${typeName}`), logger.chalk.grey('{')].join(' '));
98
99
  for (const childName in typeCoverage.children) {
99
100
  if (typeCoverage.children.hasOwnProperty(childName)) {
100
101
  const childCoverage = typeCoverage.children[childName];
101
102
  if (childCoverage.hits) {
102
- logger.Logger.log([
103
- indent(childName, 2),
104
- logger.chalk.italic.grey(`x ${childCoverage.hits}`),
105
- ].join(' '));
103
+ logger.Logger.log([indent(childName, 2), logger.chalk.italic.grey(`x ${childCoverage.hits}`)].join(' '));
106
104
  }
107
105
  else {
108
- logger.Logger.log([
109
- logger.chalk.redBright(indent(childName, 2)),
110
- logger.chalk.italic.grey('x 0'),
111
- ].join(' '));
106
+ logger.Logger.log([logger.chalk.redBright(indent(childName, 2)), logger.chalk.italic.grey('x 0')].join(' '));
112
107
  }
113
108
  }
114
109
  }
@@ -122,4 +117,3 @@ function indent(line, space) {
122
117
 
123
118
  exports.default = index;
124
119
  exports.handler = handler;
125
- //# sourceMappingURL=index.cjs.js.map
@@ -8,7 +8,7 @@ import { writeFileSync } from 'fs';
8
8
 
9
9
  function handler({ schema, documents, silent, writePath, }) {
10
10
  const shouldWrite = typeof writePath !== 'undefined';
11
- const coverage$1 = coverage(schema, documents.map((doc) => new Source(print(doc.document), doc.location)));
11
+ const coverage$1 = coverage(schema, documents.map(doc => new Source(print(doc.document), doc.location)));
12
12
  if (silent !== true) {
13
13
  renderCoverage(coverage$1);
14
14
  }
@@ -33,7 +33,7 @@ function handler({ schema, documents, silent, writePath, }) {
33
33
  }
34
34
  }
35
35
  }
36
- const index = createCommand((api) => {
36
+ const index = createCommand(api => {
37
37
  const { loaders } = api;
38
38
  return {
39
39
  command: 'coverage <documents> <schema>',
@@ -64,14 +64,19 @@ const index = createCommand((api) => {
64
64
  });
65
65
  },
66
66
  handler(args) {
67
+ var _a;
67
68
  return __awaiter(this, void 0, void 0, function* () {
68
69
  const writePath = args.write;
69
70
  const silent = args.silent;
70
71
  const { headers, token } = parseGlobalArgs(args);
72
+ const apolloFederation = args.federation || false;
73
+ const aws = args.aws || false;
74
+ const method = ((_a = args.method) === null || _a === void 0 ? void 0 : _a.toUpperCase()) || 'POST';
71
75
  const schema = yield loaders.loadSchema(args.schema, {
72
76
  token,
73
77
  headers,
74
- });
78
+ method,
79
+ }, apolloFederation, aws);
75
80
  const documents = yield loaders.loadDocuments(args.documents);
76
81
  return handler({ schema, documents, silent, writePath });
77
82
  });
@@ -86,25 +91,15 @@ function renderCoverage(coverage) {
86
91
  for (const typeName in coverage.types) {
87
92
  if (coverage.types.hasOwnProperty(typeName)) {
88
93
  const typeCoverage = coverage.types[typeName];
89
- Logger.log([
90
- chalk.grey(getTypePrefix(typeCoverage.type)),
91
- chalk.bold(`${typeName}`),
92
- chalk.grey('{'),
93
- ].join(' '));
94
+ Logger.log([chalk.grey(getTypePrefix(typeCoverage.type)), chalk.bold(`${typeName}`), chalk.grey('{')].join(' '));
94
95
  for (const childName in typeCoverage.children) {
95
96
  if (typeCoverage.children.hasOwnProperty(childName)) {
96
97
  const childCoverage = typeCoverage.children[childName];
97
98
  if (childCoverage.hits) {
98
- Logger.log([
99
- indent(childName, 2),
100
- chalk.italic.grey(`x ${childCoverage.hits}`),
101
- ].join(' '));
99
+ Logger.log([indent(childName, 2), chalk.italic.grey(`x ${childCoverage.hits}`)].join(' '));
102
100
  }
103
101
  else {
104
- Logger.log([
105
- chalk.redBright(indent(childName, 2)),
106
- chalk.italic.grey('x 0'),
107
- ].join(' '));
102
+ Logger.log([chalk.redBright(indent(childName, 2)), chalk.italic.grey('x 0')].join(' '));
108
103
  }
109
104
  }
110
105
  }
@@ -118,4 +113,3 @@ function indent(line, space) {
118
113
 
119
114
  export default index;
120
115
  export { handler };
121
- //# sourceMappingURL=index.esm.js.map
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@graphql-inspector/coverage-command",
3
- "version": "0.0.0-canary.0fd8c6a",
3
+ "version": "0.0.0-canary.36b26d2",
4
4
  "description": "Schema Coverage in GraphQL Inspector",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
7
- "graphql": "^0.13.0 || ^14.0.0 || ^15.0.0"
7
+ "graphql": "^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
8
8
  },
9
9
  "dependencies": {
10
- "@graphql-inspector/commands": "0.0.0-canary.0fd8c6a",
11
- "@graphql-inspector/core": "0.0.0-canary.0fd8c6a",
12
- "@graphql-inspector/logger": "0.0.0-canary.0fd8c6a",
10
+ "@graphql-inspector/commands": "0.0.0-canary.36b26d2",
11
+ "@graphql-inspector/core": "0.0.0-canary.36b26d2",
12
+ "@graphql-inspector/logger": "0.0.0-canary.36b26d2",
13
13
  "tslib": "^2.0.0"
14
14
  },
15
15
  "repository": {
@@ -29,10 +29,20 @@
29
29
  "url": "https://github.com/kamilkisiela"
30
30
  },
31
31
  "license": "MIT",
32
- "main": "index.cjs.js",
33
- "module": "index.esm.js",
32
+ "main": "index.js",
33
+ "module": "index.mjs",
34
34
  "typings": "index.d.ts",
35
35
  "typescript": {
36
36
  "definition": "index.d.ts"
37
+ },
38
+ "exports": {
39
+ ".": {
40
+ "require": "./index.js",
41
+ "import": "./index.mjs"
42
+ },
43
+ "./*": {
44
+ "require": "./*.js",
45
+ "import": "./*.mjs"
46
+ }
37
47
  }
38
48
  }
package/index.cjs.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../../dist/commands/coverage/src/index.js"],"sourcesContent":["import { __awaiter } from \"tslib\";\nimport { createCommand, ensureAbsolute, parseGlobalArgs, } from '@graphql-inspector/commands';\nimport { Logger, chalk } from '@graphql-inspector/logger';\nimport { coverage as calculateCoverage, getTypePrefix, } from '@graphql-inspector/core';\nimport { Source, print } from 'graphql';\nimport { extname } from 'path';\nimport { writeFileSync } from 'fs';\nexport function handler({ schema, documents, silent, writePath, }) {\n const shouldWrite = typeof writePath !== 'undefined';\n const coverage = calculateCoverage(schema, documents.map((doc) => new Source(print(doc.document), doc.location)));\n if (silent !== true) {\n renderCoverage(coverage);\n }\n if (shouldWrite) {\n if (typeof writePath !== 'string') {\n throw new Error(`--write is not valid file path: ${writePath}`);\n }\n const absPath = ensureAbsolute(writePath);\n const ext = extname(absPath).replace('.', '').toLocaleLowerCase();\n let output = undefined;\n if (ext === 'json') {\n output = outputJSON(coverage);\n }\n if (output) {\n writeFileSync(absPath, output, {\n encoding: 'utf-8',\n });\n Logger.success(`Available at ${absPath}\\n`);\n }\n else {\n throw new Error(`Extension ${ext} is not supported`);\n }\n }\n}\nexport default createCommand((api) => {\n const { loaders } = api;\n return {\n command: 'coverage <documents> <schema>',\n describe: 'Schema coverage based on documents',\n builder(yargs) {\n return yargs\n .positional('schema', {\n describe: 'Point to a schema',\n type: 'string',\n demandOption: true,\n })\n .positional('documents', {\n describe: 'Point to documents',\n type: 'string',\n demandOption: true,\n })\n .options({\n w: {\n alias: 'write',\n describe: 'Write a file with coverage stats',\n type: 'string',\n },\n s: {\n alias: 'silent',\n describe: 'Do not render any stats in the terminal',\n type: 'boolean',\n },\n });\n },\n handler(args) {\n return __awaiter(this, void 0, void 0, function* () {\n const writePath = args.write;\n const silent = args.silent;\n const { headers, token } = parseGlobalArgs(args);\n const schema = yield loaders.loadSchema(args.schema, {\n token,\n headers,\n });\n const documents = yield loaders.loadDocuments(args.documents);\n return handler({ schema, documents, silent, writePath });\n });\n },\n };\n});\nfunction outputJSON(coverage) {\n return JSON.stringify(coverage, null, 2);\n}\nfunction renderCoverage(coverage) {\n Logger.info('Schema coverage based on documents:\\n');\n for (const typeName in coverage.types) {\n if (coverage.types.hasOwnProperty(typeName)) {\n const typeCoverage = coverage.types[typeName];\n Logger.log([\n chalk.grey(getTypePrefix(typeCoverage.type)),\n chalk.bold(`${typeName}`),\n chalk.grey('{'),\n ].join(' '));\n for (const childName in typeCoverage.children) {\n if (typeCoverage.children.hasOwnProperty(childName)) {\n const childCoverage = typeCoverage.children[childName];\n if (childCoverage.hits) {\n Logger.log([\n indent(childName, 2),\n chalk.italic.grey(`x ${childCoverage.hits}`),\n ].join(' '));\n }\n else {\n Logger.log([\n chalk.redBright(indent(childName, 2)),\n chalk.italic.grey('x 0'),\n ].join(' '));\n }\n }\n }\n Logger.log(chalk.grey('}\\n'));\n }\n }\n}\nfunction indent(line, space) {\n return line.padStart(line.length + space, ' ');\n}\n//# sourceMappingURL=index.js.map"],"names":["calculateCoverage","Source","print","ensureAbsolute","extname","writeFileSync","Logger","createCommand","__awaiter","parseGlobalArgs","chalk","getTypePrefix"],"mappings":";;;;;;;;;;;;AAOO,SAAS,OAAO,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAG,EAAE;AACnE,IAAI,MAAM,WAAW,GAAG,OAAO,SAAS,KAAK,WAAW,CAAC;AACzD,IAAI,MAAM,QAAQ,GAAGA,aAAiB,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,IAAIC,cAAM,CAACC,aAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AACtH,IAAI,IAAI,MAAM,KAAK,IAAI,EAAE;AACzB,QAAQ,cAAc,CAAC,QAAQ,CAAC,CAAC;AACjC,KAAK;AACL,IAAI,IAAI,WAAW,EAAE;AACrB,QAAQ,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;AAC3C,YAAY,MAAM,IAAI,KAAK,CAAC,CAAC,gCAAgC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;AAC5E,SAAS;AACT,QAAQ,MAAM,OAAO,GAAGC,uBAAc,CAAC,SAAS,CAAC,CAAC;AAClD,QAAQ,MAAM,GAAG,GAAGC,YAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,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AAC;AACpD,yBAAyB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACrC,qBAAqB;AACrB,iBAAiB;AACjB,aAAa;AACb,YAAYJ,aAAM,CAAC,GAAG,CAACI,YAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AAC1C,SAAS;AACT,KAAK;AACL,CAAC;AACD,SAAS,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE;AAC7B,IAAI,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,GAAG,KAAK,EAAE,GAAG,CAAC,CAAC;AACnD;;;;;"}
package/index.esm.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../dist/commands/coverage/src/index.js"],"sourcesContent":["import { __awaiter } from \"tslib\";\nimport { createCommand, ensureAbsolute, parseGlobalArgs, } from '@graphql-inspector/commands';\nimport { Logger, chalk } from '@graphql-inspector/logger';\nimport { coverage as calculateCoverage, getTypePrefix, } from '@graphql-inspector/core';\nimport { Source, print } from 'graphql';\nimport { extname } from 'path';\nimport { writeFileSync } from 'fs';\nexport function handler({ schema, documents, silent, writePath, }) {\n const shouldWrite = typeof writePath !== 'undefined';\n const coverage = calculateCoverage(schema, documents.map((doc) => new Source(print(doc.document), doc.location)));\n if (silent !== true) {\n renderCoverage(coverage);\n }\n if (shouldWrite) {\n if (typeof writePath !== 'string') {\n throw new Error(`--write is not valid file path: ${writePath}`);\n }\n const absPath = ensureAbsolute(writePath);\n const ext = extname(absPath).replace('.', '').toLocaleLowerCase();\n let output = undefined;\n if (ext === 'json') {\n output = outputJSON(coverage);\n }\n if (output) {\n writeFileSync(absPath, output, {\n encoding: 'utf-8',\n });\n Logger.success(`Available at ${absPath}\\n`);\n }\n else {\n throw new Error(`Extension ${ext} is not supported`);\n }\n }\n}\nexport default createCommand((api) => {\n const { loaders } = api;\n return {\n command: 'coverage <documents> <schema>',\n describe: 'Schema coverage based on documents',\n builder(yargs) {\n return yargs\n .positional('schema', {\n describe: 'Point to a schema',\n type: 'string',\n demandOption: true,\n })\n .positional('documents', {\n describe: 'Point to documents',\n type: 'string',\n demandOption: true,\n })\n .options({\n w: {\n alias: 'write',\n describe: 'Write a file with coverage stats',\n type: 'string',\n },\n s: {\n alias: 'silent',\n describe: 'Do not render any stats in the terminal',\n type: 'boolean',\n },\n });\n },\n handler(args) {\n return __awaiter(this, void 0, void 0, function* () {\n const writePath = args.write;\n const silent = args.silent;\n const { headers, token } = parseGlobalArgs(args);\n const schema = yield loaders.loadSchema(args.schema, {\n token,\n headers,\n });\n const documents = yield loaders.loadDocuments(args.documents);\n return handler({ schema, documents, silent, writePath });\n });\n },\n };\n});\nfunction outputJSON(coverage) {\n return JSON.stringify(coverage, null, 2);\n}\nfunction renderCoverage(coverage) {\n Logger.info('Schema coverage based on documents:\\n');\n for (const typeName in coverage.types) {\n if (coverage.types.hasOwnProperty(typeName)) {\n const typeCoverage = coverage.types[typeName];\n Logger.log([\n chalk.grey(getTypePrefix(typeCoverage.type)),\n chalk.bold(`${typeName}`),\n chalk.grey('{'),\n ].join(' '));\n for (const childName in typeCoverage.children) {\n if (typeCoverage.children.hasOwnProperty(childName)) {\n const childCoverage = typeCoverage.children[childName];\n if (childCoverage.hits) {\n Logger.log([\n indent(childName, 2),\n chalk.italic.grey(`x ${childCoverage.hits}`),\n ].join(' '));\n }\n else {\n Logger.log([\n chalk.redBright(indent(childName, 2)),\n chalk.italic.grey('x 0'),\n ].join(' '));\n }\n }\n }\n Logger.log(chalk.grey('}\\n'));\n }\n }\n}\nfunction indent(line, space) {\n return line.padStart(line.length + space, ' ');\n}\n//# sourceMappingURL=index.js.map"],"names":["coverage","calculateCoverage"],"mappings":";;;;;;;;AAOO,SAAS,OAAO,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAG,EAAE;AACnE,IAAI,MAAM,WAAW,GAAG,OAAO,SAAS,KAAK,WAAW,CAAC;AACzD,IAAI,MAAMA,U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