@graphql-inspector/core 3.1.2 → 3.1.3
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.
- package/dist/LICENSE +21 -0
- package/dist/README.md +55 -0
- package/{ast → dist/ast}/document.d.ts +0 -0
- package/{coverage → dist/coverage}/index.d.ts +0 -0
- package/{coverage → dist/coverage}/output/json.d.ts +0 -0
- package/{diff → dist/diff}/argument.d.ts +0 -0
- package/{diff → dist/diff}/changes/argument.d.ts +0 -0
- package/{diff → dist/diff}/changes/change.d.ts +0 -0
- package/{diff → dist/diff}/changes/directive.d.ts +0 -0
- package/{diff → dist/diff}/changes/enum.d.ts +0 -0
- package/{diff → dist/diff}/changes/field.d.ts +0 -0
- package/{diff → dist/diff}/changes/input.d.ts +0 -0
- package/{diff → dist/diff}/changes/object.d.ts +0 -0
- package/{diff → dist/diff}/changes/schema.d.ts +0 -0
- package/{diff → dist/diff}/changes/type.d.ts +0 -0
- package/{diff → dist/diff}/changes/union.d.ts +0 -0
- package/{diff → dist/diff}/directive.d.ts +0 -0
- package/{diff → dist/diff}/enum.d.ts +0 -0
- package/{diff → dist/diff}/field.d.ts +0 -0
- package/{diff → dist/diff}/index.d.ts +0 -0
- package/{diff → dist/diff}/input.d.ts +0 -0
- package/{diff → dist/diff}/interface.d.ts +0 -0
- package/{diff → dist/diff}/object.d.ts +0 -0
- package/{diff → dist/diff}/onComplete/types.d.ts +0 -0
- package/{diff → dist/diff}/rules/config.d.ts +0 -0
- package/{diff → dist/diff}/rules/consider-usage.d.ts +0 -0
- package/{diff → dist/diff}/rules/dangerous-breaking.d.ts +0 -0
- package/{diff → dist/diff}/rules/ignore-description-changes.d.ts +0 -0
- package/{diff → dist/diff}/rules/index.d.ts +1 -0
- package/{diff → dist/diff}/rules/safe-unreachable.d.ts +0 -0
- package/{diff → dist/diff}/rules/suppress-removal-of-deprecated-field.d.ts +0 -0
- package/{diff → dist/diff}/rules/types.d.ts +0 -0
- package/{diff → dist/diff}/schema.d.ts +0 -0
- package/{diff → dist/diff}/union.d.ts +0 -0
- package/{index.d.ts → dist/index.d.ts} +0 -0
- package/{index.js → dist/index.js} +100 -3
- package/{index.mjs → dist/index.mjs} +101 -4
- package/dist/package.json +46 -0
- package/{similar → dist/similar}/index.d.ts +0 -0
- package/{utils → dist/utils}/apollo.d.ts +0 -0
- package/{utils → dist/utils}/compare.d.ts +0 -1
- package/{utils → dist/utils}/graphql.d.ts +0 -0
- package/{utils → dist/utils}/isDeprecated.d.ts +0 -0
- package/{utils → dist/utils}/path.d.ts +0 -0
- package/{utils → dist/utils}/string.d.ts +0 -0
- package/{validate → dist/validate}/index.d.ts +0 -0
- package/{validate → dist/validate}/query-depth.d.ts +0 -0
- package/package.json +35 -29
- package/utils/testing.ts +11 -0
package/dist/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Kamil Kisiela
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# GraphQL Inspector
|
|
2
|
+
|
|
3
|
+
[](https://circleci.com/gh/kamilkisiela/graphql-inspector)
|
|
4
|
+
[](https://npmjs.com/package/@graphql-inspector/core)
|
|
5
|
+
|
|
6
|
+
**GraphQL Inspector** ouputs a list of changes between two GraphQL schemas. Every change is precisely explained and marked as breaking, non-breaking or dangerous.
|
|
7
|
+
It helps you validate documents and fragments against a schema and even find similar or duplicated types.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
Major features:
|
|
12
|
+
|
|
13
|
+
- **Compares schemas**
|
|
14
|
+
- **Finds breaking or dangerous changes**
|
|
15
|
+
- **Validates documents against a schema**
|
|
16
|
+
- **Finds similar / duplicated types**
|
|
17
|
+
- **Schema coverage based on documents**
|
|
18
|
+
- **Serves a GraphQL server with faked data and GraphQL Playground**
|
|
19
|
+
|
|
20
|
+
GraphQL Inspector has a **CLI** and also a **programatic API**, so you can use it however you want to and even build tools on top of it.
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
yarn add @graphql-inspector/core
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Examples
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import {
|
|
32
|
+
diff,
|
|
33
|
+
validate,
|
|
34
|
+
similar,
|
|
35
|
+
coverage,
|
|
36
|
+
Change,
|
|
37
|
+
InvalidDocument,
|
|
38
|
+
SimilarMap,
|
|
39
|
+
SchemaCoverage
|
|
40
|
+
} from '@graphql-inspector/core'
|
|
41
|
+
|
|
42
|
+
// diff
|
|
43
|
+
const changes: Change[] = diff(schemaA, schemaB)
|
|
44
|
+
// validate
|
|
45
|
+
const invalid: InvalidDocument[] = validate(documentsGlob, schema)
|
|
46
|
+
// similar
|
|
47
|
+
const similar: SimilarMap = similar(schema, typename, threshold)
|
|
48
|
+
// coverage
|
|
49
|
+
const schemaCoverage: SchemaCoverage = coverage(schema, documents)
|
|
50
|
+
// ...
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
[MIT](https://github.com/kamilkisiela/graphql-inspector/blob/master/LICENSE) © Kamil Kisiela
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -20,7 +20,21 @@ function isEqual(a, b) {
|
|
|
20
20
|
if (a.length !== b.length)
|
|
21
21
|
return false;
|
|
22
22
|
for (var index = 0; index < a.length; index++) {
|
|
23
|
-
if (a[index]
|
|
23
|
+
if (!isEqual(a[index], b[index])) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
if (typeof a === 'object' && typeof b === 'object') {
|
|
30
|
+
const aRecord = a;
|
|
31
|
+
const bRecord = b;
|
|
32
|
+
const aKeys = Object.keys(aRecord);
|
|
33
|
+
const bKeys = Object.keys(bRecord);
|
|
34
|
+
if (aKeys.length !== bKeys.length)
|
|
35
|
+
return false;
|
|
36
|
+
for (const key of aKeys) {
|
|
37
|
+
if (!isEqual(aRecord[key], bRecord[key])) {
|
|
24
38
|
return false;
|
|
25
39
|
}
|
|
26
40
|
}
|
|
@@ -35,7 +49,7 @@ function isVoid(a) {
|
|
|
35
49
|
return typeof a === 'undefined' || a === null;
|
|
36
50
|
}
|
|
37
51
|
function diffArrays(a, b) {
|
|
38
|
-
return a.filter((c) => !b.some((d) => d
|
|
52
|
+
return a.filter((c) => !b.some((d) => isEqual(d, c)));
|
|
39
53
|
}
|
|
40
54
|
function compareLists(oldList, newList, callbacks) {
|
|
41
55
|
const oldMap = keyMap(oldList, ({ name }) => name);
|
|
@@ -204,6 +218,75 @@ function removeDirectives(node, directiveNames) {
|
|
|
204
218
|
}
|
|
205
219
|
return node;
|
|
206
220
|
}
|
|
221
|
+
function getReachableTypes(schema) {
|
|
222
|
+
const reachableTypes = new Set();
|
|
223
|
+
const collect = (type) => {
|
|
224
|
+
const typeName = type.name;
|
|
225
|
+
if (reachableTypes.has(typeName)) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
reachableTypes.add(typeName);
|
|
229
|
+
if (graphql.isScalarType(type)) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
else if (graphql.isInterfaceType(type) || graphql.isObjectType(type)) {
|
|
233
|
+
if (graphql.isInterfaceType(type)) {
|
|
234
|
+
const { objects, interfaces } = schema.getImplementations(type);
|
|
235
|
+
for (const child of objects) {
|
|
236
|
+
collect(child);
|
|
237
|
+
}
|
|
238
|
+
for (const child of interfaces) {
|
|
239
|
+
collect(child);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
const fields = type.getFields();
|
|
243
|
+
for (const fieldName in fields) {
|
|
244
|
+
const field = fields[fieldName];
|
|
245
|
+
collect(resolveOutputType(field.type));
|
|
246
|
+
const args = field.args;
|
|
247
|
+
for (const argName in args) {
|
|
248
|
+
const arg = args[argName];
|
|
249
|
+
collect(resolveInputType(arg.type));
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
else if (graphql.isUnionType(type)) {
|
|
254
|
+
const types = type.getTypes();
|
|
255
|
+
for (const child of types) {
|
|
256
|
+
collect(child);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
else if (graphql.isInputObjectType(type)) {
|
|
260
|
+
const fields = type.getFields();
|
|
261
|
+
for (const fieldName in fields) {
|
|
262
|
+
const field = fields[fieldName];
|
|
263
|
+
collect(resolveInputType(field.type));
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
for (const type of [
|
|
268
|
+
schema.getQueryType(),
|
|
269
|
+
schema.getMutationType(),
|
|
270
|
+
schema.getSubscriptionType(),
|
|
271
|
+
]) {
|
|
272
|
+
if (type) {
|
|
273
|
+
collect(type);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return reachableTypes;
|
|
277
|
+
}
|
|
278
|
+
function resolveOutputType(output) {
|
|
279
|
+
if (graphql.isListType(output) || graphql.isNonNullType(output)) {
|
|
280
|
+
return resolveOutputType(output.ofType);
|
|
281
|
+
}
|
|
282
|
+
return output;
|
|
283
|
+
}
|
|
284
|
+
function resolveInputType(input) {
|
|
285
|
+
if (graphql.isListType(input) || graphql.isNonNullType(input)) {
|
|
286
|
+
return resolveInputType(input.ofType);
|
|
287
|
+
}
|
|
288
|
+
return input;
|
|
289
|
+
}
|
|
207
290
|
|
|
208
291
|
(function (ChangeType) {
|
|
209
292
|
// Argument
|
|
@@ -1341,12 +1424,26 @@ const considerUsage = ({ changes, config, }) => tslib.__awaiter(void 0, void 0,
|
|
|
1341
1424
|
});
|
|
1342
1425
|
});
|
|
1343
1426
|
|
|
1427
|
+
const safeUnreachable = ({ changes, oldSchema }) => {
|
|
1428
|
+
const reachable = getReachableTypes(oldSchema);
|
|
1429
|
+
return changes.map((change) => {
|
|
1430
|
+
if (change.criticality.level === exports.CriticalityLevel.Breaking && change.path) {
|
|
1431
|
+
const [typeName] = parsePath(change.path);
|
|
1432
|
+
if (!reachable.has(typeName)) {
|
|
1433
|
+
return Object.assign(Object.assign({}, change), { criticality: Object.assign(Object.assign({}, change.criticality), { level: exports.CriticalityLevel.NonBreaking }), message: 'Unreachable from root' });
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
return change;
|
|
1437
|
+
});
|
|
1438
|
+
};
|
|
1439
|
+
|
|
1344
1440
|
const rules = /*#__PURE__*/Object.freeze({
|
|
1345
1441
|
__proto__: null,
|
|
1346
1442
|
dangerousBreaking: dangerousBreaking,
|
|
1347
1443
|
suppressRemovalOfDeprecatedField: suppressRemovalOfDeprecatedField,
|
|
1348
1444
|
ignoreDescriptionChanges: ignoreDescriptionChanges,
|
|
1349
|
-
considerUsage: considerUsage
|
|
1445
|
+
considerUsage: considerUsage,
|
|
1446
|
+
safeUnreachable: safeUnreachable
|
|
1350
1447
|
});
|
|
1351
1448
|
|
|
1352
1449
|
const DiffRule = rules;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __awaiter } from 'tslib';
|
|
2
|
-
import { Kind, TypeInfo, visit, visitWithTypeInfo, GraphQLError, getNamedType,
|
|
2
|
+
import { Kind, TypeInfo, visit, visitWithTypeInfo, GraphQLError, getNamedType, isScalarType, isInterfaceType, isObjectType, isUnionType, isInputObjectType, isListType, isNonNullType, isWrappingType, isEnumType, parse, extendSchema, print, validate as validate$1, printType } from 'graphql';
|
|
3
3
|
import inspect from 'object-inspect';
|
|
4
4
|
import { DepGraph } from 'dependency-graph';
|
|
5
5
|
|
|
@@ -14,7 +14,21 @@ function isEqual(a, b) {
|
|
|
14
14
|
if (a.length !== b.length)
|
|
15
15
|
return false;
|
|
16
16
|
for (var index = 0; index < a.length; index++) {
|
|
17
|
-
if (a[index]
|
|
17
|
+
if (!isEqual(a[index], b[index])) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
if (typeof a === 'object' && typeof b === 'object') {
|
|
24
|
+
const aRecord = a;
|
|
25
|
+
const bRecord = b;
|
|
26
|
+
const aKeys = Object.keys(aRecord);
|
|
27
|
+
const bKeys = Object.keys(bRecord);
|
|
28
|
+
if (aKeys.length !== bKeys.length)
|
|
29
|
+
return false;
|
|
30
|
+
for (const key of aKeys) {
|
|
31
|
+
if (!isEqual(aRecord[key], bRecord[key])) {
|
|
18
32
|
return false;
|
|
19
33
|
}
|
|
20
34
|
}
|
|
@@ -29,7 +43,7 @@ function isVoid(a) {
|
|
|
29
43
|
return typeof a === 'undefined' || a === null;
|
|
30
44
|
}
|
|
31
45
|
function diffArrays(a, b) {
|
|
32
|
-
return a.filter((c) => !b.some((d) => d
|
|
46
|
+
return a.filter((c) => !b.some((d) => isEqual(d, c)));
|
|
33
47
|
}
|
|
34
48
|
function compareLists(oldList, newList, callbacks) {
|
|
35
49
|
const oldMap = keyMap(oldList, ({ name }) => name);
|
|
@@ -198,6 +212,75 @@ function removeDirectives(node, directiveNames) {
|
|
|
198
212
|
}
|
|
199
213
|
return node;
|
|
200
214
|
}
|
|
215
|
+
function getReachableTypes(schema) {
|
|
216
|
+
const reachableTypes = new Set();
|
|
217
|
+
const collect = (type) => {
|
|
218
|
+
const typeName = type.name;
|
|
219
|
+
if (reachableTypes.has(typeName)) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
reachableTypes.add(typeName);
|
|
223
|
+
if (isScalarType(type)) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
else if (isInterfaceType(type) || isObjectType(type)) {
|
|
227
|
+
if (isInterfaceType(type)) {
|
|
228
|
+
const { objects, interfaces } = schema.getImplementations(type);
|
|
229
|
+
for (const child of objects) {
|
|
230
|
+
collect(child);
|
|
231
|
+
}
|
|
232
|
+
for (const child of interfaces) {
|
|
233
|
+
collect(child);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
const fields = type.getFields();
|
|
237
|
+
for (const fieldName in fields) {
|
|
238
|
+
const field = fields[fieldName];
|
|
239
|
+
collect(resolveOutputType(field.type));
|
|
240
|
+
const args = field.args;
|
|
241
|
+
for (const argName in args) {
|
|
242
|
+
const arg = args[argName];
|
|
243
|
+
collect(resolveInputType(arg.type));
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
else if (isUnionType(type)) {
|
|
248
|
+
const types = type.getTypes();
|
|
249
|
+
for (const child of types) {
|
|
250
|
+
collect(child);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
else if (isInputObjectType(type)) {
|
|
254
|
+
const fields = type.getFields();
|
|
255
|
+
for (const fieldName in fields) {
|
|
256
|
+
const field = fields[fieldName];
|
|
257
|
+
collect(resolveInputType(field.type));
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
for (const type of [
|
|
262
|
+
schema.getQueryType(),
|
|
263
|
+
schema.getMutationType(),
|
|
264
|
+
schema.getSubscriptionType(),
|
|
265
|
+
]) {
|
|
266
|
+
if (type) {
|
|
267
|
+
collect(type);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return reachableTypes;
|
|
271
|
+
}
|
|
272
|
+
function resolveOutputType(output) {
|
|
273
|
+
if (isListType(output) || isNonNullType(output)) {
|
|
274
|
+
return resolveOutputType(output.ofType);
|
|
275
|
+
}
|
|
276
|
+
return output;
|
|
277
|
+
}
|
|
278
|
+
function resolveInputType(input) {
|
|
279
|
+
if (isListType(input) || isNonNullType(input)) {
|
|
280
|
+
return resolveInputType(input.ofType);
|
|
281
|
+
}
|
|
282
|
+
return input;
|
|
283
|
+
}
|
|
201
284
|
|
|
202
285
|
var ChangeType;
|
|
203
286
|
(function (ChangeType) {
|
|
@@ -1337,12 +1420,26 @@ const considerUsage = ({ changes, config, }) => __awaiter(void 0, void 0, void 0
|
|
|
1337
1420
|
});
|
|
1338
1421
|
});
|
|
1339
1422
|
|
|
1423
|
+
const safeUnreachable = ({ changes, oldSchema }) => {
|
|
1424
|
+
const reachable = getReachableTypes(oldSchema);
|
|
1425
|
+
return changes.map((change) => {
|
|
1426
|
+
if (change.criticality.level === CriticalityLevel.Breaking && change.path) {
|
|
1427
|
+
const [typeName] = parsePath(change.path);
|
|
1428
|
+
if (!reachable.has(typeName)) {
|
|
1429
|
+
return Object.assign(Object.assign({}, change), { criticality: Object.assign(Object.assign({}, change.criticality), { level: CriticalityLevel.NonBreaking }), message: 'Unreachable from root' });
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
return change;
|
|
1433
|
+
});
|
|
1434
|
+
};
|
|
1435
|
+
|
|
1340
1436
|
const rules = /*#__PURE__*/Object.freeze({
|
|
1341
1437
|
__proto__: null,
|
|
1342
1438
|
dangerousBreaking: dangerousBreaking,
|
|
1343
1439
|
suppressRemovalOfDeprecatedField: suppressRemovalOfDeprecatedField,
|
|
1344
1440
|
ignoreDescriptionChanges: ignoreDescriptionChanges,
|
|
1345
|
-
considerUsage: considerUsage
|
|
1441
|
+
considerUsage: considerUsage,
|
|
1442
|
+
safeUnreachable: safeUnreachable
|
|
1346
1443
|
});
|
|
1347
1444
|
|
|
1348
1445
|
const DiffRule = rules;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@graphql-inspector/core",
|
|
3
|
+
"version": "3.1.3",
|
|
4
|
+
"description": "Tooling for GraphQL. Compare GraphQL Schemas, check documents, find breaking changes, find similar types.",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"peerDependencies": {
|
|
7
|
+
"graphql": "^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"dependency-graph": "0.11.0",
|
|
11
|
+
"object-inspect": "1.10.3",
|
|
12
|
+
"tslib": "^2.0.0"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "kamilkisiela/graphql-inspector",
|
|
17
|
+
"directory": "packages/core"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"graphql",
|
|
21
|
+
"graphql-inspector",
|
|
22
|
+
"tools"
|
|
23
|
+
],
|
|
24
|
+
"author": {
|
|
25
|
+
"name": "Kamil Kisiela",
|
|
26
|
+
"email": "kamil.kisiela@gmail.com",
|
|
27
|
+
"url": "https://github.com/kamilkisiela"
|
|
28
|
+
},
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"main": "index.js",
|
|
31
|
+
"module": "index.mjs",
|
|
32
|
+
"typings": "index.d.ts",
|
|
33
|
+
"typescript": {
|
|
34
|
+
"definition": "index.d.ts"
|
|
35
|
+
},
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"require": "./index.js",
|
|
39
|
+
"import": "./index.mjs"
|
|
40
|
+
},
|
|
41
|
+
"./*": {
|
|
42
|
+
"require": "./*.js",
|
|
43
|
+
"import": "./*.mjs"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -3,7 +3,6 @@ export declare function isEqual<T>(a: T, b: T): boolean;
|
|
|
3
3
|
export declare function isNotEqual<T>(a: T, b: T): boolean;
|
|
4
4
|
export declare function isVoid<T>(a: T): boolean;
|
|
5
5
|
export declare function diffArrays<T>(a: T[] | readonly T[], b: T[] | readonly T[]): T[];
|
|
6
|
-
export declare function unionArrays<T>(a: T[] | readonly T[], b: T[] | readonly T[]): T[];
|
|
7
6
|
export declare function compareLists<T extends {
|
|
8
7
|
name: string;
|
|
9
8
|
}>(oldList: readonly T[], newList: readonly T[], callbacks?: {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,46 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-inspector/core",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.3",
|
|
4
4
|
"description": "Tooling for GraphQL. Compare GraphQL Schemas, check documents, find breaking changes, find similar types.",
|
|
5
|
-
"sideEffects": false,
|
|
6
|
-
"peerDependencies": {
|
|
7
|
-
"graphql": "^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
8
|
-
},
|
|
9
|
-
"dependencies": {
|
|
10
|
-
"dependency-graph": "0.11.0",
|
|
11
|
-
"object-inspect": "1.10.3",
|
|
12
|
-
"tslib": "^2.0.0"
|
|
13
|
-
},
|
|
14
|
-
"repository": {
|
|
15
|
-
"type": "git",
|
|
16
|
-
"url": "kamilkisiela/graphql-inspector",
|
|
17
|
-
"directory": "packages/core"
|
|
18
|
-
},
|
|
19
5
|
"keywords": [
|
|
20
6
|
"graphql",
|
|
21
7
|
"graphql-inspector",
|
|
22
8
|
"tools"
|
|
23
9
|
],
|
|
10
|
+
"sideEffects": false,
|
|
11
|
+
"main": "dist/index.js",
|
|
12
|
+
"module": "dist/index.mjs",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"require": "./dist/index.js",
|
|
16
|
+
"import": "./dist/index.mjs"
|
|
17
|
+
},
|
|
18
|
+
"./*": {
|
|
19
|
+
"require": "./dist/*.js",
|
|
20
|
+
"import": "./dist/*.mjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"typings": "dist/index.d.ts",
|
|
24
|
+
"typescript": {
|
|
25
|
+
"definition": "dist/index.d.ts"
|
|
26
|
+
},
|
|
24
27
|
"author": {
|
|
25
28
|
"name": "Kamil Kisiela",
|
|
26
29
|
"email": "kamil.kisiela@gmail.com",
|
|
27
30
|
"url": "https://github.com/kamilkisiela"
|
|
28
31
|
},
|
|
29
32
|
"license": "MIT",
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"definition": "index.d.ts"
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "kamilkisiela/graphql-inspector",
|
|
36
|
+
"directory": "packages/core"
|
|
35
37
|
},
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"graphql": "^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"dependency-graph": "0.11.0",
|
|
43
|
+
"object-inspect": "1.10.3",
|
|
44
|
+
"tslib": "^2.0.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/object-inspect": "1.8.0"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"prepack": "bob prepack"
|
|
45
51
|
}
|
|
46
52
|
}
|
package/utils/testing.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// import { findDangerousChanges } from 'graphql';
|
|
2
|
+
|
|
3
|
+
import { Change } from '../src/diff/changes/change';
|
|
4
|
+
|
|
5
|
+
export function findChangesByPath(changes: Change[], path: string) {
|
|
6
|
+
return changes.filter((c) => c.path === path);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function findFirstChangeByPath(changes: Change[], path: string) {
|
|
10
|
+
return findChangesByPath(changes, path)[0];
|
|
11
|
+
}
|