Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
2 changes: 1 addition & 1 deletion sdk/appconfiguration/app-configuration/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "js",
"TagPrefix": "js/appconfiguration/app-configuration",
"Tag": "js/appconfiguration/app-configuration_bdaf29d71a"
"Tag": "js/appconfiguration/app-configuration_48f15db7c6"
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,12 @@ export interface FeatureFlagValue {
name: string;
parameters?: Record<string, unknown>;
}[];
requirementType?: "All" | "Any";
};
description?: string;
displayName?: string;
enabled: boolean;
id?: string;
id: string;
}

// @public
Expand Down
12 changes: 11 additions & 1 deletion sdk/appconfiguration/app-configuration/src/featureFlag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface FeatureFlagValue {
/**
* Id for the feature flag.
*/
id?: string;
id: string;
/**
* A Feature filter consistently evaluates the state of a feature flag.
* Our feature management library supports three types of built-in filters: Targeting, TimeWindow, and Percentage.
Expand All @@ -32,6 +32,7 @@ export interface FeatureFlagValue {
*/
conditions: {
clientFilters: { name: string; parameters?: Record<string, unknown> }[];
requirementType?: "All" | "Any";
};
/**
* Description of the feature.
Expand Down Expand Up @@ -76,6 +77,11 @@ export const FeatureFlagHelper = {
display_name: featureFlag.value.displayName,
};

if (featureFlag.value.conditions.requirementType) {
jsonFeatureFlagValue.conditions.requirement_type =
featureFlag.value.conditions.requirementType;
}

const configSetting = {
...featureFlag,
key,
Expand Down Expand Up @@ -117,6 +123,10 @@ export function parseFeatureFlag(
key,
contentType: featureFlagContentType,
};

if (jsonFeatureFlagValue.conditions.requirement_type) {
featureflag.value.conditions.requirementType = jsonFeatureFlagValue.conditions.requirement_type;
}
return featureflag;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
export type JsonFeatureFlagValue = {
conditions: {
client_filters: { name: string; parameters?: Record<string, unknown> }[];
requirement_type?: "All" | "Any";
};
description?: string;
enabled: boolean;
id?: string;
id: string;
display_name?: string;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ describe("AppConfigurationClient - FeatureFlag", () => {
baseSetting = {
value: {
conditions: {
requirementType: "Any",
clientFilters: [
{
name: "Microsoft.TimeWindow",
Expand All @@ -51,6 +52,7 @@ describe("AppConfigurationClient - FeatureFlag", () => {
{ name: "Microsoft.Percentage", parameters: { Value: 25 } },
],
},
id: "name-1",
enabled: false,
description: "I'm a description",
displayName: "for display",
Expand Down Expand Up @@ -202,7 +204,7 @@ describe("AppConfigurationClient - FeatureFlag", () => {
`name-1${Math.floor(Math.random() * 1000)}`,
)}`,
isReadOnly: false,
value: { conditions: { clientFilters: [] }, enabled: true },
value: { conditions: { clientFilters: [] }, id: "name-1", enabled: true },
};
});

Expand Down
Loading