The first step is to workout how to Update rich text Field documentation. This is my code:
import Fibery from 'npm:fibery-unofficial';
const fibery = new Fibery({host: "ooker.fibery.io", token: 'XXX});
const spaceName = 'a';
const databaseName = 'Literature';
async function getCollabDoc(id) {
const players = await fibery.entity.query({
'q/from': `${spaceName}/${databaseName}`,
'q/select': [
'fibery/id',
{ 'a/Description': ['Collaboration~Documents/secret'] }
],
'q/where': ['=', ['fibery/id'], '$id'],
'q/limit': 1
}, { '$id': id });
console.log(players);
}
const idList = [
'46cf6d13-9268-4b1f-bb46-d533c95085b2', // Collaboration~Documents/secret
'47748e94-1937-4b01-82de-3aa318b856ac', // Collaboration~Documents/Document
'58468b5f-83b2-45fe-8c75-9954237f5bad', // a/Literature
'3397b307-1b2d-4eb5-a252-340317b1d1b3', // a/Description
]
const content = 'Virat Kohli (born 5 November 1988) is an Indian [cricketer](https://en.wikipedia.org/wiki/Cricket) who currently captains the India national team.\\nHe plays for Royal Challengers Bangalore in the Indian Premier League.';
for (const id of idList) {
console.log(id)
await getCollabDoc(id);
await fibery.document.update(id, content, 'md');
}
I try to exhaust all IDs I can think of, but all of them return empty arrays. Do you have any idea?
Here is the schema for a/Description
:
{
"fibery/name": "a/Description",
"fibery/type": "Collaboration~Documents/Document",
"fibery/deleted?": false,
"fibery/meta": {
"fibery/readonly?": false,
"ui/hidden?": false,
"fibery/entity-component?": true,
"fibery/required?": true,
"ui/type-editor-order": 2
},
"fibery/id": "3397b307-1b2d-4eb5-a252-340317b1d1b3"
},
I see that its type is Collaboration~Documents/Document
, not Collaboration~Documents/secret
. Is this normal?