Skip to content

refactor: category-auth, category-geo, and category-predictions to SDK V3 #14221

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

Merged
merged 44 commits into from
Jul 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
7346581
refactor: upgrade category auth
Jun 20, 2025
c00cf3d
fix: update function
Jun 20, 2025
53d0005
refactor: geo
Jun 20, 2025
53afbd8
fix: identityPool test
Jun 23, 2025
442078d
fix: remove region
Jun 23, 2025
cf7d6d8
fix: region stuff
Jun 23, 2025
c514898
fix: identityPool test
Jun 23, 2025
4dd1601
fix: dedupe and api
Jun 23, 2025
959e6ba
refactor: update clients
Jun 24, 2025
009a2cd
fix: api and proxy
Jun 25, 2025
998b553
Merge branch 'dev' into sdk-migrations-1
Jun 26, 2025
435ed0d
refactor: e2e-core and some e2e-test files
Jun 26, 2025
44e507e
refactor: e2e-tests and ui-builder
Jun 27, 2025
aedf27e
fix: e2e cleanup
Jun 27, 2025
ee17cd9
fix: dedupe
Jun 27, 2025
3ae0ec9
fix: toString
Jun 27, 2025
7ab6301
fix: some e2e tests
Jul 2, 2025
8579477
Merge branch 'dev' into sdk-migrations-1
Jul 2, 2025
1f12265
fix: trying something with some function tests
Jul 2, 2025
d2db322
fix: part of the attempt
Jul 2, 2025
7804729
fix: function tests
Jul 3, 2025
b3fa4ef
fix: e2e tests
Jul 3, 2025
47c5f98
fix: some e2e tests and gaining info
Jul 3, 2025
2ac9f9a
fix: adding to if statement
Jul 3, 2025
510288c
fix: attempt for api
Jul 3, 2025
04642fa
fix: updates to hosted-ui
Jul 3, 2025
a2ceb9a
fix: api e2es
Jul 7, 2025
457185c
chore: gathering info
Jul 7, 2025
3f53f7e
fix: cleanup resources
Jul 8, 2025
7d05f2f
fix: bucket problems
Jul 8, 2025
240b8b4
fix: update memory for cleanup_resources
Jul 8, 2025
4bb7336
chore: adjustments
Jul 9, 2025
d508046
fix: possible fix for special cases
Jul 9, 2025
cb036ca
chore: remove sdk migrations for e2e-core
Jul 9, 2025
0c25c69
refactor: yarnlock and some e2e test reverts
Jul 9, 2025
711d795
refactor: revert some e2e tests changes
Jul 10, 2025
af4df8e
chore: reverting some more files
Jul 10, 2025
1960ba6
chore: revert e2e test changes
Jul 10, 2025
87b2b7d
chore: yarn lock
Jul 10, 2025
19ee157
chore: collecting info
Jul 10, 2025
0cb1d4f
chore: node version
Jul 11, 2025
433de2b
chore: node version linux
Jul 11, 2025
007b805
fix: clean up
Jul 16, 2025
dc47eaf
chore: minor adjustments
Jul 16, 2025
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
8 changes: 4 additions & 4 deletions .circleci/local_publish_helpers_codebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,10 @@ function verifyPkgCli {
fi
}

# TODO: After V3 migrations are done, decrease 995 back to 930 and 825 back to 750
verifySinglePkg "amplify-pkg-linux-x64" "amplify-pkg-linux-x64.tgz" $((995 * 1024 * 1024))
verifySinglePkg "amplify-pkg-macos-x64" "amplify-pkg-macos-x64.tgz" $((995 * 1024 * 1024))
verifySinglePkg "amplify-pkg-win-x64.exe" "amplify-pkg-win-x64.tgz" $((995 * 1024 * 1024))
# TODO: After V3 migrations are done, decrease 1020 back to 930 and 825 back to 750
verifySinglePkg "amplify-pkg-linux-x64" "amplify-pkg-linux-x64.tgz" $((1020 * 1024 * 1024))
verifySinglePkg "amplify-pkg-macos-x64" "amplify-pkg-macos-x64.tgz" $((1020 * 1024 * 1024))
verifySinglePkg "amplify-pkg-win-x64.exe" "amplify-pkg-win-x64.tgz" $((1020 * 1024 * 1024))
verifySinglePkg "amplify-pkg-linux-arm64" "amplify-pkg-linux-arm64.tgz" $((825 * 1024 * 1024))
}

