syntax = "proto3"; package state.v1; import "google/protobuf/timestamp.proto"; service MappingService { rpc InsertMapping(InsertMappingRequest) returns (InsertMappingResponse); rpc GetMapping(GetMappingRequest) returns (GetMappingResponse); rpc ListMappings(ListMappingsRequest) returns (ListMappingsResponse); rpc UpdateMapping(UpdateMappingRequest) returns (UpdateMappingResponse); rpc DeleteMapping(DeleteMappingRequest) returns (DeleteMappingResponse); // RecordMappingMatch counts one event a mapping resolved; the same // (mapping, capture) twice counts once. rpc RecordMappingMatch(RecordMappingMatchRequest) returns (RecordMappingMatchResponse); } // MappingField mirrors internal/domain/mapping.Field. message MappingField { string name = 1; string path = 2; string type = 3; bool required = 4; } // Mapping mirrors internal/domain/mapping.Mapping. message Mapping { string id = 1; string name = 2; string source_hint = 3; repeated MappingField fields = 4; google.protobuf.Timestamp created_at = 5; google.protobuf.Timestamp updated_at = 6; string event_type_id = 7; // match_count and last_matched_at are read-only: the store counts them. int64 match_count = 8; google.protobuf.Timestamp last_matched_at = 9; // workspace_id is its event type's workspace; read-only here. string workspace_id = 10; } message InsertMappingRequest { Mapping mapping = 1; } message InsertMappingResponse { string id = 1; } message GetMappingRequest { string id = 1; } message GetMappingResponse { Mapping mapping = 1; bool found = 2; } message ListMappingsRequest {} message ListMappingsResponse { repeated Mapping mappings = 1; } message UpdateMappingRequest { Mapping mapping = 1; } message UpdateMappingResponse {} message DeleteMappingRequest { string id = 1; } message DeleteMappingResponse {} message RecordMappingMatchRequest { string mapping_id = 1; string capture_id = 2; } message RecordMappingMatchResponse {}