@sasjs/adapter 3.7.3 → 3.7.6

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.
@@ -71,6 +71,8 @@ export declare class RequestClient implements HttpClient {
71
71
  }>;
72
72
  post<T>(url: string, data: any, accessToken: string | undefined, contentType?: string, overrideHeaders?: {
73
73
  [key: string]: string | number;
74
+ }, additionalSettings?: {
75
+ [key: string]: string | number;
74
76
  }): Promise<{
75
77
  result: T;
76
78
  etag: string;
package/package.json CHANGED
@@ -80,5 +80,5 @@
80
80
  "https": "1.0.0",
81
81
  "tough-cookie": "4.0.0"
82
82
  },
83
- "version": "3.7.3"
83
+ "version": "3.7.6"
84
84
  }
@@ -71,6 +71,8 @@ export declare class RequestClient implements HttpClient {
71
71
  }>;
72
72
  post<T>(url: string, data: any, accessToken: string | undefined, contentType?: string, overrideHeaders?: {
73
73
  [key: string]: string | number;
74
+ }, additionalSettings?: {
75
+ [key: string]: string | number;
74
76
  }): Promise<{
75
77
  result: T;
76
78
  etag: string;
@@ -37,7 +37,10 @@ export class SASjsApiClient {
37
37
  }>(
38
38
  'SASjsApi/drive/deploy',
39
39
  { fileTree: members, appLoc: appLoc },
40
- access_token
40
+ access_token,
41
+ undefined,
42
+ {},
43
+ { maxContentLength: Infinity, maxBodyLength: Infinity }
41
44
  )
42
45
 
43
46
  return Promise.resolve(result)
@@ -151,7 +151,7 @@ export class WebJobExecutor extends BaseJobExecutor {
151
151
 
152
152
  /* The NodeFormData object does not set the request header - so, set it */
153
153
  const contentType =
154
- formData instanceof NodeFormData
154
+ formData instanceof NodeFormData && typeof FormData === 'undefined'
155
155
  ? `multipart/form-data; boundary=${formData.getBoundary()}`
156
156
  : undefined
157
157
 
@@ -207,7 +207,8 @@ export class RequestClient implements HttpClient {
207
207
  data: any,
208
208
  accessToken: string | undefined,
209
209
  contentType = 'application/json',
210
- overrideHeaders: { [key: string]: string | number } = {}
210
+ overrideHeaders: { [key: string]: string | number } = {},
211
+ additionalSettings: { [key: string]: string | number } = {}
211
212
  ): Promise<{ result: T; etag: string }> {
212
213
  const headers = {
213
214
  ...this.getHeaders(accessToken, contentType),
@@ -215,7 +216,11 @@ export class RequestClient implements HttpClient {
215
216
  }
216
217
 
217
218
  return this.httpClient
218
- .post<T>(url, data, { headers, withCredentials: true })
219
+ .post<T>(url, data, {
220
+ headers,
221
+ withCredentials: true,
222
+ ...additionalSettings
223
+ })
219
224
  .then((response) => {
220
225
  throwIfError(response)
221
226
 
@@ -630,7 +635,7 @@ const parseError = (data: string) => {
630
635
  if (parts.length > 1) {
631
636
  const storedProcessPath = parts[1].split('<i>')[1].split('</i>')[0]
632
637
  const message = `Stored process not found: ${storedProcessPath}`
633
- return new JobExecutionError(404, message, '')
638
+ return new JobExecutionError(500, message, '')
634
639
  }
635
640
  }
636
641
  } catch (_) {}
@@ -644,7 +649,7 @@ const parseError = (data: string) => {
644
649
  if (parts.length > 1) {
645
650
  const log = parts[1].split('<pre>')[1].split('</pre>')[0]
646
651
  const message = `This request completed with errors.`
647
- return new JobExecutionError(404, message, log)
652
+ return new JobExecutionError(500, message, log)
648
653
  }
649
654
  }
650
655
  } catch (_) {}
@@ -12,6 +12,8 @@ export const getValidJson = (str: string | object): object => {
12
12
 
13
13
  if (typeof str === 'object') return str
14
14
 
15
+ if (str === '') return {}
16
+
15
17
  return JSON.parse(str)
16
18
  } catch (e) {
17
19
  if (e instanceof JsonParseArrayError) throw e