Last active
December 10, 2020 05:37
-
-
Save wassim/a77cf7491566d1c1bd574c58794c334e to your computer and use it in GitHub Desktop.
Export base meta data from Airtable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fda = ( fields ) => { | |
let data = [] | |
for(const f of fields ){ | |
data.push(fd(f)) | |
} | |
return data | |
} | |
const fd = ( field ) => { | |
let data = { | |
id: field.id, name: field.name, type: field.type, isComputed: field.isComputed, options:field.options, description: field.description | |
} | |
return data | |
} | |
let tables = [] | |
for (const table of base.tables ){ | |
let views = [] | |
for (const view of table.views ){ | |
views.push({ | |
id: view.id, | |
name: view.name, | |
type: view.type, | |
url: view.url | |
}) | |
} | |
let fields = fda(table.fields) | |
tables.push({ | |
id: table.id, | |
name: table.name, | |
description: table.description, | |
url: table.url, | |
views, fields | |
}) | |
} | |
let baseMeta = { | |
id: base.id, name: base.name, activeCollaborators: base.activeCollaborators, | |
tables | |
} | |
output.markdown('## BASE META DATA ##') | |
output.inspect(baseMeta) | |
output.markdown('### START JSON ###') | |
output.text(JSON.stringify(baseMeta)) | |
output.markdown('### END JSON ###') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment