Skip to content

Commit ad71cf4

Browse files
authored
Fix: [AEA-0000] - add cpt and rum session id to api calls (#1366)
## Summary - Routine Change ### Details - add rum session id to api calls - add cpt session id to api calls - fix dependencies we cant upgrade yet
1 parent fe84ed3 commit ad71cf4

35 files changed

+722
-557
lines changed

package-lock.json

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

packages/cognito/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"axios": "^1.12.2",
2828
"jsonwebtoken": "^9.0.2",
2929
"jwks-rsa": "^3.2.0",
30-
"uuid": "^11.1.0"
30+
"uuid": "11.1.0"
3131
},
3232
"devDependencies": {
3333
"@types/aws-lambda": "^8.10.152",
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export enum Headers {
2+
x_request_id = "x-request-id",
3+
x_correlation_id = "x-correlation-id",
4+
x_rum_session_id = "x-rum-session-id",
5+
x_session_id = "x-session-id",
6+
}

packages/common/commonTypes/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,5 @@ export type {
3737
TrackerUserInfo,
3838
TrackerUserInfoResult
3939
} from "./trackerUserInfo"
40+
41+
export {Headers} from "./headers"

packages/common/commonTypes/src/trackerUserInfo.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export type TrackerUserInfo = {
2121
user_details: UserDetails;
2222
multiple_sessions?: boolean;
2323
is_concurrent_session?: boolean;
24+
sessionId?: string;
2425
error?: string | null;
2526
};
2627

@@ -33,5 +34,6 @@ export type TrackerUserInfoResult = {
3334
hasSingleRoleAccess: boolean,
3435
isConcurrentSession: boolean,
3536
invalidSessionCause: string | undefined,
37+
sessionId: string | undefined,
3638
error: string | null
3739
}

packages/common/lambdaUtils/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
},
1616
"dependencies": {
1717
"@aws-lambda-powertools/logger": "^2.27.0",
18+
"@cpt-ui-common/common-types": "^1.0.0",
1819
"aws-lambda": "^1.0.7",
1920
"axios": "^1.12.2",
2021
"uuid": "^11.1.0"

packages/common/lambdaUtils/src/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {APIGatewayProxyEvent} from "aws-lambda"
22
import {v4 as uuidv4} from "uuid"
33
import {Logger} from "@aws-lambda-powertools/logger"
4+
import {Headers} from "@cpt-ui-common/common-types"
45

56
export * as headers from "./headers"
67
export * from "./exhaustiveGuard"
@@ -9,6 +10,8 @@ export type LoggerKeys = {
910
"apigw-request-id"?: string,
1011
"x-request-id"?: string,
1112
"x-correlation-id"?: string
13+
"x-rum-session-id"?: string
14+
"x-session-id"?: string
1215
}
1316
export type InboundEventValues = {
1417
loggerKeys: LoggerKeys,
@@ -19,8 +22,10 @@ export const extractInboundEventValues = (event: APIGatewayProxyEvent): InboundE
1922
return {
2023
loggerKeys: {
2124
"apigw-request-id": event.requestContext?.requestId,
22-
"x-request-id": event.headers["x-request-id"],
23-
"x-correlation-id": correlationId
25+
"x-request-id": event.headers[Headers.x_request_id],
26+
"x-correlation-id": correlationId,
27+
"x-session-id": event.headers[Headers.x_session_id],
28+
"x-rum-session-id": event.headers[Headers.x_rum_session_id]
2429
},
2530
correlationId
2631
}

packages/common/pdsClient/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"ajv": "^8.17.1",
2121
"axios": "^1.12.2",
2222
"json-schema-to-ts": "^3.1.1",
23-
"uuid": "^11.1.0"
23+
"uuid": "11.1.0"
2424
},
2525
"devDependencies": {
2626
"@cpt-ui-common/testing": "^1.0.0",

packages/cpt-ui/__tests__/BasicDetailsSearch.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ const signedInAuthState: AuthContextType = {
4949
selectedRole: undefined,
5050
userDetails: undefined,
5151
isConcurrentSession: false,
52+
sessionId: "test-session-id",
5253
cognitoSignIn: mockCognitoSignIn,
5354
cognitoSignOut: mockCognitoSignOut,
5455
clearAuthState: mockClearAuthState,

packages/cpt-ui/__tests__/BasicDetailsSearchResultsPage.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const mockAuthContext: AuthContextType = {
3030
selectedRole: undefined,
3131
userDetails: undefined,
3232
isConcurrentSession: false,
33+
sessionId: undefined,
3334
cognitoSignIn: jest.fn(),
3435
cognitoSignOut: jest.fn(),
3536
clearAuthState: jest.fn(),

0 commit comments

Comments
 (0)