@aws-amplify/graphql-transformer-core
Advanced tools
Comparing version 0.15.0-beta.0 to 0.15.0-beta.1
@@ -6,7 +6,39 @@ # Change Log | ||
# [0.15.0-beta.0](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/graphql-transformer-core@0.13.2...@aws-amplify/graphql-transformer-core@0.15.0-beta.0) (2021-11-23) | ||
# [0.15.0-beta.1](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/graphql-transformer-core@0.14.0...@aws-amplify/graphql-transformer-core@0.15.0-beta.1) (2021-12-03) | ||
### Bug Fixes | ||
* skip truncating unresolved tokens ([#9152](https://github.com/aws-amplify/amplify-cli/issues/9152)) ([f83ac70](https://github.com/aws-amplify/amplify-cli/commit/f83ac70753a4564a2b458584fd2176274771b4fb)) | ||
### Features | ||
* provide helpful error message when GQL schema validation fails ([#9159](https://github.com/aws-amplify/amplify-cli/issues/9159)) ([308706c](https://github.com/aws-amplify/amplify-cli/commit/308706c8a67712d7625f11a625e258101790d4c7)) | ||
# [0.15.0-beta.0](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/graphql-transformer-core@0.14.0...@aws-amplify/graphql-transformer-core@0.15.0-beta.0) (2021-12-03) | ||
### Bug Fixes | ||
* skip truncating unresolved tokens ([#9152](https://github.com/aws-amplify/amplify-cli/issues/9152)) ([f83ac70](https://github.com/aws-amplify/amplify-cli/commit/f83ac70753a4564a2b458584fd2176274771b4fb)) | ||
### Features | ||
* provide helpful error message when GQL schema validation fails ([#9159](https://github.com/aws-amplify/amplify-cli/issues/9159)) ([308706c](https://github.com/aws-amplify/amplify-cli/commit/308706c8a67712d7625f11a625e258101790d4c7)) | ||
# [0.14.0](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/graphql-transformer-core@0.13.2...@aws-amplify/graphql-transformer-core@0.14.0) (2021-11-23) | ||
### Features | ||
* override support for api category ([#9013](https://github.com/aws-amplify/amplify-cli/issues/9013)) ([ae7b001](https://github.com/aws-amplify/amplify-cli/commit/ae7b001f274f327a29c99c67fe851272c6208e84)), closes [#9001](https://github.com/aws-amplify/amplify-cli/issues/9001) [#8954](https://github.com/aws-amplify/amplify-cli/issues/8954) [#8958](https://github.com/aws-amplify/amplify-cli/issues/8958) [#8960](https://github.com/aws-amplify/amplify-cli/issues/8960) [#8967](https://github.com/aws-amplify/amplify-cli/issues/8967) [#8971](https://github.com/aws-amplify/amplify-cli/issues/8971) [#8976](https://github.com/aws-amplify/amplify-cli/issues/8976) [#8975](https://github.com/aws-amplify/amplify-cli/issues/8975) [#8981](https://github.com/aws-amplify/amplify-cli/issues/8981) [#8983](https://github.com/aws-amplify/amplify-cli/issues/8983) [#8992](https://github.com/aws-amplify/amplify-cli/issues/8992) [#9000](https://github.com/aws-amplify/amplify-cli/issues/9000) [#9002](https://github.com/aws-amplify/amplify-cli/issues/9002) [#9005](https://github.com/aws-amplify/amplify-cli/issues/9005) [#9006](https://github.com/aws-amplify/amplify-cli/issues/9006) [#9007](https://github.com/aws-amplify/amplify-cli/issues/9007) [#9008](https://github.com/aws-amplify/amplify-cli/issues/9008) [#9010](https://github.com/aws-amplify/amplify-cli/issues/9010) [#9011](https://github.com/aws-amplify/amplify-cli/issues/9011) [#9012](https://github.com/aws-amplify/amplify-cli/issues/9012) [#9014](https://github.com/aws-amplify/amplify-cli/issues/9014) [#9015](https://github.com/aws-amplify/amplify-cli/issues/9015) [#9017](https://github.com/aws-amplify/amplify-cli/issues/9017) [#9020](https://github.com/aws-amplify/amplify-cli/issues/9020) [#9024](https://github.com/aws-amplify/amplify-cli/issues/9024) [#9027](https://github.com/aws-amplify/amplify-cli/issues/9027) [#9028](https://github.com/aws-amplify/amplify-cli/issues/9028) [#9029](https://github.com/aws-amplify/amplify-cli/issues/9029) [#9032](https://github.com/aws-amplify/amplify-cli/issues/9032) [#9031](https://github.com/aws-amplify/amplify-cli/issues/9031) [#9035](https://github.com/aws-amplify/amplify-cli/issues/9035) [#9038](https://github.com/aws-amplify/amplify-cli/issues/9038) [#9039](https://github.com/aws-amplify/amplify-cli/issues/9039) | ||
@@ -13,0 +45,0 @@ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.UnknownDirectiveError = exports.InvalidDirectiveError = exports.InvalidMigrationError = exports.TransformerContractError = exports.SchemaValidationError = exports.InvalidTransformerError = void 0; | ||
const graphql_1 = require("graphql"); | ||
const GRAPHQL_TRANSFORMER_V1_DIRECTIVES = ['connection', 'key', 'versioned']; | ||
class InvalidTransformerError extends Error { | ||
@@ -17,3 +19,29 @@ constructor(message) { | ||
constructor(errors) { | ||
super(`Schema Errors:\n\n${errors.join('\n')}`); | ||
const v1DirectivesInUse = new Set(); | ||
const newErrors = errors.filter(error => { | ||
if (!error.message.startsWith('Unknown directive')) { | ||
return true; | ||
} | ||
const dir = GRAPHQL_TRANSFORMER_V1_DIRECTIVES.find(d => error.message.endsWith(`"${d}".`)); | ||
if (!dir) { | ||
return true; | ||
} | ||
v1DirectivesInUse.add(dir); | ||
return false; | ||
}); | ||
if (v1DirectivesInUse.size > 0) { | ||
const baseErrorMessage = `Your GraphQL Schema is using ${Array.from(v1DirectivesInUse.values()) | ||
.map(d => `"@${d}"`) | ||
.join(', ')} ${v1DirectivesInUse.size > 1 ? 'directives' : 'directive'} from an older version of the GraphQL Transformer. Visit https://docs.amplify.aws/cli/migration/transformer-migration/ to learn how to migrate your GraphQL schema.`; | ||
if (newErrors.length === 0) { | ||
super(baseErrorMessage); | ||
} | ||
else { | ||
super(baseErrorMessage + | ||
` There are additional validation errors listed below \n\n ${newErrors.map(error => (0, graphql_1.printError)(error)).join('\n\n')}`); | ||
} | ||
} | ||
else { | ||
super(`Schema validation failed.\n\n${newErrors.map(error => (0, graphql_1.printError)(error)).join('\n\n')} `); | ||
} | ||
Object.setPrototypeOf(this, SchemaValidationError.prototype); | ||
@@ -20,0 +48,0 @@ this.name = 'SchemaValidationError'; |
@@ -32,2 +32,3 @@ "use strict"; | ||
const UniqueDirectivesPerLocation_1 = require("graphql/validation/rules/UniqueDirectivesPerLocation"); | ||
const validate_1 = require("graphql/validation/validate"); | ||
exports.specifiedRules = [ | ||
@@ -101,3 +102,8 @@ UniqueOperationNames_1.UniqueOperationNames, | ||
} | ||
const schema = (0, buildASTSchema_1.buildASTSchema)(fullDocument); | ||
let schema; | ||
const errors = (0, validate_1.validateSDL)(fullDocument); | ||
if (errors.length > 0) { | ||
return errors; | ||
} | ||
schema = (0, buildASTSchema_1.buildASTSchema)(fullDocument, { assumeValid: true }); | ||
return (0, validation_1.validate)(schema, fullDocument, exports.specifiedRules); | ||
@@ -104,0 +110,0 @@ }; |
@@ -7,2 +7,3 @@ "use strict"; | ||
exports.TransformerResourceHelper = void 0; | ||
const core_1 = require("@aws-cdk/core"); | ||
const md5_1 = __importDefault(require("md5")); | ||
@@ -28,3 +29,3 @@ class TransformerResourceHelper { | ||
const apiId = this.api.apiId; | ||
const shortName = name.slice(0, 64 - 38 - 6) + (0, md5_1.default)(name).slice(0, 6); | ||
const shortName = `${core_1.Token.isUnresolved(name) ? name : name.slice(0, 64 - 38 - 6)}${(0, md5_1.default)(name).slice(0, 6)}`; | ||
return `${shortName}-${apiId}-${env}`; | ||
@@ -31,0 +32,0 @@ }; |
{ | ||
"name": "@aws-amplify/graphql-transformer-core", | ||
"version": "0.15.0-beta.0", | ||
"version": "0.15.0-beta.1", | ||
"description": "A framework to transform from GraphQL SDL to AWS CloudFormation.", | ||
@@ -57,3 +57,3 @@ "repository": { | ||
"@aws-cdk/region-info": "~1.124.0", | ||
"amplify-prompts": "1.7.0-beta.0", | ||
"amplify-prompts": "1.6.0", | ||
"change-case": "^4.1.1", | ||
@@ -92,3 +92,3 @@ "constructs": "^3.3.125", | ||
}, | ||
"gitHead": "94b64e9325704c2dfd22c1486e5bc52f9a425297" | ||
"gitHead": "b03d36e0416b3d5245088eb40a9f283b166db2ec" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
495360
5000
+ Addedamplify-prompts@1.6.0(transitive)
- Removedamplify-prompts@1.7.0-beta.0(transitive)
Updatedamplify-prompts@1.6.0