Expand Down
5 changes: 3 additions & 2 deletions packages/amplify-category-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@
"@aws-amplify/amplify-prompts": "2.8.7",
"@aws-amplify/amplify-util-import": "2.8.3",
"@aws-amplify/cli-extensibility-helper": "3.0.39",
"@aws-sdk/client-cognito-identity": "^3.624.0",
"@aws-sdk/client-cognito-identity-provider": "^3.624.0",
"@aws-sdk/client-s3": "^3.624.0",
"amplify-headless-interface": "1.17.8",
"amplify-util-headless-input": "1.9.19",
"aws-cdk-lib": "~2.189.1",
"aws-sdk": "^2.1464.0",
"axios": "^1.6.7",
"chalk": "^4.1.1",
"change-case": "^4.1.1",
Expand All @@ -52,7 +54,6 @@
"uuid": "^8.3.2"
},
"devDependencies": {
"@aws-sdk/client-cognito-identity-provider": "3.624.0",
"@aws-sdk/client-iam": "3.624.0",
"@types/mime-types": "^2.1.1",
"cloudform-types": "^4.2.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { ICognitoUserPoolService, IIdentityPoolService } from '@aws-amplify/amplify-util-import';
import { $TSAny, $TSContext, ServiceSelection, stateManager, AmplifyError, AmplifyFrontend } from '@aws-amplify/amplify-cli-core';
import { CognitoIdentityProvider, IdentityPool } from 'aws-sdk/clients/cognitoidentity';
import {
IdentityProviderType,
UserPoolClientType,
UserPoolDescriptionType,
UserPoolType,
} from 'aws-sdk/clients/cognitoidentityserviceprovider';
import { CognitoIdentityProvider, IdentityPool } from '@aws-sdk/client-cognito-identity';
import { IdentityProviderType, UserPoolClientType, UserPoolDescriptionType, UserPoolType } from '@aws-sdk/client-cognito-identity-provider';
import { printer } from '@aws-amplify/amplify-prompts';
import { ensureEnvParamManager } from '@aws-amplify/amplify-environment-parameters';
import Enquirer from 'enquirer';
Expand Down Expand Up @@ -82,7 +77,7 @@ const printSuccess = (context: $TSContext, authSelections: AuthSelections, userP
if (authSelections === 'userPoolOnly') {
printer.info(importMessages.UserPoolOnlySuccess(userPool.Name!));
} else {
printer.info(importMessages.UserPoolAndIdentityPoolSuccess(userPool.Name!, identityPool!.IdentityPoolName));
printer.info(importMessages.UserPoolAndIdentityPoolSuccess(userPool.Name!, identityPool!.IdentityPoolName!));
}
printer.blankLine();
printer.info('Next steps:');
Expand Down Expand Up @@ -294,7 +289,7 @@ const importServiceWalkthrough = async (
if (questionParameters.validatedIdentityPools!.length === 1) {
const { identityPool } = questionParameters.validatedIdentityPools![0];

printer.info(importMessages.OneIdentityPoolValid(identityPool.IdentityPoolName, identityPool.IdentityPoolId));
printer.info(importMessages.OneIdentityPoolValid(identityPool.IdentityPoolName!, identityPool.IdentityPoolId!));

answers.identityPoolId = identityPool.IdentityPoolId;
answers.identityPool = identityPool;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
IdentityProviderType,
UserPoolClientType,
UserPoolType,
} from 'aws-sdk/clients/cognitoidentityserviceprovider';
import { CognitoIdentityProvider, IdentityPool } from 'aws-sdk/clients/cognitoidentity';
} from '@aws-sdk/client-cognito-identity-provider';
import { CognitoIdentityProvider, IdentityPool } from '@aws-sdk/client-cognito-identity';
import { ICognitoUserPoolService, IIdentityPoolService } from '@aws-amplify/amplify-util-import';

export type AuthSelections = 'userPoolOnly' | 'identityPoolAndUserPool';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { $TSContext, AmplifyFault } from '@aws-amplify/amplify-cli-core';
import { CognitoIdentityServiceProvider } from 'aws-sdk';
import { CognitoIdentityProviderClient, DescribeUserPoolClientCommand } from '@aws-sdk/client-cognito-identity-provider';

export const getAppClientSecret = async (context: $TSContext, userpoolId: string, clientId: string): Promise<string | undefined> => {
try {
Expand All @@ -8,7 +8,8 @@ export const getAppClientSecret = async (context: $TSContext, userpoolId: string
ClientId: clientId,
UserPoolId: userpoolId,
};
const result = await identity.describeUserPoolClient(params).promise();
const command = new DescribeUserPoolClientCommand(params);
const result = await identity.send(command);
return result.UserPoolClient?.ClientSecret;
} catch (error) {
throw new AmplifyFault(
Expand All @@ -21,8 +22,8 @@ export const getAppClientSecret = async (context: $TSContext, userpoolId: string
}
};

const getCognitoIdentityProviderClient = async (context: $TSContext): Promise<CognitoIdentityServiceProvider> => {
const { client } = await context.amplify.invokePluginMethod<{ client: CognitoIdentityServiceProvider }>(
const getCognitoIdentityProviderClient = async (context: $TSContext): Promise<CognitoIdentityProviderClient> => {
const { client } = await context.amplify.invokePluginMethod<{ client: CognitoIdentityProviderClient }>(
context,
'awscloudformation',
undefined,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ICognitoUserPoolService } from '@aws-amplify/amplify-util-import';
import { $TSContext, stateManager, JSONUtilities } from '@aws-amplify/amplify-cli-core';
import { IdentityProviderType } from 'aws-sdk/clients/cognitoidentityserviceprovider';
import { IdentityProviderType } from '@aws-sdk/client-cognito-identity-provider';
import { createOAuthCredentials } from '../import';

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import { $TSContext, pathManager, stateManager, AmplifyCategories, spinner, AmplifyFault } from '@aws-amplify/amplify-cli-core';
import type { S3 } from 'aws-sdk';
import { S3Client, PutObjectCommand, PutObjectCommandInput, PutObjectCommandOutput } from '@aws-sdk/client-s3';
import { createReadStream, readdirSync, existsSync } from 'fs-extra';
import mime from 'mime-types';
import * as path from 'path';
import { getAuthResourceName } from '../../../utils/getAuthResourceName';
import s3 from 'aws-sdk/clients/s3';

const providerName = 'awscloudformation';

const getS3Client = async (context: $TSContext, action: string): Promise<S3> => {
const getS3Client = async (context: $TSContext, action: string): Promise<S3Client> => {
const providerPlugins = context.amplify.getProviderPlugins(context);
const provider = await import(providerPlugins[providerName]);
const config = await provider.getConfiguredAWSClientConfig(context, AmplifyCategories.AUTH, action);
return new s3(config);
return new S3Client(config);
};

/**
Expand All @@ -36,7 +35,7 @@ export const uploadFiles = async (context: $TSContext): Promise<void> => {
return;
}
const fileList = readdirSync(assetPath);
const uploadFileTasks: (() => Promise<S3.ManagedUpload.SendData>)[] = [];
const uploadFileTasks: (() => Promise<PutObjectCommandOutput>)[] = [];
fileList.forEach((file) => {
uploadFileTasks.push(async () => uploadFile(s3Client, bucketName, path.join(assetPath, file), file));
});
Expand All @@ -54,16 +53,22 @@ export const uploadFiles = async (context: $TSContext): Promise<void> => {
}
};

const uploadFile = async (s3Client: S3, hostingBucketName: string, filePath: string, file: string): Promise<S3.ManagedUpload.SendData> => {
const uploadFile = async (
s3Client: S3Client,
hostingBucketName: string,
filePath: string,
file: string,
): Promise<PutObjectCommandOutput> => {
const fileStream = createReadStream(filePath);
const contentType = mime.lookup(filePath);
const uploadParams = {
const uploadParams: PutObjectCommandInput = {
Bucket: hostingBucketName,
Key: file,
Body: fileStream,
ContentType: contentType || 'text/plain',
ACL: 'public-read',
};

return s3Client.upload(uploadParams).promise();
const command = new PutObjectCommand(uploadParams);
return await s3Client.send(command);
};
5 changes: 1 addition & 4 deletions packages/amplify-category-geo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,16 @@
"dependencies": {
"@aws-amplify/amplify-cli-core": "4.4.2",
"@aws-amplify/amplify-prompts": "2.8.7",
"@aws-sdk/client-location": "^3.624.0",
"ajv": "^6.12.6",
"amplify-headless-interface": "1.17.8",
"amplify-util-headless-input": "1.9.19",
"aws-cdk-lib": "~2.189.1",
"aws-sdk": "^2.1464.0",
"constructs": "^10.0.5",
"fs-extra": "^8.1.0",
"lodash": "^4.17.21",
"uuid": "^8.3.2"
},
"devDependencies": {
"@aws-sdk/client-location": "3.624.0"
},
"jest": {
"collectCoverage": true,
"collectCoverageFrom": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { $TSContext } from '@aws-amplify/amplify-cli-core';
import { prompter, printer } from '@aws-amplify/amplify-prompts';
import { existsSync, writeFileSync } from 'fs-extra';
import { join } from 'path';
import Location from 'aws-sdk/clients/location';
import { LocationClient, BatchPutGeofenceCommand } from '@aws-sdk/client-location';
import { ServiceName } from '../service-utils/constants';
import { validateGeoJSONObj } from '../service-utils/validateGeoJSONObj';
import {
Expand Down Expand Up @@ -112,7 +112,7 @@ export const importResource = async (context: $TSContext) => {
const bulkUploadGeofence = async (context: $TSContext, params: ImportParams, region: string) => {
printer.info('Updating your Geofences in the collection...');
try {
const { client } = await context.amplify.invokePluginMethod<{ client: Location }>(
const { client } = await context.amplify.invokePluginMethod<{ client: LocationClient }>(
context,
'awscloudformation',
undefined,
Expand All @@ -127,7 +127,8 @@ const bulkUploadGeofence = async (context: $TSContext, params: ImportParams, reg
CollectionName: params.collectionToImport,
Entries: geofenceEntries.splice(0, MAX_ENTRIES_PER_BATCH),
};
uploadTasks.push(client.batchPutGeofence(geofenceCollectionPerBatch).promise());
const command = new BatchPutGeofenceCommand(geofenceCollectionPerBatch);
uploadTasks.push(client.send(command));
}
await Promise.all(uploadTasks);
printer.success(`Successfully added/updated ${totalGeofenceCount} Geofences in your "${params.collectionToImport}" collection`);
Expand Down
1 change: 0 additions & 1 deletion packages/amplify-category-predictions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"dependencies": {
"@aws-amplify/amplify-cli-core": "4.4.2",
"@aws-amplify/amplify-prompts": "2.8.7",
"aws-sdk": "^2.1464.0",
"chalk": "^4.1.1",
"fs-extra": "^8.1.0",
"uuid": "^8.3.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/amplify-e2e-tests/src/__tests__/api_3.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ describe('amplify add api (GraphQL)', () => {
await getAppSyncApi(GraphQLAPIIdOutput, meta.providers.awscloudformation.Region);
expect(true).toBe(false); // expecting failure
} catch (err) {
expect(err.message).toBe(`GraphQL API ${GraphQLAPIIdOutput} not found.`);
expect(err.message).toBe('API not found.');
}
});
});
2 changes: 2 additions & 0 deletions packages/amplify-provider-awscloudformation/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import { $TSAny } from '@aws-amplify/amplify-cli-core';
import { $TSContext } from '@aws-amplify/amplify-cli-core';
import { $TSObject } from '@aws-amplify/amplify-cli-core';
import * as AWS_2 from 'aws-sdk';
import { CognitoIdentityProviderClient } from '@aws-sdk/client-cognito-identity-provider';
import { IAmplifyResource } from '@aws-amplify/amplify-cli-core';
import { LocationClient } from '@aws-sdk/client-location';
import { Template } from '@aws-amplify/amplify-cli-core';

// @public (undocumented)
Expand Down
6 changes: 6 additions & 0 deletions packages/amplify-provider-awscloudformation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@
"@aws-amplify/cli-extensibility-helper": "3.0.39",
"@aws-amplify/graphql-transformer-core": "^2.11.1",
"@aws-amplify/graphql-transformer-interfaces": "^3.12.0",
"@aws-sdk/client-cognito-identity": "^3.624.0",
"@aws-sdk/client-cognito-identity-provider": "^3.624.0",
"@aws-sdk/client-location": "^3.624.0",
"@aws-sdk/client-sts": "^3.624.0",
"@aws-sdk/types": "^3.624.0",
"@smithy/node-http-handler": "^4.0.6",
"amplify-codegen": "^4.10.3",
"archiver": "^7.0.1",
"aws-cdk-lib": "~2.189.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,19 @@ let mockCognitoIdentityRoles = {

const iamRoleNameRegex = /[\w+=,.@-]+/;

jest.mock('aws-sdk', () => {
jest.mock('@aws-sdk/client-cognito-identity', () => {
return {
CognitoIdentity: jest.fn(() => {
CognitoIdentityClient: jest.fn(() => {
return {
config: {},
getIdentityPoolRoles: jest.fn().mockImplementation(() => ({
promise: async () => {
return {
Roles: mockCognitoIdentityRoles,
};
},
})),
send: jest.fn().mockImplementation(() => {
return {
Roles: mockCognitoIdentityRoles,
};
}),
};
}),
GetIdentityPoolRolesCommand: jest.fn(() => {}),
};
});

Expand Down
Loading
Loading