Skip to content

Commit

Permalink
fix: asana bug fixes (#8692)
Browse files Browse the repository at this point in the history
* fix: asana bug fixes

* chore: removes commmented code
  • Loading branch information
akshbhu authored and kaustavghosh06 committed Nov 11, 2021
1 parent 3ab37cd commit 46a57a4
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 53 deletions.
1 change: 0 additions & 1 deletion packages/amplify-category-api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { getCfnApiArtifactHandler } from './provider-utils/awscloudformation/cfn
import { askAuthQuestions } from './provider-utils/awscloudformation/service-walkthroughs/appSync-walkthrough';
import { getAppSyncResourceName, getAppSyncAuthConfig } from './provider-utils/awscloudformation//utils/amplify-meta-utils';
import { authConfigToAppSyncAuthType } from './provider-utils/awscloudformation/utils/auth-config-to-app-sync-auth-type-bi-di-mapper';

export { NETWORK_STACK_LOGICAL_ID } from './category-constants';
export { DEPLOYMENT_MECHANISM } from './provider-utils/awscloudformation/base-api-stack';
export { EcsStack } from './provider-utils/awscloudformation/ecs-apigw-stack';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"$ref": "#/definitions/ServiceQuestionsBaseResult"
},
{
"$ref": "#/definitions/Pick<OAuthResult,\"hostedUI\"|\"hostedUIDomainName\"|\"hostedUIProviderMeta\"|\"oAuthMetadata\">"
"$ref": "#/definitions/OAuthResult"
},
{
"$ref": "#/definitions/Pick<SocialProviderResult,\"authProvidersUserPool\">"
"$ref": "#/definitions/SocialProviderResult"
},
{
"$ref": "#/definitions/IdentityPoolResult"
Expand Down Expand Up @@ -127,21 +127,14 @@
},
"userpoolClientLambdaRole": {
"type": "string"
},
"useEnabledMfas": {
"type": "boolean"
}
},
"required": [
"authSelections",
"requiredAttributes",
"resourceName",
"serviceName",
"useDefault",
"userpoolClientGenerateSecret",
"userpoolClientLambdaRole",
"userpoolClientReadAttributes",
"userpoolClientWriteAttributes"
]
"required": ["authSelections", "resourceName", "serviceName", "useDefault"]
},
"Pick<OAuthResult,\"hostedUI\"|\"hostedUIDomainName\"|\"hostedUIProviderMeta\"|\"oAuthMetadata\">": {
"OAuthResult": {
"type": "object",
"properties": {
"hostedUI": {
Expand All @@ -151,17 +144,70 @@
"type": "string"
},
"hostedUIProviderMeta": {},
"hostedUIProviderCreds": {},
"AllowedOAuthFlows": {
"enum": ["code", "implicit"],
"type": "string"
},
"AllowedOAuthScopes": {
"type": "array",
"items": {
"type": "string"
}
},
"newCallbackURLs": {
"type": "array",
"items": {
"type": "string"
}
},
"newLogoutURLs": {
"type": "array",
"items": {
"type": "string"
}
},
"oAuthMetadata": {}
}
},
"Pick<SocialProviderResult,\"authProvidersUserPool\">": {
"SocialProviderResult": {
"type": "object",
"properties": {
"authProvidersUserPool": {
"type": "array",
"items": {
"type": "string"
}
},
"facebookAppIdUserPool": {
"type": "string"
},
"facebookAppSecretUserPool": {
"type": "string"
},
"googleAppIdUserPool": {
"type": "string"
},
"googleAppSecretUserPool": {
"type": "string"
},
"loginwithamazonAppIdUserPool": {
"type": "string"
},
"loginwithamazonAppSecretUserPool": {
"type": "string"
},
"signinwithappleClientIdUserPool": {
"type": "string"
},
"signinwithappleTeamIdUserPool": {
"type": "string"
},
"signinwithappleKeyIdUserPool": {
"type": "string"
},
"signinwithapplePrivateKeyUserPool": {
"type": "string"
}
}
},
Expand Down Expand Up @@ -245,8 +291,7 @@
"type": "string"
}
}
},
"required": ["autoVerifiedAttributes"]
}
},
"MfaResult": {
"type": "object",
Expand All @@ -265,8 +310,7 @@
"smsAuthenticationMessage": {
"type": "string"
}
},
"required": ["mfaConfiguration"]
}
},
"AdminQueriesResult": {
"type": "object",
Expand Down
15 changes: 13 additions & 2 deletions packages/amplify-category-auth/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,11 @@ async function externalAuthEnable(context, externalCategory, resourceName, requi
const authPropsValues = authExists
? Object.assign(defaults.functionMap[requirements.authSelections](currentAuthName), currentAuthParams, immutables, requirements)
: Object.assign(defaults.functionMap[requirements.authSelections](currentAuthName), requirements, {
resourceName: `cognito${defaults.sharedId}`,
resourceName: currentAuthName,
sharedId: defaults.sharedId,
serviceName: 'Cognito',
useDefault: 'manual',
authSelections: requirements.authSelections,
}); //eslint-disable-line
/* eslint-enable */
const { roles } = defaults;
Expand All @@ -150,7 +153,6 @@ async function externalAuthEnable(context, externalCategory, resourceName, requi

try {
authProps = await removeDeprecatedProps(authProps);
await generateAuthStackTemplate(context, currentAuthName);
// replace secret keys from cli inputs to be stored in deployment secrets

let sharedParams = Object.assign({}, authProps);
Expand All @@ -166,6 +168,15 @@ async function externalAuthEnable(context, externalCategory, resourceName, requi
}
});
context.amplify.saveEnvResourceParameters(context, category, authExists, envSpecificParams);
const cognitoCLIInputs = {
version: '1',
cognitoConfig: cliInputs,
};
const cliState = new AuthInputState(cognitoCLIInputs.cognitoConfig.resourceName);
// saving cli-inputs except secrets
await cliState.saveCLIInputPayload(cognitoCLIInputs);
await generateAuthStackTemplate(context, currentAuthName);

const resourceDirPath = path.join(amplify.pathManager.getBackendDirPath(), 'auth', authProps.resourceName, 'build', 'parameters.json');
const authParameters = await amplify.readJsonFile(resourceDirPath);
if (!authExists) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ export interface ServiceQuestionsBaseResult {
resourceName: string;
useDefault: 'default' | 'defaultSocial' | 'manual';
updateFlow?: 'default' | 'defaultSocial' | 'manual' | 'callbacks' | 'providers' | 'updateUserPoolGroups' | 'updateAdminQueries';
requiredAttributes: string[];
requiredAttributes?: string[];
authSelections: 'userPoolOnly' | 'identityPoolAndUserPool' | 'identityPoolOnly';
userPoolName?: string;
usernameAttributes?: UsernameAttributes[];
aliasAttributes?: AliasAttributes[];
userPoolGroups?: boolean;
userPoolGroupList?: string[];
userpoolClientRefreshTokenValidity?: number;
userpoolClientReadAttributes: string[];
userpoolClientWriteAttributes: string[];
userpoolClientReadAttributes?: string[];
userpoolClientWriteAttributes?: string[];
userpoolClientSetAttributes?: boolean;
usernameCaseSensitive?: boolean;
verificationBucketName?: string;
resourceNameTruncated?: string;
sharedId?: string;
userpoolClientGenerateSecret: boolean;
userpoolClientLambdaRole: string;
userpoolClientGenerateSecret?: boolean;
userpoolClientLambdaRole?: string;
useEnabledMfas?: boolean;
}

Expand Down Expand Up @@ -83,11 +83,11 @@ export interface PasswordRecoveryResult {
emailVerificationMessage?: string;
emailVerificationSubject?: string;
smsVerificationMessage?: string;
autoVerifiedAttributes: string[];
autoVerifiedAttributes?: string[];
}

export interface MfaResult {
mfaConfiguration: 'OPTIONAL' | 'ON' | 'OFF';
mfaConfiguration?: 'OPTIONAL' | 'ON' | 'OFF';
mfaTypes?: ('SMS Text Message' | 'TOTP')[];
smsAuthenticationMessage?: string;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,7 @@ async function transformUserPoolGroupSchema(context) {
}
});

// validating cli-inputs
const cliState = new AuthInputState(authResourceName);
const identityPoolName = cliState.getCLIInputPayload().identityPoolName;
const props = {
groups,
cognitoResourceName: authResourceName,
identityPoolName: identityPoolName,
};

await generateUserPoolGroupStackTemplate(props);
await generateUserPoolGroupStackTemplate(authResourceName);
}

