jest-serializer-graphql-schema 4.10.0 → 5.0.0-0.2

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/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ # jest-serializer-graphql-schema
2
+
3
+ ## 5.0.0-0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`768f32681`](undefined) - Fix peerDependencies ranges
8
+
9
+ ## 5.0.0-0.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#125](https://github.com/benjie/postgraphile-private/pull/125)
14
+ [`91f2256b3`](https://github.com/benjie/postgraphile-private/commit/91f2256b3fd699bec19fc86f1ca79df057e58639)
15
+ Thanks [@benjie](https://github.com/benjie)! - Initial changesets release
package/LICENSE.md CHANGED
@@ -2,23 +2,19 @@
2
2
 
3
3
  Copyright © `2019` Benjie Gillam
4
4
 
5
- Permission is hereby granted, free of charge, to any person
6
- obtaining a copy of this software and associated documentation
7
- files (the Software”), to deal in the Software without
8
- restriction, including without limitation the rights to use,
9
- copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the
11
- Software is furnished to do so, subject to the following
12
- conditions:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the “Software”), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
13
11
 
14
- The above copyright notice and this permission notice shall be
15
- included in all copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
16
14
 
17
- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
18
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
- OTHER DEALINGS IN THE SOFTWARE.
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, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,13 +1,48 @@
1
1
  # jest-serializer-graphql-schema
2
2
 
3
- A serializer for doing [snapshot testing](https://jestjs.io/docs/en/snapshot-testing)
4
- of [GraphQL schemas](https://graphql.org/learn/schema/) using the
3
+ [![GitHub Sponsors](https://img.shields.io/github/sponsors/benjie?color=ff69b4&label=github%20sponsors)](https://github.com/sponsors/benjie)
4
+ [![Patreon sponsor button](https://img.shields.io/badge/sponsor-via%20Patreon-orange.svg)](https://patreon.com/benjie)
5
+ [![Discord chat room](https://img.shields.io/discord/489127045289476126.svg)](http://discord.gg/graphile)
6
+ [![Follow](https://img.shields.io/badge/twitter-@GraphileHQ-blue.svg)](https://twitter.com/GraphileHQ)
7
+
8
+ A serializer for doing
9
+ [snapshot testing](https://jestjs.io/docs/en/snapshot-testing) of
10
+ [GraphQL schemas](https://graphql.org/learn/schema/) using the
5
11
  [Jest](https://jestjs.io/) testing framework.
6
12
 
7
- This serializer only works on instances of the `GraphQLSchema` class
8
- exported from [`graphql-js`](https://github.com/graphql/graphql-js).
9
- It does _not_ work on <abbr title="abstract syntax tree">AST</abbr>
10
- objects.
13
+ This serializer only works on instances of the `GraphQLSchema` class exported
14
+ from [`graphql-js`](https://github.com/graphql/graphql-js). It does _not_ work
15
+ on <abbr title="abstract syntax tree">AST</abbr> objects.
16
+
17
+ <!-- SPONSORS_BEGIN -->
18
+
19
+ ## Crowd-funded open-source software
20
+
21
+ To help us develop this software sustainably under the MIT license, we ask all
22
+ individuals and businesses that use it to help support its ongoing maintenance
23
+ and development via sponsorship.
24
+
25
+ ### [Click here to find out more about sponsors and sponsorship.](https://www.graphile.org/sponsor/)
26
+
27
+ And please give some love to our featured sponsors 🤩:
28
+
29
+ <table><tr>
30
+ <td align="center"><a href="https://surge.io/"><img src="https://graphile.org/images/sponsors/surge.png" width="90" height="90" alt="Surge" /><br />Surge</a> *</td>
31
+ <td align="center"><a href="https://www.netflix.com/"><img src="https://graphile.org/images/sponsors/Netflix.png" width="90" height="90" alt="Netflix" /><br />Netflix</a> *</td>
32
+ <td align="center"><a href="https://qwick.com/"><img src="https://graphile.org/images/sponsors/qwick.png" width="90" height="90" alt="Qwick" /><br />Qwick</a> *</td>
33
+ <td align="center"><a href="https://www.the-guild.dev/"><img src="https://graphile.org/images/sponsors/theguild.png" width="90" height="90" alt="The Guild" /><br />The Guild</a> *</td>
34
+ </tr><tr>
35
+ <td align="center"><a href="http://chads.website"><img src="https://graphile.org/images/sponsors/chadf.png" width="90" height="90" alt="Chad Furman" /><br />Chad Furman</a> *</td>
36
+ <td align="center"><a href="https://www.fanatics.com/"><img src="https://graphile.org/images/sponsors/fanatics.png" width="90" height="90" alt="Fanatics" /><br />Fanatics</a> *</td>
37
+ <td align="center"><a href="https://dovetailapp.com/"><img src="https://graphile.org/images/sponsors/dovetail.png" width="90" height="90" alt="Dovetail" /><br />Dovetail</a> *</td>
38
+ <td align="center"><a href="https://www.enzuzo.com/"><img src="https://graphile.org/images/sponsors/enzuzo.png" width="90" height="90" alt="Enzuzo" /><br />Enzuzo</a> *</td>
39
+ </tr><tr>
40
+ <td align="center"><a href="https://stellate.co/"><img src="https://graphile.org/images/sponsors/Stellate.png" width="90" height="90" alt="Stellate" /><br />Stellate</a> *</td>
41
+ </tr></table>
42
+
43
+ <em>\* Sponsors the entire Graphile suite</em>
44
+
45
+ <!-- SPONSORS_END -->
11
46
 
12
47
  # Install
13
48
 
@@ -165,11 +200,10 @@ type Query {
165
200
 
166
201
  # Sorting Schemas
167
202
 
168
- Note that by default, schemas are _not_ sorted before serialization.
169
- This means that if the content of the schema is reordered, your
170
- snapshot test will fail. If you don't care about the order of the
171
- content of your schema, sort your schema before calling
172
- `.toMatchSnapshot()`, like this:
203
+ Note that by default, schemas are _not_ sorted before serialization. This means
204
+ that if the content of the schema is reordered, your snapshot test will fail. If
205
+ you don't care about the order of the content of your schema, sort your schema
206
+ before calling `.toMatchSnapshot()`, like this:
173
207
 
174
208
  ```ts
175
209
  import { lexicographicSortSchema } from "graphql";
@@ -0,0 +1,17 @@
1
+ import { GraphQLSchema } from "graphql";
2
+ /**
3
+ * This function is heavily based on
4
+ * {@link https://github.com/graphql/graphql-js/blob/0eb088b3d1228ac60568912c705401341f3b769d/src/utilities/lexicographicSortSchema.js | `lexicographicSortSchema` from `graphql`}
5
+ * (MIT license), but differs in that it does not change the order of fields,
6
+ * arguments or enum values.
7
+ */
8
+ export declare function consistentlyOrderedSchema(schema: GraphQLSchema): GraphQLSchema;
9
+ /**
10
+ * Returns a number indicating whether a reference string comes before, or after,
11
+ * or is the same as the given string in natural sort order.
12
+ *
13
+ * See: https://en.wikipedia.org/wiki/Natural_sort_order
14
+ *
15
+ */
16
+ export declare function naturalCompare(aStr: string, bStr: string): number;
17
+ //# sourceMappingURL=consistentlyOrderedSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consistentlyOrderedSchema.d.ts","sourceRoot":"","sources":["../src/consistentlyOrderedSchema.ts"],"names":[],"mappings":"AAiCA,OAAO,EAQL,aAAa,EAWd,MAAM,SAAS,CAAC;AASjB;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,aAAa,GACpB,aAAa,CAsHf;AA8BD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CA2CjE"}
@@ -0,0 +1,239 @@
1
+ "use strict";
2
+ // This file is broadly copied from parts of graphql-js, and thus the license
3
+ // is MIT with copyright to GraphQL Contributors:
4
+ /*
5
+ * MIT License
6
+ *
7
+ * Copyright (c) GraphQL Contributors
8
+ *
9
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ * of this software and associated documentation files (the "Software"), to deal
11
+ * in the Software without restriction, including without limitation the rights
12
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ * copies of the Software, and to permit persons to whom the Software is
14
+ * furnished to do so, subject to the following conditions:
15
+ *
16
+ * The above copyright notice and this permission notice shall be included in all
17
+ * copies or substantial portions of the Software.
18
+ *
19
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ * SOFTWARE.
26
+ */
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.naturalCompare = exports.consistentlyOrderedSchema = void 0;
29
+ const graphql_1 = require("graphql");
30
+ const util_1 = require("util");
31
+ function isNotNullish(v) {
32
+ return v != null;
33
+ }
34
+ /**
35
+ * This function is heavily based on
36
+ * {@link https://github.com/graphql/graphql-js/blob/0eb088b3d1228ac60568912c705401341f3b769d/src/utilities/lexicographicSortSchema.js | `lexicographicSortSchema` from `graphql`}
37
+ * (MIT license), but differs in that it does not change the order of fields,
38
+ * arguments or enum values.
39
+ */
40
+ function consistentlyOrderedSchema(schema) {
41
+ const schemaConfig = schema.toConfig();
42
+ const typeMap = keyValMap(sortByName(schemaConfig.types), (type) => type.name, sortNamedType);
43
+ return new graphql_1.GraphQLSchema({
44
+ ...schemaConfig,
45
+ types: Object.values(typeMap).filter(isNotNullish),
46
+ directives: sortByName(schemaConfig.directives).map(sortDirective),
47
+ query: replaceMaybeType(schemaConfig.query),
48
+ mutation: replaceMaybeType(schemaConfig.mutation),
49
+ subscription: replaceMaybeType(schemaConfig.subscription),
50
+ });
51
+ function replaceType(type) {
52
+ if ((0, graphql_1.isListType)(type)) {
53
+ return new graphql_1.GraphQLList(replaceType(type.ofType));
54
+ }
55
+ else if ((0, graphql_1.isNonNullType)(type)) {
56
+ return new graphql_1.GraphQLNonNull(replaceType(type.ofType));
57
+ }
58
+ return replaceNamedType(type);
59
+ }
60
+ function replaceNamedType(type) {
61
+ return typeMap[type.name];
62
+ }
63
+ function replaceMaybeType(maybeType) {
64
+ return maybeType && replaceNamedType(maybeType);
65
+ }
66
+ function sortDirective(directive) {
67
+ const config = directive.toConfig();
68
+ return new graphql_1.GraphQLDirective({
69
+ ...config,
70
+ locations: sortBy(config.locations, (x) => x),
71
+ args: replaceArgs(config.args),
72
+ });
73
+ }
74
+ function replaceArgs(args) {
75
+ return objMap(args, (arg) => ({
76
+ ...arg,
77
+ type: replaceType(arg.type),
78
+ }));
79
+ }
80
+ function sortFields(fieldsMap) {
81
+ return objMap(fieldsMap, (field) => ({
82
+ ...field,
83
+ type: replaceType(field.type),
84
+ args: field.args && replaceArgs(field.args),
85
+ }));
86
+ }
87
+ function sortInputFields(fieldsMap) {
88
+ return objMap(fieldsMap, (field) => ({
89
+ ...field,
90
+ type: replaceType(field.type),
91
+ }));
92
+ }
93
+ function sortTypes(array) {
94
+ return sortByName(array).map(replaceNamedType);
95
+ }
96
+ function sortNamedType(type) {
97
+ if ((0, graphql_1.isScalarType)(type) || (0, graphql_1.isIntrospectionType)(type)) {
98
+ return type;
99
+ }
100
+ if ((0, graphql_1.isObjectType)(type)) {
101
+ const config = type.toConfig();
102
+ return new graphql_1.GraphQLObjectType({
103
+ ...config,
104
+ interfaces: () => sortTypes(config.interfaces),
105
+ fields: () => sortFields(config.fields),
106
+ });
107
+ }
108
+ if ((0, graphql_1.isInterfaceType)(type)) {
109
+ const config = type.toConfig();
110
+ return new graphql_1.GraphQLInterfaceType({
111
+ ...config,
112
+ interfaces: () => sortTypes(config.interfaces),
113
+ fields: () => sortFields(config.fields),
114
+ });
115
+ }
116
+ if ((0, graphql_1.isUnionType)(type)) {
117
+ const config = type.toConfig();
118
+ return new graphql_1.GraphQLUnionType({
119
+ ...config,
120
+ types: () => sortTypes(config.types),
121
+ });
122
+ }
123
+ if ((0, graphql_1.isEnumType)(type)) {
124
+ const config = type.toConfig();
125
+ return new graphql_1.GraphQLEnumType({
126
+ ...config,
127
+ values: objMap(config.values, (value) => value),
128
+ });
129
+ }
130
+ // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
131
+ if ((0, graphql_1.isInputObjectType)(type)) {
132
+ const config = type.toConfig();
133
+ return new graphql_1.GraphQLInputObjectType({
134
+ ...config,
135
+ fields: () => sortInputFields(config.fields),
136
+ });
137
+ }
138
+ throw new Error("Unexpected type: " + (0, util_1.inspect)(type));
139
+ }
140
+ }
141
+ exports.consistentlyOrderedSchema = consistentlyOrderedSchema;
142
+ function objMap(map, valueFn) {
143
+ const result = Object.create(null);
144
+ const entries = Object.entries(map);
145
+ for (const [key, value] of entries) {
146
+ result[key] = valueFn(value);
147
+ }
148
+ return result;
149
+ }
150
+ function sortByName(array) {
151
+ return sortBy(array, (obj) => obj.name);
152
+ }
153
+ function sortBy(array, mapToKey) {
154
+ return array.slice().sort((obj1, obj2) => {
155
+ const key1 = mapToKey(obj1);
156
+ const key2 = mapToKey(obj2);
157
+ return naturalCompare(key1, key2);
158
+ });
159
+ }
160
+ // This function a direct copy of the MIT licensed implementation in graphql-js:
161
+ // https://github.com/graphql/graphql-js/blob/30b446938a9b5afeb25c642d8af1ea33f6c849f3/src/jsutils/naturalCompare.ts
162
+ /**
163
+ * Returns a number indicating whether a reference string comes before, or after,
164
+ * or is the same as the given string in natural sort order.
165
+ *
166
+ * See: https://en.wikipedia.org/wiki/Natural_sort_order
167
+ *
168
+ */
169
+ function naturalCompare(aStr, bStr) {
170
+ let aIndex = 0;
171
+ let bIndex = 0;
172
+ while (aIndex < aStr.length && bIndex < bStr.length) {
173
+ let aChar = aStr.charCodeAt(aIndex);
174
+ let bChar = bStr.charCodeAt(bIndex);
175
+ if (isDigit(aChar) && isDigit(bChar)) {
176
+ let aNum = 0;
177
+ do {
178
+ ++aIndex;
179
+ aNum = aNum * 10 + aChar - DIGIT_0;
180
+ aChar = aStr.charCodeAt(aIndex);
181
+ } while (isDigit(aChar) && aNum > 0);
182
+ let bNum = 0;
183
+ do {
184
+ ++bIndex;
185
+ bNum = bNum * 10 + bChar - DIGIT_0;
186
+ bChar = bStr.charCodeAt(bIndex);
187
+ } while (isDigit(bChar) && bNum > 0);
188
+ if (aNum < bNum) {
189
+ return -1;
190
+ }
191
+ if (aNum > bNum) {
192
+ return 1;
193
+ }
194
+ }
195
+ else {
196
+ if (aChar < bChar) {
197
+ return -1;
198
+ }
199
+ if (aChar > bChar) {
200
+ return 1;
201
+ }
202
+ ++aIndex;
203
+ ++bIndex;
204
+ }
205
+ }
206
+ return aStr.length - bStr.length;
207
+ }
208
+ exports.naturalCompare = naturalCompare;
209
+ const DIGIT_0 = 48;
210
+ const DIGIT_9 = 57;
211
+ function isDigit(code) {
212
+ return !isNaN(code) && DIGIT_0 <= code && code <= DIGIT_9;
213
+ }
214
+ /**
215
+ * Creates a keyed JS object from an array, given a function to produce the keys
216
+ * and a function to produce the values from each item in the array.
217
+ *
218
+ * ```
219
+ * const phoneBook = [
220
+ * { name: 'Jon', num: '555-1234' },
221
+ * { name: 'Jenny', num: '867-5309' }
222
+ * ]
223
+ *
224
+ * // { Jon: '555-1234', Jenny: '867-5309' }
225
+ * const phonesByName = keyValMap(
226
+ * phoneBook,
227
+ * entry => entry.name,
228
+ * entry => entry.num
229
+ * )
230
+ * ```
231
+ *
232
+ */
233
+ function keyValMap(list, keyFn, valFn) {
234
+ return list.reduce((map, item) => {
235
+ map[keyFn(item)] = valFn(item);
236
+ return map;
237
+ }, Object.create(null));
238
+ }
239
+ //# sourceMappingURL=consistentlyOrderedSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consistentlyOrderedSchema.js","sourceRoot":"","sources":["../src/consistentlyOrderedSchema.ts"],"names":[],"mappings":";AAAA,6EAA6E;AAC7E,iDAAiD;AACjD;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;AASH,qCAmBiB;AACjB,+BAA+B;AAI/B,SAAS,YAAY,CAAI,CAAI;IAC3B,OAAO,CAAC,IAAI,IAAI,CAAC;AACnB,CAAC;AAED;;;;;GAKG;AACH,SAAgB,yBAAyB,CACvC,MAAqB;IAErB,MAAM,YAAY,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IACvC,MAAM,OAAO,GAAG,SAAS,CACvB,UAAU,CAAC,YAAY,CAAC,KAAK,CAAC,EAC9B,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EACnB,aAAa,CACd,CAAC;IAEF,OAAO,IAAI,uBAAa,CAAC;QACvB,GAAG,YAAY;QACf,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC;QAClD,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,aAAa,C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B,KAAqB;IAErB,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;QAC/B,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/B,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AAC1B,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1 +1,5 @@
1
- export {};
1
+ import type { GraphQLSchema } from "graphql";
2
+ import type { Plugin } from "pretty-format";
3
+ export declare const test: Plugin["test"];
4
+ export declare const serialize: (schema: GraphQLSchema) => string;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAI5C,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,MAAM,CAA0B,CAAC;AAC3D,eAAO,MAAM,SAAS,WAAY,aAAa,KAAG,MAEjD,CAAC"}
package/dist/index.js CHANGED
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.serialize = exports.test = void 0;
3
4
  const graphql_1 = require("graphql");
4
- const GraphQLSchemaSnapshotSerializer = {
5
- test(val) {
6
- return graphql_1.isSchema(val);
7
- },
8
- serialize(schema) {
9
- return graphql_1.printSchema(schema);
10
- },
5
+ const consistentlyOrderedSchema_js_1 = require("./consistentlyOrderedSchema.js");
6
+ const test = (val) => (0, graphql_1.isSchema)(val);
7
+ exports.test = test;
8
+ const serialize = (schema) => {
9
+ return (0, graphql_1.printSchema)((0, consistentlyOrderedSchema_js_1.consistentlyOrderedSchema)(schema));
11
10
  };
12
- module.exports = GraphQLSchemaSnapshotSerializer;
11
+ exports.serialize = serialize;
13
12
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,qCAA+D;AAG/D,MAAM,+BAA+B,GAAc;IACjD,IAAI,CAAC,GAAQ;QACX,OAAO,kBAAQ,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;IACD,SAAS,CAAC,MAAqB;QAC7B,OAAO,qBAAW,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,OAAO,GAAG,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,qCAAgD;AAGhD,iFAA2E;AAEpE,MAAM,IAAI,GAAmB,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,kBAAQ,EAAC,GAAG,CAAC,CAAC;AAA9C,QAAA,IAAI,QAA0C;AACpD,MAAM,SAAS,GAAG,CAAC,MAAqB,EAAU,EAAE;IACzD,OAAO,IAAA,qBAAW,EAAC,IAAA,wDAAyB,EAAC,MAAM,CAAC,CAAC,CAAC;AACxD,CAAC,CAAC;AAFW,QAAA,SAAS,aAEpB"}
package/package.json CHANGED
@@ -1,44 +1,44 @@
1
1
  {
2
2
  "name": "jest-serializer-graphql-schema",
3
- "version": "4.10.0",
3
+ "version": "5.0.0-0.2",
4
4
  "description": "Jest serializer for GraphQLSchema objects",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
8
- "prepack": "tsc",
9
- "watch": "tsc --watch",
10
- "test": "jest"
8
+ "test": "jest -i",
9
+ "prepack": "tsc -b",
10
+ "watch": "tsc -b --watch"
11
11
  },
12
12
  "repository": {
13
13
  "type": "git",
14
- "url": "git+https://github.com/graphile/graphile-engine.git"
14
+ "url": "git+https://github.com/graphile/heart.git"
15
15
  },
16
16
  "keywords": [
17
17
  "jest",
18
18
  "graphql",
19
- "schema"
19
+ "schema",
20
+ "graphile",
21
+ "graphite"
20
22
  ],
21
23
  "author": "David Baumgold <david@davidbaumgold.com>",
22
24
  "license": "MIT",
23
25
  "bugs": {
24
- "url": "https://github.com/graphile/graphile-engine/issues"
26
+ "url": "https://github.com/graphile/heart/issues"
25
27
  },
26
- "homepage": "https://github.com/graphile/graphile-engine/tree/master/packages/jest-serializer-graphql-schema#readme",
28
+ "homepage": "https://github.com/graphile/heart/tree/main/utils/jest-serializer-graphql-schema",
27
29
  "peerDependencies": {
28
- "graphql": "^14.0.2 || ^15.4.0"
30
+ "graphql": ">=15 <17"
29
31
  },
30
32
  "devDependencies": {
31
- "@types/node-fetch": "^2.5.2",
32
- "node-fetch": "^2.6.0",
33
- "pretty-format": "^26.4.2",
34
- "ts-jest": "25.x",
35
- "typescript": "^4.0.2"
33
+ "@types/jest": "^27.5.1",
34
+ "graphql": "16.1.0-experimental-stream-defer.6",
35
+ "jest": "^28.1.0",
36
+ "pretty-format": "^27.4.2",
37
+ "ts-node": "^10.9.1",
38
+ "tslib": "^2.4.0",
39
+ "typescript": "^4.8.1-rc"
36
40
  },
37
41
  "files": [
38
42
  "dist"
39
- ],
40
- "dependencies": {
41
- "tslib": "^2.0.1"
42
- },
43
- "gitHead": "c20e6827fa3fd1de9029b9cb77de71bf75a61f5a"
44
- }
43
+ ]
44
+ }