OSS-first docs

These docs teach the open system first: contracts, generated surfaces, runtimes, governance, and incremental adoption. Studio shows up as the operating layer on top, not as the source of truth.

flag.rule.create

Create a targeting rule for a flag.

  • Type: operation (command)
  • Version: 1.0.0
  • Stability: stable
  • Owners: platform.feature-flags
  • Tags: feature-flags, rule, create
  • File: packages/libs/feature-flags/src/contracts/index.ts
  • field.key.label
    flag.rule.create
    field.version.label
    1.0.0
    field.type.label
    operation (command)
    field.title.label
    flag.rule.create
    field.description.label

    Create a targeting rule for a flag.

  • Type: operation (command)
  • Version: 1.0.0
  • Stability: stable
  • Owners: platform.feature-flags
  • Tags: feature-flags, rule, create
  • File: packages/libs/feature-flags/src/contracts/index.ts
  • field.tags.label
    feature-flags,rule,create
    field.owners.label
    platform.feature-flags
    field.stability.label
    stable

    Create a targeting rule for a flag.

    Goal

    Add conditional targeting to a flag.

    Context

    Called when setting up targeting.

    Source Definition

    import { defineCommand, defineQuery } from '@lssm-tech/lib.contracts-spec';
    import { defineSchemaModel, ScalarTypeEnum } from '@lssm-tech/lib.schema';
    
    export const CreateRuleContract = defineCommand({
    	meta: {
    		key: 'flag.rule.create',
    		version: '1.0.0',
    		stability: 'stable',
    		owners: ['platform.feature-flags'],
    		tags: ['feature-flags', 'rule', 'create'],
    		description: 'Create a targeting rule for a flag.',
    		goal: 'Add conditional targeting to a flag.',
    		context: 'Called when setting up targeting.',
    	},
    	io: {
    		input: CreateRuleInput,
    		output: TargetingRuleModel,
    		errors: {
    			FLAG_NOT_FOUND: {
    				description: 'Flag does not exist',
    				http: 404,
    				gqlCode: 'FLAG_NOT_FOUND',
    				when: 'Flag ID is invalid',
    			},
    			INVALID_OPERATOR: {
    				description: 'Invalid operator',
    				http: 400,
    				gqlCode: 'INVALID_OPERATOR',
    				when: 'Operator is not supported',
    			},
    		},
    	},
    	policy: {
    		auth: 'admin',
    	},
    });