228 lines
5.8 KiB
Protocol Buffer
228 lines
5.8 KiB
Protocol Buffer
syntax = "proto3";
|
|
package komp_ac.document_data;
|
|
|
|
service DocumentDataService {
|
|
rpc RegisterDocumentTemplate(RegisterDocumentTemplateRequest) returns (RegisterDocumentTemplateResponse);
|
|
rpc ListDocumentTemplates(ListDocumentTemplatesRequest) returns (ListDocumentTemplatesResponse);
|
|
rpc ListEnabledDocumentTemplates(ListEnabledDocumentTemplatesRequest) returns (ListDocumentTemplatesResponse);
|
|
rpc SaveDocument(SaveDocumentRequest) returns (SaveDocumentResponse);
|
|
rpc UpdateDocument(UpdateDocumentRequest) returns (UpdateDocumentResponse);
|
|
rpc RenderTextDocument(RenderTextDocumentRequest) returns (RenderTextDocumentResponse);
|
|
rpc FinalizeDocument(FinalizeDocumentRequest) returns (FinalizeDocumentResponse);
|
|
rpc GetArchivedDocument(GetArchivedDocumentRequest) returns (GetArchivedDocumentResponse);
|
|
rpc GetDocuments(GetDocumentsRequest) returns (GetDocumentsResponse);
|
|
rpc GetDocument(GetDocumentRequest) returns (GetDocumentResponse);
|
|
rpc GetDocumentVersion(GetDocumentVersionRequest) returns (GetDocumentVersionResponse);
|
|
rpc GetDocumentTemplateVersion(GetDocumentTemplateVersionRequest) returns (GetDocumentTemplateVersionResponse);
|
|
}
|
|
|
|
enum DocumentFormat {
|
|
DOCUMENT_FORMAT_UNSPECIFIED = 0;
|
|
DOCUMENT_FORMAT_TYPST = 1;
|
|
DOCUMENT_FORMAT_PLAIN_TEXT = 2;
|
|
}
|
|
|
|
enum DocumentState {
|
|
DOCUMENT_STATE_UNSPECIFIED = 0;
|
|
DOCUMENT_STATE_DRAFT = 1;
|
|
DOCUMENT_STATE_FINALIZED = 2;
|
|
}
|
|
|
|
message SourceRecord {
|
|
string profile_name = 1;
|
|
string table_name = 2;
|
|
int64 table_def_id = 3;
|
|
int64 record_id = 4;
|
|
}
|
|
|
|
message SaveDocumentRequest {
|
|
repeated SourceRecord source_records = 1;
|
|
string template_name = 2;
|
|
string data_json = 3;
|
|
int64 expected_template_version_id = 4;
|
|
string profile_name = 5;
|
|
}
|
|
|
|
message RegisterDocumentTemplateRequest {
|
|
string template_name = 1;
|
|
string input_table_name = 2;
|
|
string template_source = 3;
|
|
string renderer_version = 4;
|
|
DocumentFormat format = 5;
|
|
}
|
|
|
|
message RegisterDocumentTemplateResponse {
|
|
DocumentTemplateVersion template_version = 1;
|
|
}
|
|
|
|
message ListDocumentTemplatesRequest {
|
|
string search = 1;
|
|
uint32 limit = 2;
|
|
DocumentFormat format = 3;
|
|
}
|
|
|
|
message ListDocumentTemplatesResponse {
|
|
repeated DocumentTemplateVersion templates = 1;
|
|
}
|
|
|
|
message ListEnabledDocumentTemplatesRequest {
|
|
string profile_name = 1;
|
|
}
|
|
|
|
message SaveDocumentResponse {
|
|
int64 document_id = 1;
|
|
int64 snapshot_id = 2;
|
|
int32 version_number = 3;
|
|
int64 template_version_id = 4;
|
|
int32 template_version = 5;
|
|
}
|
|
|
|
message UpdateDocumentRequest {
|
|
int64 document_id = 1;
|
|
string data_json = 2;
|
|
string profile_name = 3;
|
|
int32 expected_version_number = 4;
|
|
}
|
|
|
|
message UpdateDocumentResponse {
|
|
int64 document_id = 1;
|
|
int64 snapshot_id = 2;
|
|
int32 version_number = 3;
|
|
}
|
|
|
|
message GetDocumentsRequest {
|
|
optional int64 schema_id = 1;
|
|
uint32 limit = 2;
|
|
optional string template_name = 3;
|
|
optional string source_profile_name = 4;
|
|
optional string source_table_name = 5;
|
|
string profile_name = 6;
|
|
}
|
|
|
|
enum DocumentDataChangeKind {
|
|
DOCUMENT_DATA_CHANGE_KIND_UNSPECIFIED = 0;
|
|
DOCUMENT_DATA_CHANGE_KIND_GENERATED = 1;
|
|
DOCUMENT_DATA_CHANGE_KIND_USER_ADJUSTMENT = 2;
|
|
}
|
|
|
|
message Document {
|
|
int64 snapshot_id = 1;
|
|
int64 document_id = 2;
|
|
int64 schema_id = 3;
|
|
repeated SourceRecord source_records = 4;
|
|
string data_json = 5;
|
|
DocumentDataChangeKind change_kind = 6;
|
|
int32 version_number = 7;
|
|
string created_at = 8;
|
|
string updated_at = 9;
|
|
int64 template_version_id = 10;
|
|
string data_sha256 = 11;
|
|
string profile_name = 12;
|
|
DocumentState state = 13;
|
|
optional int64 archive_id = 14;
|
|
}
|
|
|
|
message GetDocumentsResponse {
|
|
repeated Document documents = 1;
|
|
}
|
|
|
|
message GetDocumentRequest {
|
|
int64 document_id = 1;
|
|
string profile_name = 2;
|
|
}
|
|
|
|
message GetDocumentResponse {
|
|
optional Document document = 1;
|
|
}
|
|
|
|
message GetDocumentVersionRequest {
|
|
int64 document_id = 1;
|
|
int32 version_number = 2;
|
|
string profile_name = 3;
|
|
}
|
|
|
|
message GetDocumentVersionResponse {
|
|
optional Document document = 1;
|
|
}
|
|
|
|
message GetDocumentTemplateVersionRequest {
|
|
int64 template_version_id = 1;
|
|
int64 document_id = 2;
|
|
string profile_name = 3;
|
|
}
|
|
|
|
message DocumentTemplateVersion {
|
|
int64 id = 1;
|
|
int64 template_id = 2;
|
|
string template_name = 3;
|
|
int32 version = 4;
|
|
string source_code = 5;
|
|
string source_sha256 = 6;
|
|
string renderer_version = 7;
|
|
string created_at = 8;
|
|
string input_table_name = 9;
|
|
repeated string field_paths = 10;
|
|
repeated DocumentTemplateFieldBinding field_bindings = 11;
|
|
DocumentFormat format = 12;
|
|
}
|
|
|
|
// One profile-specific source mapping for an enabled template version.
|
|
message DocumentTemplateFieldBinding {
|
|
string field_path = 1;
|
|
string collection_path = 2;
|
|
string column_name = 3;
|
|
string source_table_name = 4;
|
|
string source_column_name = 5;
|
|
string source_profile_name = 6;
|
|
}
|
|
|
|
message GetDocumentTemplateVersionResponse {
|
|
optional DocumentTemplateVersion template_version = 1;
|
|
}
|
|
|
|
message RenderTextDocumentRequest {
|
|
string profile_name = 1;
|
|
int64 document_id = 2;
|
|
int32 expected_version_number = 3;
|
|
}
|
|
|
|
message RenderTextDocumentResponse {
|
|
string text = 1;
|
|
string renderer_version = 2;
|
|
string data_sha256 = 3;
|
|
}
|
|
|
|
message FinalizeDocumentRequest {
|
|
string profile_name = 1;
|
|
int64 document_id = 2;
|
|
int32 expected_version_number = 3;
|
|
// Typst output is compiled by the caller with the pinned template and data.
|
|
// Plain-text output is rendered by the server; these fields must be empty.
|
|
bytes rendered_output = 4;
|
|
string renderer_version = 5;
|
|
}
|
|
|
|
message FinalizeDocumentResponse {
|
|
int64 archive_id = 1;
|
|
string output_sha256 = 2;
|
|
}
|
|
|
|
message GetArchivedDocumentRequest {
|
|
string profile_name = 1;
|
|
int64 archive_id = 2;
|
|
}
|
|
|
|
message ArchivedDocument {
|
|
int64 id = 1;
|
|
Document document = 2;
|
|
DocumentTemplateVersion template_version = 3;
|
|
DocumentFormat format = 4;
|
|
bytes output = 5;
|
|
string output_sha256 = 6;
|
|
string finalized_at = 7;
|
|
}
|
|
|
|
message GetArchivedDocumentResponse {
|
|
optional ArchivedDocument document = 1;
|
|
}
|