@sasjs/adapter 3.6.0 → 3.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/file/spec/generateFileUploadForm.spec.d.ts +1 -0
- package/index.js +2 -2
- package/node/index.js +2 -2
- package/node/utils/convertToCsv.d.ts +1 -1
- package/package.json +1 -1
- package/src/file/generateFileUploadForm.ts +3 -0
- package/src/utils/convertToCsv.ts +2 -2
- package/utils/convertToCsv.d.ts +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Converts the given JSON object array to a CSV string.
|
|
3
3
|
* @param data - the array of JSON objects to convert.
|
|
4
4
|
*/
|
|
5
|
-
export declare const convertToCSV: (data: any, sasFormats?: {
|
|
5
|
+
export declare const convertToCSV: (data: any[], sasFormats?: {
|
|
6
6
|
formats: {
|
|
7
7
|
[key: string]: string;
|
|
8
8
|
};
|
package/package.json
CHANGED
|
@@ -5,8 +5,11 @@ export const generateFileUploadForm = (
|
|
|
5
5
|
data: any
|
|
6
6
|
): FormData => {
|
|
7
7
|
for (const tableName in data) {
|
|
8
|
+
if (!Array.isArray(data[tableName])) continue
|
|
9
|
+
|
|
8
10
|
const name = tableName
|
|
9
11
|
const csv = convertToCSV(data[tableName])
|
|
12
|
+
|
|
10
13
|
if (csv === 'ERROR: LARGE STRING LENGTH') {
|
|
11
14
|
throw new Error(
|
|
12
15
|
'The max length of a string value in SASjs is 32765 characters.'
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @param data - the array of JSON objects to convert.
|
|
4
4
|
*/
|
|
5
5
|
export const convertToCSV = (
|
|
6
|
-
data: any,
|
|
6
|
+
data: any[],
|
|
7
7
|
sasFormats?: { formats: { [key: string]: string } }
|
|
8
8
|
) => {
|
|
9
9
|
let formats = sasFormats?.formats
|
|
@@ -76,7 +76,7 @@ export const convertToCSV = (
|
|
|
76
76
|
return byteSize
|
|
77
77
|
}
|
|
78
78
|
})
|
|
79
|
-
.sort((a:
|
|
79
|
+
.sort((a: any, b: any) => b - a)[0]
|
|
80
80
|
|
|
81
81
|
if (longestValueForField && longestValueForField > 32765) {
|
|
82
82
|
invalidString = true
|
package/utils/convertToCsv.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Converts the given JSON object array to a CSV string.
|
|
3
3
|
* @param data - the array of JSON objects to convert.
|
|
4
4
|
*/
|
|
5
|
-
export declare const convertToCSV: (data: any, sasFormats?: {
|
|
5
|
+
export declare const convertToCSV: (data: any[], sasFormats?: {
|
|
6
6
|
formats: {
|
|
7
7
|
[key: string]: string;
|
|
8
8
|
};
|