@graphql-codegen/core 2.6.0-alpha-a52c122aa.0 → 2.6.0-alpha-252a8d50d.0

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 -1
  2. package/index.mjs +4 -1
  3. package/package.json +2 -2
package/index.js CHANGED
@@ -105,6 +105,9 @@ function hasFederationSpec(schemaOrAST) {
105
105
  }
106
106
  function extractHashFromSchema(schema) {
107
107
  var _a;
108
+ if (!schema.extensions) {
109
+ schema.extensions = {};
110
+ }
108
111
  return (_a = schema.extensions['hash']) !== null && _a !== void 0 ? _a : null;
109
112
  }
110
113
 
@@ -160,7 +163,7 @@ async function codegen(options) {
160
163
  }));
161
164
  const rules = graphql.specifiedRules.filter(rule => !ignored.some(ignoredRule => rule.name.startsWith(ignoredRule)));
162
165
  const schemaHash = extractHashFromSchema(schemaInstance);
163
- if (!schemaHash || !options.cache || !documents.some(d => typeof d.hash !== 'string')) {
166
+ if (!schemaHash || !options.cache || documents.some(d => typeof d.hash !== 'string')) {
164
167
  return utils.validateGraphQlDocuments(schemaInstance, [...documents, ...fragments], rules);
165
168
  }
166
169
  const cacheKey = [schemaHash]
package/index.mjs CHANGED
@@ -101,6 +101,9 @@ function hasFederationSpec(schemaOrAST) {
101
101
  }
102
102
  function extractHashFromSchema(schema) {
103
103
  var _a;
104
+ if (!schema.extensions) {
105
+ schema.extensions = {};
106
+ }
104
107
  return (_a = schema.extensions['hash']) !== null && _a !== void 0 ? _a : null;
105
108
  }
106
109
 
@@ -156,7 +159,7 @@ async function codegen(options) {
156
159
  }));
157
160
  const rules = specifiedRules.filter(rule => !ignored.some(ignoredRule => rule.name.startsWith(ignoredRule)));
158
161
  const schemaHash = extractHashFromSchema(schemaInstance);
159
- if (!schemaHash || !options.cache || !documents.some(d => typeof d.hash !== 'string')) {
162
+ if (!schemaHash || !options.cache || documents.some(d => typeof d.hash !== 'string')) {
160
163
  return validateGraphQlDocuments(schemaInstance, [...documents, ...fragments], rules);
161
164
  }
162
165
  const cacheKey = [schemaHash]
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@graphql-codegen/core",
3
- "version": "2.6.0-alpha-a52c122aa.0",
3
+ "version": "2.6.0-alpha-252a8d50d.0",
4
4
  "peerDependencies": {
5
5
  "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
6
6
  },
7
7
  "dependencies": {
8
- "@graphql-codegen/plugin-helpers": "2.5.0-alpha-a52c122aa.0",
8
+ "@graphql-codegen/plugin-helpers": "2.5.0-alpha-252a8d50d.0",
9
9
  "@graphql-tools/schema": "^8.1.2",
10
10
  "@graphql-tools/utils": "^8.1.1",
11
11
  "tslib": "~2.3.0"