Skip to content

Commit

Permalink
feat: clean api behind a flag (#3288)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew committed Mar 9, 2023
1 parent 785d056 commit 898d4f0
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 27 deletions.
2 changes: 2 additions & 0 deletions src/lib/__snapshots__/create-config.test.ts.snap
Expand Up @@ -71,6 +71,7 @@ exports[`should create default config 1`] = `
"anonymiseEventLog": false,
"bulkOperations": false,
"caseInsensitiveInOperators": false,
"cleanClientApi": false,
"crOnVariants": false,
"embedProxy": true,
"embedProxyFrontend": true,
Expand All @@ -95,6 +96,7 @@ exports[`should create default config 1`] = `
"anonymiseEventLog": false,
"bulkOperations": false,
"caseInsensitiveInOperators": false,
"cleanClientApi": false,
"crOnVariants": false,
"embedProxy": true,
"embedProxyFrontend": true,
Expand Down
58 changes: 31 additions & 27 deletions src/lib/services/feature-toggle-service.ts
Expand Up @@ -692,33 +692,37 @@ class FeatureToggleService {
query,
includeIds,
);
return result.map(
({
name,
type,
enabled,
project,
stale,
strategies,
variants,
description,
createdAt,
lastSeenAt,
impressionData,
}) => ({
name,
type,
enabled,
project,
stale,
strategies,
variants,
description,
createdAt,
lastSeenAt,
impressionData,
}),
);
if (this.flagResolver.isEnabled('cleanClientApi')) {
return result.map(
({
name,
type,
enabled,
project,
stale,
strategies,
variants,
description,
createdAt,
lastSeenAt,
impressionData,
}) => ({
name,
type,
enabled,
project,
stale,
strategies,
variants,
description,
createdAt,
lastSeenAt,
impressionData,
}),
);
} else {
return result;
}
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/lib/types/experimental.ts
Expand Up @@ -72,6 +72,7 @@ const flags = {
process.env.PROJECT_SCOPED_SEGMENTS,
false,
),
cleanClientApi: parseEnvVarBoolean(process.env.CLEAN_CLIENT_API, false),
};

export const defaultExperimentalOptions: IExperimentalOptions = {
Expand Down

0 comments on commit 898d4f0

Please sign in to comment.