UNPKG

unleash-server

Version:

Unleash is an enterprise ready feature toggles service. It provides different strategies for handling feature toggles.

102 lines 4.34 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.playgroundStrategySchema = exports.strategyEvaluationResults = exports.playgroundStrategyEvaluation = void 0; const parameters_schema_1 = require("./parameters-schema"); const playground_constraint_schema_1 = require("./playground-constraint-schema"); const playground_segment_schema_1 = require("./playground-segment-schema"); exports.playgroundStrategyEvaluation = { evaluationComplete: 'complete', evaluationIncomplete: 'incomplete', unknownResult: 'unknown', }; exports.strategyEvaluationResults = { anyOf: [ { type: 'object', additionalProperties: false, required: ['evaluationStatus', 'enabled'], properties: { evaluationStatus: { type: 'string', 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.", enum: [exports.playgroundStrategyEvaluation.evaluationIncomplete], }, enabled: { 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`.", anyOf: [ { type: 'boolean', enum: [false] }, { type: 'string', enum: [exports.playgroundStrategyEvaluation.unknownResult], }, ], }, }, }, { type: 'object', additionalProperties: false, required: ['evaluationStatus', 'enabled'], properties: { evaluationStatus: { description: 'Signals that this strategy was evaluated successfully.', type: 'string', enum: ['complete'], }, enabled: { type: 'boolean', description: 'Whether this strategy evaluates to true or not.', }, }, }, ], }; exports.playgroundStrategySchema = { $id: '#/components/schemas/playgroundStrategySchema', type: 'object', additionalProperties: false, required: ['id', 'name', 'result', 'segments', 'constraints', 'parameters'], properties: { name: { description: "The strategy's name.", type: 'string', }, id: { description: "The strategy's id.", type: 'string', }, result: { description: `The strategy's evaluation result. If the strategy is a custom strategy that Unleash can't evaluate, \`evaluationStatus\` will be \`${exports.playgroundStrategyEvaluation.unknownResult}\`. Otherwise, it will be \`true\` or \`false\``, ...exports.strategyEvaluationResults, }, segments: { type: 'array', description: "The strategy's segments and their evaluation results.", items: { $ref: playground_segment_schema_1.playgroundSegmentSchema.$id, }, }, constraints: { type: 'array', description: "The strategy's constraints and their evaluation results.", items: { $ref: playground_constraint_schema_1.playgroundConstraintSchema.$id, }, }, parameters: { description: "The strategy's constraints and their evaluation results.", example: { myParam1: 'param value', }, $ref: parameters_schema_1.parametersSchema.$id, }, }, components: { schemas: { playgroundConstraintSchema: playground_constraint_schema_1.playgroundConstraintSchema, playgroundSegmentSchema: playground_segment_schema_1.playgroundSegmentSchema, parametersSchema: parameters_schema_1.parametersSchema, }, }, }; //# sourceMappingURL=playground-strategy-schema.js.map