@graphql-inspector/audit-command 0.0.0-canary.fec2df4 → 3.4.1-alpha-20230111095532-bd016dc8

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.
Files changed (3) hide show
  1. package/index.js +4 -6
  2. package/index.mjs +4 -6
  3. package/package.json +4 -4
package/index.js CHANGED
@@ -7,9 +7,9 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
7
7
  const tslib = require('tslib');
8
8
  const commands = require('@graphql-inspector/commands');
9
9
  const core = require('@graphql-inspector/core');
10
- const graphql = require('graphql');
11
10
  const logger = require('@graphql-inspector/logger');
12
11
  const Table = _interopDefault(require('cli-table3'));
12
+ const graphql = require('graphql');
13
13
 
14
14
  const index = commands.createCommand(api => {
15
15
  return {
@@ -76,10 +76,8 @@ function handler(args) {
76
76
  fragments.set(definition.name.value, definition);
77
77
  fragmentStrings.set(definition.name.value, graphql.print(definition));
78
78
  }
79
- else if (definition.kind === 'OperationDefinition') {
80
- if (definition.name) {
81
- operations.set(definition.name.value, definition);
82
- }
79
+ else if (definition.kind === 'OperationDefinition' && definition.name) {
80
+ operations.set(definition.name.value, definition);
83
81
  }
84
82
  }
85
83
  }
@@ -99,7 +97,7 @@ function handler(args) {
99
97
  getReferencedFragmentSource: getFragmentSource,
100
98
  });
101
99
  const complexity = core.calculateOperationComplexity(operation, args.complexityConfig, getFragmentReference);
102
- results.push([name, depth, aliases, directives, tokenCount.toFixed(2), complexity]);
100
+ results.push([name, depth, aliases, directives, tokenCount, complexity.toFixed(2)]);
103
101
  maxDepth = Math.max(maxDepth, depth);
104
102
  maxAliases = Math.max(maxAliases, aliases);
105
103
  maxDirectives = Math.max(maxDirectives, directives);
package/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import { __awaiter } from 'tslib';
2
2
  import { createCommand } from '@graphql-inspector/commands';
3
3
  import { countDepth, countAliases, countDirectives, calculateTokenCount, calculateOperationComplexity } from '@graphql-inspector/core';
4
- import { print } from 'graphql';
5
4
  import { Logger, chalk } from '@graphql-inspector/logger';
6
5
  import Table from 'cli-table3';
6
+ import { print } from 'graphql';
7
7
 
8
8
  const index = createCommand(api => {
9
9
  return {
@@ -70,10 +70,8 @@ function handler(args) {
70
70
  fragments.set(definition.name.value, definition);
71
71
  fragmentStrings.set(definition.name.value, print(definition));
72
72
  }
73
- else if (definition.kind === 'OperationDefinition') {
74
- if (definition.name) {
75
- operations.set(definition.name.value, definition);
76
- }
73
+ else if (definition.kind === 'OperationDefinition' && definition.name) {
74
+ operations.set(definition.name.value, definition);
77
75
  }
78
76
  }
79
77
  }
@@ -93,7 +91,7 @@ function handler(args) {
93
91
  getReferencedFragmentSource: getFragmentSource,
94
92
  });
95
93
  const complexity = calculateOperationComplexity(operation, args.complexityConfig, getFragmentReference);
96
- results.push([name, depth, aliases, directives, tokenCount.toFixed(2), complexity]);
94
+ results.push([name, depth, aliases, directives, tokenCount, complexity.toFixed(2)]);
97
95
  maxDepth = Math.max(maxDepth, depth);
98
96
  maxAliases = Math.max(maxAliases, aliases);
99
97
  maxDirectives = Math.max(maxDirectives, directives);
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@graphql-inspector/audit-command",
3
- "version": "0.0.0-canary.fec2df4",
3
+ "version": "3.4.1-alpha-20230111095532-bd016dc8",
4
4
  "description": "Audit Documents in GraphQL Inspector",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
7
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.fec2df4",
11
- "@graphql-inspector/core": "0.0.0-canary.fec2df4",
12
- "@graphql-inspector/logger": "0.0.0-canary.fec2df4",
10
+ "@graphql-inspector/commands": "3.4.1-alpha-20230111095532-bd016dc8",
11
+ "@graphql-inspector/core": "3.4.1-alpha-20230111095532-bd016dc8",
12
+ "@graphql-inspector/logger": "3.4.1-alpha-20230111095532-bd016dc8",
13
13
  "cli-table3": "0.6.2",
14
14
  "tslib": "^2.0.0"
15
15
  },