Skip to content

Instantly share code, notes, and snippets.

@wassim
Last active December 10, 2020 05:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wassim/a77cf7491566d1c1bd574c58794c334e to your computer and use it in GitHub Desktop.
Save wassim/a77cf7491566d1c1bd574c58794c334e to your computer and use it in GitHub Desktop.
Export base meta data from Airtable
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