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.

saas.billing.feature.check

Check if organization has access to a feature.

  • Type: operation (query)
  • Version: 1.0.0
  • Stability: stable
  • Owners: @example.saas-boilerplate
  • Tags: saas, billing, feature
  • File: packages/examples/saas-boilerplate/src/billing/billing.operations.ts
  • field.key.label
    saas.billing.feature.check
    field.version.label
    1.0.0
    field.type.label
    operation (query)
    field.title.label
    saas.billing.feature.check
    field.description.label

    Check if organization has access to a feature.

  • Type: operation (query)
  • Version: 1.0.0
  • Stability: stable
  • Owners: @example.saas-boilerplate
  • Tags: saas, billing, feature
  • File: packages/examples/saas-boilerplate/src/billing/billing.operations.ts
  • field.tags.label
    saas,billing,feature
    field.owners.label
    @example.saas-boilerplate
    field.stability.label
    stable

    Check if organization has access to a feature.

    Goal

    Gate features based on plan/usage.

    Context

    Feature access checks, upgrade prompts.

    Source Definition

    import { defineCommand, defineQuery } from '@lssm-tech/lib.contracts-spec';
    import {
    	CheckFeatureAccessInputModel,
    	CheckFeatureAccessOutputModel,
    	GetUsageSummaryInputModel,
    	GetUsageSummaryOutputModel,
    	RecordUsageInputModel,
    	RecordUsageOutputModel,
    	SubscriptionModel,
    	UsageRecordedPayloadModel,
    } from './billing.schema';
    
    export const CheckFeatureAccessContract = defineQuery({
    	meta: {
    		key: 'saas.billing.feature.check',
    		version: '1.0.0',
    		stability: 'stable',
    		owners: ['@example.saas-boilerplate'],
    		tags: ['saas', 'billing', 'feature'],
    		description: 'Check if organization has access to a feature.',
    		goal: 'Gate features based on plan/usage.',
    		context: 'Feature access checks, upgrade prompts.',
    	},
    	io: {
    		input: CheckFeatureAccessInputModel,
    		output: CheckFeatureAccessOutputModel,
    	},
    	policy: {
    		auth: 'user',
    	},
    	acceptance: {
    		scenarios: [
    			{
    				key: 'check-access-granted',
    				given: ['Organization is on Pro plan'],
    				when: ['User checks access to Pro feature'],
    				then: ['Access is granted'],
    			},
    		],
    		examples: [
    			{
    				key: 'check-advanced-reports',
    				input: { feature: 'advanced_reports' },
    				output: { hasAccess: true, reason: 'Included in Pro plan' },
    			},
    		],
    	},
    });