Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: clean and rebuild yarn.lock file, update associated code #473

Merged
merged 1 commit into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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