UNPKG

flagsmith-nodejs

Version:

Flagsmith lets you manage features flags and remote config across web, mobile and server side applications. Deliver true Continuous Integration. Get builds out faster. Control who has access to new features.

217 lines (216 loc) 5.88 kB
/** * This file was automatically generated by json-schema-to-typescript. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run json-schema-to-typescript to regenerate this file. */ /** * An environment's unique identifier. */ export type Key = string; /** * An environment's human-readable name. */ export type Name = string; /** * A unique identifier for an identity, used for segment and multivariate feature flag targeting, and displayed in the Flagsmith UI. */ export type Identifier = string; /** * Key used when selecting a value for a multivariate feature, or for % split segmentation. Set to an internal identifier or a composite value based on the environment key and identifier, depending on Flagsmith implementation. */ export type Key1 = string; /** * Key used for % split segmentation. */ export type Key2 = string; /** * The name of the segment. */ export type Name1 = string; /** * Segment rule type. Represents a logical quantifier for the conditions and sub-rules. */ export type Type = 'ALL' | 'ANY' | 'NONE'; export type SegmentCondition = SegmentCondition1 | InSegmentCondition; /** * A reference to the identity trait or value in the evaluation context. */ export type Property = string; /** * The operator to use for evaluating the condition. */ export type Operator = 'EQUAL' | 'GREATER_THAN' | 'LESS_THAN' | 'LESS_THAN_INCLUSIVE' | 'CONTAINS' | 'GREATER_THAN_INCLUSIVE' | 'NOT_CONTAINS' | 'NOT_EQUAL' | 'REGEX' | 'PERCENTAGE_SPLIT' | 'MODULO' | 'IS_SET' | 'IS_NOT_SET' | 'IN'; /** * The value to compare against the trait or context value. */ export type Value = string; /** * A reference to the identity trait or value in the evaluation context. */ export type Property1 = string; /** * The operator to use for evaluating the condition. */ export type Operator1 = 'IN'; /** * The values to compare against the trait or context value. */ export type Value1 = string[]; /** * Conditions that must be met for the rule to apply. */ export type Conditions = SegmentCondition[]; /** * Sub-rules nested within the segment rule. */ export type SubRules = SegmentRule[]; /** * Rules that define the segment. */ export type Rules = SegmentRule[]; /** * Key used when selecting a value for a multivariate feature. Set to an internal identifier or a UUID, depending on Flagsmith implementation. */ export type Key3 = string; /** * Unique feature identifier. */ export type FeatureKey = string; /** * Feature name. */ export type Name2 = string; /** * Indicates whether the feature is enabled in the environment. */ export type Enabled = boolean; /** * A default environment value for the feature. If the feature is multivariate, this will be the control value. */ export type Value2 = string; /** * The value of the feature. */ export type Value3 = string; /** * The weight of the feature value variant, as a percentage number (i.e. 100.0). */ export type Weight = number; /** * An array of environment default values associated with the feature. Contains a single value for standard features, or multiple values for multivariate features. */ export type Variants = FeatureValue[]; /** * Priority of the feature context. Lower values indicate a higher priority when multiple contexts apply to the same feature. */ export type Priority = number; /** * Feature overrides for the segment. */ export type Overrides = FeatureContext[]; /** * A context object containing the necessary information to evaluate Flagsmith feature flags. */ export interface EvaluationContext { environment: EnvironmentContext; /** * Identity context used for identity-based evaluation. */ identity?: IdentityContext | null; segments?: Segments; features?: Features; [k: string]: unknown; } /** * Environment context required for evaluation. */ export interface EnvironmentContext { key: Key; name: Name; [k: string]: unknown; } /** * Represents an identity context for feature flag evaluation. */ export interface IdentityContext { identifier: Identifier; key: Key1; traits?: Traits; [k: string]: unknown; } /** * A map of traits associated with the identity, where the key is the trait name and the value is the trait value. */ export interface Traits { [k: string]: string | number | boolean | null; } /** * Segments applicable to the evaluation context. */ export interface Segments { [k: string]: SegmentContext; } /** * Represents a segment context for feature flag evaluation. */ export interface SegmentContext { key: Key2; name: Name1; rules: Rules; overrides?: Overrides; [k: string]: unknown; } /** * Represents a rule within a segment for feature flag evaluation. */ export interface SegmentRule { type: Type; conditions?: Conditions; rules?: SubRules; [k: string]: unknown; } /** * Represents a condition within a segment rule for feature flag evaluation. */ export interface SegmentCondition1 { property: Property; operator: Operator; value: Value; [k: string]: unknown; } /** * Represents an IN condition within a segment rule for feature flag evaluation. */ export interface InSegmentCondition { property: Property1; operator: Operator1; value: Value1; [k: string]: unknown; } /** * Represents a feature context for feature flag evaluation. */ export interface FeatureContext { key: Key3; feature_key: FeatureKey; name: Name2; enabled: Enabled; value: Value2; variants?: Variants; priority?: Priority; [k: string]: unknown; } /** * Represents a multivariate value for a feature flag. */ export interface FeatureValue { value: Value3; weight: Weight; [k: string]: unknown; } /** * Features to be evaluated in the context. */ export interface Features { [k: string]: FeatureContext; }