@sasjs/adapter 4.4.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.
@@ -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)
@@ -1,6 +1,9 @@
1
1
  export interface PollOptions {
2
2
  maxPollCount: number
3
- pollInterval: number
4
- streamLog: boolean
3
+ pollInterval: number // milliseconds
4
+ pollStrategy?: PollStrategy
5
+ streamLog?: boolean
5
6
  logFolderPath?: string
6
7
  }
8
+
9
+ export type PollStrategy = PollOptions[]
@@ -0,0 +1,5 @@
1
+ import { isNode } from './'
2
+ import * as NodeFormData from 'form-data'
3
+
4
+ export const getFormData = () =>
5
+ isNode() ? new NodeFormData() : new FormData()
@@ -20,3 +20,4 @@ export * from './parseWeboutResponse'
20
20
  export * from './serialize'
21
21
  export * from './splitChunks'
22
22
  export * from './validateInput'
23
+ export * from './getFormData'
@@ -1,6 +1,8 @@
1
1
  export interface PollOptions {
2
2
  maxPollCount: number;
3
3
  pollInterval: number;
4
- streamLog: boolean;
4
+ pollStrategy?: PollStrategy;
5
+ streamLog?: boolean;
5
6
  logFolderPath?: string;
6
7
  }
8
+ export declare type PollStrategy = PollOptions[];
@@ -0,0 +1,2 @@
1
+ import * as NodeFormData from 'form-data';
2
+ export declare const getFormData: () => NodeFormData | FormData;
package/utils/index.d.ts CHANGED
@@ -20,3 +20,4 @@ export * from './parseWeboutResponse';
20
20
  export * from './serialize';
21
21
  export * from './splitChunks';
22
22
  export * from './validateInput';
23
+ export * from './getFormData';
@@ -0,0 +1 @@
1
+ export {};