Airtable

Lifecycle

  • location: src/builtin/AirtablePod.ts
plant {

    verifyDir(dest)
    filteredNotes = filteredNotes(srcHierarchy)

    if (!noCheckpointing) {
        filterdNotes := filterByCheckpointFile
    }

    {created, updated} = processNote(filteredNotes)
    updateAirtableIdForNewlySyncedNotes(created)
}

processNote {
    {create, update, lastUpdate} = notesToSrcFieldMap(filteredNotes, srcFieldMapping)

    api = new AirtableApi(...)

    chunkAndCall(create, api)
    chunkAndCall(update, api)

    if (checkpointing) {
        writeFile(checkpointFile, lastUpdate)
    }
}

updateAirtableIdForNewlySyncedNotes(records) {

    records.map note => {  
        if (!noteAirtableId := note.airtableId) {
            note = {
                ...note,
                noteAirtableId
            }
            engine.writeNote(note)
        }
    }

}