Package-level declarations

Types

Link copied to clipboard

Standard keys for FlippingExecutionContext parameters.

Link copied to clipboard
@Serializable
data class Feature(val uid: String, val isEnabled: Boolean = false, val description: String? = null, val group: String? = null, val permissions: Set<String> = emptySet(), val flippingStrategy: FlippingStrategy? = null, val customProperties: Map<String, Property<*>> = emptyMap())

Represents a feature flag (feature toggle) identified by a unique identifier.

Link copied to clipboard
interface FeatureStore

Storage abstraction for Feature flags with Kotlin-idiomatic operator support.

Link copied to clipboard
data class FlippingExecutionContext(values: Map<String, Any> = emptyMap()) : CoroutineContext.Element

A type-safe execution context for feature flipping strategies.

Link copied to clipboard
fun interface FlippingStrategy

Defines a strategy for determining whether a feature should be enabled.

Link copied to clipboard
interface PropertyStore

A store for managing feature flag properties.

Properties

Link copied to clipboard

Checks if this feature has a flipping strategy configured.

Link copied to clipboard

Checks if this feature has any permission restrictions.

Link copied to clipboard

Checks if this feature is disabled.

Link copied to clipboard

Returns the set of all custom property names attached to this feature.

Functions

Link copied to clipboard
fun Feature.addGroup(groupName: String): Feature

Returns a new Feature associated with the specified group.

Link copied to clipboard
fun Feature.addProperties(vararg properties: Property<*>): Feature

Returns a new Feature with multiple properties added.

Link copied to clipboard

Returns a new Feature with all permissions removed.

Link copied to clipboard

Returns a new Feature with all custom properties removed.

Link copied to clipboard
suspend fun PropertyStore.count(): Int

Returns the number of properties in the store.

Link copied to clipboard
suspend fun <T> PropertyStore.createOrUpdateProperty(property: Property<T>)

Creates a new property or updates it if it already exists (upsert operation).

Link copied to clipboard

Retrieve the current FlippingExecutionContext from the coroutine context.

Link copied to clipboard

Retrieves a required parameter from the context, throwing if not present.

Link copied to clipboard

Returns all custom properties whose values are of the specified type.

Link copied to clipboard

Retrieves a custom property by name, throwing an exception if not found.

Retrieves a property by name, throwing an exception if not found.

Link copied to clipboard
suspend fun <T> PropertyStore.getPropertyValue(name: String): T?

Retrieves a property's value directly, without the Property wrapper.

Link copied to clipboard
inline fun <T> Feature.getPropertyValueOrDefault(name: String, default: T): T

Retrieves a custom property's value by name, returning a default if not found.

suspend fun <T> PropertyStore.getPropertyValueOrDefault(name: String, default: T): T

Retrieves a property's value, or returns a default if not found.

Link copied to clipboard
fun Feature.grantPermissions(vararg permissions: String): Feature

Returns a new Feature with the specified permissions granted.

Link copied to clipboard
fun Feature.hasAllPermissions(vararg permissions: String): Boolean

Checks if this feature has all of the specified permissions.

Link copied to clipboard
fun Feature.hasAnyPermission(vararg permissions: String): Boolean

Checks if this feature has at least one of the specified permissions.

Link copied to clipboard

Checks if a property exists and has a specific value.

Link copied to clipboard

Merges this context with another, with the other context's values taking precedence. Does not modify either original context.

Link copied to clipboard

Returns a new Feature removed from its current group.

Link copied to clipboard

Returns a new Feature with the specified properties removed.

Link copied to clipboard
fun Feature.revokePermissions(vararg permissions: String): Feature

Returns a new Feature with the specified permissions revoked.

Link copied to clipboard
inline suspend fun <T> withFlippingContext(context: FlippingExecutionContext, crossinline block: suspend () -> T): T

Execute a block with the given FlippingExecutionContext.

Link copied to clipboard
inline suspend fun <T> withFlippingParameters(vararg parameters: Pair<String, Any>, crossinline block: suspend () -> T): T

Execute a block with additional parameters merged into the current context.

Link copied to clipboard

Creates a new context with an additional parameter. Does not modify the original context.

Link copied to clipboard

Creates a new context with additional parameters. Does not modify the original context.