fauna-dumpify
Library responsible for iterating over given collections and write a CSV file per collection on a given path.
Usage API:
faunaDump (key: string, outputPath: string, options?: {
collections?: Array<string>,
headers?: (collection: string) => Array<string>,
startPointInTime?: Date,
endPointInTime?: Date,
pageSize?: Number,
headerTransformer?: (header: string) => string,
dataTransformer?: (header, data) => data[header],
appendData?: (_, data) => data,
faunaLambda?: (faunaQueryBuilder, collection), => faunaQueryBuilder
onCollectionProgress?: (progress) => {}
}): Promise<string>
Example:
faunaDump(faunaKey, outputPath, {
collections: ['Token', 'User'],
headers: (collection) => {
if (collection === 'User') {
return ['id', 'name', 'picture', 'email', 'issuer', 'github', 'public_address', 'inserted_at', 'updated_at']
}
return ['id']
},
dataTransformer: (header, allData, collection) => {
if (header === 'inserted_at') return allData.created?.value
return allData[header]
}
})