Skip to content

Commit

Permalink
chore: clean and rebuild yarn.lock file, update associated code (#473)
Browse files Browse the repository at this point in the history
  • Loading branch information
alharris-at committed May 31, 2022
1 parent a6020df commit 9e7a187
Show file tree
Hide file tree
Showing 5 changed files with 2,710 additions and 2,935 deletions.
8 changes: 4 additions & 4 deletions packages/amplify-graphql-transformer-core/src/errors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,17 @@ export class TransformerContractError extends Error {
*/
export class InvalidMigrationError extends Error {
fix: string;
cause: string;
constructor(message: string, cause: string, fix: string) {
causedBy: string;
constructor(message: string, causedBy: string, fix: string) {
super(message);
Object.setPrototypeOf(this, InvalidMigrationError.prototype);
this.name = 'InvalidMigrationError';
this.fix = fix;
this.cause = cause;
this.causedBy = causedBy;
}
}
InvalidMigrationError.prototype.toString = function () {
return `${this.message}\nCause: ${this.cause}\nHow to fix: ${this.fix}`;
return `${this.message}\nCause: ${this.causedBy}\nHow to fix: ${this.fix}`;
};

export class InvalidDirectiveError extends Error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ jest.mock('amplify-cli-core', () => ({
pathManager: {
getAmplifyPackageLibDirPath: jest.fn().mockReturnValue('test/path'),
},
getTransformerVersion: jest.fn().mockReturnValue(2),
ApiCategoryFacade: {
getTransformerVersion: jest.fn().mockReturnValue(2),
},
getGraphQLTransformerFunctionDocLink: jest.fn().mockReturnValue('mockdocs'),
stateManager: {
getMeta: jest.fn().mockReturnValue({
Expand Down
4 changes: 2 additions & 2 deletions packages/amplify-util-mock/src/api/lambda-arn-to-config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { keys } from 'lodash';
import { $TSAny, $TSContext, stateManager, getTransformerVersion, getGraphQLTransformerFunctionDocLink } from 'amplify-cli-core';
import { $TSAny, $TSContext, stateManager, getGraphQLTransformerFunctionDocLink, ApiCategoryFacade } from 'amplify-cli-core';
import _ = require('lodash');
import { ServiceName } from 'amplify-category-function';
import { loadLambdaConfig } from '../utils/lambda/load-lambda-config';
Expand All @@ -9,7 +9,7 @@ import { ProcessedLambdaFunction } from '../CFNParser/stack/types';
* Attempts to match an arn object against the array of lambdas configured in the project
*/
export const lambdaArnToConfig = async (context: $TSContext, arn: $TSAny): Promise<ProcessedLambdaFunction> => {
const version = await getTransformerVersion(context);
const version = await ApiCategoryFacade.getTransformerVersion(context);
const doclink = getGraphQLTransformerFunctionDocLink(version);
const errorSuffix = `\nSee ${doclink} for information on how to configure Lambda resolvers.`;
let searchString = '';
Expand Down
10 changes: 5 additions & 5 deletions packages/graphql-transformer-core/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,19 @@ export class DestructiveMigrationError extends Error {
* Thrown by the sanity checker when a user is trying to make a migration that is known to not work.
*/
export class InvalidMigrationError extends Error {
constructor(message: string, public cause: string, public fix: string) {
constructor(message: string, public causedBy: string, public fix: string) {
super(message);
Object.setPrototypeOf(this, new.target.prototype);
this.name = 'InvalidMigrationError';
}
toString = () => `${this.message}\nCause: ${this.cause}\nHow to fix: ${this.fix}`;
toString = () => `${this.message}\nCause: ${this.causedBy}\nHow to fix: ${this.fix}`;
}

export class InvalidGSIMigrationError extends InvalidMigrationError {
fix: string;
cause: string;
constructor(message: string, cause: string, fix: string) {
super(message, cause, fix);
causedBy: string;
constructor(message: string, causedBy: string, fix: string) {
super(message, causedBy, fix);
this.name = 'InvalidGSIMigrationError';
}
}
Expand Down
Loading

0 comments on commit 9e7a187

Please sign in to comment.