-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add mocked generate graphql-client-code to cli * Update packages/cli/src/commands/generate/generate_command_factory.test.ts fix: update test name Co-authored-by: Kamil Sobol <[email protected]> * chore: add missing descriptions for targets, use new shared backendIdentifierResolver * chore: remove adapter, we may need to reintroduce in the future, but simplifying until we have an impl in place * chore: add feature flags * chore: flip to use real generator, not mocked api --------- Co-authored-by: Kamil Sobol <[email protected]>
- Loading branch information
1 parent
e0e1488
commit 6ec93ae
Showing
13 changed files
with
716 additions
and
27 deletions.
There are no files selected for viewing
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,5 @@ | ||
--- | ||
'@aws-amplify/backend-cli': minor | ||
--- | ||
|
||
Add generate graphql-client-code command with mocked implementation |
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 |
---|---|---|
|
@@ -14,6 +14,7 @@ export default [ | |
'codegen', | ||
'cognito', | ||
'ctor', | ||
'datastore', | ||
'debounce', | ||
'declarator', | ||
'deployer', | ||
|
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
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 to facilitate testing. | ||
*/ | ||
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, | ||
}); | ||
} |
Oops, something went wrong.