unleash-server
Version:
Unleash is an enterprise ready feature toggles service. It provides different strategies for handling feature toggles.
530 lines (529 loc) • 32.9 kB
TypeScript
import { FromSchema } from 'json-schema-to-ts';
export declare const unknownFeatureEvaluationResult: "unevaluated";
export declare const playgroundFeatureSchema: {
readonly $id: "#/components/schemas/playgroundFeatureSchema";
readonly description: "A simplified feature toggle model intended for the Unleash playground.";
readonly type: "object";
readonly additionalProperties: false;
readonly required: readonly ["name", "projectId", "isEnabled", "isEnabledInCurrentEnvironment", "variant", "variants", "strategies"];
readonly properties: {
readonly name: {
readonly type: "string";
readonly example: "my-feature";
readonly description: "The feature's name.";
};
readonly projectId: {
readonly type: "string";
readonly example: "my-project";
readonly description: "The ID of the project that contains this feature.";
};
readonly strategies: {
readonly type: "object";
readonly additionalProperties: false;
readonly required: readonly ["result", "data"];
readonly properties: {
readonly result: {
readonly description: "The cumulative results of all the feature's strategies. Can be `true`,\n `false`, or `unknown`.\n This property will only be `unknown`\n if one or more of the strategies can't be fully evaluated and the rest of the strategies\n all resolve to `false`.";
readonly anyOf: readonly [{
readonly type: "boolean";
}, {
readonly type: "string";
readonly enum: readonly ["unknown"];
}];
};
readonly data: {
readonly description: "The strategies that apply to this feature.";
readonly type: "array";
readonly items: {
readonly $ref: "#/components/schemas/playgroundStrategySchema";
};
};
};
};
readonly isEnabledInCurrentEnvironment: {
readonly type: "boolean";
readonly description: "Whether the feature is active and would be evaluated in the provided environment in a normal SDK context.";
};
readonly isEnabled: {
readonly description: "Whether this feature is enabled or not in the current environment.\n If a feature can't be fully evaluated (that is, `strategies.result` is `unknown`),\n this will be `false` to align with how client SDKs treat unresolved feature states.";
readonly type: "boolean";
readonly example: true;
};
readonly variant: {
readonly description: "The feature variant you receive based on the provided context or the _disabled\n variant_. If a feature is disabled or doesn't have any\n variants, you would get the _disabled variant_.\n Otherwise, you'll get one of thefeature's defined variants.";
readonly type: "object";
readonly additionalProperties: false;
readonly required: readonly ["name", "enabled"];
readonly properties: {
readonly name: {
readonly type: "string";
readonly description: "The variant's name. If there is no variant or if the toggle is disabled, this will be `disabled`";
readonly example: "red-variant";
};
readonly enabled: {
readonly type: "boolean";
readonly description: "Whether the variant is enabled or not. If the feature is disabled or if it doesn't have variants, this property will be `false`";
};
readonly payload: {
readonly type: "object";
readonly additionalProperties: false;
readonly required: readonly ["type", "value"];
readonly description: "An optional payload attached to the variant.";
readonly properties: {
readonly type: {
readonly description: "The format of the payload.";
readonly type: "string";
readonly enum: readonly ["json", "csv", "string"];
};
readonly value: {
readonly type: "string";
readonly description: "The payload value stringified.";
readonly example: "{\"property\": \"value\"}";
};
};
};
};
readonly nullable: true;
readonly example: {
readonly name: "green";
readonly enabled: true;
};
};
readonly variants: {
readonly type: "array";
readonly items: {
readonly $ref: "#/components/schemas/variantSchema";
};
};
};
readonly components: {
readonly schemas: {
readonly playgroundStrategySchema: {
readonly $id: "#/components/schemas/playgroundStrategySchema";
readonly type: "object";
readonly additionalProperties: false;
readonly required: readonly ["id", "name", "result", "segments", "constraints", "parameters"];
readonly properties: {
readonly name: {
readonly description: "The strategy's name.";
readonly type: "string";
};
readonly id: {
readonly description: "The strategy's id.";
readonly type: "string";
};
readonly result: {
readonly anyOf: readonly [{
readonly type: "object";
readonly additionalProperties: false;
readonly required: readonly ["evaluationStatus", "enabled"];
readonly properties: {
readonly evaluationStatus: {
readonly type: "string";
readonly description: "Signals that this strategy could not be evaluated. This is most likely because you're using a custom strategy that Unleash doesn't know about.";
readonly enum: readonly ["incomplete"];
};
readonly enabled: {
readonly description: "Whether this strategy resolves to `false` or if it might resolve to `true`. Because Unleash can't evaluate the strategy, it can't say for certain whether it will be `true`, but if you have failing constraints or segments, it _can_ determine that your strategy would be `false`.";
readonly anyOf: readonly [{
readonly type: "boolean";
readonly enum: readonly [false];
}, {
readonly type: "string";
readonly enum: readonly ["unknown"];
}];
};
};
}, {
readonly type: "object";
readonly additionalProperties: false;
readonly required: readonly ["evaluationStatus", "enabled"];
readonly properties: {
readonly evaluationStatus: {
readonly description: "Signals that this strategy was evaluated successfully.";
readonly type: "string";
readonly enum: readonly ["complete"];
};
readonly enabled: {
readonly type: "boolean";
readonly description: "Whether this strategy evaluates to true or not.";
};
};
}];
readonly description: "The strategy's evaluation result. If the strategy is a custom strategy that Unleash can't evaluate, `evaluationStatus` will be `unknown`. Otherwise, it will be `true` or `false`";
};
readonly segments: {
readonly type: "array";
readonly description: "The strategy's segments and their evaluation results.";
readonly items: {
readonly $ref: "#/components/schemas/playgroundSegmentSchema";
};
};
readonly constraints: {
readonly type: "array";
readonly description: "The strategy's constraints and their evaluation results.";
readonly items: {
readonly $ref: "#/components/schemas/playgroundConstraintSchema";
};
};
readonly parameters: {
readonly description: "The strategy's constraints and their evaluation results.";
readonly example: {
readonly myParam1: "param value";
};
readonly $ref: "#/components/schemas/parametersSchema";
};
};
readonly components: {
readonly schemas: {
readonly playgroundConstraintSchema: {
readonly required: readonly ["contextName", "operator", "result"];
readonly properties: {
readonly result: {
readonly description: "Whether this was evaluated as true or false.";
readonly type: "boolean";
};
readonly contextName: {
readonly description: "The name of the context field that this constraint should apply to.";
readonly example: "appName";
readonly type: "string";
};
readonly operator: {
readonly description: "The operator to use when evaluating this constraint. For more information about the various operators, refer to [the strategy constraint operator documentation](https://docs.getunleash.io/reference/strategy-constraints#strategy-constraint-operators).";
readonly type: "string";
readonly enum: readonly ["NOT_IN", "IN", "STR_ENDS_WITH", "STR_STARTS_WITH", "STR_CONTAINS", "NUM_EQ", "NUM_GT", "NUM_GTE", "NUM_LT", "NUM_LTE", "DATE_AFTER", "DATE_BEFORE", "SEMVER_EQ", "SEMVER_GT", "SEMVER_LT"];
};
readonly caseInsensitive: {
readonly description: "Whether the operator should be case sensitive or not. Defaults to `false` (being case sensitive).";
readonly type: "boolean";
readonly default: false;
};
readonly inverted: {
readonly description: "Whether the result should be negated or not. If `true`, will turn a `true` result into a `false` result and vice versa.";
readonly type: "boolean";
readonly default: false;
};
readonly values: {
readonly type: "array";
readonly description: "The context values that should be used for constraint evaluation. Use this property instead of `value` for properties that accept multiple values.";
readonly items: {
readonly type: "string";
};
};
readonly value: {
readonly description: "The context value that should be used for constraint evaluation. Use this property instead of `values` for properties that only accept single values.";
readonly type: "string";
};
};
readonly type: "object";
readonly description: "A strategy constraint. For more information, refer to [the strategy constraint reference documentation](https://docs.getunleash.io/reference/strategy-constraints)";
readonly components: {};
readonly $id: "#/components/schemas/playgroundConstraintSchema";
readonly additionalProperties: false;
};
readonly playgroundSegmentSchema: {
readonly $id: "#/components/schemas/playgroundSegmentSchema";
readonly type: "object";
readonly additionalProperties: false;
readonly required: readonly ["name", "id", "constraints", "result"];
readonly properties: {
readonly id: {
readonly description: "The segment's id.";
readonly type: "integer";
};
readonly name: {
readonly description: "The name of the segment.";
readonly example: "segment A";
readonly type: "string";
};
readonly result: {
readonly description: "Whether this was evaluated as true or false.";
readonly type: "boolean";
};
readonly constraints: {
readonly type: "array";
readonly description: "The list of constraints in this segment.";
readonly items: {
readonly $ref: "#/components/schemas/playgroundConstraintSchema";
};
};
};
readonly components: {
readonly schemas: {
readonly playgroundConstraintSchema: {
readonly required: readonly ["contextName", "operator", "result"];
readonly properties: {
readonly result: {
readonly description: "Whether this was evaluated as true or false.";
readonly type: "boolean";
};
readonly contextName: {
readonly description: "The name of the context field that this constraint should apply to.";
readonly example: "appName";
readonly type: "string";
};
readonly operator: {
readonly description: "The operator to use when evaluating this constraint. For more information about the various operators, refer to [the strategy constraint operator documentation](https://docs.getunleash.io/reference/strategy-constraints#strategy-constraint-operators).";
readonly type: "string";
readonly enum: readonly ["NOT_IN", "IN", "STR_ENDS_WITH", "STR_STARTS_WITH", "STR_CONTAINS", "NUM_EQ", "NUM_GT", "NUM_GTE", "NUM_LT", "NUM_LTE", "DATE_AFTER", "DATE_BEFORE", "SEMVER_EQ", "SEMVER_GT", "SEMVER_LT"];
};
readonly caseInsensitive: {
readonly description: "Whether the operator should be case sensitive or not. Defaults to `false` (being case sensitive).";
readonly type: "boolean";
readonly default: false;
};
readonly inverted: {
readonly description: "Whether the result should be negated or not. If `true`, will turn a `true` result into a `false` result and vice versa.";
readonly type: "boolean";
readonly default: false;
};
readonly values: {
readonly type: "array";
readonly description: "The context values that should be used for constraint evaluation. Use this property instead of `value` for properties that accept multiple values.";
readonly items: {
readonly type: "string";
};
};
readonly value: {
readonly description: "The context value that should be used for constraint evaluation. Use this property instead of `values` for properties that only accept single values.";
readonly type: "string";
};
};
readonly type: "object";
readonly description: "A strategy constraint. For more information, refer to [the strategy constraint reference documentation](https://docs.getunleash.io/reference/strategy-constraints)";
readonly components: {};
readonly $id: "#/components/schemas/playgroundConstraintSchema";
readonly additionalProperties: false;
};
};
};
};
readonly parametersSchema: {
readonly $id: "#/components/schemas/parametersSchema";
readonly type: "object";
readonly additionalProperties: {
readonly type: "string";
};
readonly components: {};
};
};
};
};
readonly playgroundConstraintSchema: {
readonly required: readonly ["contextName", "operator", "result"];
readonly properties: {
readonly result: {
readonly description: "Whether this was evaluated as true or false.";
readonly type: "boolean";
};
readonly contextName: {
readonly description: "The name of the context field that this constraint should apply to.";
readonly example: "appName";
readonly type: "string";
};
readonly operator: {
readonly description: "The operator to use when evaluating this constraint. For more information about the various operators, refer to [the strategy constraint operator documentation](https://docs.getunleash.io/reference/strategy-constraints#strategy-constraint-operators).";
readonly type: "string";
readonly enum: readonly ["NOT_IN", "IN", "STR_ENDS_WITH", "STR_STARTS_WITH", "STR_CONTAINS", "NUM_EQ", "NUM_GT", "NUM_GTE", "NUM_LT", "NUM_LTE", "DATE_AFTER", "DATE_BEFORE", "SEMVER_EQ", "SEMVER_GT", "SEMVER_LT"];
};
readonly caseInsensitive: {
readonly description: "Whether the operator should be case sensitive or not. Defaults to `false` (being case sensitive).";
readonly type: "boolean";
readonly default: false;
};
readonly inverted: {
readonly description: "Whether the result should be negated or not. If `true`, will turn a `true` result into a `false` result and vice versa.";
readonly type: "boolean";
readonly default: false;
};
readonly values: {
readonly type: "array";
readonly description: "The context values that should be used for constraint evaluation. Use this property instead of `value` for properties that accept multiple values.";
readonly items: {
readonly type: "string";
};
};
readonly value: {
readonly description: "The context value that should be used for constraint evaluation. Use this property instead of `values` for properties that only accept single values.";
readonly type: "string";
};
};
readonly type: "object";
readonly description: "A strategy constraint. For more information, refer to [the strategy constraint reference documentation](https://docs.getunleash.io/reference/strategy-constraints)";
readonly components: {};
readonly $id: "#/components/schemas/playgroundConstraintSchema";
readonly additionalProperties: false;
};
readonly playgroundSegmentSchema: {
readonly $id: "#/components/schemas/playgroundSegmentSchema";
readonly type: "object";
readonly additionalProperties: false;
readonly required: readonly ["name", "id", "constraints", "result"];
readonly properties: {
readonly id: {
readonly description: "The segment's id.";
readonly type: "integer";
};
readonly name: {
readonly description: "The name of the segment.";
readonly example: "segment A";
readonly type: "string";
};
readonly result: {
readonly description: "Whether this was evaluated as true or false.";
readonly type: "boolean";
};
readonly constraints: {
readonly type: "array";
readonly description: "The list of constraints in this segment.";
readonly items: {
readonly $ref: "#/components/schemas/playgroundConstraintSchema";
};
};
};
readonly components: {
readonly schemas: {
readonly playgroundConstraintSchema: {
readonly required: readonly ["contextName", "operator", "result"];
readonly properties: {
readonly result: {
readonly description: "Whether this was evaluated as true or false.";
readonly type: "boolean";
};
readonly contextName: {
readonly description: "The name of the context field that this constraint should apply to.";
readonly example: "appName";
readonly type: "string";
};
readonly operator: {
readonly description: "The operator to use when evaluating this constraint. For more information about the various operators, refer to [the strategy constraint operator documentation](https://docs.getunleash.io/reference/strategy-constraints#strategy-constraint-operators).";
readonly type: "string";
readonly enum: readonly ["NOT_IN", "IN", "STR_ENDS_WITH", "STR_STARTS_WITH", "STR_CONTAINS", "NUM_EQ", "NUM_GT", "NUM_GTE", "NUM_LT", "NUM_LTE", "DATE_AFTER", "DATE_BEFORE", "SEMVER_EQ", "SEMVER_GT", "SEMVER_LT"];
};
readonly caseInsensitive: {
readonly description: "Whether the operator should be case sensitive or not. Defaults to `false` (being case sensitive).";
readonly type: "boolean";
readonly default: false;
};
readonly inverted: {
readonly description: "Whether the result should be negated or not. If `true`, will turn a `true` result into a `false` result and vice versa.";
readonly type: "boolean";
readonly default: false;
};
readonly values: {
readonly type: "array";
readonly description: "The context values that should be used for constraint evaluation. Use this property instead of `value` for properties that accept multiple values.";
readonly items: {
readonly type: "string";
};
};
readonly value: {
readonly description: "The context value that should be used for constraint evaluation. Use this property instead of `values` for properties that only accept single values.";
readonly type: "string";
};
};
readonly type: "object";
readonly description: "A strategy constraint. For more information, refer to [the strategy constraint reference documentation](https://docs.getunleash.io/reference/strategy-constraints)";
readonly components: {};
readonly $id: "#/components/schemas/playgroundConstraintSchema";
readonly additionalProperties: false;
};
};
};
};
readonly parametersSchema: {
readonly $id: "#/components/schemas/parametersSchema";
readonly type: "object";
readonly additionalProperties: {
readonly type: "string";
};
readonly components: {};
};
readonly variantSchema: {
readonly $id: "#/components/schemas/variantSchema";
readonly type: "object";
readonly additionalProperties: false;
readonly required: readonly ["name", "weight"];
readonly properties: {
readonly name: {
readonly type: "string";
};
readonly weight: {
readonly type: "number";
};
readonly weightType: {
readonly type: "string";
};
readonly stickiness: {
readonly type: "string";
};
readonly payload: {
readonly type: "object";
readonly required: readonly ["type", "value"];
readonly properties: {
readonly type: {
readonly type: "string";
};
readonly value: {
readonly type: "string";
};
};
};
readonly overrides: {
readonly type: "array";
readonly items: {
readonly $ref: "#/components/schemas/overrideSchema";
};
};
};
readonly components: {
readonly schemas: {
readonly overrideSchema: {
readonly $id: "#/components/schemas/overrideSchema";
readonly type: "object";
readonly additionalProperties: false;
readonly required: readonly ["contextName", "values"];
readonly properties: {
readonly contextName: {
readonly type: "string";
};
readonly values: {
readonly type: "array";
readonly items: {
readonly type: "string";
};
};
};
readonly components: {};
};
};
};
};
readonly overrideSchema: {
readonly $id: "#/components/schemas/overrideSchema";
readonly type: "object";
readonly additionalProperties: false;
readonly required: readonly ["contextName", "values"];
readonly properties: {
readonly contextName: {
readonly type: "string";
};
readonly values: {
readonly type: "array";
readonly items: {
readonly type: "string";
};
};
};
readonly components: {};
};
};
readonly variants: {
readonly type: "array";
readonly items: {
readonly $ref: "#/components/schemas/variantSchema";
};
};
};
};
export declare type PlaygroundFeatureSchema = FromSchema<typeof playgroundFeatureSchema>;