Skip to content

Commit

Permalink
Merge branch 'dev' into featureflag/import-validation-api
Browse files Browse the repository at this point in the history
  • Loading branch information
Yagnik56 authored Aug 20, 2024
2 parents 674f815 + f1238eb commit 9361c54
Show file tree
Hide file tree
Showing 59 changed files with 2,200 additions and 975 deletions.
4 changes: 2 additions & 2 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ab_testing_backend",
"version": "5.2.0",
"version": "6.0.0",
"description": "Backend for A/B Testing Project",
"scripts": {
"install:all": "npm ci && cd packages/Scheduler && npm ci && cd ../Upgrade && npm ci",
Expand Down
4 changes: 2 additions & 2 deletions backend/packages/Scheduler/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion backend/packages/Scheduler/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ppl-upgrade-serverless",
"version": "5.2.0",
"version": "6.0.0",
"description": "Serverless webpack example using Typescript",
"main": "handler.js",
"scripts": {
Expand Down
1,949 changes: 1,196 additions & 753 deletions backend/packages/Upgrade/package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions backend/packages/Upgrade/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ab_testing_backend",
"version": "5.2.0",
"version": "6.0.0",
"description": "Backend for A/B Testing Project",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -56,9 +56,9 @@
"typeorm-seeding": "^1.2.0"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.485.0",
"@aws-sdk/client-ses": "^3.485.0",
"@aws-sdk/client-sfn": "^3.485.0",
"@aws-sdk/client-s3": "^3.633.0",
"@aws-sdk/client-ses": "^3.632.0",
"@aws-sdk/client-sfn": "^3.632.0",
"@aws-sdk/lib-storage": "^3.485.0",
"@aws-sdk/s3-request-presigner": "^3.485.0",
"@golevelup/ts-jest": "^0.4.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Repository, EntityRepository, EntityManager } from 'typeorm';
import { FeatureFlag } from '../models/FeatureFlag';
import repositoryError from './utils/repositoryError';
import { FEATURE_FLAG_STATUS } from 'upgrade_types';
import { FILTER_MODE } from 'types/src';
import { FEATURE_FLAG_STATUS, FILTER_MODE } from 'upgrade_types';

@EntityRepository(FeatureFlag)
export class FeatureFlagRepository extends Repository<FeatureFlag> {
Expand Down
34 changes: 25 additions & 9 deletions backend/packages/Upgrade/src/auth/AuthService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,32 @@ export class AuthService {

public async validateUser(token: string, request: express.Request): Promise<User> {
const client = new OAuth2Client(env.google.clientId);
request.logger.info({ message: 'Validating ID Token' });
const ticket = await client.verifyIdToken({
idToken: token,
audience: env.google.clientId, // Specify the CLIENT_ID of the app that accesses the backend
// Or, if multiple clients access the backend:
// [CLIENT_ID_1, CLIENT_ID_2, CLIENT_ID_3]
});
request.logger.info({ message: 'Token Validated' });
request.logger.info({ message: 'Validating Token' });

const payload = ticket.getPayload();
let payload;
try {
// First, try to verify the token as an ID token
const ticket = await client.verifyIdToken({
idToken: token,
audience: env.google.clientId, // Specify the CLIENT_ID of the app that accesses the backend
// Or, if multiple clients access the backend:
// [CLIENT_ID_1, CLIENT_ID_2, CLIENT_ID_3]
});
payload = ticket.getPayload();
request.logger.info({ message: 'ID Token Validated' });
} catch (error) {
// If ID token verification fails, try to verify it as an access token
try {
await client.getTokenInfo(token);
request.logger.info({ message: 'Access Token Validated' });
// For service account access tokens, we'll return null
// We might want to implement specific handling for service accounts here
return null;
} catch (error) {
request.logger.error(error);
throw error;
}
}

// check if user exist in the user repo
const email = payload.email;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ import {
FLAG_SEARCH_KEY,
FLAG_SORT_KEY,
} from '../../../src/api/controllers/validators/FeatureFlagsPaginatedParamsValidator';
import { SEGMENT_TYPE, SORT_AS_DIRECTION } from '../../../../../../types/src';
import { FEATURE_FLAG_STATUS, FILTER_MODE, SEGMENT_TYPE, SORT_AS_DIRECTION } from 'upgrade_types';
import { isUUID } from 'class-validator';
import { v4 as uuid } from 'uuid';
import { FEATURE_FLAG_STATUS, FILTER_MODE } from 'upgrade_types';
import { ExperimentAssignmentService } from '../../../src/api/services/ExperimentAssignmentService';
import { FeatureFlagValidation } from '../../../src/api/controllers/validators/FeatureFlagValidator';
import { FeatureFlagListValidator } from '../../../src/api/controllers/validators/FeatureFlagListValidator';
Expand Down
2 changes: 1 addition & 1 deletion clientlibs/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
at the same time that happen to rev to the same new version will be caught
by a merge conflict. -->

<version>5.2.0</version>
<version>6.0.0</version>
<build>
<plugins>
<plugin>
Expand Down
32 changes: 16 additions & 16 deletions clientlibs/js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion clientlibs/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "upgrade_client_lib",
"version": "5.2.0",
"version": "6.0.0",
"description": "Client library to communicate with the Upgrade server",
"files": [
"dist/*"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ab-testing",
"version": "5.2.0",
"version": "6.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,19 @@ export class FeatureFlagsDataService {
const url = `${this.environment.api.addFlagInclusionList}/${segmentId}`;
return this.http.delete(url);
}

addExclusionList(list: AddPrivateSegmentListRequest): Observable<FeatureFlagSegmentListDetails> {
const url = this.environment.api.addFlagExclusionList;
return this.http.post<FeatureFlagSegmentListDetails>(url, list);
}

updateExclusionList(list: EditPrivateSegmentListRequest): Observable<FeatureFlagSegmentListDetails> {
const url = `${this.environment.api.addFlagExclusionList}/${list.list.id}`;
return this.http.put<FeatureFlagSegmentListDetails>(url, list);
}

deleteExclusionList(segmentId: string) {
const url = `${this.environment.api.addFlagExclusionList}/${segmentId}`;
return this.http.delete(url);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import {
selectAppContexts,
selectIsLoadingImportFeatureFlag,
selectFeatureFlagIds,
selectShouldShowWarningForSelectedFlag,
selectWarningStatusForAllFlags,
} from './store/feature-flags.selectors';
import * as FeatureFlagsActions from './store/feature-flags.actions';
import { actionFetchContextMetaData } from '../experiments/store/experiments.actions';
Expand Down Expand Up @@ -60,7 +62,8 @@ export class FeatureFlagsService {
searchKey$ = this.store$.pipe(select(selectSearchKey));
sortKey$ = this.store$.pipe(select(selectSortKey));
sortAs$ = this.store$.pipe(select(selectSortAs));

shouldShowWarningForSelectedFlag$ = this.store$.pipe(select(selectShouldShowWarningForSelectedFlag));
warningStatusForAllFlags$ = this.store$.pipe(select(selectWarningStatusForAllFlags));

hasFeatureFlagsCountChanged$ = this.allFeatureFlags$.pipe(
pairwise(),
Expand Down Expand Up @@ -184,4 +187,16 @@ export class FeatureFlagsService {
deleteFeatureFlagInclusionPrivateSegmentList(segmentId: string) {
this.store$.dispatch(FeatureFlagsActions.actionDeleteFeatureFlagInclusionList({ segmentId }));
}

addFeatureFlagExclusionPrivateSegmentList(list: AddPrivateSegmentListRequest) {
this.store$.dispatch(FeatureFlagsActions.actionAddFeatureFlagExclusionList({ list }));
}

updateFeatureFlagExclusionPrivateSegmentList(list: EditPrivateSegmentListRequest) {
this.store$.dispatch(FeatureFlagsActions.actionUpdateFeatureFlagExclusionList({ list }));
}

deleteFeatureFlagExclusionPrivateSegmentList(segmentId: string) {
this.store$.dispatch(FeatureFlagsActions.actionDeleteFeatureFlagExclusionList({ segmentId }));
}
}
Loading

0 comments on commit 9361c54

Please sign in to comment.