mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-16 00:20:06 +00:00
chore(git): Merge branch 'master' into auto-tests
This commit is contained in:
@@ -65,7 +65,7 @@ The below services need to be created on your SAS server, at the location specif
|
|||||||
```sas
|
```sas
|
||||||
filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
|
filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
|
||||||
%inc mc;
|
%inc mc;
|
||||||
filename ft15f001 temp;
|
filename ft15f001 temp lrecl=1000;
|
||||||
parmcards4;
|
parmcards4;
|
||||||
%webout(FETCH)
|
%webout(FETCH)
|
||||||
%webout(OPEN)
|
%webout(OPEN)
|
||||||
@@ -113,7 +113,7 @@ data _null_;
|
|||||||
```sas
|
```sas
|
||||||
filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
|
filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
|
||||||
%inc mc;
|
%inc mc;
|
||||||
filename ft15f001 temp;
|
filename ft15f001 temp lrecl=1000;
|
||||||
parmcards4;
|
parmcards4;
|
||||||
%webout(FETCH)
|
%webout(FETCH)
|
||||||
%webout(OPEN)
|
%webout(OPEN)
|
||||||
|
|||||||
@@ -916,8 +916,8 @@ export default class SASjs {
|
|||||||
return await this.sasJSApiClient?.deploy(dataJson, appLoc, authConfig)
|
return await this.sasJSApiClient?.deploy(dataJson, appLoc, authConfig)
|
||||||
}
|
}
|
||||||
|
|
||||||
public async executeJobSASjs(query: ExecutionQuery) {
|
public async executeJobSASjs(query: ExecutionQuery, authConfig?: AuthConfig) {
|
||||||
return await this.sasJSApiClient?.executeJob(query)
|
return await this.sasJSApiClient?.executeJob(query, authConfig)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -43,7 +43,9 @@ export class SASjsApiClient {
|
|||||||
return Promise.resolve(result)
|
return Promise.resolve(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
public async executeJob(query: ExecutionQuery) {
|
public async executeJob(query: ExecutionQuery, authConfig?: AuthConfig) {
|
||||||
|
const access_token = authConfig ? authConfig.access_token : undefined
|
||||||
|
|
||||||
const { result } = await this.requestClient.post<{
|
const { result } = await this.requestClient.post<{
|
||||||
status: string
|
status: string
|
||||||
message: string
|
message: string
|
||||||
@@ -51,7 +53,7 @@ export class SASjsApiClient {
|
|||||||
logPath?: string
|
logPath?: string
|
||||||
error?: {}
|
error?: {}
|
||||||
_webout?: string
|
_webout?: string
|
||||||
}>('SASjsApi/stp/execute', query, undefined)
|
}>('SASjsApi/stp/execute', query, access_token)
|
||||||
|
|
||||||
if (Object.keys(result).includes('_webout')) {
|
if (Object.keys(result).includes('_webout')) {
|
||||||
result._webout = parseWeboutResponse(result._webout!)
|
result._webout = parseWeboutResponse(result._webout!)
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import {
|
|||||||
} from '../utils'
|
} from '../utils'
|
||||||
import { BaseJobExecutor } from './JobExecutor'
|
import { BaseJobExecutor } from './JobExecutor'
|
||||||
import { parseWeboutResponse } from '../utils/parseWeboutResponse'
|
import { parseWeboutResponse } from '../utils/parseWeboutResponse'
|
||||||
|
import { Server } from 'https'
|
||||||
|
|
||||||
export interface WaitingRequstPromise {
|
export interface WaitingRequstPromise {
|
||||||
promise: Promise<any> | null
|
promise: Promise<any> | null
|
||||||
@@ -46,7 +47,7 @@ export class WebJobExecutor extends BaseJobExecutor {
|
|||||||
authConfig?: AuthConfig,
|
authConfig?: AuthConfig,
|
||||||
extraResponseAttributes: ExtraResponseAttributes[] = []
|
extraResponseAttributes: ExtraResponseAttributes[] = []
|
||||||
) {
|
) {
|
||||||
const loginCallback = loginRequiredCallback || (() => Promise.resolve())
|
const loginCallback = loginRequiredCallback
|
||||||
const program = isRelativePath(sasJob)
|
const program = isRelativePath(sasJob)
|
||||||
? config.appLoc
|
? config.appLoc
|
||||||
? config.appLoc.replace(/\/?$/, '/') + sasJob.replace(/^\//, '')
|
? config.appLoc.replace(/\/?$/, '/') + sasJob.replace(/^\//, '')
|
||||||
@@ -79,7 +80,7 @@ export class WebJobExecutor extends BaseJobExecutor {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
await loginCallback()
|
if (loginCallback) await loginCallback()
|
||||||
} else {
|
} else {
|
||||||
reject(new ErrorResponse(e?.message, e))
|
reject(new ErrorResponse(e?.message, e))
|
||||||
}
|
}
|
||||||
@@ -225,6 +226,15 @@ export class WebJobExecutor extends BaseJobExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (e instanceof LoginRequiredError) {
|
if (e instanceof LoginRequiredError) {
|
||||||
|
if (!loginRequiredCallback) {
|
||||||
|
reject(
|
||||||
|
new ErrorResponse(
|
||||||
|
'Request is not authenticated. Make sure .env file exists with valid credentials.',
|
||||||
|
e
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
this.appendWaitingRequest(() => {
|
this.appendWaitingRequest(() => {
|
||||||
return this.execute(
|
return this.execute(
|
||||||
sasJob,
|
sasJob,
|
||||||
@@ -243,7 +253,7 @@ export class WebJobExecutor extends BaseJobExecutor {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
await loginCallback()
|
if (loginCallback) await loginCallback()
|
||||||
} else {
|
} else {
|
||||||
reject(new ErrorResponse(e?.message, e))
|
reject(new ErrorResponse(e?.message, e))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user