Skip to content

Commit 28879e3

Browse files
[DevTools] PR2: Backend Services, Console Viewer, and Resources (#2879)
1 parent 3778fd8 commit 28879e3

File tree

59 files changed

+10518
-2586
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+10518
-2586
lines changed

.changeset/dull-towns-attack.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@aws-amplify/deployed-backend-client': patch
3+
'@aws-amplify/platform-core': patch
4+
---
5+
6+
made regionfetcher public, added metadata to deployedbackendresource

.changeset/loose-wings-stop.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@aws-amplify/cli-core': patch
3+
---
4+
5+
pulled out normalizeCDKconstructPath

.changeset/thin-paths-drum.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@aws-amplify/sandbox': minor
3+
'@aws-amplify/backend-cli': minor
4+
'@aws-amplify/backend-deployer': patch
5+
'@aws-amplify/ai-constructs': patch
6+
---
7+
8+
Devtools PR2

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ packages/integration-tests/src/e2e-tests
1919

2020
# Frontend code
2121
packages/cli/src/commands/sandbox/sandbox-devtools/react-app/**
22+
!packages/cli/src/commands/sandbox/sandbox-devtools/react-app/package.json

package-lock.json

Lines changed: 3194 additions & 2465 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@
6666
"@aws-sdk/client-iam": "^3.750.0",
6767
"@aws-sdk/client-s3": "^3.750.0",
6868
"@aws-sdk/client-ssm": "^3.750.0",
69+
"@aws-sdk/eventstream-handler-node": "^3.821.0",
70+
"@aws-sdk/middleware-eventstream": "^3.821.0",
6971
"@changesets/cli": "^2.26.1",
7072
"@changesets/get-release-plan": "^4.0.0",
7173
"@changesets/types": "^6.0.0",
@@ -97,6 +99,7 @@
9799
"glob": "^11.0.2",
98100
"husky": "^9.1.7",
99101
"lint-staged": "^15.2.10",
102+
"npm-force-resolutions": "^0.0.10",
100103
"prettier": "^3.5.3",
101104
"rimraf": "^6.0.1",
102105
"semver": "^7.5.4",

packages/cli-core/API.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ export enum LogLevel {
9090
// @public (undocumented)
9191
export const minimumLogLevel: LogLevel;
9292

93+
// @public
94+
export const normalizeCDKConstructPath: (constructPath: string) => string;
95+
9396
// @public (undocumented)
9497
export type Notice = z.infer<typeof noticeSchema>;
9598

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Utilities for formatting CDK paths and constructs
3+
*/
4+
5+
/**
6+
* Normalizes a CDK construct path to create a more readable friendly name
7+
* @param constructPath The CDK construct path
8+
* @returns A normalized construct path
9+
*/
10+
export const normalizeCDKConstructPath = (constructPath: string): string => {
11+
// Don't process very long paths to avoid performance issues
12+
if (constructPath.length > 1000) return constructPath;
13+
14+
// Handle nested stack paths
15+
const nestedStackRegex =
16+
/(?<nestedStack>[a-zA-Z0-9_]+)\.NestedStack\/\1\.NestedStackResource$/;
17+
18+
return constructPath
19+
.replace(nestedStackRegex, '$<nestedStack>')
20+
.replace('/amplifyAuth/', '/')
21+
.replace('/amplifyData/', '/');
22+
};

packages/cli-core/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ export * from './package-manager-controller/package_manager_controller_factory.j
66
export * from './loggers/amplify_io_events_bridge_singleton_factory.js';
77
export * from './notices/notices.js';
88
export * from './notices/notices_manifest_validator.js';
9+
export { normalizeCDKConstructPath } from './formatters/cdk_path_formatter.js';

packages/cli-core/src/loggers/cfn-deployment-progress/cfn_deployment_progress_logger.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { StackEvent } from '@aws-sdk/client-cloudformation';
33
import { RewritableBlock } from './rewritable_block.js';
44
import { ColorName, format } from '../../format/format.js';
55
import { EOL } from 'os';
6+
import { normalizeCDKConstructPath } from '../../formatters/cdk_path_formatter.js';
67

78
/**
89
* Collects events from CDK Toolkit about cfn deployment and structures them
@@ -103,7 +104,7 @@ export class CfnDeploymentProgressLogger {
103104
if (metadata && metadata.constructPath) {
104105
if (!(event.LogicalResourceId in this.resourceNameCache)) {
105106
this.resourceNameCache[event.LogicalResourceId] =
106-
this.normalizeCDKConstructPath(metadata.constructPath);
107+
normalizeCDKConstructPath(metadata.constructPath);
107108
}
108109
}
109110
// Hydrate friendly name resource cache
@@ -231,21 +232,6 @@ export class CfnDeploymentProgressLogger {
231232
await this.block.displayLines(lines);
232233
}
233234

234-
/**
235-
* Extract nested stack names
236-
*/
237-
private normalizeCDKConstructPath = (constructPath: string): string => {
238-
// Don't run regex on long strings, they are most likely not valid and could cause DOS attach. See CodeQL's js/polynomial-redos
239-
if (constructPath.length > 1000) return constructPath;
240-
const nestedStackRegex =
241-
/(?<nestedStack>[a-zA-Z0-9_]+)\.NestedStack\/\1\.NestedStackResource$/;
242-
243-
return constructPath
244-
.replace(nestedStackRegex, '$<nestedStack>')
245-
.replace('/amplifyAuth/', '/')
246-
.replace('/amplifyData/', '/');
247-
};
248-
249235
/**
250236
* Extract the failure reason from stack events
251237
*/

0 commit comments

Comments
 (0)