mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 13:57:10 +09:00
Middleware 0.12.2 (#612)
This commit is contained in:
parent
3be0e45e31
commit
2b6c47f9e3
9 changed files with 460 additions and 22 deletions
|
@ -15,6 +15,10 @@
|
|||
* Drag-and-drop area issues on home dashboard (#570)
|
||||
* Should not navigate to congratulation screen (designed for sign-up flow) after sign-in (#606)
|
||||
|
||||
### Middleware ⚙
|
||||
|
||||
* Updated middleware protocol to `0.12.2` (#454)
|
||||
|
||||
## Version 0.0.40
|
||||
|
||||
### New features 🚀
|
||||
|
|
|
@ -597,6 +597,5 @@ fun PageInfoEntity.toDomain(): PageInfo = PageInfo(
|
|||
id = id,
|
||||
fields = Block.Fields(fields.map),
|
||||
snippet = snippet,
|
||||
hasInboundLinks = hasInboundLinks,
|
||||
lastOpened = lastOpened
|
||||
hasInboundLinks = hasInboundLinks
|
||||
)
|
|
@ -4,7 +4,6 @@ data class PageInfoEntity(
|
|||
val id: String,
|
||||
val fields: BlockEntity.Fields,
|
||||
val snippet: String?,
|
||||
val lastOpened: Long,
|
||||
val hasInboundLinks: Boolean
|
||||
)
|
||||
|
||||
|
|
|
@ -6,14 +6,12 @@ import com.agileburo.anytype.domain.block.model.Block
|
|||
* @property id page id
|
||||
* @property fields page fields
|
||||
* @property snippet text from first child block of the page
|
||||
* @property lastOpened last time opened
|
||||
* @property hasInboundLinks does this page has inbound pages
|
||||
*/
|
||||
data class PageInfo(
|
||||
val id: String,
|
||||
val fields: Block.Fields,
|
||||
val snippet: String?,
|
||||
val lastOpened: Long,
|
||||
val hasInboundLinks: Boolean
|
||||
)
|
||||
|
||||
|
|
|
@ -311,7 +311,6 @@ fun BlockEntity.Align.toMiddleware(): Block.Align = when (this) {
|
|||
fun Localstore.PageInfo.toEntity(): PageInfoEntity = PageInfoEntity(
|
||||
id = id,
|
||||
fields = details.fields(),
|
||||
lastOpened = lastOpened,
|
||||
hasInboundLinks = hasInboundLinks,
|
||||
snippet = snippet
|
||||
)
|
||||
|
|
|
@ -205,6 +205,7 @@ message Rpc {
|
|||
}
|
||||
}
|
||||
|
||||
// commands acceptable only for text blocks, others will be ignored
|
||||
message Text {
|
||||
message Style {
|
||||
message Request {
|
||||
|
@ -237,6 +238,30 @@ message Rpc {
|
|||
string color = 3;
|
||||
}
|
||||
|
||||
message Response {
|
||||
Error error = 1;
|
||||
ResponseEvent event = 2;
|
||||
|
||||
message Error {
|
||||
Code code = 1;
|
||||
string description = 2;
|
||||
|
||||
enum Code {
|
||||
NULL = 0;
|
||||
UNKNOWN_ERROR = 1;
|
||||
BAD_INPUT = 2;
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
message Mark {
|
||||
message Request {
|
||||
string contextId = 1;
|
||||
repeated string blockIds = 2;
|
||||
anytype.model.Block.Content.Text.Mark mark = 3;
|
||||
}
|
||||
|
||||
message Response {
|
||||
Error error = 1;
|
||||
ResponseEvent event = 2;
|
||||
|
@ -469,7 +494,6 @@ message Rpc {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
message Copy {
|
||||
message Request {
|
||||
string contextId = 1;
|
||||
|
@ -1016,8 +1040,65 @@ message Rpc {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
message Dataview {
|
||||
message View {
|
||||
message Request {
|
||||
string contextId = 1;
|
||||
string blockId = 2; // id of dataview block to update
|
||||
string viewId = 3; // id of view to update
|
||||
anytype.model.Block.Content.Dataview.View view = 4;
|
||||
}
|
||||
|
||||
message Response {
|
||||
Error error = 1;
|
||||
ResponseEvent event = 2;
|
||||
|
||||
message Error {
|
||||
Code code = 1;
|
||||
string description = 2;
|
||||
|
||||
enum Code {
|
||||
NULL = 0;
|
||||
UNKNOWN_ERROR = 1;
|
||||
BAD_INPUT = 2;
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set the current active view (persisted only within a session)
|
||||
message ActiveView {
|
||||
message Request {
|
||||
string contextId = 1;
|
||||
string blockId = 2; // id of dataview block
|
||||
string viewId = 3; // id of active view
|
||||
uint32 offset = 4;
|
||||
uint32 limit = 5;
|
||||
}
|
||||
|
||||
message Response {
|
||||
Error error = 1;
|
||||
ResponseEvent event = 2;
|
||||
|
||||
message Error {
|
||||
Code code = 1;
|
||||
string description = 2;
|
||||
|
||||
enum Code {
|
||||
NULL = 0;
|
||||
UNKNOWN_ERROR = 1;
|
||||
BAD_INPUT = 2;
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
message Bookmark {
|
||||
message Fetch {
|
||||
|
@ -1307,6 +1388,35 @@ message Rpc {
|
|||
* 3. Front <- MW: Event.Block.Show(newPage)
|
||||
*/
|
||||
message Create {
|
||||
message Dataview {
|
||||
message View {
|
||||
message Request {
|
||||
string contextId = 1;
|
||||
string blockId = 2; // id of dataview block to insert the new block
|
||||
anytype.model.Block.Content.Dataview.View view = 4;
|
||||
}
|
||||
|
||||
message Response {
|
||||
Error error = 1;
|
||||
ResponseEvent event = 2;
|
||||
string viewId = 3;
|
||||
|
||||
message Error {
|
||||
Code code = 1;
|
||||
string description = 2;
|
||||
|
||||
enum Code {
|
||||
NULL = 0;
|
||||
UNKNOWN_ERROR = 1;
|
||||
BAD_INPUT = 2;
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// common simple block command
|
||||
message Request {
|
||||
string contextId = 1; // id of the context block
|
||||
string targetId = 2; // id of the closest block
|
||||
|
@ -1361,9 +1471,9 @@ message Rpc {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove blocks from the childrenIds of its parents
|
||||
*/
|
||||
/*
|
||||
* Remove blocks from the childrenIds of its parents
|
||||
*/
|
||||
message Unlink {
|
||||
message Request {
|
||||
string contextId = 1; // id of the context block
|
||||
|
@ -1389,6 +1499,35 @@ message Rpc {
|
|||
}
|
||||
}
|
||||
|
||||
message Delete {
|
||||
message Dataview {
|
||||
message View {
|
||||
message Request {
|
||||
string contextId = 1; // id of the context block
|
||||
string blockId = 2; // id of the dataview
|
||||
string viewId = 4; // id of the view to remove
|
||||
}
|
||||
|
||||
message Response {
|
||||
Error error = 1;
|
||||
ResponseEvent event = 2;
|
||||
|
||||
message Error {
|
||||
Code code = 1;
|
||||
string description = 2;
|
||||
|
||||
enum Code {
|
||||
NULL = 0;
|
||||
UNKNOWN_ERROR = 1;
|
||||
BAD_INPUT = 2;
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Block.Close – it means unsubscribe from a block.
|
||||
* Precondition: block should be opened.
|
||||
|
@ -1557,7 +1696,7 @@ message Rpc {
|
|||
FAILED_TO_RUN_NODE = 105;
|
||||
WALLET_RECOVER_NOT_PERFORMED = 106;
|
||||
FAILED_TO_STOP_RUNNING_NODE = 107;
|
||||
|
||||
ANOTHER_ANYTYPE_PROCESS_IS_RUNNING = 108;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1596,6 +1735,8 @@ message Rpc {
|
|||
LOCAL_REPO_NOT_EXISTS_AND_MNEMONIC_NOT_SET = 105;
|
||||
FAILED_TO_STOP_SEARCHER_NODE = 106;
|
||||
FAILED_TO_RECOVER_PREDEFINED_BLOCKS = 107;
|
||||
ANOTHER_ANYTYPE_PROCESS_IS_RUNNING = 108;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,12 +35,15 @@ message Event {
|
|||
Block.Set.Align blockSetAlign = 15;
|
||||
Block.Set.Details blockSetDetails = 16;
|
||||
Block.Set.Div blockSetDiv = 17;
|
||||
Block.Set.Dataview.Records blockSetDataviewRecords = 18;
|
||||
Block.Set.Dataview.View blockSetDataviewView = 19;
|
||||
Block.Delete.Dataview.View blockDeleteDataviewView = 20;
|
||||
|
||||
Block.Show blockShow = 20;
|
||||
User.Block.Join userBlockJoin = 21;
|
||||
User.Block.Left userBlockLeft = 22;
|
||||
User.Block.SelectRange userBlockSelectRange = 23;
|
||||
User.Block.TextRange userBlockTextRange = 24;
|
||||
Block.Show blockShow = 30;
|
||||
User.Block.Join userBlockJoin = 31;
|
||||
User.Block.Left userBlockLeft = 32;
|
||||
User.Block.SelectRange userBlockSelectRange = 33;
|
||||
User.Block.TextRange userBlockTextRange = 34;
|
||||
|
||||
Ping ping = 100;
|
||||
|
||||
|
@ -108,6 +111,13 @@ message Event {
|
|||
*/
|
||||
message Delete {
|
||||
repeated string blockIds = 1;
|
||||
|
||||
message Dataview {
|
||||
message View {
|
||||
string id = 1; // dataview block's id
|
||||
string viewId = 2; // view id to remove
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
message MarksInfo {
|
||||
|
@ -121,6 +131,30 @@ message Event {
|
|||
google.protobuf.Struct details = 2;
|
||||
}
|
||||
|
||||
|
||||
message Dataview {
|
||||
// sent when the active view's visible records have been
|
||||
// changed either by the view settings(filters/sort/limit/offset) or by the data itself
|
||||
message Records {
|
||||
string id = 1; // dataview block's id
|
||||
string viewId = 2; // view id, client should double check this to make sure client doesn't switch the active view in the middle
|
||||
repeated google.protobuf.Struct updated = 3; // existing records updated
|
||||
repeated google.protobuf.Struct inserted = 4; // block of new records to insert
|
||||
uint32 insertPosition = 5; // position to insert
|
||||
repeated string removed = 6;
|
||||
uint32 total = 7; // total number of records
|
||||
}
|
||||
|
||||
// sent when the view settings have been changed
|
||||
message View {
|
||||
string id = 1; // dataview block's id
|
||||
string viewId = 2; // view id, client should double check this to make sure client doesn't switch the active view in the middle
|
||||
anytype.model.Block.Content.Dataview.View view = 3;
|
||||
uint32 offset = 4; // middleware will try to preserve the current aciveview's offset&limit but may reset it in case it becomes invalid or not actual anymore
|
||||
uint32 limit = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message Fields {
|
||||
string id = 1;
|
||||
google.protobuf.Struct fields = 2;
|
||||
|
@ -281,6 +315,180 @@ message Event {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
message Fill {
|
||||
|
||||
message Details {
|
||||
string id = 1;
|
||||
google.protobuf.Struct details = 2;
|
||||
}
|
||||
|
||||
message DatabaseRecords {
|
||||
string id = 1;
|
||||
repeated google.protobuf.Struct records = 2;
|
||||
}
|
||||
|
||||
message Fields {
|
||||
string id = 1;
|
||||
google.protobuf.Struct fields = 2;
|
||||
}
|
||||
|
||||
message ChildrenIds {
|
||||
string id = 1;
|
||||
repeated string childrenIds = 2;
|
||||
}
|
||||
|
||||
message Restrictions {
|
||||
string id = 1;
|
||||
anytype.model.Block.Restrictions restrictions = 2;
|
||||
}
|
||||
|
||||
message BackgroundColor {
|
||||
string id = 1;
|
||||
string backgroundColor = 2;
|
||||
}
|
||||
|
||||
message Align {
|
||||
string id = 1;
|
||||
anytype.model.Block.Align align = 2;
|
||||
}
|
||||
|
||||
|
||||
message Text {
|
||||
string id = 1;
|
||||
TText text = 2;
|
||||
Style style = 3;
|
||||
Marks marks = 4;
|
||||
Checked checked = 5;
|
||||
Color color = 6;
|
||||
|
||||
message TText {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message Style {
|
||||
anytype.model.Block.Content.Text.Style value = 1;
|
||||
}
|
||||
|
||||
message Marks {
|
||||
anytype.model.Block.Content.Text.Marks value = 1;
|
||||
}
|
||||
|
||||
message Checked {
|
||||
bool value = 1;
|
||||
}
|
||||
|
||||
message Color {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
message Div {
|
||||
string id = 1;
|
||||
Style style = 2;
|
||||
|
||||
message Style {
|
||||
anytype.model.Block.Content.Div.Style value = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
message File {
|
||||
string id = 1;
|
||||
Type type = 2;
|
||||
State state = 3;
|
||||
Mime mime = 4;
|
||||
Hash hash = 5;
|
||||
Name name = 6;
|
||||
Size size = 7;
|
||||
|
||||
message Name {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message Width {
|
||||
int32 value = 1;
|
||||
}
|
||||
|
||||
message State {
|
||||
anytype.model.Block.Content.File.State value = 1;
|
||||
}
|
||||
|
||||
message Type {
|
||||
anytype.model.Block.Content.File.Type value = 1;
|
||||
}
|
||||
|
||||
message Hash {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message Mime {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message Size {
|
||||
int64 value = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
message Link {
|
||||
string id = 1;
|
||||
TargetBlockId targetBlockId = 2;
|
||||
Style style = 3;
|
||||
Fields fields = 4;
|
||||
|
||||
message TargetBlockId {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message Style {
|
||||
anytype.model.Block.Content.Link.Style value = 1;
|
||||
}
|
||||
|
||||
message Fields {
|
||||
google.protobuf.Struct value = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
message Bookmark {
|
||||
string id = 1;
|
||||
Url url = 2;
|
||||
Title title = 3;
|
||||
Description description = 4;
|
||||
ImageHash imageHash = 5;
|
||||
FaviconHash faviconHash = 6;
|
||||
Type type = 7;
|
||||
|
||||
message Url {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message Title {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message Description {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message ImageHash {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message FaviconHash {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
message Type {
|
||||
anytype.model.LinkPreview.Type value = 1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
message User {
|
||||
|
@ -351,10 +559,12 @@ message Event {
|
|||
|
||||
enum SmartBlockType {
|
||||
Page = 0;
|
||||
Home = 1;
|
||||
ProfilePage = 2;
|
||||
Archive = 3;
|
||||
Breadcrumbs = 4;
|
||||
Home = 1; // have only Link simpleblocks
|
||||
ProfilePage = 2; // just a usual page for now
|
||||
Archive = 3; // have only Link simpleblocks
|
||||
Breadcrumbs = 4; // have only Link simpleblocks
|
||||
|
||||
Set = 5; // only have dataview simpleblock
|
||||
}
|
||||
|
||||
message ResponseEvent {
|
||||
|
|
|
@ -13,7 +13,6 @@ message PageInfo {
|
|||
google.protobuf.Struct details = 2;
|
||||
string snippet = 3;
|
||||
State state = 4;
|
||||
int64 lastOpened = 5;
|
||||
bool hasInboundLinks = 6;
|
||||
}
|
||||
|
||||
|
|
|
@ -191,6 +191,95 @@ message Block {
|
|||
|
||||
message Dataview {
|
||||
string databaseId = 1;
|
||||
repeated View views = 2;
|
||||
string schemaURL = 3;
|
||||
|
||||
message View {
|
||||
string id = 1;
|
||||
Type type = 2;
|
||||
string name = 3;
|
||||
repeated Sort sorts = 4;
|
||||
repeated Filter filters = 5;
|
||||
repeated Relation relations = 6; // relations fields/columns options, also used to provide the order
|
||||
|
||||
enum Type {
|
||||
Table = 0;
|
||||
List = 1;
|
||||
Gallery = 2;
|
||||
Kanban = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message Relation {
|
||||
string id = 1;
|
||||
bool isVisible = 2;
|
||||
int32 width = 3; // the displayed column % calculated based on other visible relations
|
||||
|
||||
oneof options {
|
||||
EmptyOptions emptyOptions = 10;
|
||||
DateOptions dateOptions = 11;
|
||||
}
|
||||
|
||||
message EmptyOptions {
|
||||
}
|
||||
|
||||
message DateOptions {
|
||||
bool includeTime = 1;
|
||||
TimeFormat timeFormat = 2;
|
||||
DateFormat dateFormat = 3;
|
||||
}
|
||||
|
||||
enum DateFormat {
|
||||
MonthAbbrBeforeDay = 0; // Jul 30, 2020
|
||||
MonthAbbrAfterDay = 1; // 30 Jul 2020
|
||||
Short = 2; // 30/07/2020
|
||||
ShortUS = 3; // 07/30/2020
|
||||
ISO = 4; // 2020-07-30
|
||||
}
|
||||
|
||||
enum TimeFormat {
|
||||
Format12 = 0;
|
||||
Format24 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message Sort {
|
||||
string relationId = 1;
|
||||
Type type = 2;
|
||||
|
||||
enum Type {
|
||||
Asc = 0;
|
||||
Desc = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message Filter {
|
||||
Operator operator = 1;
|
||||
string relationId = 2;
|
||||
string relationProperty = 5;
|
||||
Condition condition = 3;
|
||||
google.protobuf.Value value = 4;
|
||||
|
||||
enum Operator {
|
||||
And = 0;
|
||||
Or = 1;
|
||||
}
|
||||
|
||||
enum Condition {
|
||||
Equal = 0;
|
||||
NotEqual = 1;
|
||||
Greater = 2;
|
||||
Less = 3;
|
||||
GreaterOrEqual = 4;
|
||||
LessOrEqual = 5;
|
||||
Like = 6;
|
||||
NotLike = 7;
|
||||
In = 8;
|
||||
NotIn = 9;
|
||||
Empty = 10;
|
||||
NotEmpty = 11;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue