-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: flip to use real generator, not mocked api
- Loading branch information
1 parent
3f26cef
commit 7adb34b
Showing
8 changed files
with
202 additions
and
180 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
packages/cli/src/commands/generate/graphql-client-code/generate_api_code_adapter.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { BackendIdentifier } from '@aws-amplify/deployed-backend-client'; | ||
import { | ||
GenerateOptions, | ||
GenerationResult, | ||
generateApiCode, | ||
} from '@aws-amplify/model-generator'; | ||
import { AwsCredentialIdentityProvider } from '@aws-sdk/types'; | ||
|
||
// For some reason using `omit` is causing type errors, so reconstructing without the credentialProvider. | ||
export type InvokeGenerateApiCodeProps = GenerateOptions & BackendIdentifier; | ||
|
||
/** | ||
* Class to wrap static generateApiCode method for testability. | ||
*/ | ||
export class GenerateApiCodeAdapter { | ||
/** | ||
* Creates graphql api code adapter. | ||
*/ | ||
constructor( | ||
private readonly credentialProvider: AwsCredentialIdentityProvider | ||
) {} | ||
|
||
/** | ||
* Invoke the generateApiCode method, using the constructor injected credentialProvider, and remaining props. | ||
*/ | ||
invokeGenerateApiCode = ( | ||
props: InvokeGenerateApiCodeProps | ||
): Promise<GenerationResult> => | ||
generateApiCode({ | ||
...props, | ||
credentialProvider: this.credentialProvider, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.