1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-18 09:30:06 +00:00

fix(special-missings): fix convertToCSV format object

This commit is contained in:
Yury Shkoda
2022-02-16 17:13:00 +03:00
parent 4026b03005
commit d3dff44918
2 changed files with 5 additions and 2 deletions

View File

@@ -5,8 +5,11 @@ export const generateFileUploadForm = (
data: any data: any
): FormData => { ): FormData => {
for (const tableName in data) { for (const tableName in data) {
if (!Array.isArray(data[tableName])) continue
const name = tableName const name = tableName
const csv = convertToCSV(data[tableName]) const csv = convertToCSV(data[tableName])
if (csv === 'ERROR: LARGE STRING LENGTH') { if (csv === 'ERROR: LARGE STRING LENGTH') {
throw new Error( throw new Error(
'The max length of a string value in SASjs is 32765 characters.' 'The max length of a string value in SASjs is 32765 characters.'

View File

@@ -3,7 +3,7 @@
* @param data - the array of JSON objects to convert. * @param data - the array of JSON objects to convert.
*/ */
export const convertToCSV = ( export const convertToCSV = (
data: any, data: Array<any>,
sasFormats?: { formats: { [key: string]: string } } sasFormats?: { formats: { [key: string]: string } }
) => { ) => {
let formats = sasFormats?.formats let formats = sasFormats?.formats
@@ -76,7 +76,7 @@ export const convertToCSV = (
return byteSize return byteSize
} }
}) })
.sort((a: number, b: number) => b - a)[0] .sort((a: any, b: any) => b - a)[0]
if (longestValueForField && longestValueForField > 32765) { if (longestValueForField && longestValueForField > 32765) {
invalidString = true invalidString = true