UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

1,007 lines • 47.2 kB
import { APIResource } from "../../../../core/resource.mjs"; import * as ChangelogAPI from "./changelog.mjs"; import { BaseChangelog, Changelog, ChangelogListParams, ChangelogListResponse, ChangelogListResponsesCursorPaginationAfter } from "./changelog.mjs"; import { APIPromise } from "../../../../core/api-promise.mjs"; import { CursorPaginationAfter, type CursorPaginationAfterParams, PagePromise } from "../../../../core/pagination.mjs"; import { RequestOptions } from "../../../../internal/request-options.mjs"; export declare class BaseFlags extends APIResource { static readonly _key: readonly ['flagship', 'apps', 'flags']; /** * Creates a flag. Returns 409 if the key already exists. `type` is always inferred * from variation values; legacy request-side values are ignored. */ create(appID: string, params: FlagCreateParams, options?: RequestOptions): APIPromise<FlagCreateResponse>; /** * Replaces the entire flag definition. Omitted fields are dropped, not preserved — * read before writing. The path key identifies the flag and cannot be renamed by * changing the body `key`. Each update appends a changelog entry. */ update(flagKey: string, params: FlagUpdateParams, options?: RequestOptions): APIPromise<FlagUpdateResponse>; /** * Lists an app's flags ordered by key. Pass `cursor` from `result_info` to page * forward; a null cursor indicates the last page. */ list(appID: string, params: FlagListParams, options?: RequestOptions): PagePromise<FlagListResponsesCursorPaginationAfter, FlagListResponse>; /** * Deletes a flag permanently. After deletion propagates, direct evaluations return * not found; typed binding accessors may return the caller-supplied default. * Cannot be undone. */ delete(flagKey: string, params: FlagDeleteParams, options?: RequestOptions): APIPromise<FlagDeleteResponse>; /** * Returns the full flag definition including rules, variations, and audit fields. */ get(flagKey: string, params: FlagGetParams, options?: RequestOptions): APIPromise<FlagGetResponse>; } export declare class Flags extends BaseFlags { changelog: ChangelogAPI.Changelog; } export type FlagListResponsesCursorPaginationAfter = CursorPaginationAfter<FlagListResponse>; export interface FlagCreateResponse { /** * Variation the API serves when the flag is off, or when it's on but no rule * matches the context. Must be a key in `variations`. */ default_variation: string; /** * When false, the flag bypasses all rules and always serves `default_variation`. */ enabled: boolean; /** * Unique identifier for the flag within an app. Used in all evaluation and SDK * calls. */ key: string; /** * Targeting rules evaluated in ascending `priority`; the first matching rule wins. * An empty array means the flag always serves `default_variation`. */ rules: Array<FlagCreateResponse.Rule>; /** * Server-inferred value type shared by all of the flag's variations. */ type: 'boolean' | 'string' | 'number' | 'json'; /** * Map of variation name to value. All values share the same type (boolean, string, * number, or JSON object/array), and each serialized value stays within 10KB. */ variations: { [key: string]: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; }; /** * Optional operator-facing description. It does not affect flag evaluation. */ description?: string | null; updated_at?: string; updated_by?: string; } export declare namespace FlagCreateResponse { interface Rule { /** * Conditions the context must satisfy for this rule to match. An empty array * matches all contexts. */ conditions: Array<Rule.UnionMember0 | Rule.UnionMember1>; /** * Evaluation order: the API evaluates rules with lower numbers first. Must be * unique across the flag's rules. */ priority: number; /** * Variation the API serves when this rule matches. Must be a key in `variations`. */ serve_variation: string; rollout?: Rule.Rollout; } namespace Rule { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>>; logical_operator: 'AND' | 'OR'; } } } } } } interface Rollout { /** * Percentage of matching traffic (0–100, up to 2 decimal places) served this * variation. For multi-way splits, use cumulative upper bounds across rules (e.g. * 30, 70, 100). */ percentage: number; /** * Context attribute used for sticky bucketing. Defaults to `targetingKey`. If * absent at evaluation time, bucketing is random per request. */ attribute?: string; } } } export interface FlagUpdateResponse { /** * Variation the API serves when the flag is off, or when it's on but no rule * matches the context. Must be a key in `variations`. */ default_variation: string; /** * When false, the flag bypasses all rules and always serves `default_variation`. */ enabled: boolean; /** * Unique identifier for the flag within an app. Used in all evaluation and SDK * calls. */ key: string; /** * Targeting rules evaluated in ascending `priority`; the first matching rule wins. * An empty array means the flag always serves `default_variation`. */ rules: Array<FlagUpdateResponse.Rule>; /** * Server-inferred value type shared by all of the flag's variations. */ type: 'boolean' | 'string' | 'number' | 'json'; /** * Map of variation name to value. All values share the same type (boolean, string, * number, or JSON object/array), and each serialized value stays within 10KB. */ variations: { [key: string]: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; }; /** * Optional operator-facing description. It does not affect flag evaluation. */ description?: string | null; updated_at?: string; updated_by?: string; } export declare namespace FlagUpdateResponse { interface Rule { /** * Conditions the context must satisfy for this rule to match. An empty array * matches all contexts. */ conditions: Array<Rule.UnionMember0 | Rule.UnionMember1>; /** * Evaluation order: the API evaluates rules with lower numbers first. Must be * unique across the flag's rules. */ priority: number; /** * Variation the API serves when this rule matches. Must be a key in `variations`. */ serve_variation: string; rollout?: Rule.Rollout; } namespace Rule { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>>; logical_operator: 'AND' | 'OR'; } } } } } } interface Rollout { /** * Percentage of matching traffic (0–100, up to 2 decimal places) served this * variation. For multi-way splits, use cumulative upper bounds across rules (e.g. * 30, 70, 100). */ percentage: number; /** * Context attribute used for sticky bucketing. Defaults to `targetingKey`. If * absent at evaluation time, bucketing is random per request. */ attribute?: string; } } } export interface FlagListResponse { /** * Variation the API serves when the flag is off, or when it's on but no rule * matches the context. Must be a key in `variations`. */ default_variation: string; /** * When false, the flag bypasses all rules and always serves `default_variation`. */ enabled: boolean; /** * Unique identifier for the flag within an app. Used in all evaluation and SDK * calls. */ key: string; /** * Targeting rules evaluated in ascending `priority`; the first matching rule wins. * An empty array means the flag always serves `default_variation`. */ rules: Array<FlagListResponse.Rule>; /** * Server-inferred value type shared by all of the flag's variations. */ type: 'boolean' | 'string' | 'number' | 'json'; /** * Map of variation name to value. All values share the same type (boolean, string, * number, or JSON object/array), and each serialized value stays within 10KB. */ variations: { [key: string]: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; }; /** * Optional operator-facing description. It does not affect flag evaluation. */ description?: string | null; updated_at?: string; updated_by?: string; } export declare namespace FlagListResponse { interface Rule { /** * Conditions the context must satisfy for this rule to match. An empty array * matches all contexts. */ conditions: Array<Rule.UnionMember0 | Rule.UnionMember1>; /** * Evaluation order: the API evaluates rules with lower numbers first. Must be * unique across the flag's rules. */ priority: number; /** * Variation the API serves when this rule matches. Must be a key in `variations`. */ serve_variation: string; rollout?: Rule.Rollout; } namespace Rule { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>>; logical_operator: 'AND' | 'OR'; } } } } } } interface Rollout { /** * Percentage of matching traffic (0–100, up to 2 decimal places) served this * variation. For multi-way splits, use cumulative upper bounds across rules (e.g. * 30, 70, 100). */ percentage: number; /** * Context attribute used for sticky bucketing. Defaults to `targetingKey`. If * absent at evaluation time, bucketing is random per request. */ attribute?: string; } } } export interface FlagDeleteResponse { key: string; } export interface FlagGetResponse { /** * Variation the API serves when the flag is off, or when it's on but no rule * matches the context. Must be a key in `variations`. */ default_variation: string; /** * When false, the flag bypasses all rules and always serves `default_variation`. */ enabled: boolean; /** * Unique identifier for the flag within an app. Used in all evaluation and SDK * calls. */ key: string; /** * Targeting rules evaluated in ascending `priority`; the first matching rule wins. * An empty array means the flag always serves `default_variation`. */ rules: Array<FlagGetResponse.Rule>; /** * Server-inferred value type shared by all of the flag's variations. */ type: 'boolean' | 'string' | 'number' | 'json'; /** * Map of variation name to value. All values share the same type (boolean, string, * number, or JSON object/array), and each serialized value stays within 10KB. */ variations: { [key: string]: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; }; /** * Optional operator-facing description. It does not affect flag evaluation. */ description?: string | null; updated_at?: string; updated_by?: string; } export declare namespace FlagGetResponse { interface Rule { /** * Conditions the context must satisfy for this rule to match. An empty array * matches all contexts. */ conditions: Array<Rule.UnionMember0 | Rule.UnionMember1>; /** * Evaluation order: the API evaluates rules with lower numbers first. Must be * unique across the flag's rules. */ priority: number; /** * Variation the API serves when this rule matches. Must be a key in `variations`. */ serve_variation: string; rollout?: Rule.Rollout; } namespace Rule { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>>; logical_operator: 'AND' | 'OR'; } } } } } } interface Rollout { /** * Percentage of matching traffic (0–100, up to 2 decimal places) served this * variation. For multi-way splits, use cumulative upper bounds across rules (e.g. * 30, 70, 100). */ percentage: number; /** * Context attribute used for sticky bucketing. Defaults to `targetingKey`. If * absent at evaluation time, bucketing is random per request. */ attribute?: string; } } } export interface FlagCreateParams { /** * Path param: Cloudflare account ID that owns the Flagship app. */ account_id: string; /** * Body param: Variation the API serves when the flag is off, or when it's on but * no rule matches the context. Must be a key in `variations`. */ default_variation: string; /** * Body param: When false, the flag bypasses all rules and always serves * `default_variation`. */ enabled: boolean; /** * Body param: Unique identifier for the flag within an app. Used in all evaluation * and SDK calls. */ key: string; /** * Body param: Targeting rules evaluated in ascending `priority`; the first * matching rule wins. An empty array means the flag always serves * `default_variation`. */ rules: Array<FlagCreateParams.Rule>; /** * Body param: Map of variation name to value. All values share the same type * (boolean, string, number, or JSON object/array), and each serialized value stays * within 10KB. */ variations: { [key: string]: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; }; /** * Body param: Optional operator-facing description. It does not affect flag * evaluation. */ description?: string | null; /** * @deprecated Body param: Deprecated compatibility field. Omit it; the API ignores * this value and infers the type from the flag's variations. */ type?: 'boolean' | 'string' | 'number' | 'json'; } export declare namespace FlagCreateParams { interface Rule { /** * Conditions the context must satisfy for this rule to match. An empty array * matches all contexts. */ conditions: Array<Rule.UnionMember0 | Rule.UnionMember1>; /** * Evaluation order: the API evaluates rules with lower numbers first. Must be * unique across the flag's rules. */ priority: number; /** * Variation the API serves when this rule matches. Must be a key in `variations`. */ serve_variation: string; rollout?: Rule.Rollout; } namespace Rule { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>>; logical_operator: 'AND' | 'OR'; } } } } } } interface Rollout { /** * Percentage of matching traffic (0–100, up to 2 decimal places) served this * variation. For multi-way splits, use cumulative upper bounds across rules (e.g. * 30, 70, 100). */ percentage: number; /** * Context attribute used for sticky bucketing. Defaults to `targetingKey`. If * absent at evaluation time, bucketing is random per request. */ attribute?: string; } } } export interface FlagUpdateParams { /** * Path param: Cloudflare account ID that owns the Flagship app. */ account_id: string; /** * Path param: Flagship app ID returned when the app was created. */ app_id: string; /** * Body param: Variation the API serves when the flag is off, or when it's on but * no rule matches the context. Must be a key in `variations`. */ default_variation: string; /** * Body param: When false, the flag bypasses all rules and always serves * `default_variation`. */ enabled: boolean; /** * Body param: Unique identifier for the flag within an app. Used in all evaluation * and SDK calls. */ key: string; /** * Body param: Targeting rules evaluated in ascending `priority`; the first * matching rule wins. An empty array means the flag always serves * `default_variation`. */ rules: Array<FlagUpdateParams.Rule>; /** * Body param: Map of variation name to value. All values share the same type * (boolean, string, number, or JSON object/array), and each serialized value stays * within 10KB. */ variations: { [key: string]: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; }; /** * Body param: Optional operator-facing description. It does not affect flag * evaluation. */ description?: string | null; /** * @deprecated Body param: Deprecated compatibility field. Omit it; the API ignores * this value and infers the type from the flag's variations. */ type?: 'boolean' | 'string' | 'number' | 'json'; } export declare namespace FlagUpdateParams { interface Rule { /** * Conditions the context must satisfy for this rule to match. An empty array * matches all contexts. */ conditions: Array<Rule.UnionMember0 | Rule.UnionMember1>; /** * Evaluation order: the API evaluates rules with lower numbers first. Must be * unique across the flag's rules. */ priority: number; /** * Variation the API serves when this rule matches. Must be a key in `variations`. */ serve_variation: string; rollout?: Rule.Rollout; } namespace Rule { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<UnionMember1.UnionMember0 | UnionMember1.UnionMember1>; logical_operator: 'AND' | 'OR'; } namespace UnionMember1 { interface UnionMember0 { attribute: string; operator: 'equals' | 'not_equals' | 'greater_than' | 'less_than' | 'greater_than_or_equals' | 'less_than_or_equals' | 'contains' | 'starts_with' | 'ends_with' | 'in' | 'not_in' | 'has' | 'not_has'; value: string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>; } interface UnionMember1 { clauses: Array<string | null | number | boolean | { [key: string]: unknown; } | Array<unknown>>; logical_operator: 'AND' | 'OR'; } } } } } } interface Rollout { /** * Percentage of matching traffic (0–100, up to 2 decimal places) served this * variation. For multi-way splits, use cumulative upper bounds across rules (e.g. * 30, 70, 100). */ percentage: number; /** * Context attribute used for sticky bucketing. Defaults to `targetingKey`. If * absent at evaluation time, bucketing is random per request. */ attribute?: string; } } } export interface FlagListParams extends CursorPaginationAfterParams { /** * Path param: Cloudflare account ID that owns the Flagship app. */ account_id: string; /** * Query param: Max items to return (1–200). */ limit?: number; } export interface FlagDeleteParams { /** * Cloudflare account ID that owns the Flagship app. */ account_id: string; /** * Flagship app ID returned when the app was created. */ app_id: string; } export interface FlagGetParams { /** * Cloudflare account ID that owns the Flagship app. */ account_id: string; /** * Flagship app ID returned when the app was created. */ app_id: string; } export declare namespace Flags { export { type FlagCreateResponse as FlagCreateResponse, type FlagUpdateResponse as FlagUpdateResponse, type FlagListResponse as FlagListResponse, type FlagDeleteResponse as FlagDeleteResponse, type FlagGetResponse as FlagGetResponse, type FlagListResponsesCursorPaginationAfter as FlagListResponsesCursorPaginationAfter, type FlagCreateParams as FlagCreateParams, type FlagUpdateParams as FlagUpdateParams, type FlagListParams as FlagListParams, type FlagDeleteParams as FlagDeleteParams, type FlagGetParams as FlagGetParams, }; export { Changelog as Changelog, BaseChangelog as BaseChangelog, type ChangelogListResponse as ChangelogListResponse, type ChangelogListResponsesCursorPaginationAfter as ChangelogListResponsesCursorPaginationAfter, type ChangelogListParams as ChangelogListParams, }; } //# sourceMappingURL=flags.d.mts.map