module.exports = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ export async function showStatusTable(tableViewFilter: ViewResourceTableParams)
print.info('\nTag Changes Detected');
}

//4. Display Root Stack Status
if (rootStackUpdated) {
print.info('Root Stack Changes Detected');
}

//4. Display Detailed Diffs (Cfn/NonCfn)
if (tableViewFilter.verbose) {
await viewResourceDiffs({ resourcesToBeUpdated, resourcesToBeDeleted, resourcesToBeCreated });
Expand Down Expand Up @@ -73,11 +68,6 @@ export async function showResourceTable(category?, resourceName?, filteredResour
print.info('\nTag Changes Detected');
}

//4. Display root stack Status
if (rootStackUpdated) {
print.info('\n RootStack Changes Detected');
}

const resourceChanged =
resourcesToBeCreated.length + resourcesToBeUpdated.length + resourcesToBeSynced.length + resourcesToBeDeleted.length > 0 ||
tagsUpdated ||
Expand Down
2 changes: 1 addition & 1 deletion packages/amplify-e2e-tests/src/__tests__/auth_1.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe('amplify add auth...', () => {
expect(clients[0].UserPoolClient.ClientSecret).toBeDefined();
});

it.only('...should init an Android project and add default auth', async () => {
it('...should init an Android project and add default auth', async () => {
await initAndroidProjectWithProfile(projRoot, defaultsSettings);
await addAuthWithDefault(projRoot, {});
await amplifyPushAuth(projRoot);
Expand Down
8 changes: 5 additions & 3 deletions packages/amplify-e2e-tests/src/__tests__/interactions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ describe('amplify add interactions', () => {
await addSampleInteraction(projRoot, {});
await amplifyPushAuth(projRoot);
const meta = getProjectMeta(projRoot);
const { FunctionArn: functionArn, BotName: botName, Region: region } = Object.keys(meta.interactions).map(
key => meta.interactions[key],
)[0].output;
const {
FunctionArn: functionArn,
BotName: botName,
Region: region,
} = Object.keys(meta.interactions).map(key => meta.interactions[key])[0].output;
expect(functionArn).toBeDefined();
expect(botName).toBeDefined();
expect(region).toBeDefined();
Expand Down

0 comments on commit 46a57a4

Please sign in to comment.