export type SymbolRef = { namespace: string; name: string; version: string; hash?: string; }; export type FunctionRef = { packageNamespace: string; packageName: string; symbol: string; operation?: string; versionRef?: string; }; export type ConflictStrategy = | "replace" | "preserve_conflicts" | "crdt"; export type Cardinality = | "optional_one" | "exactly_one" | "many" | "many_unique" | "many_ordered" | "many_unique_ordered"; export type EdgeDirectionality = "directed" | "undirected"; export type EdgeMaterialization = { class: SymbolRef; connectProjection: string; }; export type FieldStorageKind = | "stored" | "derived" | "lazy" | "external" | "static_final"; export type FieldStorage = { kind: FieldStorageKind; resolver?: FunctionRef; cache: boolean; }; export type FieldOps = { implementation: "service"; service: string; }; export type TypeRef = { protoType: string; symbol?: SymbolRef; enumValues?: string[]; }; export type TypeBinding = { name: string; type: TypeRef; }; export type InterfaceFieldContract = { required: boolean; readable: boolean; writable: boolean; watchable: boolean; typeParam?: string; type?: TypeRef; }; export type InterfaceImplementation = { interface: SymbolRef; typeBindings: TypeBinding[]; }; export type FieldSchema = { name: string; tag: number; type: TypeRef; conflict: ConflictStrategy; repeated: boolean; optional: boolean; storage: FieldStorage; ops?: FieldOps; interfaceContract?: InterfaceFieldContract; isDisplayLabel: boolean; }; export type EdgeEndpointSchema = { class?: SymbolRef; interface?: SymbolRef; projection: string; cardinality: Cardinality; indexed: boolean; materialization?: EdgeMaterialization; }; export type EdgeSchema = { id: SymbolRef; directionality: EdgeDirectionality; sourceField: string; fromClass: SymbolRef; toClass: SymbolRef; cardinality: Cardinality; inverse?: string; fields: FieldSchema[]; fromEndpoint: EdgeEndpointSchema; toEndpoint: EdgeEndpointSchema; declaringClass: SymbolRef; tags: SymbolRef[]; implements: SymbolRef[]; }; export type MethodSchema = { name: string; function: FunctionRef; }; export type MigrationSpec = { fromVersion: number; toVersion: number; function: FunctionRef; }; export type ConstructorSpec = { function: FunctionRef; }; export type OperationSchema = { name: string; inputType: TypeRef; outputType: TypeRef; function: FunctionRef; }; export type OperationServiceSchema = { name: string; fullName: string; operations: OperationSchema[]; }; export type ClassSchema = { id: SymbolRef; version: number; fields: FieldSchema[]; edges: EdgeSchema[]; methods: MethodSchema[]; migrations: MigrationSpec[]; operationServices: OperationServiceSchema[]; implements: InterfaceImplementation[]; constructorSpec?: ConstructorSpec; sourceFile: string; protoMessage: string; }; export type InterfaceSchema = { id: SymbolRef; version: number; fields: FieldSchema[]; sourceFile: string; protoMessage: string; }; export type SchemaCompileResult = { sourceFile: string; classes: ClassSchema[]; interfaces: InterfaceSchema[]; };