mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-16 16:40:06 +00:00
Merge branch 'api-execution' of https://github.com/sasjs/adapter into issue17
This commit is contained in:
File diff suppressed because one or more lines are too long
294
docs/classes/reflection-560.reflection-1.sas9apiclient.html
Normal file
294
docs/classes/reflection-560.reflection-1.sas9apiclient.html
Normal file
File diff suppressed because one or more lines are too long
934
docs/classes/reflection-560.reflection-1.sasjs.html
Normal file
934
docs/classes/reflection-560.reflection-1.sasjs.html
Normal file
File diff suppressed because one or more lines are too long
892
docs/classes/reflection-560.reflection-1.sasviyaapiclient.html
Normal file
892
docs/classes/reflection-560.reflection-1.sasviyaapiclient.html
Normal file
File diff suppressed because one or more lines are too long
206
docs/classes/reflection-560.reflection-1.sessionmanager.html
Normal file
206
docs/classes/reflection-560.reflection-1.sessionmanager.html
Normal file
File diff suppressed because one or more lines are too long
@@ -319,7 +319,7 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in SASjs.ts:465</li>
|
<li>Defined in SASjs.ts:473</li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography tsd-comment-shorttext">
|
<div class="tsd-comment tsd-typography tsd-comment-shorttext">
|
||||||
@@ -587,7 +587,7 @@
|
|||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in SASjs.ts:1071</li>
|
<li>Defined in SASjs.ts:1065</li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<h4 class="tsd-returns-title">Returns <a href="../interfaces/types.sasjsrequest.html" class="tsd-signature-type">SASjsRequest</a><span class="tsd-signature-symbol">[]</span></h4>
|
<h4 class="tsd-returns-title">Returns <a href="../interfaces/types.sasjsrequest.html" class="tsd-signature-type">SASjsRequest</a><span class="tsd-signature-symbol">[]</span></h4>
|
||||||
@@ -730,13 +730,13 @@
|
|||||||
<a name="request" class="tsd-anchor"></a>
|
<a name="request" class="tsd-anchor"></a>
|
||||||
<h3>request</h3>
|
<h3>request</h3>
|
||||||
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
||||||
<li class="tsd-signature tsd-kind-icon">request<span class="tsd-signature-symbol">(</span>sasJob<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, data<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, params<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span>, loginRequiredCallback<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span>, accessToken<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></li>
|
<li class="tsd-signature tsd-kind-icon">request<span class="tsd-signature-symbol">(</span>sasJob<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, data<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, config<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span>, loginRequiredCallback<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span>, accessToken<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="tsd-descriptions">
|
<ul class="tsd-descriptions">
|
||||||
<li class="tsd-description">
|
<li class="tsd-description">
|
||||||
<aside class="tsd-sources">
|
<aside class="tsd-sources">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Defined in SASjs.ts:415</li>
|
<li>Defined in SASjs.ts:416</li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
<div class="tsd-comment tsd-typography tsd-comment-shorttext">
|
<div class="tsd-comment tsd-typography tsd-comment-shorttext">
|
||||||
@@ -765,10 +765,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<h5><span class="tsd-flag ts-flagOptional">Optional</span> params: <span class="tsd-signature-type">any</span></h5>
|
<h5><span class="tsd-flag ts-flagDefault value">Default value</span> config: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol"> = {}</span></h5>
|
||||||
<div class="tsd-comment tsd-typography tsd-comment-text">
|
<div class="tsd-comment tsd-typography tsd-comment-text">
|
||||||
<p>Provide any changes to the config here, for instance to
|
<p>Provide any changes to the config here, for instance to
|
||||||
enable / disable <code>debug</code>.</p>
|
enable / disable <code>debug</code>. Any change provided will override the global config,
|
||||||
|
for that particular function call.</p>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
|||||||
@@ -96,8 +96,8 @@
|
|||||||
<h3>Properties</h3>
|
<h3>Properties</h3>
|
||||||
<ul class="tsd-index-list">
|
<ul class="tsd-index-list">
|
||||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="types.sasjswaitingrequest.html#sasjob" class="tsd-kind-icon">SASjob</a></li>
|
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="types.sasjswaitingrequest.html#sasjob" class="tsd-kind-icon">SASjob</a></li>
|
||||||
|
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="types.sasjswaitingrequest.html#config" class="tsd-kind-icon">config</a></li>
|
||||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="types.sasjswaitingrequest.html#data" class="tsd-kind-icon">data</a></li>
|
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="types.sasjswaitingrequest.html#data" class="tsd-kind-icon">data</a></li>
|
||||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="types.sasjswaitingrequest.html#params" class="tsd-kind-icon">params</a></li>
|
|
||||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="types.sasjswaitingrequest.html#requestpromise" class="tsd-kind-icon">requestPromise</a></li>
|
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="types.sasjswaitingrequest.html#requestpromise" class="tsd-kind-icon">requestPromise</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
@@ -116,6 +116,16 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
</section>
|
</section>
|
||||||
|
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||||
|
<a name="config" class="tsd-anchor"></a>
|
||||||
|
<h3><span class="tsd-flag ts-flagOptional">Optional</span> config</h3>
|
||||||
|
<div class="tsd-signature tsd-kind-icon">config<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div>
|
||||||
|
<aside class="tsd-sources">
|
||||||
|
<ul>
|
||||||
|
<li>Defined in types/SASjsWaitingRequest.ts:13</li>
|
||||||
|
</ul>
|
||||||
|
</aside>
|
||||||
|
</section>
|
||||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||||
<a name="data" class="tsd-anchor"></a>
|
<a name="data" class="tsd-anchor"></a>
|
||||||
<h3>data</h3>
|
<h3>data</h3>
|
||||||
@@ -126,16 +136,6 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
</section>
|
</section>
|
||||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
|
||||||
<a name="params" class="tsd-anchor"></a>
|
|
||||||
<h3><span class="tsd-flag ts-flagOptional">Optional</span> params</h3>
|
|
||||||
<div class="tsd-signature tsd-kind-icon">params<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div>
|
|
||||||
<aside class="tsd-sources">
|
|
||||||
<ul>
|
|
||||||
<li>Defined in types/SASjsWaitingRequest.ts:13</li>
|
|
||||||
</ul>
|
|
||||||
</aside>
|
|
||||||
</section>
|
|
||||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||||
<a name="requestpromise" class="tsd-anchor"></a>
|
<a name="requestpromise" class="tsd-anchor"></a>
|
||||||
<h3>request<wbr>Promise</h3>
|
<h3>request<wbr>Promise</h3>
|
||||||
@@ -205,10 +205,10 @@
|
|||||||
<a href="types.sasjswaitingrequest.html#sasjob" class="tsd-kind-icon">SASjob</a>
|
<a href="types.sasjswaitingrequest.html#sasjob" class="tsd-kind-icon">SASjob</a>
|
||||||
</li>
|
</li>
|
||||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||||
<a href="types.sasjswaitingrequest.html#data" class="tsd-kind-icon">data</a>
|
<a href="types.sasjswaitingrequest.html#config" class="tsd-kind-icon">config</a>
|
||||||
</li>
|
</li>
|
||||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||||
<a href="types.sasjswaitingrequest.html#params" class="tsd-kind-icon">params</a>
|
<a href="types.sasjswaitingrequest.html#data" class="tsd-kind-icon">data</a>
|
||||||
</li>
|
</li>
|
||||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||||
<a href="types.sasjswaitingrequest.html#requestpromise" class="tsd-kind-icon">request<wbr>Promise</a>
|
<a href="types.sasjswaitingrequest.html#requestpromise" class="tsd-kind-icon">request<wbr>Promise</a>
|
||||||
|
|||||||
107
docs/modules/reflection-560.html
Normal file
107
docs/modules/reflection-560.html
Normal file
File diff suppressed because one or more lines are too long
125
docs/modules/reflection-560.reflection-1.html
Normal file
125
docs/modules/reflection-560.reflection-1.html
Normal file
File diff suppressed because one or more lines are too long
@@ -24,7 +24,7 @@
|
|||||||
"build": "react-scripts build",
|
"build": "react-scripts build",
|
||||||
"test": "react-scripts test",
|
"test": "react-scripts test",
|
||||||
"eject": "react-scripts eject",
|
"eject": "react-scripts eject",
|
||||||
"deploy": "npm run build && rsync -avhe ssh ./build/* --delete kriaco@sas.analytium.co.uk:/var/www/html/kriaco/sasjs-tests"
|
"deploy": "cd .. && npm run package:lib && cd sasjs-tests && npm i ../build/sasjs-adapter-5.0.0.tgz && npm run build && rsync -avhe ssh ./build/* --delete kriaco@sas.analytium.co.uk:/var/www/html/kriaco/sasjs-tests"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": "react-app"
|
"extends": "react-app"
|
||||||
|
|||||||
100
src/SASjs.ts
100
src/SASjs.ts
@@ -44,7 +44,7 @@ const requestRetryLimit = 5;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export default class SASjs {
|
export default class SASjs {
|
||||||
private sasjsConfig = new SASjsConfig();
|
private sasjsConfig: SASjsConfig = new SASjsConfig();
|
||||||
private jobsPath: string = "";
|
private jobsPath: string = "";
|
||||||
private logoutUrl: string = "";
|
private logoutUrl: string = "";
|
||||||
private loginUrl: string = "";
|
private loginUrl: string = "";
|
||||||
@@ -406,8 +406,9 @@ export default class SASjs {
|
|||||||
* Process.) Is prepended at runtime with the value of `appLoc`.
|
* Process.) Is prepended at runtime with the value of `appLoc`.
|
||||||
* @param data - A JSON object containing one or more tables to be sent to
|
* @param data - A JSON object containing one or more tables to be sent to
|
||||||
* SAS. Can be `null` if no inputs required.
|
* SAS. Can be `null` if no inputs required.
|
||||||
* @param params - Provide any changes to the config here, for instance to
|
* @param config - Provide any changes to the config here, for instance to
|
||||||
* enable / disable `debug`.
|
* enable / disable `debug`. Any change provided will override the global config,
|
||||||
|
* for that particular function call.
|
||||||
* @param loginRequiredCallback - provide a function here to be called if the
|
* @param loginRequiredCallback - provide a function here to be called if the
|
||||||
* user is not logged in (eg to display a login form). The request will be
|
* user is not logged in (eg to display a login form). The request will be
|
||||||
* resubmitted after logon.
|
* resubmitted after logon.
|
||||||
@@ -415,40 +416,47 @@ export default class SASjs {
|
|||||||
public async request(
|
public async request(
|
||||||
sasJob: string,
|
sasJob: string,
|
||||||
data: any,
|
data: any,
|
||||||
params?: any,
|
config: any = {},
|
||||||
loginRequiredCallback?: any,
|
loginRequiredCallback?: any,
|
||||||
accessToken?: string
|
accessToken?: string
|
||||||
) {
|
) {
|
||||||
|
let requestResponse;
|
||||||
|
|
||||||
|
config = {
|
||||||
|
...this.sasjsConfig,
|
||||||
|
...config,
|
||||||
|
};
|
||||||
|
|
||||||
sasJob = sasJob.startsWith("/") ? sasJob.replace("/", "") : sasJob;
|
sasJob = sasJob.startsWith("/") ? sasJob.replace("/", "") : sasJob;
|
||||||
if (
|
|
||||||
this.sasjsConfig.serverType === ServerType.SASViya &&
|
if (config.serverType === ServerType.SASViya && config.contextName) {
|
||||||
this.sasjsConfig.contextName
|
if (config.useComputeApi) {
|
||||||
) {
|
requestResponse = await this.executeJobViaComputeApi(
|
||||||
if (this.sasjsConfig.useComputeApi) {
|
|
||||||
return await this.executeJobViaComputeApi(
|
|
||||||
sasJob,
|
sasJob,
|
||||||
data,
|
data,
|
||||||
params,
|
config,
|
||||||
loginRequiredCallback,
|
loginRequiredCallback,
|
||||||
accessToken
|
accessToken
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return await this.executeJobViaJesApi(
|
requestResponse = await this.executeJobViaJesApi(
|
||||||
sasJob,
|
sasJob,
|
||||||
data,
|
data,
|
||||||
params,
|
config,
|
||||||
loginRequiredCallback,
|
loginRequiredCallback,
|
||||||
accessToken
|
accessToken
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return await this.executeJobViaJes(
|
requestResponse = await this.executeJobViaWeb(
|
||||||
sasJob,
|
sasJob,
|
||||||
data,
|
data,
|
||||||
params,
|
config,
|
||||||
loginRequiredCallback
|
loginRequiredCallback
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return requestResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -515,7 +523,7 @@ export default class SASjs {
|
|||||||
private async executeJobViaComputeApi(
|
private async executeJobViaComputeApi(
|
||||||
sasJob: string,
|
sasJob: string,
|
||||||
data: any,
|
data: any,
|
||||||
params?: any,
|
config: any,
|
||||||
loginRequiredCallback?: any,
|
loginRequiredCallback?: any,
|
||||||
accessToken?: string
|
accessToken?: string
|
||||||
) {
|
) {
|
||||||
@@ -527,7 +535,6 @@ export default class SASjs {
|
|||||||
},
|
},
|
||||||
SASjob: sasJob,
|
SASjob: sasJob,
|
||||||
data,
|
data,
|
||||||
params,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
sasjsWaitingRequest.requestPromise.promise = new Promise(
|
sasjsWaitingRequest.requestPromise.promise = new Promise(
|
||||||
@@ -536,13 +543,13 @@ export default class SASjs {
|
|||||||
await this.sasViyaApiClient
|
await this.sasViyaApiClient
|
||||||
?.executeComputeJob(
|
?.executeComputeJob(
|
||||||
sasJob,
|
sasJob,
|
||||||
this.sasjsConfig.contextName,
|
config.contextName,
|
||||||
this.sasjsConfig.debug,
|
config.debug,
|
||||||
data,
|
data,
|
||||||
accessToken
|
accessToken
|
||||||
)
|
)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (!this.sasjsConfig.debug) {
|
if (!config.debug) {
|
||||||
this.appendSasjsRequest(null, sasJob, null);
|
this.appendSasjsRequest(null, sasJob, null);
|
||||||
} else {
|
} else {
|
||||||
this.appendSasjsRequest(response, sasJob, null);
|
this.appendSasjsRequest(response, sasJob, null);
|
||||||
@@ -554,6 +561,7 @@ export default class SASjs {
|
|||||||
if (loginRequiredCallback) loginRequiredCallback(true);
|
if (loginRequiredCallback) loginRequiredCallback(true);
|
||||||
sasjsWaitingRequest.requestPromise.resolve = resolve;
|
sasjsWaitingRequest.requestPromise.resolve = resolve;
|
||||||
sasjsWaitingRequest.requestPromise.reject = reject;
|
sasjsWaitingRequest.requestPromise.reject = reject;
|
||||||
|
sasjsWaitingRequest.config = config;
|
||||||
this.sasjsWaitingRequests.push(sasjsWaitingRequest);
|
this.sasjsWaitingRequests.push(sasjsWaitingRequest);
|
||||||
} else {
|
} else {
|
||||||
reject({ MESSAGE: e || "Job execution failed" });
|
reject({ MESSAGE: e || "Job execution failed" });
|
||||||
@@ -568,7 +576,7 @@ export default class SASjs {
|
|||||||
private async executeJobViaJesApi(
|
private async executeJobViaJesApi(
|
||||||
sasJob: string,
|
sasJob: string,
|
||||||
data: any,
|
data: any,
|
||||||
params?: any,
|
config: any,
|
||||||
loginRequiredCallback?: any,
|
loginRequiredCallback?: any,
|
||||||
accessToken?: string
|
accessToken?: string
|
||||||
) {
|
) {
|
||||||
@@ -580,7 +588,6 @@ export default class SASjs {
|
|||||||
},
|
},
|
||||||
SASjob: sasJob,
|
SASjob: sasJob,
|
||||||
data,
|
data,
|
||||||
params,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
sasjsWaitingRequest.requestPromise.promise = new Promise(
|
sasjsWaitingRequest.requestPromise.promise = new Promise(
|
||||||
@@ -591,19 +598,20 @@ export default class SASjs {
|
|||||||
if (loginRequiredCallback) loginRequiredCallback(true);
|
if (loginRequiredCallback) loginRequiredCallback(true);
|
||||||
sasjsWaitingRequest.requestPromise.resolve = resolve;
|
sasjsWaitingRequest.requestPromise.resolve = resolve;
|
||||||
sasjsWaitingRequest.requestPromise.reject = reject;
|
sasjsWaitingRequest.requestPromise.reject = reject;
|
||||||
|
sasjsWaitingRequest.config = config;
|
||||||
this.sasjsWaitingRequests.push(sasjsWaitingRequest);
|
this.sasjsWaitingRequests.push(sasjsWaitingRequest);
|
||||||
} else {
|
} else {
|
||||||
resolve(
|
resolve(
|
||||||
await this.sasViyaApiClient
|
await this.sasViyaApiClient
|
||||||
?.executeJob(
|
?.executeJob(
|
||||||
sasJob,
|
sasJob,
|
||||||
this.sasjsConfig.contextName,
|
config.contextName,
|
||||||
this.sasjsConfig.debug,
|
config.debug,
|
||||||
data,
|
data,
|
||||||
accessToken
|
accessToken
|
||||||
)
|
)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (!this.sasjsConfig.debug) {
|
if (!config.debug) {
|
||||||
this.appendSasjsRequest(null, sasJob, null);
|
this.appendSasjsRequest(null, sasJob, null);
|
||||||
} else {
|
} else {
|
||||||
this.appendSasjsRequest(response, sasJob, null);
|
this.appendSasjsRequest(response, sasJob, null);
|
||||||
@@ -620,10 +628,10 @@ export default class SASjs {
|
|||||||
return sasjsWaitingRequest.requestPromise.promise;
|
return sasjsWaitingRequest.requestPromise.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async executeJobViaJes(
|
private async executeJobViaWeb(
|
||||||
sasJob: string,
|
sasJob: string,
|
||||||
data: any,
|
data: any,
|
||||||
params?: any,
|
config: any,
|
||||||
loginRequiredCallback?: any
|
loginRequiredCallback?: any
|
||||||
) {
|
) {
|
||||||
const sasjsWaitingRequest: SASjsWaitingRequest = {
|
const sasjsWaitingRequest: SASjsWaitingRequest = {
|
||||||
@@ -634,24 +642,19 @@ export default class SASjs {
|
|||||||
},
|
},
|
||||||
SASjob: sasJob,
|
SASjob: sasJob,
|
||||||
data,
|
data,
|
||||||
params,
|
|
||||||
};
|
};
|
||||||
const program = this.sasjsConfig.appLoc
|
const program = config.appLoc
|
||||||
? this.sasjsConfig.appLoc.replace(/\/?$/, "/") + sasJob.replace(/^\//, "")
|
? config.appLoc.replace(/\/?$/, "/") + sasJob.replace(/^\//, "")
|
||||||
: sasJob;
|
: sasJob;
|
||||||
const jobUri =
|
const jobUri =
|
||||||
this.sasjsConfig.serverType === "SASVIYA"
|
config.serverType === "SASVIYA" ? await this.getJobUri(sasJob) : "";
|
||||||
? await this.getJobUri(sasJob)
|
const apiUrl = `${config.serverUrl}${this.jobsPath}/?${
|
||||||
: "";
|
|
||||||
const apiUrl = `${this.sasjsConfig.serverUrl}${this.jobsPath}/?${
|
|
||||||
jobUri.length > 0
|
jobUri.length > 0
|
||||||
? "__program=" + program + "&_job=" + jobUri
|
? "__program=" + program + "&_job=" + jobUri
|
||||||
: "_program=" + program
|
: "_program=" + program
|
||||||
}`;
|
}`;
|
||||||
|
|
||||||
const inputParams = params ? params : {};
|
|
||||||
const requestParams = {
|
const requestParams = {
|
||||||
...inputParams,
|
|
||||||
...this.getRequestParamsWeb(),
|
...this.getRequestParamsWeb(),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -663,7 +666,7 @@ export default class SASjs {
|
|||||||
if (data) {
|
if (data) {
|
||||||
const stringifiedData = JSON.stringify(data);
|
const stringifiedData = JSON.stringify(data);
|
||||||
if (
|
if (
|
||||||
this.sasjsConfig.serverType === ServerType.SAS9 ||
|
config.serverType === ServerType.SAS9 ||
|
||||||
stringifiedData.length > 500000 ||
|
stringifiedData.length > 500000 ||
|
||||||
stringifiedData.includes(";")
|
stringifiedData.includes(";")
|
||||||
) {
|
) {
|
||||||
@@ -755,10 +758,7 @@ export default class SASjs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (response.redirected && config.serverType === ServerType.SAS9) {
|
||||||
response.redirected &&
|
|
||||||
this.sasjsConfig.serverType === ServerType.SAS9
|
|
||||||
) {
|
|
||||||
isRedirected = true;
|
isRedirected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -771,7 +771,7 @@ export default class SASjs {
|
|||||||
) {
|
) {
|
||||||
if (this.retryCountRequest < requestRetryLimit) {
|
if (this.retryCountRequest < requestRetryLimit) {
|
||||||
this.retryCountRequest++;
|
this.retryCountRequest++;
|
||||||
this.request(sasJob, data, params).then(
|
this.request(sasJob, data).then(
|
||||||
(res: any) => resolve(res),
|
(res: any) => resolve(res),
|
||||||
(err: any) => reject(err)
|
(err: any) => reject(err)
|
||||||
);
|
);
|
||||||
@@ -787,12 +787,10 @@ export default class SASjs {
|
|||||||
if (loginRequiredCallback) loginRequiredCallback(true);
|
if (loginRequiredCallback) loginRequiredCallback(true);
|
||||||
sasjsWaitingRequest.requestPromise.resolve = resolve;
|
sasjsWaitingRequest.requestPromise.resolve = resolve;
|
||||||
sasjsWaitingRequest.requestPromise.reject = reject;
|
sasjsWaitingRequest.requestPromise.reject = reject;
|
||||||
|
sasjsWaitingRequest.config = config;
|
||||||
this.sasjsWaitingRequests.push(sasjsWaitingRequest);
|
this.sasjsWaitingRequests.push(sasjsWaitingRequest);
|
||||||
} else {
|
} else {
|
||||||
if (
|
if (config.serverType === ServerType.SAS9 && config.debug) {
|
||||||
this.sasjsConfig.serverType === ServerType.SAS9 &&
|
|
||||||
this.sasjsConfig.debug
|
|
||||||
) {
|
|
||||||
this.updateUsername(responseText);
|
this.updateUsername(responseText);
|
||||||
const jsonResponseText = this.parseSAS9Response(responseText);
|
const jsonResponseText = this.parseSAS9Response(responseText);
|
||||||
|
|
||||||
@@ -804,8 +802,8 @@ export default class SASjs {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
this.sasjsConfig.serverType === ServerType.SASViya &&
|
config.serverType === ServerType.SASViya &&
|
||||||
this.sasjsConfig.debug
|
config.debug
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
this.parseSASVIYADebugResponse(responseText).then(
|
this.parseSASVIYADebugResponse(responseText).then(
|
||||||
@@ -851,11 +849,7 @@ export default class SASjs {
|
|||||||
|
|
||||||
private async resendWaitingRequests() {
|
private async resendWaitingRequests() {
|
||||||
for (const sasjsWaitingRequest of this.sasjsWaitingRequests) {
|
for (const sasjsWaitingRequest of this.sasjsWaitingRequests) {
|
||||||
this.request(
|
this.request(sasjsWaitingRequest.SASjob, sasjsWaitingRequest.data).then(
|
||||||
sasjsWaitingRequest.SASjob,
|
|
||||||
sasjsWaitingRequest.data,
|
|
||||||
sasjsWaitingRequest.params
|
|
||||||
).then(
|
|
||||||
(res: any) => {
|
(res: any) => {
|
||||||
sasjsWaitingRequest.requestPromise.resolve(res);
|
sasjsWaitingRequest.requestPromise.resolve(res);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -10,5 +10,5 @@ export interface SASjsWaitingRequest {
|
|||||||
};
|
};
|
||||||
SASjob: string;
|
SASjob: string;
|
||||||
data: any;
|
data: any;
|
||||||
params?: any;
|
config?: any;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user