1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 05:47:05 +09:00

DROID-165 Tech | Enhancement | update middleware to 0.21.0 (#2410)

This commit is contained in:
Sergey Boishtyan 2022-07-15 12:30:00 +03:00 committed by GitHub
parent 084994b138
commit b4954c2c5e
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 858 additions and 26 deletions

View file

@ -176,7 +176,7 @@ data class Block(
}
data class Layout(val type: Type) : Content() {
enum class Type { ROW, COLUMN, DIV, HEADER }
enum class Type { ROW, COLUMN, DIV, HEADER, TABLE_ROW, TABLE_COLUMN }
}
@Deprecated("Legacy class")
@ -334,7 +334,8 @@ data class Block(
enum class Operator { AND, OR }
enum class Condition {
EQUAL, NOT_EQUAL, GREATER, LESS, GREATER_OR_EQUAL, LESS_OR_EQUAL,
LIKE, NOT_LIKE, IN, NOT_IN, EMPTY, NOT_EMPTY, ALL_IN, NOT_ALL_IN, NONE
LIKE, NOT_LIKE, IN, NOT_IN, EMPTY, NOT_EMPTY, ALL_IN, NOT_ALL_IN, NONE,
EXACT_IN, NOT_EXACT_IN
}
enum class ConditionType { TEXT, NUMBER, SELECT, CHECKBOX }

View file

@ -33,6 +33,7 @@ data class ObjectType(
IMAGE(8),
NOTE(9),
SPACE(10),
BOOKMARK(11),
DATABASE(20),
}

View file

@ -35,6 +35,8 @@ enum class ObjectRestriction {
*/
LAYOUT_CHANGE,
TEMPLATE
TEMPLATE,
DUPLICATE
}

View file

@ -260,21 +260,6 @@ fun String?.getMimeIcon(name: String?): Int {
}
}
fun ObjectLayoutView.getIconSize24(): Int? = when (this) {
is ObjectLayoutView.Basic -> R.drawable.ic_layout_basic
is ObjectLayoutView.Image -> null
is ObjectLayoutView.Note -> null
is ObjectLayoutView.Profile -> R.drawable.ic_layout_profile
is ObjectLayoutView.Set -> R.drawable.ic_layout_set
is ObjectLayoutView.Todo -> R.drawable.ic_layout_todo
is ObjectLayoutView.Dashboard -> null
is ObjectLayoutView.Database -> null
is ObjectLayoutView.File -> null
is ObjectLayoutView.ObjectType -> null
is ObjectLayoutView.Relation -> null
is ObjectLayoutView.Space -> null
}
fun ObjectLayoutView.getName(): Int? = when (this) {
is ObjectLayoutView.Basic -> R.string.name_layout_basic
is ObjectLayoutView.Image -> null
@ -288,4 +273,5 @@ fun ObjectLayoutView.getName(): Int? = when (this) {
is ObjectLayoutView.ObjectType -> null
is ObjectLayoutView.Relation -> null
is ObjectLayoutView.Space -> null
is ObjectLayoutView.Bookmark -> null
}

View file

@ -86,7 +86,7 @@ ext {
// Anytype
middleware_version = 'v0.19.3'
middleware_version = 'v0.21.0'
mainApplication = [
kotlin: "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version",

View file

@ -324,6 +324,8 @@ fun MBLayoutStyle.toCoreModels(): Block.Content.Layout.Type = when (this) {
MBLayoutStyle.Column -> Block.Content.Layout.Type.COLUMN
MBLayoutStyle.Div -> Block.Content.Layout.Type.DIV
MBLayoutStyle.Header -> Block.Content.Layout.Type.HEADER
MBLayoutStyle.TableRows -> Block.Content.Layout.Type.TABLE_ROW
MBLayoutStyle.TableColumns -> Block.Content.Layout.Type.TABLE_COLUMN
}
fun MBAlign.toCoreModelsAlign(): Block.Align = when (this) {
@ -434,6 +436,8 @@ fun MDVFilterCondition.toCoreModels(): DVFilterCondition = when (this) {
MDVFilterCondition.AllIn -> DVFilterCondition.ALL_IN
MDVFilterCondition.NotAllIn -> DVFilterCondition.NOT_ALL_IN
MDVFilterCondition.None -> DVFilterCondition.NONE
MDVFilterCondition.ExactIn -> DVFilterCondition.EXACT_IN
MDVFilterCondition.NotExactIn -> DVFilterCondition.NOT_EXACT_IN
}
fun MDVFilterOperator.toCoreModels(): DVFilterOperator = when (this) {
@ -492,6 +496,7 @@ fun MOTypeLayout.toCoreModels(): ObjectType.Layout = when (this) {
MOTypeLayout.image -> ObjectType.Layout.IMAGE
MOTypeLayout.note -> ObjectType.Layout.NOTE
MOTypeLayout.space -> ObjectType.Layout.SPACE
MOTypeLayout.bookmark -> ObjectType.Layout.BOOKMARK
}
fun MRelationDataSource.source(): Relation.Source = when (this) {
@ -590,6 +595,7 @@ fun MObjectRestriction.toCoreModel(): ObjectRestriction? = when (this) {
MObjectRestriction.LayoutChange -> ObjectRestriction.LAYOUT_CHANGE
MObjectRestriction.Template -> ObjectRestriction.TEMPLATE
MObjectRestriction.None -> null
MObjectRestriction.Duplicate -> ObjectRestriction.DUPLICATE
}
fun MDVRestrictions.toCoreModel(): DataViewRestrictions {

View file

@ -79,6 +79,8 @@ fun Block.Content.Layout.toMiddlewareModel(): MBLayout = when (type) {
Block.Content.Layout.Type.COLUMN -> MBLayout(style = MBLayoutStyle.Column)
Block.Content.Layout.Type.DIV -> MBLayout(style = MBLayoutStyle.Div)
Block.Content.Layout.Type.HEADER -> MBLayout(style = MBLayoutStyle.Header)
Block.Content.Layout.Type.TABLE_ROW -> MBLayout(style = MBLayoutStyle.TableRows)
Block.Content.Layout.Type.TABLE_COLUMN -> MBLayout(style = MBLayoutStyle.TableColumns)
}
fun Block.Content.Bookmark.toMiddlewareModel(): MBBookmark = MBBookmark(
@ -353,6 +355,8 @@ fun Block.Content.DataView.Filter.Condition.toMiddlewareModel(): MDVFilterCondit
Block.Content.DataView.Filter.Condition.ALL_IN -> MDVFilterCondition.AllIn
Block.Content.DataView.Filter.Condition.NOT_ALL_IN -> MDVFilterCondition.NotAllIn
Block.Content.DataView.Filter.Condition.NONE -> MDVFilterCondition.None
Block.Content.DataView.Filter.Condition.EXACT_IN -> MDVFilterCondition.ExactIn
Block.Content.DataView.Filter.Condition.NOT_EXACT_IN -> MDVFilterCondition.NotExactIn
}
fun Block.Content.DataView.DateFormat?.toMiddlewareModel(): MDVDateFormat = when (this) {
@ -395,6 +399,7 @@ fun ObjectType.Layout.toMiddlewareModel(): MOTypeLayout = when (this) {
ObjectType.Layout.IMAGE -> MOTypeLayout.image
ObjectType.Layout.NOTE -> MOTypeLayout.note
ObjectType.Layout.SPACE -> MOTypeLayout.space
ObjectType.Layout.BOOKMARK -> MOTypeLayout.bookmark
}
fun Relation.Format.toMiddlewareModel(): MRelationFormat = when (this) {

View file

@ -189,6 +189,8 @@ fun DVFilterCondition.getPropName() = when (this) {
Block.Content.DataView.Filter.Condition.ALL_IN -> "allin"
Block.Content.DataView.Filter.Condition.NOT_ALL_IN -> "notallin"
Block.Content.DataView.Filter.Condition.NONE -> "none"
Block.Content.DataView.Filter.Condition.EXACT_IN -> "exactin"
Block.Content.DataView.Filter.Condition.NOT_EXACT_IN -> "notexactin"
}
fun Relation.Format.getPropName() = when (this) {

View file

@ -149,4 +149,6 @@ private fun DVFilterCondition.toView(
DVFilterConditionType.CHECKBOX -> Viewer.Filter.Condition.Checkbox.None()
}
}
DVFilterCondition.EXACT_IN -> TODO()
DVFilterCondition.NOT_EXACT_IN -> TODO()
}

View file

@ -11,7 +11,6 @@ import com.anytypeio.anytype.core_models.ObjectType
import com.anytypeio.anytype.core_models.ObjectWrapper
import com.anytypeio.anytype.core_models.Relation
import com.anytypeio.anytype.core_models.Relations
import com.anytypeio.anytype.core_models.ext.textStyle
import com.anytypeio.anytype.domain.config.DebugSettings
import com.anytypeio.anytype.domain.misc.UrlBuilder
import com.anytypeio.anytype.presentation.dashboard.DashboardView
@ -727,6 +726,7 @@ fun List<ObjectType.Layout>.toView(): List<ObjectLayoutView> = map { layout ->
ObjectType.Layout.NOTE -> ObjectLayoutView.Note(id = layout.code, isSelected = false)
ObjectType.Layout.DATABASE -> ObjectLayoutView.Database(id = layout.code, isSelected = false)
ObjectType.Layout.SPACE -> ObjectLayoutView.Space(id = layout.code, isSelected = false)
ObjectType.Layout.BOOKMARK -> ObjectLayoutView.Bookmark(id = layout.code, isSelected = false)
}
}
@ -743,9 +743,5 @@ fun ObjectLayoutView.toObjectLayout() = when (this) {
is ObjectLayoutView.Set -> ObjectType.Layout.SET
is ObjectLayoutView.Space -> ObjectType.Layout.SPACE
is ObjectLayoutView.Todo -> ObjectType.Layout.TODO
}
fun List<Block>.getTextStyleForSelectedTextBlocks(): Block.Content.Text.Style? {
val styles = map { it.textStyle() }.distinct()
return if (styles.size == 1) styles[0] else null
is ObjectLayoutView.Bookmark -> ObjectType.Layout.BOOKMARK
}

View file

@ -63,6 +63,7 @@ sealed class ObjectIcon {
ObjectType.Layout.DASHBOARD -> None
ObjectType.Layout.SPACE -> None
ObjectType.Layout.DATABASE -> None
ObjectType.Layout.BOOKMARK -> None
null -> None
}
}

View file

@ -93,4 +93,11 @@ sealed class ObjectLayoutView {
) : ObjectLayoutView() {
override fun copy(isSelected: Boolean) = copy(id = id, isSelected = isSelected)
}
data class Bookmark(
override val id: Int,
override val isSelected: Boolean
) : ObjectLayoutView() {
override fun copy(isSelected: Boolean) = copy(id = id, isSelected = isSelected)
}
}

View file

@ -53,6 +53,7 @@ class ObjectMenuOptionsProviderImpl(
ObjectType.Layout.IMAGE,
ObjectType.Layout.SPACE,
ObjectType.Layout.SET,
ObjectType.Layout.BOOKMARK,
ObjectType.Layout.DATABASE -> Options.ALL.copy(
hasIcon = hasIcon,
hasCover = hasCover,

View file

@ -198,6 +198,7 @@ message Rpc {
oneof avatar {
string avatarLocalPath = 2; // Path to an image, that will be used as an avatar of this account
}
string storePath = 3; // Path to local storage
string alphaInviteCode = 20;
@ -223,6 +224,8 @@ message Rpc {
ACCOUNT_CREATED_BUT_FAILED_TO_SET_NAME = 102;
ACCOUNT_CREATED_BUT_FAILED_TO_SET_AVATAR = 103;
FAILED_TO_STOP_RUNNING_NODE = 104;
FAILED_TO_WRITE_CONFIG = 105;
FAILED_TO_CREATE_LOCAL_REPO = 106;
BAD_INVITE_CODE = 900;
@ -365,6 +368,93 @@ message Rpc {
}
}
message Move {
/**
* Front-end-to-middleware request to move a account to a new disk location
*/
message Request {
string newPath = 1;
}
message Response {
Error error = 1;
message Error {
Code code = 1;
string description = 2;
enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
FAILED_TO_STOP_NODE = 101;
FAILED_TO_IDENTIFY_ACCOUNT_DIR = 102;
FAILED_TO_REMOVE_ACCOUNT_DATA = 103;
FAILED_TO_CREATE_LOCAL_REPO = 104;
FAILED_TO_WRITE_CONFIG = 105;
FAILED_TO_GET_CONFIG = 106;
}
}
}
}
message ConfigUpdate {
message Request {
string timeZone = 1;
}
message Response {
Error error = 1;
message Error {
Code code = 1;
string description = 2;
enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
ACCOUNT_IS_NOT_RUNNING = 101;
FAILED_TO_WRITE_CONFIG = 102;
FAILED_TO_GET_CONFIG = 103;
}
}
}
enum Timezones {
GMT = 0;
ECT = 1;
EET = 2;
EAT = 3;
MET = 4;
NET = 5;
PLT = 6;
IST = 7;
BST = 8;
VST = 9;
CTT = 10;
JST = 11;
ACT = 12;
AET = 13;
SST = 14;
NST = 15;
MIT = 16;
HST = 17;
AST = 18;
PST = 19;
MST = 20;
CST = 21;
IET = 22;
PRT = 23;
CNT = 24;
BET = 25;
BRT = 26;
CAT = 27;
}
}
message GetConfig {
message Get {
message Request {
@ -595,6 +685,8 @@ message Rpc {
message Create {
message Request {
google.protobuf.Struct details = 1; // object details
repeated anytype.model.InternalFlag internalFlags = 2;
string templateId = 3;
}
message Response {
@ -616,11 +708,82 @@ message Rpc {
}
}
message CreateBookmark {
message Request {
string url = 1;
}
message Response {
Error error = 1;
string pageId = 2;
message Error {
Code code = 1;
string description = 2;
enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
// ...
}
}
}
}
message BookmarkFetch {
message Request {
string contextId = 1;
string url = 2;
}
message Response {
Error error = 1;
message Error {
Code code = 1;
string description = 2;
enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
// ...
}
}
}
}
message ToBookmark {
message Request {
string contextId = 1;
string url = 2;
}
message Response {
Error error = 1;
string objectId = 2;
message Error {
Code code = 1;
string description = 2;
enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
// ...
}
}
}
}
message CreateSet {
message Request {
repeated string source = 1;
google.protobuf.Struct details = 2; // if omitted the name of page will be the same with object type
string templateId = 3; // optional template id for creating from template
repeated anytype.model.InternalFlag internalFlags = 4;
}
message Response {
@ -913,6 +1076,30 @@ message Rpc {
}
}
message RelationSearchDistinct {
message Request {
string relationKey = 1;
repeated anytype.model.Block.Content.Dataview.Filter filters = 2;
}
message Response {
Error error = 1;
repeated anytype.model.Block.Content.Dataview.Group groups = 2;
message Error {
Code code = 1;
string description = 2;
enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
}
}
}
}
message SubscribeIds {
message Request {
// (optional) subscription identifier
@ -2508,6 +2695,31 @@ message Rpc {
}
}
message ListSetVerticalAlign {
message Request {
string contextId = 1; // id of the context object
repeated string blockIds = 2;
anytype.model.Block.VerticalAlign verticalAlign = 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 ListSetFields {
message Request {
string contextId = 1;
@ -3003,6 +3215,405 @@ message Rpc {
}
}
}
message ListClearStyle {
message Request {
string contextId = 1;
repeated string blockIds = 2;
}
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 ListClearContent {
message Request {
string contextId = 1;
repeated string blockIds = 2;
}
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 BlockTable {
message Create {
message Request {
string contextId = 1; // id of the context object
string targetId = 2; // id of the closest block
anytype.model.Block.Position position = 3;
uint32 rows = 4;
uint32 columns = 5;
bool withHeaderRow = 6;
}
message Response {
Error error = 1;
string blockId = 2;
ResponseEvent event = 3;
message Error {
Code code = 1;
string description = 2;
enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
// ...
}
}
}
}
message RowCreate {
message Request {
string contextId = 1; // id of the context object
string targetId = 2; // id of the closest row
anytype.model.Block.Position position = 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 RowSetHeader {
message Request {
string contextId = 1; // id of the context object
string targetId = 2;
bool isHeader = 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 RowListFill {
message Request {
string contextId = 1; // id of the context object
repeated string blockIds = 2;
}
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 RowListClean {
message Request {
string contextId = 1; // id of the context object
repeated string blockIds = 2;
}
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 ColumnListFill {
message Request {
string contextId = 1; // id of the context object
repeated string blockIds = 2;
}
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 ColumnCreate {
message Request {
string contextId = 1; // id of the context object
string targetId = 2; // id of the closest column
anytype.model.Block.Position position = 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 RowDelete {
message Request {
string contextId = 1; // id of the context object
string targetId = 2; // id of the closest row
}
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 ColumnDelete {
message Request {
string contextId = 1; // id of the context object
string targetId = 2; // id of the closest column
}
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 ColumnMove {
message Request {
string contextId = 1;
string targetId = 2;
string dropTargetId = 3;
anytype.model.Block.Position position = 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;
// ...
}
}
}
}
message RowDuplicate {
message Request {
string contextId = 1; // id of the context object
string targetId = 2;
string blockId = 3; // block to duplicate
anytype.model.Block.Position position = 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;
// ...
}
}
}
}
message ColumnDuplicate {
message Request {
string contextId = 1; // id of the context object
string targetId = 2;
string blockId = 3; // block to duplicate
anytype.model.Block.Position position = 4;
}
message Response {
Error error = 1;
string blockId = 2;
ResponseEvent event = 3;
message Error {
Code code = 1;
string description = 2;
enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
// ...
}
}
}
}
message Expand {
message Request {
string contextId = 1; // id of the context object
string targetId = 2;
uint32 columns = 3; // number of columns to append
uint32 rows = 4; // number of rows to append
}
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 Sort {
message Request {
string contextId = 1; // id of the context object
string columnId = 2;
anytype.model.Block.Content.Dataview.Sort.Type type = 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 BlockFile {
@ -3189,6 +3800,7 @@ message Rpc {
string contextId = 1; // id of the context object
google.protobuf.Struct details = 3; // new object details
string templateId = 5; // optional template id for creating from template
repeated anytype.model.InternalFlag internalFlags = 7;
// link block params
string targetId = 2; // id of the closest simple block
@ -3620,6 +4232,80 @@ message Rpc {
}
}
}
message GroupOrder {
message Update {
message Request {
string contextId = 1;
string blockId = 2;
anytype.model.Block.Content.Dataview.GroupOrder groupOrder = 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 ObjectOrder {
message Update {
message Request {
string contextId = 1;
string blockId = 2;
repeated anytype.model.Block.Content.Dataview.ObjectOrder objectOrders = 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 CreateBookmark {
message Request {
string contextId = 1;
string blockId = 2;
string url = 3;
}
message Response {
Error error = 1;
string id = 2;
message Error {
Code code = 1;
string description = 2;
enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
// ...
}
}
}
}
}
message BlockDataviewRecord {

View file

@ -54,6 +54,8 @@ message Event {
Block.Set.Div blockSetDiv = 17;
Block.Set.Relation blockSetRelation = 21;
Block.Set.Latex blockSetLatex = 25;
Block.Set.VerticalAlign blockSetVerticalAlign = 36;
Block.Set.TableRow blockSetTableRow = 37;
Block.Dataview.RecordsSet blockDataviewRecordsSet = 18;
Block.Dataview.RecordsUpdate blockDataviewRecordsUpdate = 26;
@ -66,6 +68,7 @@ message Event {
Block.Dataview.ViewOrder blockDataviewViewOrder = 29;
Block.Dataview.RelationDelete blockDataviewRelationDelete = 24;
Block.Dataview.RelationSet blockDataviewRelationSet = 23;
Block.Dataview.GroupOrderUpdate blockDataViewGroupOrderUpdate = 38;
User.Block.Join userBlockJoin = 31;
@ -220,6 +223,12 @@ message Event {
repeated anytype.model.ObjectType objectTypes = 5; // objectTypes contains ONLY to get layouts for the actual and all dependent objects. Relations are currently omitted // todo: switch to other pb model
repeated anytype.model.Relation relations = 7; // combined relations of object's type + extra relations. If object doesn't has some relation key in the details this means client should hide it and only suggest when adding existing one
anytype.model.Restrictions restrictions = 8; // object restrictions
HistorySize history = 9;
message HistorySize {
int32 undo = 1;
int32 redo = 2;
}
}
message Remove {
@ -301,6 +310,11 @@ message Event {
anytype.model.Block.Align align = 2;
}
message VerticalAlign {
string id = 1;
anytype.model.Block.VerticalAlign verticalAlign = 2;
}
message Text {
string id = 1;
@ -450,6 +464,8 @@ message Event {
ImageHash imageHash = 5;
FaviconHash faviconHash = 6;
Type type = 7;
TargetObjectId targetObjectId = 8;
State state = 9;
message Url {
string value = 1;
@ -475,6 +491,22 @@ message Event {
anytype.model.LinkPreview.Type value = 1;
}
message TargetObjectId {
string value = 1;
}
message State {
anytype.model.Block.Content.Bookmark.State value = 1;
}
}
message TableRow {
string id = 1;
IsHeader isHeader = 2;
message IsHeader {
bool value = 1;
}
}
}
@ -629,6 +661,8 @@ message Event {
ImageHash imageHash = 5;
FaviconHash faviconHash = 6;
Type type = 7;
TargetObjectId targetObjectId = 8;
message Url {
string value = 1;
@ -654,6 +688,9 @@ message Event {
anytype.model.LinkPreview.Type value = 1;
}
message TargetObjectId {
string value = 1;
}
}
}
@ -724,6 +761,11 @@ message Event {
string viewId = 2; // view id, client should double check this to make sure client doesn't switch the active view in the middle
repeated string removed = 6;
}
message GroupOrderUpdate {
string id = 1; // dataview block's id
anytype.model.Block.Content.Dataview.GroupOrder groupOrder = 2;
}
}
}

View file

@ -51,6 +51,7 @@ message Block {
repeated string childrenIds = 4;
string backgroundColor = 5;
Align align = 6;
VerticalAlign verticalAlign = 7;
oneof content {
Content.Smartblock smartblock = 11;
@ -67,6 +68,9 @@ message Block {
Content.FeaturedRelations featuredRelations = 23;
Content.Latex latex = 24;
Content.TableOfContents tableOfContents = 25;
Content.Table table = 26;
Content.TableColumn tableColumn = 27;
Content.TableRow tableRow = 28;
}
message Restrictions {
@ -101,6 +105,12 @@ message Block {
AlignRight = 2;
}
enum VerticalAlign {
VerticalAlignTop = 0;
VerticalAlignMiddle = 1;
VerticalAlignBottom = 2;
}
message Content {
/*
* Layout have no visual representation, but affects on blocks, that it contains.
@ -114,6 +124,8 @@ message Block {
Column = 1;
Div = 2;
Header = 3;
TableRows = 4;
TableColumns = 5;
}
}
@ -178,6 +190,16 @@ message Block {
string imageHash = 4;
string faviconHash = 5;
LinkPreview.Type type = 6;
string targetObjectId = 7;
State state = 8;
enum State {
Empty = 0;
Fetching = 1;
Done = 2;
Error = 3;
}
}
message Icon {
@ -282,6 +304,8 @@ message Block {
// index 3 is deprecated, was used for schemaURL in old-format sets
repeated model.Relation relations = 4;
string activeView = 3; // saved within a session
repeated GroupOrder groupOrders = 12;
repeated ObjectOrder objectOrders = 13;
message View {
string id = 1;
@ -290,10 +314,11 @@ message Block {
repeated Sort sorts = 4;
repeated Filter filters = 5;
repeated Relation relations = 6; // relations fields/columns options, also used to provide the order
string coverRelationKey = 7; // Relation used for cover in gallery
string coverRelationKey = 7; // Relation used for cover in gallery
bool hideIcon = 8; // Hide icon near name
Size cardSize = 9; // Gallery card size
bool coverFit = 10; // Image fits container
string groupRelationKey = 11;
enum Type {
Table = 0;
@ -372,6 +397,8 @@ message Block {
NotEmpty = 12;
AllIn = 13;
NotAllIn = 14;
ExactIn = 15;
NotExactIn = 16;
}
enum QuickOption {
@ -389,6 +416,48 @@ message Block {
NumberOfDaysNow = 11;
}
}
message GroupOrder {
string viewId = 1;
repeated ViewGroup viewGroups = 2;
}
message ViewGroup {
string groupId = 1;
int32 index = 2;
bool hidden = 3;
}
message ObjectOrder {
string viewId = 1;
string groupId = 2;
repeated string objectIds = 3;
}
message Group {
string id = 1;
oneof Value {
Status status = 2;
Tag tag = 3;
Checkbox checkbox = 4;
Date date = 5;
}
}
message Status {
string id = 1;
}
message Tag {
repeated string ids = 1;
}
message Checkbox {
bool checked = 1;
}
message Date {
}
}
message Relation {
@ -401,6 +470,12 @@ message Block {
message TableOfContents {
}
message Table {}
message TableColumn {}
message TableRow {
bool isHeader = 1;
}
}
}
@ -470,6 +545,8 @@ message Account {
string marketplaceTemplateObjectId = 7; // marketplace template id
string deviceId = 8;
string gatewayUrl = 101; // gateway url for fetching static files
string localStoragePath = 103; // path to local storage
string timeZone = 104; // time zone from config
}
}
@ -504,9 +581,14 @@ message Restrictions {
Blocks = 3;
// restricts work with details
Details = 4;
// restricts type changing
TypeChange = 5;
// restricts layout changing
LayoutChange = 6;
// restricts template creation from this object
Template = 7;
// restricts duplicate object
Duplicate = 8;
}
@ -557,6 +639,7 @@ message ObjectType {
image = 8;
note = 9;
space = 10;
bookmark = 11;
database = 20; // to be released later
}
@ -657,3 +740,14 @@ message RelationOptions {
repeated Relation.Option options = 1;
}
message InternalFlag {
Value value = 1;
// Use such a weird construction due to the issue with imported repeated enum type
// Look https://github.com/golang/protobuf/issues/1135 for more information.
enum Value {
editorDeleteEmpty = 0;
editorSelectType = 1;
editorSelectTemplate = 2;
}
}