mcp-decisive
Version:
MCP server for WRAP decision-making framework with structured output
123 lines • 3.56 kB
TypeScript
import { Result } from 'neverthrow';
/**
* Option Selection Term Model Implementation
*
* This demonstrates the Term Model pattern for Domain-Driven Design:
* - Domain vocabulary as executable code
* - Smart constructors with validation
* - Immutable value objects
* - Business rule enforcement
* - Type-safe domain modeling
*/
/**
* Term types in this domain:
* - value: Value objects and identifiers
* - policy: Business policies and rules
*/
/**
* 語彙「OptionId」
* domain type: value
*/
type OptionId = string & {
readonly _brand: 'OptionId';
};
declare const OptionId: {
readonly generate: () => OptionId;
readonly fromString: (value: string) => Result<OptionId, ValidationError[]>;
readonly toString: (id: OptionId) => string;
};
/**
* 語彙「OptionText」
* domain type: value
*
* 選択肢の文字列(30文字まで)
*/
type OptionText = string & {
readonly _brand: 'OptionText';
};
declare const OptionText: {
readonly create: (value: string) => Result<OptionText, ValidationError[]>;
readonly toString: (text: OptionText) => string;
};
/**
* 語彙「Option」
* domain type: value
*/
type Option = {
readonly id: OptionId;
readonly text: OptionText;
readonly supplementaryInfo?: string;
};
type RequestedOption = {
text: string;
supplementaryInfo?: string;
};
/**
* 語彙「OptionList」
* domain type: policy
*
* Business rule: 選択肢は3〜5個である
*/
type OptionList = {
readonly options: readonly Option[];
} & {
readonly _brand: 'OptionList';
};
type RequestedOptionList = {
options: readonly RequestedOption[];
};
type ValidationError = {
readonly type: 'required' | 'too_short' | 'too_long' | 'invalid_format' | 'invalid_count';
readonly field: string;
readonly message: string;
};
type OptionError = {
readonly type: 'InvalidTitle' | 'InvalidDescription' | 'InvalidId' | 'OptionCreationFailed';
readonly message: string;
};
type OptionListError = {
readonly type: 'InvalidOptionCount' | 'OptionCreationFailed';
readonly message: string;
};
type ConstructOption = (params: RequestedOption) => Result<Option, OptionError[]>;
type ConstructOptionList = (params: RequestedOptionList) => Result<OptionList, OptionListError[]>;
declare const ValidationError: {
readonly create: (type: ValidationError["type"], field: string, message: string) => ValidationError;
};
declare const OptionError: {
readonly create: (type: OptionError["type"], message: string) => OptionError;
};
declare const OptionListError: {
readonly create: (type: OptionListError["type"], message: string) => OptionListError;
};
/**
* Option Term Model
*/
export declare const OptionModel: {
readonly create: ConstructOption;
};
/**
* OptionList Term Model
*/
export declare const OptionListModel: {
readonly create: ConstructOptionList;
};
/**
* Value Object Constructors
*/
export declare const Values: {
readonly OptionId: {
readonly generate: () => OptionId;
readonly fromString: (value: string) => Result<OptionId, ValidationError[]>;
readonly toString: (id: OptionId) => string;
};
readonly OptionText: {
readonly create: (value: string) => Result<OptionText, ValidationError[]>;
readonly toString: (text: OptionText) => string;
};
};
/**
* Type Exports for External Use
*/
export type { Option, RequestedOption, OptionList, RequestedOptionList, OptionId, OptionText, ValidationError, OptionError, OptionListError };
//# sourceMappingURL=option.d.ts.map