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.
Create a usage threshold.
Goal
Set up usage limits and alerts.
Context
Called when configuring limits.
Source Definition
import { defineCommand, defineQuery } from '@lssm-tech/lib.contracts-spec';
import { defineSchemaModel, ScalarTypeEnum } from '@lssm-tech/lib.schema';
export const CreateThresholdContract = defineCommand({
meta: {
key: 'threshold.create',
version: '1.0.0',
stability: 'stable',
owners: ['platform.metering'],
tags: ['metering', 'threshold', 'create'],
description: 'Create a usage threshold.',
goal: 'Set up usage limits and alerts.',
context: 'Called when configuring limits.',
},
io: {
input: CreateThresholdInput,
output: UsageThresholdModel,
errors: {
METRIC_NOT_FOUND: {
description: 'Metric does not exist',
http: 404,
gqlCode: 'METRIC_NOT_FOUND',
when: 'Metric key is invalid',
},
},
},
policy: {
auth: 'admin',
},
});