-
Notifications
You must be signed in to change notification settings - Fork 825
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
112 changed files
with
2,250 additions
and
962 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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
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
34 changes: 0 additions & 34 deletions
34
...plify-category-auth/src/provider-utils/awscloudformation/handlers/get-add-auth-handler.ts
This file was deleted.
Oops, something went wrong.
55 changes: 55 additions & 0 deletions
55
.../amplify-category-auth/src/provider-utils/awscloudformation/handlers/resource-handlers.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,55 @@ | ||
import { ServiceQuestionsResult } from '../service-walkthrough-types'; | ||
import { getAddAuthDefaultsApplier, getUpdateAuthDefaultsApplier } from '../utils/auth-defaults-appliers'; | ||
import { getResourceSynthesizer, getResourceUpdater } from '../utils/synthesize-resources'; | ||
import { getPostAddAuthMetaUpdater, getPostUpdateAuthMetaUpdater } from '../utils/amplify-meta-updaters'; | ||
import { getPostAddAuthMessagePrinter, getPostUpdateAuthMessagePrinter } from '../utils/message-printer'; | ||
import { supportedServices } from '../../supported-services'; | ||
|
||
/** | ||
* Factory function that returns a ServiceQuestionsResult consumer that handles all of the resource generation logic. | ||
* The consumer returns the resourceName of the generated resource. | ||
* @param context The amplify context | ||
*/ | ||
export const getAddAuthHandler = (context: any) => async (request: ServiceQuestionsResult) => { | ||
const serviceMetadata = supportedServices[request.serviceName]; | ||
const { cfnFilename, defaultValuesFilename, provider } = serviceMetadata; | ||
let projectName = context.amplify.getProjectConfig().projectName.toLowerCase(); | ||
const disallowedChars = /[^A-Za-z0-9]+/g; | ||
projectName = projectName.replace(disallowedChars, ''); | ||
const requestWithDefaults = await getAddAuthDefaultsApplier(context, defaultValuesFilename, projectName)(request); | ||
await getResourceSynthesizer( | ||
context, | ||
cfnFilename, | ||
provider, | ||
)(requestWithDefaults) | ||
.then(req => req.resourceName!) | ||
.then(getPostAddAuthMetaUpdater(context, { service: requestWithDefaults.serviceName, providerName: provider })) | ||
.then(getPostAddAuthMessagePrinter(context.print)) | ||
.catch(err => { | ||
context.print.info(err.stack); | ||
context.print.error('There was an error adding the auth resource'); | ||
context.usageData.emitError(err); | ||
process.exitCode = 1; | ||
}); | ||
return requestWithDefaults.resourceName!; | ||
}; | ||
|
||
export const getUpdateAuthHandler = (context: any) => async (request: ServiceQuestionsResult) => { | ||
const { cfnFilename, defaultValuesFilename, provider } = supportedServices[request.serviceName]; | ||
const requestWithDefaults = await getUpdateAuthDefaultsApplier(defaultValuesFilename, context.updatingAuth)(request); | ||
await getResourceUpdater( | ||
context, | ||
cfnFilename, | ||
provider, | ||
)(requestWithDefaults) | ||
.then(req => req.resourceName!) | ||
.then(getPostUpdateAuthMetaUpdater(context)) | ||
.then(getPostUpdateAuthMessagePrinter(context.print)) | ||
.catch(err => { | ||
context.print.info(err.stack); | ||
context.print.error('There was an error updating the auth resource'); | ||
context.usageData.emitError(err); | ||
process.exitCode = 1; | ||
}); | ||
return requestWithDefaults.resourceName!; | ||
}; |
Oops, something went wrong.