@sasjs/adapter 4.5.0 → 4.5.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/index-dev.js +2 -2
- package/index-dev.js.LICENSE.txt +31 -2
- package/index.js +1 -1
- package/index.js.LICENSE.txt +31 -2
- package/minified_sas9.js +1 -1
- package/node/file/generateTableUploadForm.d.ts +1 -1
- package/node/index.js +1 -1
- package/node/index.js.LICENSE.txt +31 -0
- package/node/utils/getFormData.d.ts +2 -0
- package/node/utils/index.d.ts +1 -0
- package/package.json +3 -3
- package/src/file/generateFileUploadForm.ts +6 -2
- package/src/job-execution/SasjsJobExecutor.ts +2 -3
- package/src/job-execution/WebJobExecutor.ts +4 -4
- package/src/utils/getFormData.ts +5 -0
- package/src/utils/index.ts +1 -0
- package/utils/getFormData.d.ts +2 -0
- package/utils/index.d.ts +1 -0
- package/utils/spec/getFormData.spec.d.ts +1 -0
|
@@ -29,6 +29,37 @@
|
|
|
29
29
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
|
+
/*!
|
|
33
|
+
* Copyright (c) 2015-2020, Salesforce.com, Inc.
|
|
34
|
+
* All rights reserved.
|
|
35
|
+
*
|
|
36
|
+
* Redistribution and use in source and binary forms, with or without
|
|
37
|
+
* modification, are permitted provided that the following conditions are met:
|
|
38
|
+
*
|
|
39
|
+
* 1. Redistributions of source code must retain the above copyright notice,
|
|
40
|
+
* this list of conditions and the following disclaimer.
|
|
41
|
+
*
|
|
42
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
43
|
+
* this list of conditions and the following disclaimer in the documentation
|
|
44
|
+
* and/or other materials provided with the distribution.
|
|
45
|
+
*
|
|
46
|
+
* 3. Neither the name of Salesforce.com nor the names of its contributors may
|
|
47
|
+
* be used to endorse or promote products derived from this software without
|
|
48
|
+
* specific prior written permission.
|
|
49
|
+
*
|
|
50
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
51
|
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
52
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
53
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
54
|
+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
55
|
+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
56
|
+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
57
|
+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
58
|
+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
59
|
+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
60
|
+
* POSSIBILITY OF SUCH DAMAGE.
|
|
61
|
+
*/
|
|
62
|
+
|
|
32
63
|
/*!
|
|
33
64
|
* Copyright (c) 2018, Salesforce.com, Inc.
|
|
34
65
|
* All rights reserved.
|
package/node/utils/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@types/jest": "27.4.0",
|
|
50
50
|
"@types/mime": "2.0.3",
|
|
51
51
|
"@types/pem": "1.9.6",
|
|
52
|
-
"@types/tough-cookie": "4.0.
|
|
52
|
+
"@types/tough-cookie": "4.0.2",
|
|
53
53
|
"copyfiles": "2.4.1",
|
|
54
54
|
"cp": "0.2.0",
|
|
55
55
|
"cypress": "7.7.0",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"axios-cookiejar-support": "1.0.1",
|
|
83
83
|
"form-data": "4.0.0",
|
|
84
84
|
"https": "1.0.0",
|
|
85
|
-
"tough-cookie": "4.
|
|
85
|
+
"tough-cookie": "4.1.3"
|
|
86
86
|
},
|
|
87
|
-
"version": "4.5.
|
|
87
|
+
"version": "4.5.1"
|
|
88
88
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as NodeFormData from 'form-data'
|
|
2
2
|
import { convertToCSV } from '../utils/convertToCsv'
|
|
3
|
+
import { isNode } from '../utils'
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* One of the approaches SASjs takes to send tables-formatted JSON (see README)
|
|
@@ -26,12 +27,15 @@ export const generateFileUploadForm = (
|
|
|
26
27
|
)
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
// INFO: unfortunately it is not possible to check if formData is instance of NodeFormData or FormData because it will return true for both
|
|
31
|
+
if (isNode()) {
|
|
32
|
+
// INFO: environment is Node and formData is instance of NodeFormData
|
|
33
|
+
;(formData as NodeFormData).append(name, csv, {
|
|
31
34
|
filename: `${name}.csv`,
|
|
32
35
|
contentType: 'application/csv'
|
|
33
36
|
})
|
|
34
37
|
} else {
|
|
38
|
+
// INFO: environment is Browser and formData is instance of FormData
|
|
35
39
|
const file = new Blob([csv], {
|
|
36
40
|
type: 'application/csv'
|
|
37
41
|
})
|
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
LoginRequiredError
|
|
11
11
|
} from '../types/errors'
|
|
12
12
|
import { generateFileUploadForm } from '../file/generateFileUploadForm'
|
|
13
|
-
|
|
14
13
|
import { RequestClient } from '../request/RequestClient'
|
|
14
|
+
import { getFormData } from '../utils'
|
|
15
15
|
|
|
16
16
|
import {
|
|
17
17
|
isRelativePath,
|
|
@@ -53,8 +53,7 @@ export class SasjsJobExecutor extends BaseJobExecutor {
|
|
|
53
53
|
* Use the available form data object (FormData in Browser, NodeFormData in
|
|
54
54
|
* Node)
|
|
55
55
|
*/
|
|
56
|
-
let formData =
|
|
57
|
-
typeof FormData === 'undefined' ? new NodeFormData() : new FormData()
|
|
56
|
+
let formData = getFormData()
|
|
58
57
|
|
|
59
58
|
if (data) {
|
|
60
59
|
// file upload approach
|
|
@@ -16,10 +16,11 @@ import { SASViyaApiClient } from '../SASViyaApiClient'
|
|
|
16
16
|
import {
|
|
17
17
|
isRelativePath,
|
|
18
18
|
parseSasViyaDebugResponse,
|
|
19
|
-
appendExtraResponseAttributes
|
|
19
|
+
appendExtraResponseAttributes,
|
|
20
|
+
parseWeboutResponse,
|
|
21
|
+
getFormData
|
|
20
22
|
} from '../utils'
|
|
21
23
|
import { BaseJobExecutor } from './JobExecutor'
|
|
22
|
-
import { parseWeboutResponse } from '../utils/parseWeboutResponse'
|
|
23
24
|
|
|
24
25
|
export interface WaitingRequstPromise {
|
|
25
26
|
promise: Promise<any> | null
|
|
@@ -112,8 +113,7 @@ export class WebJobExecutor extends BaseJobExecutor {
|
|
|
112
113
|
* Use the available form data object (FormData in Browser, NodeFormData in
|
|
113
114
|
* Node)
|
|
114
115
|
*/
|
|
115
|
-
let formData =
|
|
116
|
-
typeof FormData === 'undefined' ? new NodeFormData() : new FormData()
|
|
116
|
+
let formData = getFormData()
|
|
117
117
|
|
|
118
118
|
if (data) {
|
|
119
119
|
const stringifiedData = JSON.stringify(data)
|
package/src/utils/index.ts
CHANGED
package/utils/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|