1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-11 14:20:05 +00:00

fix(*): separate job execution code from main SASjs class

This commit is contained in:
Krishna Acondy
2021-01-27 20:30:13 +00:00
parent e0d85f458b
commit d7ecaf5932
18 changed files with 798 additions and 714 deletions

View File

@@ -0,0 +1,24 @@
import { convertToCSV } from '../utils/convertToCsv'
export const generateFileUploadForm = (
formData: FormData,
data: any
): FormData => {
for (const tableName in data) {
const name = tableName
const csv = convertToCSV(data[tableName])
if (csv === 'ERROR: LARGE STRING LENGTH') {
throw new Error(
'The max length of a string value in SASjs is 32765 characters.'
)
}
const file = new Blob([csv], {
type: 'application/csv'
})
formData.append(name, file, `${name}.csv`)
}
return formData
}