1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-10 01:51:07 +09:00
anytype-heart/cmd/archiveprocessor
2023-07-04 15:40:32 +02:00
..
excluded.go GO-1561 Add exclusion mechanism 2023-06-29 10:19:55 +02:00
excluded.json GO-1564 Exclude Assignee block from tasks 2023-06-29 10:54:50 +02:00
main.go GO-1561 Small fixes 2023-07-04 15:40:32 +02:00
README.md GO-1055 Archive processor 2023-04-25 18:17:59 +02:00
rules.go Go 1508 long objectimportusecases (#99) 2023-06-15 01:01:06 +02:00
rules.json PROD-778 Changes in inline sets 2023-06-08 16:00:16 +02:00
validators.go fix knowledge_base.zip 2023-06-29 20:38:18 +02:00

Use Case archives processing tool

To use Use Case archives processing tool build the program go build and run it using ./archiveprocessor <path_to_archive> command.

If all protobuf objects contain correct information, resulting archive would be written in <path_to_archive>_new.zip file in same directory.

If objects in archive have some incorrect information, e.g.:

  • links to objects that are not presented in the archive
  • relation links or object types not presented among objects

then program provides you with error messages in the output along with the list of all objects processed by the tool.

Resolving incorrect data

Incorrect data found by tool could be resolved two different ways:

  1. Via editor of the client and repetitive export of desired account
  2. Using rules engine

Rules are the actions that could be done upon such entities of smartblock as:

  • relation links
  • object types
  • details
  • target object of dataView blocks
  • target object of link blocks

Other entities will be added to the list on demand.

These entities could be added to the object, modified or deleted. To choose the desired action action field should be provided to the JSON object.

rules.json file provides all rules to be processed upon archive.

Examples:

  1. To change the target object of dataView block "block1" of object "object1" to some object "object2" these json object should be defined:
{
    "action": "change",
    "entity": "dataViewTarget",
    "objectID": "object1",
    "targetID": "object2",
    "blockID": "block1"
}
  1. To add relation link grannyName with format shorttext (=1) to some object "lovelygrandson" define this rule:
{
    "action": "add",
    "entity": "relationLink",
    "objectID": "lovelygrandson",
    "relationLink": {
        "key": "grannyName",
        "format": 1
    }
}
  1. To delete detail with key awfulDetail from all objects in the archive define:
{
    "action": "remove",
    "entity": "detail",
    "detailKey": "awfulDetail"
}

More examples could be found in rules.json file