1
0
mirror of https://github.com/sasjs/adapter.git synced 2025-12-11 09:24:35 +00:00

Compare commits

...

57 Commits

Author SHA1 Message Date
Krishna Acondy
f764f1f22f Merge pull request #94 from sasjs/sas-job-absolute-paths
feat(job-execution): support absolute paths to SAS jobs
2020-09-22 08:46:04 +01:00
Krishna Acondy
978af5037e Merge branch 'master' of https://github.com/sasjs/adapter into sas-job-absolute-paths 2020-09-22 08:38:13 +01:00
Krishna Acondy
39e88052c7 Merge pull request #101 from sasjs/dependabot/npm_and_yarn/semantic-release-17.1.2
chore(deps-dev): bump semantic-release from 17.1.1 to 17.1.2
2020-09-22 08:34:38 +01:00
dependabot-preview[bot]
889351caf1 chore(deps-dev): bump semantic-release from 17.1.1 to 17.1.2
Bumps [semantic-release](https://github.com/semantic-release/semantic-release) from 17.1.1 to 17.1.2.
- [Release notes](https://github.com/semantic-release/semantic-release/releases)
- [Commits](https://github.com/semantic-release/semantic-release/compare/v17.1.1...v17.1.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-09-22 07:33:28 +00:00
Krishna Acondy
e6476dc230 Merge pull request #102 from sasjs/dependabot/npm_and_yarn/webpack-4.44.2
chore(deps-dev): bump webpack from 4.44.1 to 4.44.2
2020-09-22 08:31:20 +01:00
dependabot-preview[bot]
e7de45c94f chore(deps-dev): bump webpack from 4.44.1 to 4.44.2
Bumps [webpack](https://github.com/webpack/webpack) from 4.44.1 to 4.44.2.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v4.44.1...v4.44.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-09-22 07:30:22 +00:00
Krishna Acondy
2f822aba71 Merge pull request #103 from sasjs/dependabot/npm_and_yarn/types/jest-26.0.14
chore(deps-dev): bump @types/jest from 26.0.13 to 26.0.14
2020-09-22 08:28:16 +01:00
dependabot-preview[bot]
ba687bf8e2 chore(deps-dev): bump @types/jest from 26.0.13 to 26.0.14
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 26.0.13 to 26.0.14.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-09-22 07:21:57 +00:00
Krishna Acondy
618cbe5a21 Merge pull request #104 from sasjs/dependabot/npm_and_yarn/ts-loader-8.0.4
chore(deps-dev): bump ts-loader from 8.0.3 to 8.0.4
2020-09-22 08:19:40 +01:00
Krishna Acondy
d723150b6d fix(job-execution): support relative paths with web approach 2020-09-21 19:45:23 +01:00
dependabot-preview[bot]
b1ad983ca5 chore(deps-dev): bump ts-loader from 8.0.3 to 8.0.4
Bumps [ts-loader](https://github.com/TypeStrong/ts-loader) from 8.0.3 to 8.0.4.
- [Release notes](https://github.com/TypeStrong/ts-loader/releases)
- [Changelog](https://github.com/TypeStrong/ts-loader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/ts-loader/compare/v8.0.3...8.0.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-09-21 18:19:59 +00:00
Krishna Acondy
4711d0510e Merge branch 'master' of https://github.com/sasjs/adapter into sas-job-absolute-paths 2020-09-21 08:47:19 +01:00
Krishna Acondy
93854c287f Merge pull request #100 from sasjs/descs
chore(doc): Update descriptions of SASjsConfig properties
2020-09-21 08:45:29 +01:00
Krishna Acondy
687a3047fd chore(*): remove trailing slashes 2020-09-21 08:38:03 +01:00
Krishna Acondy
c067c6e74d chore(*): remove log 2020-09-21 08:26:18 +01:00
Allan Bowe
04b44f40ba docs: updates to description of SASjsConfig items 2020-09-20 20:23:04 +02:00
Allan Bowe
ce2126bd34 docs: typedocs 2020-09-20 20:22:44 +02:00
Krishna Acondy
638efe8899 chore(build): add terser plugin for code optimization 2020-09-20 12:00:02 +01:00
Krishna Acondy
23353355e4 chore(build): update webpack config to minify built code 2020-09-20 11:59:37 +01:00
Krishna Acondy
1be64798c5 fix(job-execution): fetch log when webout is not available 2020-09-20 11:42:49 +01:00
Krishna Acondy
a92a458cf1 chore(types): export types from index 2020-09-20 11:42:29 +01:00
Krishna Acondy
703fdf9c02 fix(job-execution): fix program name 2020-09-20 10:35:32 +01:00
Krishna Acondy
bc239cf5d6 fix(job-execution): fix program path for absolute path jobs 2020-09-18 17:40:35 +01:00
Krishna Acondy
86780db478 fix(job-execution): fix program variable for absolute path jobs 2020-09-18 17:32:12 +01:00
Krishna Acondy
5d5afa20c7 chore(doc): update documentation 2020-09-18 16:49:54 +01:00
Krishna Acondy
d662c1a981 Merge branch 'master' into sas-job-absolute-paths 2020-09-18 16:45:13 +01:00
Allan Bowe
927bb8c78c Merge pull request #91 from sasjs/issue90
Issue90
2020-09-18 17:44:08 +02:00
Mihajlo Medjedovic
509171c484 chore: typedoc 2020-09-18 17:41:09 +02:00
Krishna Acondy
ae98b50a21 Merge branch 'master' into issue90 2020-09-18 16:38:23 +01:00
Krishna Acondy
f3abafd5ed Merge branch 'master' into sas-job-absolute-paths 2020-09-18 15:06:50 +01:00
Yury Shkoda
939e6803e1 Merge pull request #99 from sasjs/issue-96
fix(error): added error handling for http responses with status 401 and 403
2020-09-18 13:30:11 +03:00
Yury Shkoda
6a055a4fc6 fix(error): added error handling for http responses with status 401 and 403 2020-09-18 12:54:17 +03:00
Krishna Acondy
5076ea696c feat(job-execution): support absolute job paths for JES and web approaches 2020-09-18 09:24:33 +01:00
Krishna Acondy
3a60e6422c chore(sasjs-tests): fix failing test, add test for absolute path 2020-09-18 08:33:46 +01:00
Krishna Acondy
b90b5d5c03 Merge branch 'master' of https://github.com/sasjs/adapter into sas-job-absolute-paths 2020-09-18 08:25:21 +01:00
Yury Shkoda
6fb9d11712 Merge pull request #92 from sasjs/issue87
Issue87
2020-09-18 08:41:59 +03:00
Mihajlo Medjedovic
d61728e52a chore: removed extra console.error 2020-09-17 12:21:49 +02:00
Mihajlo Medjedovic
a9339b52ed Merge branch 'master' into issue87 2020-09-17 12:20:42 +02:00
Mihajlo Medjedovic
970e14b2e1 Merge branch 'master' into issue90 2020-09-17 12:19:45 +02:00
Krishna Acondy
d5a8140d4f feat(job-execution): populate folder map on demand 2020-09-17 09:35:43 +01:00
Krishna Acondy
dcc5a1efdd Merge pull request #95 from sasjs/issue-90
docs: fixed typos and updated docs
2020-09-17 08:08:20 +01:00
Yury Shkoda
d517897615 docs: fyxed typos and updated docs 2020-09-16 11:34:59 +03:00
Krishna Acondy
5f5d84da87 feat(job-execution): support absolute paths to SAS jobs 2020-09-16 08:49:18 +01:00
Mihajlo Medjedovic
8650d91672 Merge branch 'master' into issue87 2020-09-15 13:33:14 +02:00
Mihajlo Medjedovic
4c9e48550e chore: lint 2020-09-15 13:24:20 +02:00
Mihajlo Medjedovic
8504ec6c4d fix: error response stringify and added raw field 2020-09-15 13:18:26 +02:00
Mihajlo Medjedovic
a0ad8b3f34 Merge branch 'master' into issue90 2020-09-15 13:13:52 +02:00
Yury Shkoda
4ed150aff9 Merged with master branch 2020-09-15 12:55:15 +03:00
Yury Shkoda
81be11f3b9 refactor(error): refactoring errors and fixing spelling 2020-09-15 12:48:33 +03:00
Krishna Acondy
e7e238e20b Merge pull request #89 from sasjs/issue-84
docs: updated docs for 'executeScript()'
2020-09-15 09:45:38 +01:00
Mihajlo Medjedovic
53990a9ba3 feat: added type for error response 2020-09-14 16:47:54 +02:00
Mihajlo Medjedovic
afec560952 fix: JES API error handling if job does not exist 2020-09-14 16:26:27 +02:00
Yury Shkoda
17d8ea8b17 docs: updated docs for 'executeScript()' 2020-09-14 15:55:18 +03:00
Yury Shkoda
9af45799b9 Merge pull request #88 from sasjs/issue-84
feat(executeScript): added ability to run arbitrary sas code to 'executeScript()'
2020-09-14 15:33:39 +03:00
Yury Shkoda
fdbb87ed7b docs: updated docs 2020-09-14 15:23:48 +03:00
Yury Shkoda
5e7ffc1f58 Merge branch 'master' into issue-84 2020-09-14 15:21:59 +03:00
Yury Shkoda
3369b28933 feat(executeScript): added ability to run arbitrary sas code to 'executeScript()' 2020-09-14 15:21:06 +03:00
72 changed files with 13945 additions and 1829 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,231 @@
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>FileUploader | @sasjs/adapter</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<ul class="results-priority" style="display:none">
</ul>
<a href="../index.html" class="title">@sasjs/adapter</a>
&emsp;<a href="https://github.com/sasjs/adapter" class="title">SASjs on Github</a>
&emsp;<a href="https://sasjs.io" class="title">SASjs.io</a>
&emsp;<a href="https://github.com/sasjs/cli" class="title">SASjs CLI</a>
&emsp;<a href="https://github.com/sasjs/react-seed-app" class="title">React Seed App</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked />
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li>
<a href="../modules/reflection-724.html"></a>
</li>
<li>
<a href="../modules/reflection-724.reflection-187.html"></a>
</li>
<li>
<a href="reflection-724.reflection-187.fileuploader.html">FileUploader</a>
</li>
</ul>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-3 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation outline primary">
<a style="margin-left:0em" href="../globals.html">Globals</a>
<ul style="display:none">
{&quot;SAS Adapter&quot;:{&quot;SASjs&quot;:&quot;classes/reflection-717.reflection-180.sasjs&quot;,&quot;Types&quot;:&quot;modules/types&quot;},&quot;SAS Viya API Client&quot;:&quot;classes/reflection-717.reflection-180.sasviyaapiclient&quot;,&quot;SAS 9 API Client&quot;:&quot;classes/reflection-717.reflection-180.sas9apiclient&quot;}
</ul>
</nav>
</div>
<div class="col-7 offset-3 col-content">
<h1>Class FileUploader</h1>
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li>
<span class="target">FileUploader</span>
</li>
</ul>
</section>
<section class="tsd-panel-group tsd-index-group">
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section ">
<h3>Constructors</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-constructor tsd-parent-kind-class"><a href="reflection-724.reflection-187.fileuploader.html#constructor" class="tsd-kind-icon">constructor</a></li>
</ul>
</section>
<section class="tsd-index-section ">
<h3>Methods</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-method tsd-parent-kind-class"><a href="reflection-724.reflection-187.fileuploader.html#uploadfile" class="tsd-kind-icon">uploadFile</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Constructors</h2>
<section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class">
<a name="constructor" class="tsd-anchor"></a>
<h3>constructor</h3>
<ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">new <wbr>File<wbr>Uploader<span class="tsd-signature-symbol">(</span>appLoc<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, serverUrl<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, jobsPath<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, setCsrfTokenWeb<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, csrfToken<span class="tsd-signature-symbol">?: </span><a href="../interfaces/types.csrftoken.html" class="tsd-signature-type">CsrfToken</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="reflection-724.reflection-187.fileuploader.html" class="tsd-signature-type">FileUploader</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in
<a href="https://github.com/sasjs/adapter/blob/master/src/FileUploader.ts#L7">
FileUploader.ts:7
</a>
</li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>appLoc: <span class="tsd-signature-type">string</span></h5>
</li>
<li>
<h5>serverUrl: <span class="tsd-signature-type">string</span></h5>
</li>
<li>
<h5>jobsPath: <span class="tsd-signature-type">string</span></h5>
</li>
<li>
<h5>setCsrfTokenWeb: <span class="tsd-signature-type">any</span></h5>
</li>
<li>
<h5><span class="tsd-flag ts-flagDefault value">Default value</span> csrfToken: <a href="../interfaces/types.csrftoken.html" class="tsd-signature-type">CsrfToken</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> = null</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <a href="reflection-724.reflection-187.fileuploader.html" class="tsd-signature-type">FileUploader</a></h4>
</li>
</ul>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Methods</h2>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="uploadfile" class="tsd-anchor"></a>
<h3>upload<wbr>File</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">upload<wbr>File<span class="tsd-signature-symbol">(</span>sasJob<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, files<span class="tsd-signature-symbol">: </span><a href="../interfaces/types.uploadfile.html" class="tsd-signature-type">UploadFile</a><span class="tsd-signature-symbol">[]</span>, params<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</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">&lt;</span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">&gt;</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in
<a href="https://github.com/sasjs/adapter/blob/master/src/FileUploader.ts#L20">
FileUploader.ts:20
</a>
</li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>sasJob: <span class="tsd-signature-type">string</span></h5>
</li>
<li>
<h5>files: <a href="../interfaces/types.uploadfile.html" class="tsd-signature-type">UploadFile</a><span class="tsd-signature-symbol">[]</span></h5>
</li>
<li>
<h5>params: <span class="tsd-signature-type">any</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">&gt;</span></h4>
</li>
</ul>
</section>
</section>
<!--{&quot;options&quot;:&quot;/Users/allan/git/adapter&quot;,&quot;tsconfig&quot;:&quot;/Users/allan/git/adapter&quot;,&quot;inputFiles&quot;:[&quot;/Users/allan/git/adapter/src/FileUploader.ts&quot;,&quot;/Users/allan/git/adapter/src/SAS9ApiClient.ts&quot;,&quot;/Users/allan/git/adapter/src/SASViyaApiClient.ts&quot;,&quot;/Users/allan/git/adapter/src/SASjs.ts&quot;,&quot;/Users/allan/git/adapter/src/SessionManager.ts&quot;,&quot;/Users/allan/git/adapter/src/index.ts&quot;,&quot;/Users/allan/git/adapter/src/types/Context.ts&quot;,&quot;/Users/allan/git/adapter/src/types/CsrfToken.ts&quot;,&quot;/Users/allan/git/adapter/src/types/ErrorResponse.ts&quot;,&quot;/Users/allan/git/adapter/src/types/Folder.ts&quot;,&quot;/Users/allan/git/adapter/src/types/Job.ts&quot;,&quot;/Users/allan/git/adapter/src/types/JobDefinition.ts&quot;,&quot;/Users/allan/git/adapter/src/types/JobResult.ts&quot;,&quot;/Users/allan/git/adapter/src/types/Link.ts&quot;,&quot;/Users/allan/git/adapter/src/types/SASjsConfig.ts&quot;,&quot;/Users/allan/git/adapter/src/types/SASjsRequest.ts&quot;,&quot;/Users/allan/git/adapter/src/types/SASjsWaitingRequest.ts&quot;,&quot;/Users/allan/git/adapter/src/types/ServerType.ts&quot;,&quot;/Users/allan/git/adapter/src/types/Session.ts&quot;,&quot;/Users/allan/git/adapter/src/types/UploadFile.ts&quot;,&quot;/Users/allan/git/adapter/src/types/index.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/asyncForEach.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/compareTimestamps.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/convertToCsv.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/formatDataForRequest.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/index.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isAuthorizeFormRequired.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isIeOrEdge.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isLoginRequired.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isLoginSuccess.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isUri.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isUrl.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/makeRequest.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/needsRetry.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/parseAndSubmitAuthorizeForm.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/parseGeneratedCode.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/parseSasViyaLog.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/parseSourceCode.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/parseWeboutResponse.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/serialize.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/splitChunks.ts&quot;],&quot;mode&quot;:1,&quot;includeDeclarations&quot;:true,&quot;entryPoint&quot;:&quot;&quot;,&quot;exclude&quot;:[&quot;**/*+(index|.spec|.e2e).ts&quot;],&quot;externalPattern&quot;:[],&quot;excludeExternals&quot;:true,&quot;excludeNotExported&quot;:true,&quot;excludeNotDocumented&quot;:false,&quot;excludePrivate&quot;:true,&quot;excludeProtected&quot;:false,&quot;ignoreCompilerErrors&quot;:true,&quot;disableSources&quot;:false,&quot;includes&quot;:&quot;&quot;,&quot;media&quot;:&quot;&quot;,&quot;out&quot;:&quot;docs&quot;,&quot;json&quot;:&quot;&quot;,&quot;theme&quot;:&quot;./node_modules/typedoc-neo-theme/bin/default&quot;,&quot;name&quot;:&quot;&quot;,&quot;includeVersion&quot;:false,&quot;excludeTags&quot;:[],&quot;readme&quot;:&quot;&quot;,&quot;defaultCategory&quot;:&quot;Other&quot;,&quot;categoryOrder&quot;:[],&quot;categorizeByGroup&quot;:true,&quot;gitRevision&quot;:&quot;&quot;,&quot;gitRemote&quot;:&quot;origin&quot;,&quot;gaID&quot;:&quot;&quot;,&quot;gaSite&quot;:&quot;auto&quot;,&quot;hideGenerator&quot;:false,&quot;toc&quot;:[],&quot;disableOutputCheck&quot;:true,&quot;help&quot;:false,&quot;version&quot;:false,&quot;plugin&quot;:[],&quot;logger&quot;:&quot;console&quot;,&quot;listInvalidSymbolLinks&quot;:false,&quot;links&quot;:[{&quot;label&quot;:&quot;SASjs on Github&quot;,&quot;url&quot;:&quot;https://github.com/sasjs/adapter&quot;},{&quot;label&quot;:&quot;SASjs.io&quot;,&quot;url&quot;:&quot;https://sasjs.io&quot;},{&quot;label&quot;:&quot;SASjs CLI&quot;,&quot;url&quot;:&quot;https://github.com/sasjs/cli&quot;},{&quot;label&quot;:&quot;React Seed App&quot;,&quot;url&quot;:&quot;https://github.com/sasjs/react-seed-app&quot;}],&quot;outline&quot;:[{&quot;SAS Adapter&quot;:{&quot;SASjs&quot;:&quot;classes/reflection-717.reflection-180.sasjs&quot;,&quot;Types&quot;:&quot;modules/types&quot;},&quot;SAS Viya API Client&quot;:&quot;classes/reflection-717.reflection-180.sasviyaapiclient&quot;,&quot;SAS 9 API Client&quot;:&quot;classes/reflection-717.reflection-180.sas9apiclient&quot;}],&quot;source&quot;:[{&quot;path&quot;:&quot;https://github.com/sasjs/adapter/blob/master/src/&quot;,&quot;line&quot;:&quot;L&quot;}],&quot;disableAutoModuleName&quot;:&quot;false&quot;}-->
</div>
<div class="col-2 col-menu secondary-menu">
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
</ul>
<ul class="current">
<li class="current tsd-kind-class tsd-parent-kind-module root">
<a href="reflection-724.reflection-187.fileuploader.html" class="tsd-kind-icon">File<wbr>Uploader</a>
<ul>
<li class=" tsd-kind-constructor tsd-parent-kind-class">
<a href="reflection-724.reflection-187.fileuploader.html#constructor" class="tsd-kind-icon">constructor</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="reflection-724.reflection-187.fileuploader.html#uploadfile" class="tsd-kind-icon">upload<wbr>File</a>
</li>
</ul>
</li>
</ul>
<ul class="after-current">
<li class=" tsd-kind-class tsd-parent-kind-module root">
<a href="reflection-724.reflection-187.sas9apiclient.html" class="tsd-kind-icon">SAS9<wbr>Api<wbr>Client</a>
</li>
<li class=" tsd-kind-class tsd-parent-kind-module root">
<a href="reflection-724.reflection-187.sasviyaapiclient.html" class="tsd-kind-icon">SASViya<wbr>Api<wbr>Client</a>
</li>
<li class=" tsd-kind-class tsd-parent-kind-module root">
<a href="reflection-724.reflection-187.sasjs.html" class="tsd-kind-icon">SASjs</a>
</li>
<li class=" tsd-kind-class tsd-parent-kind-module root">
<a href="reflection-724.reflection-187.sessionmanager.html" class="tsd-kind-icon">Session<wbr>Manager</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="http://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="../assets/js/main.js"></script>
</body>
</html>

View File

@@ -0,0 +1,312 @@
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>SAS9ApiClient | @sasjs/adapter</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<ul class="results-priority" style="display:none">
</ul>
<a href="../index.html" class="title">@sasjs/adapter</a>
&emsp;<a href="https://github.com/sasjs/adapter" class="title">SASjs on Github</a>
&emsp;<a href="https://sasjs.io" class="title">SASjs.io</a>
&emsp;<a href="https://github.com/sasjs/cli" class="title">SASjs CLI</a>
&emsp;<a href="https://github.com/sasjs/react-seed-app" class="title">React Seed App</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked />
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li>
<a href="../modules/reflection-724.html"></a>
</li>
<li>
<a href="../modules/reflection-724.reflection-187.html"></a>
</li>
<li>
<a href="reflection-724.reflection-187.sas9apiclient.html">SAS9ApiClient</a>
</li>
</ul>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-3 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation outline primary">
<a style="margin-left:0em" href="../globals.html">Globals</a>
<ul style="display:none">
{&quot;SAS Adapter&quot;:{&quot;SASjs&quot;:&quot;classes/reflection-717.reflection-180.sasjs&quot;,&quot;Types&quot;:&quot;modules/types&quot;},&quot;SAS Viya API Client&quot;:&quot;classes/reflection-717.reflection-180.sasviyaapiclient&quot;,&quot;SAS 9 API Client&quot;:&quot;classes/reflection-717.reflection-180.sas9apiclient&quot;}
</ul>
</nav>
</div>
<div class="col-7 offset-3 col-content">
<h1>Class SAS9ApiClient</h1>
<section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography tsd-comment-shorttext">
<div class="lead">
<p>A client for interfacing with the SAS9 REST API.</p>
</div>
</div></section>
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li>
<span class="target">SAS9ApiClient</span>
</li>
</ul>
</section>
<section class="tsd-panel-group tsd-index-group">
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section ">
<h3>Constructors</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-constructor tsd-parent-kind-class"><a href="reflection-724.reflection-187.sas9apiclient.html#constructor" class="tsd-kind-icon">constructor</a></li>
</ul>
</section>
<section class="tsd-index-section ">
<h3>Methods</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-method tsd-parent-kind-class"><a href="reflection-724.reflection-187.sas9apiclient.html#executescript" class="tsd-kind-icon">executeScript</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="reflection-724.reflection-187.sas9apiclient.html#getconfig" class="tsd-kind-icon">getConfig</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="reflection-724.reflection-187.sas9apiclient.html#setconfig" class="tsd-kind-icon">setConfig</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Constructors</h2>
<section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class">
<a name="constructor" class="tsd-anchor"></a>
<h3>constructor</h3>
<ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">new SAS9<wbr>Api<wbr>Client<span class="tsd-signature-symbol">(</span>serverUrl<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><a href="reflection-724.reflection-187.sas9apiclient.html" class="tsd-signature-type">SAS9ApiClient</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in
<a href="https://github.com/sasjs/adapter/blob/master/src/SAS9ApiClient.ts#L7">
SAS9ApiClient.ts:7
</a>
</li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>serverUrl: <span class="tsd-signature-type">string</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <a href="reflection-724.reflection-187.sas9apiclient.html" class="tsd-signature-type">SAS9ApiClient</a></h4>
</li>
</ul>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Methods</h2>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="executescript" class="tsd-anchor"></a>
<h3>execute<wbr>Script</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">execute<wbr>Script<span class="tsd-signature-symbol">(</span>linesOfCode<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span>, serverName<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, repositoryName<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">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in
<a href="https://github.com/sasjs/adapter/blob/master/src/SAS9ApiClient.ts#L35">
SAS9ApiClient.ts:35
</a>
</li>
</ul>
</aside>
<div class="tsd-comment tsd-typography tsd-comment-shorttext">
<div class="lead">
<p>Executes code on a SAS9 server.</p>
</div>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>linesOfCode: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></h5>
<div class="tsd-comment tsd-typography tsd-comment-text">
<p>an array of code lines to execute.</p>
</div>
</li>
<li>
<h5>serverName: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography tsd-comment-text">
<p>the server to execute the code on.</p>
</div>
</li>
<li>
<h5>repositoryName: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography tsd-comment-text">
<p>the repository to execute the code in.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">&gt;</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="getconfig" class="tsd-anchor"></a>
<h3>get<wbr>Config</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">get<wbr>Config<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">object</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in
<a href="https://github.com/sasjs/adapter/blob/master/src/SAS9ApiClient.ts#L15">
SAS9ApiClient.ts:15
</a>
</li>
</ul>
</aside>
<div class="tsd-comment tsd-typography tsd-comment-shorttext">
<div class="lead">
<p>Returns an object containing server URL.</p>
</div>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">object</span></h4>
<ul class="tsd-parameters">
<li class="tsd-parameter">
<h5>server<wbr>Url<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5>
</li>
</ul>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="setconfig" class="tsd-anchor"></a>
<h3>set<wbr>Config</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">set<wbr>Config<span class="tsd-signature-symbol">(</span>serverUrl<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">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in
<a href="https://github.com/sasjs/adapter/blob/master/src/SAS9ApiClient.ts#L25">
SAS9ApiClient.ts:25
</a>
</li>
</ul>
</aside>
<div class="tsd-comment tsd-typography tsd-comment-shorttext">
<div class="lead">
<p>Updates server URL which is not null.</p>
</div>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>serverUrl: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography tsd-comment-text">
<p>URL of the server to be set.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
</section>
<!--{&quot;options&quot;:&quot;/Users/allan/git/adapter&quot;,&quot;tsconfig&quot;:&quot;/Users/allan/git/adapter&quot;,&quot;inputFiles&quot;:[&quot;/Users/allan/git/adapter/src/FileUploader.ts&quot;,&quot;/Users/allan/git/adapter/src/SAS9ApiClient.ts&quot;,&quot;/Users/allan/git/adapter/src/SASViyaApiClient.ts&quot;,&quot;/Users/allan/git/adapter/src/SASjs.ts&quot;,&quot;/Users/allan/git/adapter/src/SessionManager.ts&quot;,&quot;/Users/allan/git/adapter/src/index.ts&quot;,&quot;/Users/allan/git/adapter/src/types/Context.ts&quot;,&quot;/Users/allan/git/adapter/src/types/CsrfToken.ts&quot;,&quot;/Users/allan/git/adapter/src/types/ErrorResponse.ts&quot;,&quot;/Users/allan/git/adapter/src/types/Folder.ts&quot;,&quot;/Users/allan/git/adapter/src/types/Job.ts&quot;,&quot;/Users/allan/git/adapter/src/types/JobDefinition.ts&quot;,&quot;/Users/allan/git/adapter/src/types/JobResult.ts&quot;,&quot;/Users/allan/git/adapter/src/types/Link.ts&quot;,&quot;/Users/allan/git/adapter/src/types/SASjsConfig.ts&quot;,&quot;/Users/allan/git/adapter/src/types/SASjsRequest.ts&quot;,&quot;/Users/allan/git/adapter/src/types/SASjsWaitingRequest.ts&quot;,&quot;/Users/allan/git/adapter/src/types/ServerType.ts&quot;,&quot;/Users/allan/git/adapter/src/types/Session.ts&quot;,&quot;/Users/allan/git/adapter/src/types/UploadFile.ts&quot;,&quot;/Users/allan/git/adapter/src/types/index.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/asyncForEach.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/compareTimestamps.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/convertToCsv.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/formatDataForRequest.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/index.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isAuthorizeFormRequired.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isIeOrEdge.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isLoginRequired.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isLoginSuccess.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isUri.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isUrl.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/makeRequest.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/needsRetry.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/parseAndSubmitAuthorizeForm.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/parseGeneratedCode.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/parseSasViyaLog.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/parseSourceCode.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/parseWeboutResponse.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/serialize.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/splitChunks.ts&quot;],&quot;mode&quot;:1,&quot;includeDeclarations&quot;:true,&quot;entryPoint&quot;:&quot;&quot;,&quot;exclude&quot;:[&quot;**/*+(index|.spec|.e2e).ts&quot;],&quot;externalPattern&quot;:[],&quot;excludeExternals&quot;:true,&quot;excludeNotExported&quot;:true,&quot;excludeNotDocumented&quot;:false,&quot;excludePrivate&quot;:true,&quot;excludeProtected&quot;:false,&quot;ignoreCompilerErrors&quot;:true,&quot;disableSources&quot;:false,&quot;includes&quot;:&quot;&quot;,&quot;media&quot;:&quot;&quot;,&quot;out&quot;:&quot;docs&quot;,&quot;json&quot;:&quot;&quot;,&quot;theme&quot;:&quot;./node_modules/typedoc-neo-theme/bin/default&quot;,&quot;name&quot;:&quot;&quot;,&quot;includeVersion&quot;:false,&quot;excludeTags&quot;:[],&quot;readme&quot;:&quot;&quot;,&quot;defaultCategory&quot;:&quot;Other&quot;,&quot;categoryOrder&quot;:[],&quot;categorizeByGroup&quot;:true,&quot;gitRevision&quot;:&quot;&quot;,&quot;gitRemote&quot;:&quot;origin&quot;,&quot;gaID&quot;:&quot;&quot;,&quot;gaSite&quot;:&quot;auto&quot;,&quot;hideGenerator&quot;:false,&quot;toc&quot;:[],&quot;disableOutputCheck&quot;:true,&quot;help&quot;:false,&quot;version&quot;:false,&quot;plugin&quot;:[],&quot;logger&quot;:&quot;console&quot;,&quot;listInvalidSymbolLinks&quot;:false,&quot;links&quot;:[{&quot;label&quot;:&quot;SASjs on Github&quot;,&quot;url&quot;:&quot;https://github.com/sasjs/adapter&quot;},{&quot;label&quot;:&quot;SASjs.io&quot;,&quot;url&quot;:&quot;https://sasjs.io&quot;},{&quot;label&quot;:&quot;SASjs CLI&quot;,&quot;url&quot;:&quot;https://github.com/sasjs/cli&quot;},{&quot;label&quot;:&quot;React Seed App&quot;,&quot;url&quot;:&quot;https://github.com/sasjs/react-seed-app&quot;}],&quot;outline&quot;:[{&quot;SAS Adapter&quot;:{&quot;SASjs&quot;:&quot;classes/reflection-717.reflection-180.sasjs&quot;,&quot;Types&quot;:&quot;modules/types&quot;},&quot;SAS Viya API Client&quot;:&quot;classes/reflection-717.reflection-180.sasviyaapiclient&quot;,&quot;SAS 9 API Client&quot;:&quot;classes/reflection-717.reflection-180.sas9apiclient&quot;}],&quot;source&quot;:[{&quot;path&quot;:&quot;https://github.com/sasjs/adapter/blob/master/src/&quot;,&quot;line&quot;:&quot;L&quot;}],&quot;disableAutoModuleName&quot;:&quot;false&quot;}-->
</div>
<div class="col-2 col-menu secondary-menu">
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
<li class=" tsd-kind-class tsd-parent-kind-module root">
<a href="reflection-724.reflection-187.fileuploader.html" class="tsd-kind-icon">File<wbr>Uploader</a>
</li>
</ul>
<ul class="current">
<li class="current tsd-kind-class tsd-parent-kind-module root">
<a href="reflection-724.reflection-187.sas9apiclient.html" class="tsd-kind-icon">SAS9<wbr>Api<wbr>Client</a>
<ul>
<li class=" tsd-kind-constructor tsd-parent-kind-class">
<a href="reflection-724.reflection-187.sas9apiclient.html#constructor" class="tsd-kind-icon">constructor</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="reflection-724.reflection-187.sas9apiclient.html#executescript" class="tsd-kind-icon">execute<wbr>Script</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="reflection-724.reflection-187.sas9apiclient.html#getconfig" class="tsd-kind-icon">get<wbr>Config</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="reflection-724.reflection-187.sas9apiclient.html#setconfig" class="tsd-kind-icon">set<wbr>Config</a>
</li>
</ul>
</li>
</ul>
<ul class="after-current">
<li class=" tsd-kind-class tsd-parent-kind-module root">
<a href="reflection-724.reflection-187.sasviyaapiclient.html" class="tsd-kind-icon">SASViya<wbr>Api<wbr>Client</a>
</li>
<li class=" tsd-kind-class tsd-parent-kind-module root">
<a href="reflection-724.reflection-187.sasjs.html" class="tsd-kind-icon">SASjs</a>
</li>
<li class=" tsd-kind-class tsd-parent-kind-module root">
<a href="reflection-724.reflection-187.sessionmanager.html" class="tsd-kind-icon">Session<wbr>Manager</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="http://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="../assets/js/main.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,271 @@
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>SessionManager | @sasjs/adapter</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<ul class="results-priority" style="display:none">
</ul>
<a href="../index.html" class="title">@sasjs/adapter</a>
&emsp;<a href="https://github.com/sasjs/adapter" class="title">SASjs on Github</a>
&emsp;<a href="https://sasjs.io" class="title">SASjs.io</a>
&emsp;<a href="https://github.com/sasjs/cli" class="title">SASjs CLI</a>
&emsp;<a href="https://github.com/sasjs/react-seed-app" class="title">React Seed App</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked />
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li>
<a href="../modules/reflection-724.html"></a>
</li>
<li>
<a href="../modules/reflection-724.reflection-187.html"></a>
</li>
<li>
<a href="reflection-724.reflection-187.sessionmanager.html">SessionManager</a>
</li>
</ul>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-3 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation outline primary">
<a style="margin-left:0em" href="../globals.html">Globals</a>
<ul style="display:none">
{&quot;SAS Adapter&quot;:{&quot;SASjs&quot;:&quot;classes/reflection-717.reflection-180.sasjs&quot;,&quot;Types&quot;:&quot;modules/types&quot;},&quot;SAS Viya API Client&quot;:&quot;classes/reflection-717.reflection-180.sasviyaapiclient&quot;,&quot;SAS 9 API Client&quot;:&quot;classes/reflection-717.reflection-180.sas9apiclient&quot;}
</ul>
</nav>
</div>
<div class="col-7 offset-3 col-content">
<h1>Class SessionManager</h1>
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li>
<span class="target">SessionManager</span>
</li>
</ul>
</section>
<section class="tsd-panel-group tsd-index-group">
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section ">
<h3>Constructors</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-constructor tsd-parent-kind-class"><a href="reflection-724.reflection-187.sessionmanager.html#constructor" class="tsd-kind-icon">constructor</a></li>
</ul>
</section>
<section class="tsd-index-section ">
<h3>Methods</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-method tsd-parent-kind-class"><a href="reflection-724.reflection-187.sessionmanager.html#clearsession" class="tsd-kind-icon">clearSession</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="reflection-724.reflection-187.sessionmanager.html#getsession" class="tsd-kind-icon">getSession</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Constructors</h2>
<section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class">
<a name="constructor" class="tsd-anchor"></a>
<h3>constructor</h3>
<ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">new <wbr>Session<wbr>Manager<span class="tsd-signature-symbol">(</span>serverUrl<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, contextName<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, setCsrfToken<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="reflection-724.reflection-187.sessionmanager.html" class="tsd-signature-type">SessionManager</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in
<a href="https://github.com/sasjs/adapter/blob/master/src/SessionManager.ts#L6">
SessionManager.ts:6
</a>
</li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>serverUrl: <span class="tsd-signature-type">string</span></h5>
</li>
<li>
<h5>contextName: <span class="tsd-signature-type">string</span></h5>
</li>
<li>
<h5>setCsrfToken: <span class="tsd-signature-type">function</span></h5>
<ul class="tsd-parameters">
<li class="tsd-parameter-siganture">
<ul class="tsd-signatures tsd-kind-type-literal">
<li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>csrfToken<span class="tsd-signature-symbol">: </span><a href="../interfaces/types.csrftoken.html" class="tsd-signature-type">CsrfToken</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>csrfToken: <a href="../interfaces/types.csrftoken.html" class="tsd-signature-type">CsrfToken</a></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <a href="reflection-724.reflection-187.sessionmanager.html" class="tsd-signature-type">SessionManager</a></h4>
</li>
</ul>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Methods</h2>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="clearsession" class="tsd-anchor"></a>
<h3>clear<wbr>Session</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">clear<wbr>Session<span class="tsd-signature-symbol">(</span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</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">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in
<a href="https://github.com/sasjs/adapter/blob/master/src/SessionManager.ts#L37">
SessionManager.ts:37
</a>
</li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>id: <span class="tsd-signature-type">string</span></h5>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> accessToken: <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="getsession" class="tsd-anchor"></a>
<h3>get<wbr>Session</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">get<wbr>Session<span class="tsd-signature-symbol">(</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">&lt;</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="../interfaces/types.session.html" class="tsd-signature-type">Session</a><span class="tsd-signature-symbol">&gt;</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in
<a href="https://github.com/sasjs/adapter/blob/master/src/SessionManager.ts#L19">
SessionManager.ts:19
</a>
</li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> accessToken: <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="../interfaces/types.session.html" class="tsd-signature-type">Session</a><span class="tsd-signature-symbol">&gt;</span></h4>
</li>
</ul>
</section>
</section>
<!--{&quot;options&quot;:&quot;/Users/allan/git/adapter&quot;,&quot;tsconfig&quot;:&quot;/Users/allan/git/adapter&quot;,&quot;inputFiles&quot;:[&quot;/Users/allan/git/adapter/src/FileUploader.ts&quot;,&quot;/Users/allan/git/adapter/src/SAS9ApiClient.ts&quot;,&quot;/Users/allan/git/adapter/src/SASViyaApiClient.ts&quot;,&quot;/Users/allan/git/adapter/src/SASjs.ts&quot;,&quot;/Users/allan/git/adapter/src/SessionManager.ts&quot;,&quot;/Users/allan/git/adapter/src/index.ts&quot;,&quot;/Users/allan/git/adapter/src/types/Context.ts&quot;,&quot;/Users/allan/git/adapter/src/types/CsrfToken.ts&quot;,&quot;/Users/allan/git/adapter/src/types/ErrorResponse.ts&quot;,&quot;/Users/allan/git/adapter/src/types/Folder.ts&quot;,&quot;/Users/allan/git/adapter/src/types/Job.ts&quot;,&quot;/Users/allan/git/adapter/src/types/JobDefinition.ts&quot;,&quot;/Users/allan/git/adapter/src/types/JobResult.ts&quot;,&quot;/Users/allan/git/adapter/src/types/Link.ts&quot;,&quot;/Users/allan/git/adapter/src/types/SASjsConfig.ts&quot;,&quot;/Users/allan/git/adapter/src/types/SASjsRequest.ts&quot;,&quot;/Users/allan/git/adapter/src/types/SASjsWaitingRequest.ts&quot;,&quot;/Users/allan/git/adapter/src/types/ServerType.ts&quot;,&quot;/Users/allan/git/adapter/src/types/Session.ts&quot;,&quot;/Users/allan/git/adapter/src/types/UploadFile.ts&quot;,&quot;/Users/allan/git/adapter/src/types/index.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/asyncForEach.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/compareTimestamps.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/convertToCsv.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/formatDataForRequest.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/index.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isAuthorizeFormRequired.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isIeOrEdge.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isLoginRequired.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isLoginSuccess.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isUri.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isUrl.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/makeRequest.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/needsRetry.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/parseAndSubmitAuthorizeForm.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/parseGeneratedCode.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/parseSasViyaLog.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/parseSourceCode.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/parseWeboutResponse.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/serialize.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/splitChunks.ts&quot;],&quot;mode&quot;:1,&quot;includeDeclarations&quot;:true,&quot;entryPoint&quot;:&quot;&quot;,&quot;exclude&quot;:[&quot;**/*+(index|.spec|.e2e).ts&quot;],&quot;externalPattern&quot;:[],&quot;excludeExternals&quot;:true,&quot;excludeNotExported&quot;:true,&quot;excludeNotDocumented&quot;:false,&quot;excludePrivate&quot;:true,&quot;excludeProtected&quot;:false,&quot;ignoreCompilerErrors&quot;:true,&quot;disableSources&quot;:false,&quot;includes&quot;:&quot;&quot;,&quot;media&quot;:&quot;&quot;,&quot;out&quot;:&quot;docs&quot;,&quot;json&quot;:&quot;&quot;,&quot;theme&quot;:&quot;./node_modules/typedoc-neo-theme/bin/default&quot;,&quot;name&quot;:&quot;&quot;,&quot;includeVersion&quot;:false,&quot;excludeTags&quot;:[],&quot;readme&quot;:&quot;&quot;,&quot;defaultCategory&quot;:&quot;Other&quot;,&quot;categoryOrder&quot;:[],&quot;categorizeByGroup&quot;:true,&quot;gitRevision&quot;:&quot;&quot;,&quot;gitRemote&quot;:&quot;origin&quot;,&quot;gaID&quot;:&quot;&quot;,&quot;gaSite&quot;:&quot;auto&quot;,&quot;hideGenerator&quot;:false,&quot;toc&quot;:[],&quot;disableOutputCheck&quot;:true,&quot;help&quot;:false,&quot;version&quot;:false,&quot;plugin&quot;:[],&quot;logger&quot;:&quot;console&quot;,&quot;listInvalidSymbolLinks&quot;:false,&quot;links&quot;:[{&quot;label&quot;:&quot;SASjs on Github&quot;,&quot;url&quot;:&quot;https://github.com/sasjs/adapter&quot;},{&quot;label&quot;:&quot;SASjs.io&quot;,&quot;url&quot;:&quot;https://sasjs.io&quot;},{&quot;label&quot;:&quot;SASjs CLI&quot;,&quot;url&quot;:&quot;https://github.com/sasjs/cli&quot;},{&quot;label&quot;:&quot;React Seed App&quot;,&quot;url&quot;:&quot;https://github.com/sasjs/react-seed-app&quot;}],&quot;outline&quot;:[{&quot;SAS Adapter&quot;:{&quot;SASjs&quot;:&quot;classes/reflection-717.reflection-180.sasjs&quot;,&quot;Types&quot;:&quot;modules/types&quot;},&quot;SAS Viya API Client&quot;:&quot;classes/reflection-717.reflection-180.sasviyaapiclient&quot;,&quot;SAS 9 API Client&quot;:&quot;classes/reflection-717.reflection-180.sas9apiclient&quot;}],&quot;source&quot;:[{&quot;path&quot;:&quot;https://github.com/sasjs/adapter/blob/master/src/&quot;,&quot;line&quot;:&quot;L&quot;}],&quot;disableAutoModuleName&quot;:&quot;false&quot;}-->
</div>
<div class="col-2 col-menu secondary-menu">
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
<li class=" tsd-kind-class tsd-parent-kind-module root">
<a href="reflection-724.reflection-187.fileuploader.html" class="tsd-kind-icon">File<wbr>Uploader</a>
</li>
<li class=" tsd-kind-class tsd-parent-kind-module root">
<a href="reflection-724.reflection-187.sas9apiclient.html" class="tsd-kind-icon">SAS9<wbr>Api<wbr>Client</a>
</li>
<li class=" tsd-kind-class tsd-parent-kind-module root">
<a href="reflection-724.reflection-187.sasviyaapiclient.html" class="tsd-kind-icon">SASViya<wbr>Api<wbr>Client</a>
</li>
<li class=" tsd-kind-class tsd-parent-kind-module root">
<a href="reflection-724.reflection-187.sasjs.html" class="tsd-kind-icon">SASjs</a>
</li>
</ul>
<ul class="current">
<li class="current tsd-kind-class tsd-parent-kind-module root">
<a href="reflection-724.reflection-187.sessionmanager.html" class="tsd-kind-icon">Session<wbr>Manager</a>
<ul>
<li class=" tsd-kind-constructor tsd-parent-kind-class">
<a href="reflection-724.reflection-187.sessionmanager.html#constructor" class="tsd-kind-icon">constructor</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="reflection-724.reflection-187.sessionmanager.html#clearsession" class="tsd-kind-icon">clear<wbr>Session</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="reflection-724.reflection-187.sessionmanager.html#getsession" class="tsd-kind-icon">get<wbr>Session</a>
</li>
</ul>
</li>
</ul>
<ul class="after-current">
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="http://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="../assets/js/main.js"></script>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,106 @@
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title> | @sasjs/adapter</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<ul class="results-priority" style="display:none">
</ul>
<a href="../index.html" class="title">@sasjs/adapter</a>
&emsp;<a href="https://github.com/sasjs/adapter" class="title">SASjs on Github</a>
&emsp;<a href="https://sasjs.io" class="title">SASjs.io</a>
&emsp;<a href="https://github.com/sasjs/cli" class="title">SASjs CLI</a>
&emsp;<a href="https://github.com/sasjs/react-seed-app" class="title">React Seed App</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked />
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li>
<a href="reflection-724.html"></a>
</li>
</ul>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-3 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation outline primary">
<a style="margin-left:0em" href="../globals.html">Globals</a>
<ul style="display:none">
{&quot;SAS Adapter&quot;:{&quot;SASjs&quot;:&quot;classes/reflection-717.reflection-180.sasjs&quot;,&quot;Types&quot;:&quot;modules/types&quot;},&quot;SAS Viya API Client&quot;:&quot;classes/reflection-717.reflection-180.sasviyaapiclient&quot;,&quot;SAS 9 API Client&quot;:&quot;classes/reflection-717.reflection-180.sas9apiclient&quot;}
</ul>
</nav>
</div>
<div class="col-7 offset-3 col-content">
<h1>Module</h1>
<section class="tsd-panel-group tsd-index-group">
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section ">
<h3>Modules</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-module tsd-parent-kind-module"><a href="reflection-724.reflection-187.html" class="tsd-kind-icon"><em>Module</em></a></li>
</ul>
</section>
</div>
</section>
</section>
<!--{&quot;options&quot;:&quot;/Users/allan/git/adapter&quot;,&quot;tsconfig&quot;:&quot;/Users/allan/git/adapter&quot;,&quot;inputFiles&quot;:[&quot;/Users/allan/git/adapter/src/FileUploader.ts&quot;,&quot;/Users/allan/git/adapter/src/SAS9ApiClient.ts&quot;,&quot;/Users/allan/git/adapter/src/SASViyaApiClient.ts&quot;,&quot;/Users/allan/git/adapter/src/SASjs.ts&quot;,&quot;/Users/allan/git/adapter/src/SessionManager.ts&quot;,&quot;/Users/allan/git/adapter/src/index.ts&quot;,&quot;/Users/allan/git/adapter/src/types/Context.ts&quot;,&quot;/Users/allan/git/adapter/src/types/CsrfToken.ts&quot;,&quot;/Users/allan/git/adapter/src/types/ErrorResponse.ts&quot;,&quot;/Users/allan/git/adapter/src/types/Folder.ts&quot;,&quot;/Users/allan/git/adapter/src/types/Job.ts&quot;,&quot;/Users/allan/git/adapter/src/types/JobDefinition.ts&quot;,&quot;/Users/allan/git/adapter/src/types/JobResult.ts&quot;,&quot;/Users/allan/git/adapter/src/types/Link.ts&quot;,&quot;/Users/allan/git/adapter/src/types/SASjsConfig.ts&quot;,&quot;/Users/allan/git/adapter/src/types/SASjsRequest.ts&quot;,&quot;/Users/allan/git/adapter/src/types/SASjsWaitingRequest.ts&quot;,&quot;/Users/allan/git/adapter/src/types/ServerType.ts&quot;,&quot;/Users/allan/git/adapter/src/types/Session.ts&quot;,&quot;/Users/allan/git/adapter/src/types/UploadFile.ts&quot;,&quot;/Users/allan/git/adapter/src/types/index.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/asyncForEach.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/compareTimestamps.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/convertToCsv.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/formatDataForRequest.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/index.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isAuthorizeFormRequired.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isIeOrEdge.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isLoginRequired.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isLoginSuccess.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isUri.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isUrl.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/makeRequest.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/needsRetry.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/parseAndSubmitAuthorizeForm.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/parseGeneratedCode.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/parseSasViyaLog.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/parseSourceCode.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/parseWeboutResponse.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/serialize.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/splitChunks.ts&quot;],&quot;mode&quot;:1,&quot;includeDeclarations&quot;:true,&quot;entryPoint&quot;:&quot;&quot;,&quot;exclude&quot;:[&quot;**/*+(index|.spec|.e2e).ts&quot;],&quot;externalPattern&quot;:[],&quot;excludeExternals&quot;:true,&quot;excludeNotExported&quot;:true,&quot;excludeNotDocumented&quot;:false,&quot;excludePrivate&quot;:true,&quot;excludeProtected&quot;:false,&quot;ignoreCompilerErrors&quot;:true,&quot;disableSources&quot;:false,&quot;includes&quot;:&quot;&quot;,&quot;media&quot;:&quot;&quot;,&quot;out&quot;:&quot;docs&quot;,&quot;json&quot;:&quot;&quot;,&quot;theme&quot;:&quot;./node_modules/typedoc-neo-theme/bin/default&quot;,&quot;name&quot;:&quot;&quot;,&quot;includeVersion&quot;:false,&quot;excludeTags&quot;:[],&quot;readme&quot;:&quot;&quot;,&quot;defaultCategory&quot;:&quot;Other&quot;,&quot;categoryOrder&quot;:[],&quot;categorizeByGroup&quot;:true,&quot;gitRevision&quot;:&quot;&quot;,&quot;gitRemote&quot;:&quot;origin&quot;,&quot;gaID&quot;:&quot;&quot;,&quot;gaSite&quot;:&quot;auto&quot;,&quot;hideGenerator&quot;:false,&quot;toc&quot;:[],&quot;disableOutputCheck&quot;:true,&quot;help&quot;:false,&quot;version&quot;:false,&quot;plugin&quot;:[],&quot;logger&quot;:&quot;console&quot;,&quot;listInvalidSymbolLinks&quot;:false,&quot;links&quot;:[{&quot;label&quot;:&quot;SASjs on Github&quot;,&quot;url&quot;:&quot;https://github.com/sasjs/adapter&quot;},{&quot;label&quot;:&quot;SASjs.io&quot;,&quot;url&quot;:&quot;https://sasjs.io&quot;},{&quot;label&quot;:&quot;SASjs CLI&quot;,&quot;url&quot;:&quot;https://github.com/sasjs/cli&quot;},{&quot;label&quot;:&quot;React Seed App&quot;,&quot;url&quot;:&quot;https://github.com/sasjs/react-seed-app&quot;}],&quot;outline&quot;:[{&quot;SAS Adapter&quot;:{&quot;SASjs&quot;:&quot;classes/reflection-717.reflection-180.sasjs&quot;,&quot;Types&quot;:&quot;modules/types&quot;},&quot;SAS Viya API Client&quot;:&quot;classes/reflection-717.reflection-180.sasviyaapiclient&quot;,&quot;SAS 9 API Client&quot;:&quot;classes/reflection-717.reflection-180.sas9apiclient&quot;}],&quot;source&quot;:[{&quot;path&quot;:&quot;https://github.com/sasjs/adapter/blob/master/src/&quot;,&quot;line&quot;:&quot;L&quot;}],&quot;disableAutoModuleName&quot;:&quot;false&quot;}-->
</div>
<div class="col-2 col-menu secondary-menu">
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="http://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="../assets/js/main.js"></script>
</body>
</html>

View File

@@ -0,0 +1,128 @@
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title> | @sasjs/adapter</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<ul class="results-priority" style="display:none">
</ul>
<a href="../index.html" class="title">@sasjs/adapter</a>
&emsp;<a href="https://github.com/sasjs/adapter" class="title">SASjs on Github</a>
&emsp;<a href="https://sasjs.io" class="title">SASjs.io</a>
&emsp;<a href="https://github.com/sasjs/cli" class="title">SASjs CLI</a>
&emsp;<a href="https://github.com/sasjs/react-seed-app" class="title">React Seed App</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked />
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li>
<a href="reflection-724.html"></a>
</li>
<li>
<a href="reflection-724.reflection-187.html"></a>
</li>
</ul>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-3 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation outline primary">
<a style="margin-left:0em" href="../globals.html">Globals</a>
<ul style="display:none">
{&quot;SAS Adapter&quot;:{&quot;SASjs&quot;:&quot;classes/reflection-717.reflection-180.sasjs&quot;,&quot;Types&quot;:&quot;modules/types&quot;},&quot;SAS Viya API Client&quot;:&quot;classes/reflection-717.reflection-180.sasviyaapiclient&quot;,&quot;SAS 9 API Client&quot;:&quot;classes/reflection-717.reflection-180.sas9apiclient&quot;}
</ul>
</nav>
</div>
<div class="col-7 offset-3 col-content">
<h1>Module</h1>
<section class="tsd-panel-group tsd-index-group">
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section ">
<h3>Classes</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-class tsd-parent-kind-module"><a href="../classes/reflection-724.reflection-187.fileuploader.html" class="tsd-kind-icon">FileUploader</a></li>
<li class="tsd-kind-class tsd-parent-kind-module"><a href="../classes/reflection-724.reflection-187.sas9apiclient.html" class="tsd-kind-icon">SAS9ApiClient</a></li>
<li class="tsd-kind-class tsd-parent-kind-module"><a href="../classes/reflection-724.reflection-187.sasviyaapiclient.html" class="tsd-kind-icon">SASViyaApiClient</a></li>
<li class="tsd-kind-class tsd-parent-kind-module"><a href="../classes/reflection-724.reflection-187.sasjs.html" class="tsd-kind-icon">SASjs</a></li>
<li class="tsd-kind-class tsd-parent-kind-module"><a href="../classes/reflection-724.reflection-187.sessionmanager.html" class="tsd-kind-icon">SessionManager</a></li>
</ul>
</section>
</div>
</section>
</section>
<!--{&quot;options&quot;:&quot;/Users/allan/git/adapter&quot;,&quot;tsconfig&quot;:&quot;/Users/allan/git/adapter&quot;,&quot;inputFiles&quot;:[&quot;/Users/allan/git/adapter/src/FileUploader.ts&quot;,&quot;/Users/allan/git/adapter/src/SAS9ApiClient.ts&quot;,&quot;/Users/allan/git/adapter/src/SASViyaApiClient.ts&quot;,&quot;/Users/allan/git/adapter/src/SASjs.ts&quot;,&quot;/Users/allan/git/adapter/src/SessionManager.ts&quot;,&quot;/Users/allan/git/adapter/src/index.ts&quot;,&quot;/Users/allan/git/adapter/src/types/Context.ts&quot;,&quot;/Users/allan/git/adapter/src/types/CsrfToken.ts&quot;,&quot;/Users/allan/git/adapter/src/types/ErrorResponse.ts&quot;,&quot;/Users/allan/git/adapter/src/types/Folder.ts&quot;,&quot;/Users/allan/git/adapter/src/types/Job.ts&quot;,&quot;/Users/allan/git/adapter/src/types/JobDefinition.ts&quot;,&quot;/Users/allan/git/adapter/src/types/JobResult.ts&quot;,&quot;/Users/allan/git/adapter/src/types/Link.ts&quot;,&quot;/Users/allan/git/adapter/src/types/SASjsConfig.ts&quot;,&quot;/Users/allan/git/adapter/src/types/SASjsRequest.ts&quot;,&quot;/Users/allan/git/adapter/src/types/SASjsWaitingRequest.ts&quot;,&quot;/Users/allan/git/adapter/src/types/ServerType.ts&quot;,&quot;/Users/allan/git/adapter/src/types/Session.ts&quot;,&quot;/Users/allan/git/adapter/src/types/UploadFile.ts&quot;,&quot;/Users/allan/git/adapter/src/types/index.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/asyncForEach.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/compareTimestamps.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/convertToCsv.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/formatDataForRequest.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/index.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isAuthorizeFormRequired.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isIeOrEdge.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isLoginRequired.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isLoginSuccess.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isUri.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/isUrl.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/makeRequest.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/needsRetry.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/parseAndSubmitAuthorizeForm.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/parseGeneratedCode.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/parseSasViyaLog.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/parseSourceCode.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/parseWeboutResponse.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/serialize.ts&quot;,&quot;/Users/allan/git/adapter/src/utils/splitChunks.ts&quot;],&quot;mode&quot;:1,&quot;includeDeclarations&quot;:true,&quot;entryPoint&quot;:&quot;&quot;,&quot;exclude&quot;:[&quot;**/*+(index|.spec|.e2e).ts&quot;],&quot;externalPattern&quot;:[],&quot;excludeExternals&quot;:true,&quot;excludeNotExported&quot;:true,&quot;excludeNotDocumented&quot;:false,&quot;excludePrivate&quot;:true,&quot;excludeProtected&quot;:false,&quot;ignoreCompilerErrors&quot;:true,&quot;disableSources&quot;:false,&quot;includes&quot;:&quot;&quot;,&quot;media&quot;:&quot;&quot;,&quot;out&quot;:&quot;docs&quot;,&quot;json&quot;:&quot;&quot;,&quot;theme&quot;:&quot;./node_modules/typedoc-neo-theme/bin/default&quot;,&quot;name&quot;:&quot;&quot;,&quot;includeVersion&quot;:false,&quot;excludeTags&quot;:[],&quot;readme&quot;:&quot;&quot;,&quot;defaultCategory&quot;:&quot;Other&quot;,&quot;categoryOrder&quot;:[],&quot;categorizeByGroup&quot;:true,&quot;gitRevision&quot;:&quot;&quot;,&quot;gitRemote&quot;:&quot;origin&quot;,&quot;gaID&quot;:&quot;&quot;,&quot;gaSite&quot;:&quot;auto&quot;,&quot;hideGenerator&quot;:false,&quot;toc&quot;:[],&quot;disableOutputCheck&quot;:true,&quot;help&quot;:false,&quot;version&quot;:false,&quot;plugin&quot;:[],&quot;logger&quot;:&quot;console&quot;,&quot;listInvalidSymbolLinks&quot;:false,&quot;links&quot;:[{&quot;label&quot;:&quot;SASjs on Github&quot;,&quot;url&quot;:&quot;https://github.com/sasjs/adapter&quot;},{&quot;label&quot;:&quot;SASjs.io&quot;,&quot;url&quot;:&quot;https://sasjs.io&quot;},{&quot;label&quot;:&quot;SASjs CLI&quot;,&quot;url&quot;:&quot;https://github.com/sasjs/cli&quot;},{&quot;label&quot;:&quot;React Seed App&quot;,&quot;url&quot;:&quot;https://github.com/sasjs/react-seed-app&quot;}],&quot;outline&quot;:[{&quot;SAS Adapter&quot;:{&quot;SASjs&quot;:&quot;classes/reflection-717.reflection-180.sasjs&quot;,&quot;Types&quot;:&quot;modules/types&quot;},&quot;SAS Viya API Client&quot;:&quot;classes/reflection-717.reflection-180.sasviyaapiclient&quot;,&quot;SAS 9 API Client&quot;:&quot;classes/reflection-717.reflection-180.sas9apiclient&quot;}],&quot;source&quot;:[{&quot;path&quot;:&quot;https://github.com/sasjs/adapter/blob/master/src/&quot;,&quot;line&quot;:&quot;L&quot;}],&quot;disableAutoModuleName&quot;:&quot;false&quot;}-->
</div>
<div class="col-2 col-menu secondary-menu">
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
<li class=" tsd-kind-class tsd-parent-kind-module root">
<a href="../classes/reflection-724.reflection-187.fileuploader.html" class="tsd-kind-icon">File<wbr>Uploader</a>
</li>
<li class=" tsd-kind-class tsd-parent-kind-module root">
<a href="../classes/reflection-724.reflection-187.sas9apiclient.html" class="tsd-kind-icon">SAS9<wbr>Api<wbr>Client</a>
</li>
<li class=" tsd-kind-class tsd-parent-kind-module root">
<a href="../classes/reflection-724.reflection-187.sasviyaapiclient.html" class="tsd-kind-icon">SASViya<wbr>Api<wbr>Client</a>
</li>
<li class=" tsd-kind-class tsd-parent-kind-module root">
<a href="../classes/reflection-724.reflection-187.sasjs.html" class="tsd-kind-icon">SASjs</a>
</li>
<li class=" tsd-kind-class tsd-parent-kind-module root">
<a href="../classes/reflection-724.reflection-187.sessionmanager.html" class="tsd-kind-icon">Session<wbr>Manager</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="http://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="../assets/js/main.js"></script>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2221
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -37,22 +37,22 @@
"license": "ISC",
"devDependencies": {
"@types/isomorphic-fetch": "0.0.35",
"@types/jest": "^26.0.13",
"@types/jest": "^26.0.14",
"cp": "^0.2.0",
"jest": "^25.5.4",
"path": "^0.12.7",
"rimraf": "^3.0.2",
"semantic-release": "^17.1.1",
"semantic-release": "^17.1.2",
"terser-webpack-plugin": "^4.2.2",
"ts-jest": "^25.5.1",
"ts-loader": "^8.0.3",
"ts-loader": "^8.0.4",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0",
"typedoc": "^0.17.8",
"typedoc-neo-theme": "^1.0.10",
"typedoc-plugin-external-module-name": "^4.0.3",
"typescript": "^3.9.7",
"uglifyjs-webpack-plugin": "^2.2.0",
"webpack": "^4.44.1",
"webpack": "^4.44.2",
"webpack-cli": "^3.3.12"
},
"main": "index.js",

View File

@@ -13,7 +13,7 @@ const defaultConfig: SASjsConfig = {
};
const customConfig = {
serverUrl: "url",
serverUrl: "http://url.com",
pathSAS9: "sas9",
pathSASViya: "viya",
appLoc: "/Public/seedapp",

View File

@@ -47,6 +47,16 @@ const getLargeObjectData = () => {
export const sendArrTests = (adapter: SASjs): TestSuite => ({
name: "sendArr",
tests: [
{
title: "Absolute paths",
description: "Should work with absolute paths to SAS jobs",
test: () => {
return adapter.request("/Public/app/common/sendArr", stringData);
},
assertion: (res: any) => {
return res.table1[0][0] === stringData.table1[0].col1;
}
},
{
title: "Single string value",
description: "Should send an array with a single string value",

View File

@@ -18,7 +18,8 @@ export class FileUploader {
private retryCount = 0
public uploadFile(sasJob: string, files: UploadFile[], params: any) {
if (files?.length < 1) throw new Error('Atleast one file must be provided')
if (files?.length < 1)
throw new Error('At least one file must be provided.')
let paramsString = ''
@@ -75,7 +76,7 @@ export class FileUploader {
})
.then((responseText) => {
if (isLogInRequired(responseText))
reject('You must be logged in to upload a fle')
reject('You must be logged in to upload a file')
if (needsRetry(responseText)) {
if (this.retryCount < requestRetryLimit) {

View File

@@ -1,7 +1,7 @@
import { isUrl } from './utils'
/**
* A client for interfacing with the SAS9 REST API
* A client for interfacing with the SAS9 REST API.
*
*/
export class SAS9ApiClient {
@@ -10,7 +10,7 @@ export class SAS9ApiClient {
}
/**
* returns on object containing the server URL
* Returns an object containing server URL.
*/
public getConfig() {
return {
@@ -19,8 +19,8 @@ export class SAS9ApiClient {
}
/**
* Updates serverurl which is not null
* @param serverUrl - the URL of the server.
* Updates server URL which is not null.
* @param serverUrl - URL of the server to be set.
*/
public setConfig(serverUrl: string) {
if (serverUrl) this.serverUrl = serverUrl
@@ -28,9 +28,9 @@ export class SAS9ApiClient {
/**
* Executes code on a SAS9 server.
* @param linesOfCode - an array of lines of code to execute
* @param serverName - the server to execute the code on
* @param repositoryName - the repository to execute the code on
* @param linesOfCode - an array of code lines to execute.
* @param serverName - the server to execute the code on.
* @param repositoryName - the repository to execute the code in.
*/
public async executeScript(
linesOfCode: string[],

View File

@@ -3,25 +3,26 @@ import {
parseAndSubmitAuthorizeForm,
convertToCSV,
makeRequest,
isRelativePath,
isUri,
isUrl
} from './utils'
import * as NodeFormData from 'form-data'
import * as path from 'path'
import {
Job,
Session,
Context,
Folder,
CsrfToken,
EditContextInput
EditContextInput,
ErrorResponse,
JobDefinition
} from './types'
import { JobDefinition } from './types/JobDefinition'
import { formatDataForRequest } from './utils/formatDataForRequest'
import { SessionManager } from './SessionManager'
/**
* A client for interfacing with the SAS Viya REST API
* A client for interfacing with the SAS Viya REST API.
*
*/
export class SASViyaApiClient {
@@ -29,39 +30,37 @@ export class SASViyaApiClient {
private serverUrl: string,
private rootFolderName: string,
private contextName: string,
private setCsrfToken: (csrfToken: CsrfToken) => void,
private rootFolderMap = new Map<string, Job[]>()
private setCsrfToken: (csrfToken: CsrfToken) => void
) {
if (!rootFolderName) {
throw new Error('Root folder must be provided.')
}
if (serverUrl) isUrl(serverUrl)
}
private csrfToken: CsrfToken | null = null
private rootFolder: Folder | null = null
private sessionManager = new SessionManager(
this.serverUrl,
this.contextName,
this.setCsrfToken
)
private isForceDeploy: boolean = false
private folderMap = new Map<string, Job[]>()
/**
* Returns a map containing the directory structure in the currently set root folder.
* Returns a list of jobs in the currently set root folder.
*/
public async getAppLocMap() {
if (this.rootFolderMap.size) {
return this.rootFolderMap
public async getJobsInFolder(folderPath: string) {
const path = isRelativePath(folderPath)
? `${this.rootFolderName}/${folderPath}`
: folderPath
if (this.folderMap.get(path)) {
return this.folderMap.get(path)
}
this.populateRootFolderMap()
return this.rootFolderMap
await this.populateFolderMap(path)
return this.folderMap.get(path)
}
/**
* returns an object containing the Server URL and root folder name
* Returns an object containing the server URL and root folder name.
*/
public getConfig() {
return {
@@ -71,9 +70,9 @@ export class SASViyaApiClient {
}
/**
* Updates server URL or root folder name when not null
* Updates server URL and root folder name, if it was not set.
* @param serverUrl - the URL of the server.
* @param rootFolderName - the name for rootFolderName.
* @param rootFolderName - the name for root folder.
*/
public setConfig(serverUrl: string, rootFolderName: string) {
if (serverUrl) this.serverUrl = serverUrl
@@ -88,14 +87,18 @@ export class SASViyaApiClient {
const headers: any = {
'Content-Type': 'application/json'
}
if (accessToken) {
headers.Authorization = `Bearer ${accessToken}`
}
const { result: contexts } = await this.request<{ items: Context[] }>(
`${this.serverUrl}/compute/contexts`,
`${this.serverUrl}/compute/contexts?limit=10000`,
{ headers }
)
const contextsList = contexts && contexts.items ? contexts.items : []
return contextsList.map((context: any) => ({
createdBy: context.createdBy,
id: context.id,
@@ -113,36 +116,48 @@ export class SASViyaApiClient {
const headers: any = {
'Content-Type': 'application/json'
}
if (accessToken) {
headers.Authorization = `Bearer ${accessToken}`
}
const { result: contexts } = await this.request<{ items: Context[] }>(
`${this.serverUrl}/compute/contexts`,
`${this.serverUrl}/compute/contexts?limit=10000`,
{ headers }
)
const contextsList = contexts && contexts.items ? contexts.items : []
).catch((err) => {
throw err
})
const contextsList = contexts.items || []
const executableContexts: any[] = []
const promises = contextsList.map((context: any) => {
const linesOfCode = ['%put &=sysuserid;']
return this.executeScript(
`test-${context.name}`,
linesOfCode,
context.name,
accessToken
accessToken,
false,
null,
true
).catch(() => null)
})
const results = await Promise.all(promises)
results.forEach((result: any, index: number) => {
if (result && result.jobStatus === 'completed') {
if (result) {
let sysUserId = ''
if (result && result.log && result.log.items) {
const sysUserIdLog = result.log.items.find((i: any) =>
i.line.startsWith('SYSUSERID=')
)
if (result.log) {
const sysUserIdLog = result.log
.split('\n')
.find((line: string) => line.startsWith('SYSUSERID='))
if (sysUserIdLog) {
sysUserId = sysUserIdLog.line.replace('SYSUSERID=', '')
sysUserId = sysUserIdLog.replace('SYSUSERID=', '')
}
}
@@ -176,7 +191,7 @@ export class SASViyaApiClient {
}
const { result: contexts } = await this.request<{ items: Context[] }>(
`${this.serverUrl}/compute/contexts`,
`${this.serverUrl}/compute/contexts?limit=10000`,
{ headers }
)
const executionContext =
@@ -206,7 +221,7 @@ export class SASViyaApiClient {
* Creates a compute context on the given server.
* @param contextName - the name of the context to be created.
* @param launchContextName - the name of the launcher context used by the compute service.
* @param sharedAccountId - the ID of the account to run the servers for this context as.
* @param sharedAccountId - the ID of the account to run the servers for this context.
* @param autoExecLines - the lines of code to execute during session initialization.
* @param authorizedUsers - an optional list of authorized user IDs.
* @param accessToken - an access token for an authorized user.
@@ -220,15 +235,15 @@ export class SASViyaApiClient {
accessToken?: string
) {
if (!contextName) {
throw new Error('Missing context name.')
throw new Error('Context name is required.')
}
if (!launchContextName) {
throw new Error('Missing launch context name.')
throw new Error('Launch context name is required.')
}
if (!sharedAccountId) {
throw new Error('Missing shared account ID.')
throw new Error('Shared account ID is required.')
}
const headers: any = {
@@ -307,17 +322,14 @@ export class SASViyaApiClient {
{
headers
}
).catch((e) => {
console.error(e)
if (e && e.status === 404) {
).catch((err) => {
if (err && err.status === 404) {
throw new Error(
`The context ${contextName} was not found on this server.`
`The context '${contextName}' was not found on this server.`
)
}
throw new Error(
`An error occurred when fetching the context ${contextName}`
)
throw err
})
// An If-Match header with the value of the last ETag for the context
@@ -348,7 +360,7 @@ export class SASViyaApiClient {
*/
public async deleteContext(contextName: string, accessToken?: string) {
if (!contextName) {
throw new Error('Invalid context Name.')
throw new Error('Invalid context name.')
}
const headers: any = {
@@ -374,21 +386,25 @@ export class SASViyaApiClient {
/**
* Executes code on the current SAS Viya server.
* @param fileName - a name for the file being submitted for execution.
* @param linesOfCode - an array of lines of code to execute.
* @param jobPath - the path to the file being submitted for execution.
* @param linesOfCode - an array of code lines to execute.
* @param contextName - the context to execute the code in.
* @param accessToken - an access token for an authorized user.
* @param sessionId - optional session ID to reuse.
* @param silent - optional flag to turn of logging.
* @param silent - optional flag to disable logging.
* @param data - execution data.
* @param debug - when set to true, the log will be returned.
* @param expectWebout - when set to true, the automatic _webout fileref will be checked for content, and that content returned. This fileref is used when the Job contains a SASjs web request (as opposed to executing arbitrary SAS code).
*/
public async executeScript(
jobName: string,
jobPath: string,
linesOfCode: string[],
contextName: string,
accessToken?: string,
silent = false,
data = null,
debug = false
debug = false,
expectWebout = false
): Promise<any> {
silent = !debug
try {
@@ -419,13 +435,21 @@ export class SASViyaApiClient {
jobArguments['_DEBUG'] = 131
}
const fileName = `exec-${
jobName.includes('/') ? jobName.split('/')[1] : jobName
}`
let fileName
if (isRelativePath(jobPath)) {
fileName = `exec-${
jobPath.includes('/') ? jobPath.split('/')[1] : jobPath
}`
} else {
const jobPathParts = jobPath.split('/')
fileName = jobPathParts.pop()
}
let jobVariables: any = {
SYS_JES_JOB_URI: '',
_program: this.rootFolderName + '/' + jobName
_program: isRelativePath(jobPath)
? this.rootFolderName + '/' + jobPath
: jobPath
}
let files: any[] = []
@@ -433,7 +457,9 @@ export class SASViyaApiClient {
if (data) {
if (JSON.stringify(data).includes(';')) {
files = await this.uploadTables(data, accessToken)
jobVariables['_webin_file_count'] = files.length
files.forEach((fileInfo, index) => {
jobVariables[
`_webin_fileuri${index + 1}`
@@ -464,11 +490,11 @@ export class SASViyaApiClient {
)
if (!silent) {
console.log(`Job has been submitted for ${fileName}`)
console.log(`Job has been submitted for '${fileName}'.`)
console.log(
`You can monitor the job progress at ${this.serverUrl}${
`You can monitor the job progress at '${this.serverUrl}${
postedJob.links.find((l: any) => l.rel === 'state')!.href
}`
}'.`
)
}
@@ -503,16 +529,42 @@ export class SASViyaApiClient {
if (jobStatus === 'failed' || jobStatus === 'error') {
return Promise.reject({ error: currentJob.error, log })
}
const resultLink = `/compute/sessions/${executionSessionId}/filerefs/_webout/content`
let resultLink
if (expectWebout) {
resultLink = `/compute/sessions/${executionSessionId}/filerefs/_webout/content`
}
if (resultLink) {
jobResult = await this.request<any>(
`${this.serverUrl}${resultLink}`,
{ headers },
'text'
).catch((e) => ({
result: JSON.stringify(e)
}))
).catch(async (e) => {
if (e && e.status === 404) {
if (logLink) {
log = await this.request<any>(
`${this.serverUrl}${logLink.href}/content?limit=10000`,
{
headers
}
).then((res: any) =>
res.result.items.map((i: any) => i.line).join('\n')
)
return Promise.reject(
new ErrorResponse('Job execution failed', {
status: 500,
body: log
})
)
}
}
return {
result: JSON.stringify(e)
}
})
}
await this.sessionManager.clearSession(executionSessionId, accessToken)
@@ -521,7 +573,7 @@ export class SASViyaApiClient {
} catch (e) {
if (e && e.status === 404) {
return this.executeScript(
jobName,
jobPath,
linesOfCode,
contextName,
accessToken,
@@ -536,13 +588,12 @@ export class SASViyaApiClient {
}
/**
* Creates a folder in the specified location. Either parentFolderPath or
* parentFolderUri must be provided.
* Creates a folder. Path to or URI of the parent folder is required.
* @param folderName - the name of the new folder.
* @param parentFolderPath - the full path to the parent folder. If not
* provided, the parentFolderUri must be provided.
* @param parentFolderUri - the URI (eg /folders/folders/UUID) of the parent
* folder. If not provided, the parentFolderPath must be provided.
* folder. If not provided, the parentFolderPath must be provided.
* @param accessToken - an access token for authorizing the request.
* @param isForced - flag that indicates if target folder already exists, it and all subfolders have to be deleted.
*/
@@ -554,7 +605,7 @@ export class SASViyaApiClient {
isForced?: boolean
): Promise<Folder> {
if (!parentFolderPath && !parentFolderUri) {
throw new Error('Parent folder path or uri is required')
throw new Error('Path or URI of the parent folder is required.')
}
if (!parentFolderUri && parentFolderPath) {
@@ -562,7 +613,9 @@ export class SASViyaApiClient {
if (!parentFolderUri) {
if (isForced) this.isForceDeploy = true
console.log(`Parent folder is not present: ${parentFolderPath}`)
console.log(
`Parent folder at path '${parentFolderPath}' is not present.`
)
const newParentFolderPath = parentFolderPath.substring(
0,
@@ -570,10 +623,10 @@ export class SASViyaApiClient {
)
const newFolderName = `${parentFolderPath.split('/').pop()}`
if (newParentFolderPath === '') {
throw new Error('Root Folder should have been present on server')
throw new Error('Root folder has to be present on the server.')
}
console.log(
`Creating Parent Folder:\n${newFolderName} in ${newParentFolderPath}`
`Creating parent folder:\n'${newFolderName}' in '${newParentFolderPath}'`
)
const parentFolder = await this.createFolder(
newFolderName,
@@ -581,7 +634,9 @@ export class SASViyaApiClient {
undefined,
accessToken
)
console.log(`Parent Folder "${newFolderName}" successfully created.`)
console.log(
`Parent folder '${newFolderName}' has been successfully created.`
)
parentFolderUri = `/folders/folders/${parentFolder.id}`
} else if (isForced && accessToken && !this.isForceDeploy) {
this.isForceDeploy = true
@@ -595,11 +650,11 @@ export class SASViyaApiClient {
const newFolderName = `${parentFolderPath.split('/').pop()}`
if (newParentFolderPath === '') {
throw new Error('Root Folder should have been present on server')
throw new Error(`Root folder has to be present on the server.`)
}
console.log(
`Creating Parent Folder:\n${newFolderName} in ${newParentFolderPath}`
`Creating parent folder:\n'${newFolderName}' in '${newParentFolderPath}'`
)
const parentFolder = await this.createFolder(
@@ -609,7 +664,9 @@ export class SASViyaApiClient {
accessToken
)
console.log(`Parent Folder "${newFolderName}" successfully created.`)
console.log(
`Parent folder '${newFolderName}' has been successfully created.`
)
parentFolderUri = `/folders/folders/${parentFolder.id}`
}
@@ -633,8 +690,11 @@ export class SASViyaApiClient {
createFolderRequest
)
// update rootFolderMap with newly created folder.
await this.populateRootFolderMap(accessToken)
// update folder map with newly created folder.
await this.populateFolderMap(
`${parentFolderPath}/${folderName}`,
accessToken
)
return createFolderResponse
}
@@ -654,9 +714,7 @@ export class SASViyaApiClient {
accessToken?: string
) {
if (!parentFolderPath && !parentFolderUri) {
throw new Error(
'Either parentFolderPath or parentFolderUri must be provided'
)
throw new Error(`Path to or URI of the parent folder is required.`)
}
if (!parentFolderUri && parentFolderPath) {
@@ -697,7 +755,7 @@ export class SASViyaApiClient {
}
/**
* Performs a login redirect and returns an auth code for the given client
* Performs a login redirect and returns an auth code for the given client.
* @param clientId - the client ID to authenticate with.
*/
public async getAuthCode(clientId: string) {
@@ -851,7 +909,7 @@ export class SASViyaApiClient {
}
/**
* Executes a job via the SAS Viya Compute API
* Executes a job via the SAS Viya Compute API.
* @param sasJob - the relative path to the job.
* @param contextName - the name of the context where the job is to be executed.
* @param debug - sets the _debug flag in the job arguments.
@@ -865,35 +923,51 @@ export class SASViyaApiClient {
data?: any,
accessToken?: string
) {
if (!this.rootFolder) {
await this.populateRootFolder(accessToken)
}
if (!this.rootFolder) {
console.error('Root folder was not found')
throw new Error('Root folder was not found')
}
if (!this.rootFolderMap.size) {
await this.populateRootFolderMap(accessToken)
}
if (!this.rootFolderMap.size) {
console.error(`The job ${sasJob} was not found in ${this.rootFolderName}`)
if (isRelativePath(sasJob) && !this.rootFolderName) {
throw new Error(
`The job ${sasJob} was not found in ${this.rootFolderName}`
'Relative paths cannot be used without specifying a root folder name'
)
}
if (isRelativePath(sasJob)) {
const folderName = sasJob.split('/')[0]
await this.populateFolderMap(`${this.rootFolderName}/${folderName}`)
if (!this.folderMap.get(`${this.rootFolderName}/${folderName}`)) {
throw new Error(
`The folder '${folderName}' was not found at '${this.serverUrl}/${this.rootFolderName}'`
)
}
} else {
const folderPathParts = sasJob.split('/')
folderPathParts.pop()
const folderPath = folderPathParts.join('/')
await this.populateFolderMap(folderPath, accessToken)
}
const headers: any = { 'Content-Type': 'application/json' }
if (!!accessToken) {
headers.Authorization = `Bearer ${accessToken}`
}
const folderName = sasJob.split('/')[0]
const jobName = sasJob.split('/')[1]
const jobFolder = this.rootFolderMap.get(folderName)
const jobToExecute = jobFolder?.find((item) => item.name === jobName)
let jobToExecute
if (isRelativePath(sasJob)) {
const folderName = sasJob.split('/')[0]
const jobName = sasJob.split('/')[1]
const jobFolder = this.folderMap.get(
`${this.rootFolderName}/${folderName}`
)
jobToExecute = jobFolder?.find((item) => item.name === jobName)
} else {
const folderPathParts = sasJob.split('/')
const jobName = folderPathParts.pop()
const folderPath = folderPathParts.join('/')
const jobFolder = this.folderMap.get(folderPath)
jobToExecute = jobFolder?.find((item) => item.name === jobName)
}
if (!jobToExecute) {
throw new Error('Job was not found.')
throw new Error(`Job was not found.`)
}
let code = jobToExecute?.code
@@ -904,8 +978,7 @@ export class SASViyaApiClient {
)
if (!jobDefinitionLink) {
console.error('Job definition URI was not found.')
throw new Error('Job definition URI was not found.')
throw new Error(`URI of job definition was not found.`)
}
const { result: jobDefinition } = await this.request<JobDefinition>(
@@ -915,7 +988,7 @@ export class SASViyaApiClient {
code = jobDefinition.code
// Add code to existing job definition
// Adds code to existing job definition
jobToExecute.code = code
}
@@ -927,13 +1000,14 @@ export class SASViyaApiClient {
accessToken,
true,
data,
debug
debug,
true
)
}
/**
* Executes a job via the SAS Viya Job Execution API
* @param sasJob - the relative path to the job.
* @param sasJob - the relative or absolute path to the job.
* @param contextName - the name of the context where the job is to be executed.
* @param debug - sets the _debug flag in the job arguments.
* @param data - any data to be passed in as input to the job.
@@ -946,20 +1020,31 @@ export class SASViyaApiClient {
data?: any,
accessToken?: string
) {
if (!this.rootFolder) {
await this.populateRootFolder(accessToken)
if (isRelativePath(sasJob) && !this.rootFolderName) {
throw new Error(
'Relative paths cannot be used without specifying a root folder name.'
)
}
if (!this.rootFolder) {
throw new Error('Root folder was not found')
}
if (!this.rootFolderMap.size) {
await this.populateRootFolderMap(accessToken)
}
if (!this.rootFolderMap.size) {
throw new Error(
`The job ${sasJob} was not found in ${this.rootFolderName}`
)
if (isRelativePath(sasJob)) {
const folderName = sasJob.split('/')[0]
await this.populateFolderMap(`${this.rootFolderName}/${folderName}`)
if (!this.folderMap.get(`${this.rootFolderName}/${folderName}`)) {
throw new Error(
`The folder '${folderName}' was not found at '${this.serverUrl}/${this.rootFolderName}'.`
)
}
} else {
const folderPathParts = sasJob.split('/')
folderPathParts.pop()
const folderPath = folderPathParts.join('/')
await this.populateFolderMap(folderPath, accessToken)
if (!this.folderMap.get(folderPath)) {
throw new Error(
`The folder '${folderPath}' was not found at '${this.serverUrl}'.`
)
}
}
let files: any[] = []
@@ -967,114 +1052,128 @@ export class SASViyaApiClient {
files = await this.uploadTables(data, accessToken)
}
const jobName = path.basename(sasJob)
const jobFolder = sasJob.replace(`/${jobName}`, '')
const allJobsInFolder = this.rootFolderMap.get(jobFolder.replace('/', ''))
if (allJobsInFolder) {
const jobSpec = allJobsInFolder.find((j: Job) => j.name === jobName)
const jobDefinitionLink = jobSpec?.links.find(
(l) => l.rel === 'getResource'
)?.href
const requestInfo: any = {
method: 'GET'
}
const headers: any = { 'Content-Type': 'application/json' }
if (!!accessToken) {
headers.Authorization = `Bearer ${accessToken}`
}
requestInfo.headers = headers
const { result: jobDefinition } = await this.request<Job>(
`${this.serverUrl}${jobDefinitionLink}`,
requestInfo
)
const jobArguments: { [key: string]: any } = {
_contextName: contextName,
_program: `${this.rootFolderName}/${sasJob}`,
_webin_file_count: files.length,
_OMITJSONLISTING: true,
_OMITJSONLOG: true,
_OMITSESSIONRESULTS: true,
_OMITTEXTLISTING: true,
_OMITTEXTLOG: true
}
if (debug) {
jobArguments['_OMITTEXTLOG'] = 'false'
jobArguments['_OMITSESSIONRESULTS'] = 'false'
jobArguments['_DEBUG'] = 131
}
files.forEach((fileInfo, index) => {
jobArguments[
`_webin_fileuri${index + 1}`
] = `/files/files/${fileInfo.file.id}`
jobArguments[`_webin_name${index + 1}`] = fileInfo.tableName
})
const postJobRequest = {
method: 'POST',
headers,
body: JSON.stringify({
name: `exec-${jobName}`,
description: 'Powered by SASjs',
jobDefinition,
arguments: jobArguments
})
}
const { result: postedJob, etag } = await this.request<Job>(
`${this.serverUrl}/jobExecution/jobs?_action=wait`,
postJobRequest
)
const jobStatus = await this.pollJobState(
postedJob,
etag,
accessToken,
true
)
const { result: currentJob } = await this.request<Job>(
`${this.serverUrl}/jobExecution/jobs/${postedJob.id}`,
{ headers }
)
let jobResult, log
if (jobStatus === 'failed') {
return Promise.reject(currentJob.error)
}
const resultLink = currentJob.results['_webout.json']
const logLink = currentJob.links.find((l) => l.rel === 'log')
if (resultLink) {
jobResult = await this.request<any>(
`${this.serverUrl}${resultLink}/content`,
{ headers },
'text'
)
}
if (debug && logLink) {
log = await this.request<any>(
`${this.serverUrl}${logLink.href}/content`,
{
headers
}
).then((res: any) =>
res.result.items.map((i: any) => i.line).join('\n')
)
}
return { result: jobResult?.result, log }
let jobToExecute: Job | undefined
let jobName: string | undefined
let jobPath: string | undefined
if (isRelativePath(sasJob)) {
const folderName = sasJob.split('/')[0]
jobName = sasJob.split('/')[1]
jobPath = `${this.rootFolderName}/${folderName}`
const jobFolder = this.folderMap.get(jobPath)
jobToExecute = jobFolder?.find((item) => item.name === jobName)
} else {
throw new Error(
`The job ${sasJob} was not found at the location ${this.rootFolderName}`
const folderPathParts = sasJob.split('/')
jobName = folderPathParts.pop()
jobPath = folderPathParts.join('/')
const jobFolder = this.folderMap.get(jobPath)
jobToExecute = jobFolder?.find((item) => item.name === jobName)
}
if (!jobToExecute) {
throw new Error(`The job ${sasJob} was not found.`)
}
const jobDefinitionLink = jobToExecute?.links.find(
(l) => l.rel === 'getResource'
)?.href
const requestInfo: any = {
method: 'GET'
}
const headers: any = { 'Content-Type': 'application/json' }
if (!!accessToken) {
headers.Authorization = `Bearer ${accessToken}`
}
requestInfo.headers = headers
const { result: jobDefinition } = await this.request<Job>(
`${this.serverUrl}${jobDefinitionLink}`,
requestInfo
)
const jobArguments: { [key: string]: any } = {
_contextName: contextName,
_program: `${jobPath}/${jobName}`,
_webin_file_count: files.length,
_OMITJSONLISTING: true,
_OMITJSONLOG: true,
_OMITSESSIONRESULTS: true,
_OMITTEXTLISTING: true,
_OMITTEXTLOG: true
}
if (debug) {
jobArguments['_OMITTEXTLOG'] = 'false'
jobArguments['_OMITSESSIONRESULTS'] = 'false'
jobArguments['_DEBUG'] = 131
}
files.forEach((fileInfo, index) => {
jobArguments[
`_webin_fileuri${index + 1}`
] = `/files/files/${fileInfo.file.id}`
jobArguments[`_webin_name${index + 1}`] = fileInfo.tableName
})
const postJobRequest = {
method: 'POST',
headers,
body: JSON.stringify({
name: `exec-${jobName}`,
description: 'Powered by SASjs',
jobDefinition,
arguments: jobArguments
})
}
const { result: postedJob, etag } = await this.request<Job>(
`${this.serverUrl}/jobExecution/jobs?_action=wait`,
postJobRequest
)
const jobStatus = await this.pollJobState(
postedJob,
etag,
accessToken,
true
)
const { result: currentJob } = await this.request<Job>(
`${this.serverUrl}/jobExecution/jobs/${postedJob.id}`,
{ headers }
)
let jobResult
let log
if (jobStatus === 'failed') {
return Promise.reject(currentJob.error)
}
const resultLink = currentJob.results['_webout.json']
const logLink = currentJob.links.find((l) => l.rel === 'log')
if (resultLink) {
jobResult = await this.request<any>(
`${this.serverUrl}${resultLink}/content`,
{ headers },
'text'
)
}
if (debug && logLink) {
log = await this.request<any>(
`${this.serverUrl}${logLink.href}/content`,
{
headers
}
).then((res: any) => res.result.items.map((i: any) => i.line).join('\n'))
}
return { result: jobResult?.result, log }
}
private async populateRootFolderMap(accessToken?: string) {
const allItems = new Map<string, Job[]>()
const url = '/folders/folders/@item?path=' + this.rootFolderName
private async populateFolderMap(folderPath: string, accessToken?: string) {
const path = isRelativePath(folderPath)
? `${this.rootFolderName}/${folderPath}`
: folderPath
if (this.folderMap.get(path)) {
return
}
const url = '/folders/folders/@item?path=' + path
const requestInfo: any = {
method: 'GET'
}
@@ -1086,7 +1185,7 @@ export class SASViyaApiClient {
requestInfo
)
if (!folder) {
throw new Error('Cannot populate RootFolderMap unless rootFolder exists')
throw new Error(`The path ${path} does not exist on ${this.serverUrl}`)
}
const { result: members } = await this.request<{ items: any[] }>(
`${this.serverUrl}/folders/folders/${folder.id}/members`,
@@ -1094,55 +1193,7 @@ export class SASViyaApiClient {
)
const itemsAtRoot = members.items
allItems.set('', itemsAtRoot)
const subfolderRequests = members.items
.filter((i: any) => i.contentType === 'folder')
.map(async (member: any) => {
const subFolderUrl =
'/folders/folders/@item?path=' +
this.rootFolderName +
'/' +
member.name
const { result: memberDetail } = await this.request<Folder>(
`${this.serverUrl}${subFolderUrl}`,
requestInfo
)
const membersLink = memberDetail.links.find(
(l: any) => l.rel === 'members'
)
const { result: memberContents } = await this.request<{ items: any[] }>(
`${this.serverUrl}${membersLink!.href}`,
requestInfo
)
const itemsInFolder = memberContents.items as any[]
allItems.set(member.name, itemsInFolder)
return itemsInFolder
})
await Promise.all(subfolderRequests)
this.rootFolderMap = allItems
}
private async populateRootFolder(accessToken?: string) {
const url = '/folders/folders/@item?path=' + this.rootFolderName
const requestInfo: RequestInit = {
method: 'GET'
}
if (accessToken) {
requestInfo.headers = { Authorization: `Bearer ${accessToken}` }
}
let error
const rootFolder = await this.request<Folder>(
`${this.serverUrl}${url}`,
requestInfo
)
this.rootFolder = rootFolder?.result || null
if (error) {
throw new Error(JSON.stringify(error))
}
this.folderMap.set(path, itemsAtRoot)
}
private async pollJobState(
@@ -1164,7 +1215,7 @@ export class SASViyaApiClient {
}
const stateLink = postedJob.links.find((l: any) => l.rel === 'state')
if (!stateLink) {
Promise.reject('Job state link was not found.')
Promise.reject(`Job state link was not found.`)
}
const { result: state } = await this.request<string>(
@@ -1348,17 +1399,13 @@ export class SASViyaApiClient {
const { result: contexts } = await this.request<{ items: Context[] }>(
`${this.serverUrl}/compute/contexts?filter=eq(name, "${contextName}")`,
{ headers }
).catch((e) => {
console.error(e)
throw new Error(
`An error occurred when fetching the context with ID ${contextName}`
)
).catch((err) => {
throw err
})
if (!contexts || !(contexts.items && contexts.items.length)) {
throw new Error(
`The context ${contextName} was not found on ${this.serverUrl}.`
`The context '${contextName}' was not found at '${this.serverUrl}'.`
)
}
@@ -1417,7 +1464,7 @@ export class SASViyaApiClient {
}
/**
* For performance (and in case of accidental error) the `deleteFolder` function does not actually delete the folder (and all it's content and subfolder content). Instead the folder is simply moved to the recycle bin. Deletion time will be added to the folder name.
* For performance (and in case of accidental error) the `deleteFolder` function does not actually delete the folder (and all its content and subfolder content). Instead the folder is simply moved to the recycle bin. Deletion time will be added to the folder name.
* @param folderPath - the full path (eg `/Public/example/deleteThis`) of the folder to be deleted.
* @param accessToken - an access token for authorizing the request.
*/

View File

@@ -21,7 +21,8 @@ import {
parseGeneratedCode,
parseWeboutResponse,
needsRetry,
asyncForEach
asyncForEach,
isRelativePath
} from './utils'
import {
SASjsConfig,
@@ -30,7 +31,8 @@ import {
ServerType,
CsrfToken,
UploadFile,
EditContextInput
EditContextInput,
ErrorResponse
} from './types'
import { SASViyaApiClient } from './SASViyaApiClient'
import { SAS9ApiClient } from './SAS9ApiClient'
@@ -84,9 +86,8 @@ export default class SASjs {
serverName: string,
repositoryName: string
) {
if (this.sasjsConfig.serverType !== ServerType.SAS9) {
throw new Error('This operation is only supported on SAS9 servers.')
}
this.isMethodSupported('executeScriptSAS9', ServerType.SAS9)
return await this.sas9ApiClient?.executeScript(
linesOfCode,
serverName,
@@ -95,16 +96,14 @@ export default class SASjs {
}
public async getAllContexts(accessToken: string) {
if (this.sasjsConfig.serverType !== ServerType.SASViya) {
throw new Error('This operation is only supported on SAS Viya servers.')
}
this.isMethodSupported('getAllContexts', ServerType.SASViya)
return await this.sasViyaApiClient!.getAllContexts(accessToken)
}
public async getExecutableContexts(accessToken: string) {
if (this.sasjsConfig.serverType !== ServerType.SASViya) {
throw new Error('This operation is only supported on SAS Viya servers.')
}
this.isMethodSupported('getExecutableContexts', ServerType.SASViya)
return await this.sasViyaApiClient!.getExecutableContexts(accessToken)
}
@@ -125,9 +124,8 @@ export default class SASjs {
authorizedUsers: string[],
accessToken: string
) {
if (this.sasjsConfig.serverType !== ServerType.SASViya) {
throw new Error('This operation is only supported on SAS Viya servers.')
}
this.isMethodSupported('createContext', ServerType.SASViya)
return await this.sasViyaApiClient!.createContext(
contextName,
launchContextName,
@@ -149,9 +147,8 @@ export default class SASjs {
editedContext: EditContextInput,
accessToken?: string
) {
if (this.sasjsConfig.serverType !== ServerType.SASViya) {
throw new Error('This operation is only supported on SAS Viya servers.')
}
this.isMethodSupported('editContext', ServerType.SASViya)
return await this.sasViyaApiClient!.editContext(
contextName,
editedContext,
@@ -165,16 +162,14 @@ export default class SASjs {
* @param accessToken - an access token for an authorized user.
*/
public async deleteContext(contextName: string, accessToken?: string) {
if (this.sasjsConfig.serverType !== ServerType.SASViya) {
throw new Error('This operation is only supported on SAS Viya servers.')
}
this.isMethodSupported('deleteContext', ServerType.SASViya)
return await this.sasViyaApiClient!.deleteContext(contextName, accessToken)
}
public async createSession(contextName: string, accessToken: string) {
if (this.sasjsConfig.serverType !== ServerType.SASViya) {
throw new Error('This operation is only supported on SAS Viya servers.')
}
this.isMethodSupported('createSession', ServerType.SASViya)
return await this.sasViyaApiClient!.createSession(contextName, accessToken)
}
@@ -186,9 +181,8 @@ export default class SASjs {
sessionId = '',
silent = false
) {
if (this.sasjsConfig.serverType !== ServerType.SASViya) {
throw new Error('This operation is only supported on SAS Viya servers.')
}
this.isMethodSupported('executeScriptSASViya', ServerType.SASViya)
return await this.sasViyaApiClient!.executeScript(
fileName,
linesOfCode,
@@ -201,7 +195,7 @@ export default class SASjs {
}
/**
* Creates a folder at SAS file system
* Creates a folder at SAS file system.
* @param folderName - name of the folder to be created.
* @param parentFolderPath - the full path (eg `/Public/example/myFolder`) of the parent folder.
* @param parentFolderUri - the URI of the parent folder.
@@ -217,9 +211,8 @@ export default class SASjs {
sasApiClient?: SASViyaApiClient,
isForced?: boolean
) {
if (this.sasjsConfig.serverType !== ServerType.SASViya) {
throw new Error('This operation is only supported on SAS Viya servers.')
}
this.isMethodSupported('createFolder', ServerType.SASViya)
if (sasApiClient)
return await sasApiClient.createFolder(
folderName,
@@ -244,9 +237,8 @@ export default class SASjs {
accessToken?: string,
sasApiClient?: SASViyaApiClient
) {
if (this.sasjsConfig.serverType !== ServerType.SASViya) {
throw new Error('This operation is only supported on SAS Viya servers.')
}
this.isMethodSupported('createJobDefinition', ServerType.SASViya)
if (sasApiClient)
return await sasApiClient!.createJobDefinition(
jobName,
@@ -265,9 +257,8 @@ export default class SASjs {
}
public async getAuthCode(clientId: string) {
if (this.sasjsConfig.serverType !== ServerType.SASViya) {
throw new Error('This operation is only supported on SAS Viya servers.')
}
this.isMethodSupported('getAuthCode', ServerType.SASViya)
return await this.sasViyaApiClient!.getAuthCode(clientId)
}
@@ -276,9 +267,8 @@ export default class SASjs {
clientSecret: string,
authCode: string
) {
if (this.sasjsConfig.serverType !== ServerType.SASViya) {
throw new Error('This operation is only supported on SAS Viya servers.')
}
this.isMethodSupported('getAccessToken', ServerType.SASViya)
return await this.sasViyaApiClient!.getAccessToken(
clientId,
clientSecret,
@@ -291,9 +281,8 @@ export default class SASjs {
clientSecret: string,
refreshToken: string
) {
if (this.sasjsConfig.serverType !== ServerType.SASViya) {
throw new Error('This operation is only supported on SAS Viya servers.')
}
this.isMethodSupported('refreshTokens', ServerType.SASViya)
return await this.sasViyaApiClient!.refreshTokens(
clientId,
clientSecret,
@@ -302,9 +291,8 @@ export default class SASjs {
}
public async deleteClient(clientId: string, accessToken: string) {
if (this.sasjsConfig.serverType !== ServerType.SASViya) {
throw new Error('This operation is only supported on SAS Viya servers.')
}
this.isMethodSupported('deleteClient', ServerType.SASViya)
return await this.sasViyaApiClient!.deleteClient(clientId, accessToken)
}
@@ -325,7 +313,7 @@ export default class SASjs {
}
/**
* Returns the _csrf token of the current session for the API approach
* Returns the _csrf token of the current session for the API approach.
*
*/
public getCsrfApi() {
@@ -342,7 +330,7 @@ export default class SASjs {
/**
* Sets the SASjs configuration.
* @param config - SASjsConfig indicating SASjs Configuration
* @param config - SASjs configuration.
*/
public async setSASjsConfig(config: SASjsConfig) {
this.sasjsConfig = {
@@ -353,17 +341,16 @@ export default class SASjs {
}
/**
* Sets the debug state. Turning this on will enable additional logging to
* be returned to the adapter.
* @param value - Boolean indicating debug state
* Sets the debug state. Turning this on will enable additional logging in the adapter.
* @param value - boolean indicating debug state (on/off).
*/
public setDebugState(value: boolean) {
this.sasjsConfig.debug = value
}
/**
* Checks whether a session is active, or login is required
* @returns a promise which resolves with an object containing two values - a boolean `isLoggedIn`, and a string `userName`
* Checks whether a session is active, or login is required.
* @returns - a promise which resolves with an object containing two values - a boolean `isLoggedIn`, and a string `userName`.
*/
public async checkSession() {
const loginResponse = await fetch(this.loginUrl.replace('.do', ''))
@@ -377,9 +364,9 @@ export default class SASjs {
}
/**
* Logs into the SAS server with the supplied credentials
* @param username - a string representing the username
* @param password - a string representing the password
* Logs into the SAS server with the supplied credentials.
* @param username - a string representing the username.
* @param password - a string representing the password.
*/
public async logIn(username: string, password: string) {
const loginParams: any = {
@@ -448,7 +435,7 @@ export default class SASjs {
}
/**
* Logs out of the configured SAS server
* Logs out of the configured SAS server.
*/
public logOut() {
return new Promise((resolve, reject) => {
@@ -462,12 +449,12 @@ export default class SASjs {
}
/**
* Uploads a file to the given service
* @param sasJob - The path to the SAS program (ultimately resolves to
* Uploads a file to the given service.
* @param sasJob - the path to the SAS program (ultimately resolves to
* the SAS `_program` parameter to run a Job Definition or SAS 9 Stored
* Process.) Is prepended at runtime with the value of `appLoc`.
* @param file - Array of files to be uploaded, including File object and file name.
* @param params - Request URL paramaters
* Process). Is prepended at runtime with the value of `appLoc`.
* @param files - array of files to be uploaded, including File object and file name.
* @param params - request URL parameters.
*/
public uploadFile(sasJob: string, files: UploadFile[], params: any) {
const fileUploader =
@@ -484,21 +471,21 @@ export default class SASjs {
}
/**
* Makes a request to the SAS Service specified in `SASjob`. The response
* Makes a request to the SAS Service specified in `SASjob`. The response
* object will always contain table names in lowercase, and column names in
* uppercase. Values are returned formatted by default, unformatted
* uppercase. Values are returned formatted by default, unformatted
* values can be configured as an option in the `%webout` macro.
*
* @param sasJob - The path to the SAS program (ultimately resolves to
* @param sasJob - the path to the SAS program (ultimately resolves to
* the SAS `_program` parameter to run a Job Definition or SAS 9 Stored
* Process.) Is prepended at runtime with the value of `appLoc`.
* @param data - A JSON object containing one or more tables to be sent to
* SAS. Can be `null` if no inputs required.
* @param config - Provide any changes to the config here, for instance to
* enable / disable `debug`. Any change provided will override the global config,
* Process). Is prepended at runtime with the value of `appLoc`.
* @param data - a JSON object containing one or more tables to be sent to
* SAS. Can be `null` if no inputs required.
* @param config - provide any changes to the config here, for instance to
* 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
* 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.
*/
public async request(
@@ -515,8 +502,6 @@ export default class SASjs {
...config
}
sasJob = sasJob.startsWith('/') ? sasJob.replace('/', '') : sasJob
if (config.serverType === ServerType.SASViya && config.contextName) {
if (config.useComputeApi) {
requestResponse = await this.executeJobViaComputeApi(
@@ -552,8 +537,7 @@ export default class SASjs {
}
/**
* Creates the folders and services in the provided JSON on the given location
* (appLoc) on the given server (serverUrl).
* Creates the folders and services at the given location `appLoc` on the given server `serverUrl`.
* @param serviceJson - the JSON specifying the folders and services to be created.
* @param appLoc - the base folder in which to create the new folders and
* services. If not provided, is taken from SASjsConfig.
@@ -570,9 +554,7 @@ export default class SASjs {
accessToken?: string,
isForced = false
) {
if (this.sasjsConfig.serverType !== ServerType.SASViya) {
throw new Error('This operation is only supported on SAS Viya servers.')
}
this.isMethodSupported('deployServicePack', ServerType.SASViya)
let sasApiClient: any = null
if (serverUrl || appLoc) {
@@ -686,7 +668,9 @@ export default class SASjs {
resolve(retryResponse)
} else {
this.retryCountComputeApi = 0
reject({ MESSAGE: 'Compute API retry requests limit reached' })
reject(
new ErrorResponse('Compute API retry requests limit reached')
)
}
}
@@ -697,7 +681,7 @@ export default class SASjs {
sasjsWaitingRequest.config = config
this.sasjsWaitingRequests.push(sasjsWaitingRequest)
} else {
reject({ MESSAGE: error || 'Job execution failed' })
reject(new ErrorResponse('Job execution failed', error))
}
this.appendSasjsRequest(response.log, sasJob, null)
@@ -779,11 +763,13 @@ export default class SASjs {
resolve(retryResponse)
} else {
this.retryCountJeseApi = 0
reject({ MESSAGE: 'Jes API retry requests limit reached' })
reject(
new ErrorResponse('Jes API retry requests limit reached')
)
}
}
reject({ MESSAGE: (e && e.message) || 'Job execution failed' })
reject(new ErrorResponse('Job execution failed', e))
})
)
}
@@ -807,11 +793,15 @@ export default class SASjs {
SASjob: sasJob,
data
}
const program = config.appLoc
? config.appLoc.replace(/\/?$/, '/') + sasJob.replace(/^\//, '')
const program = isRelativePath(sasJob)
? config.appLoc
? config.appLoc.replace(/\/?$/, '/') + sasJob.replace(/^\//, '')
: sasJob
: sasJob
const jobUri =
config.serverType === 'SASVIYA' ? await this.getJobUri(sasJob) : ''
config.serverType === ServerType.SASViya
? await this.getJobUri(sasJob)
: ''
const apiUrl = `${config.serverUrl}${this.jobsPath}/?${
jobUri.length > 0
? '__program=' + program + '&_job=' + jobUri
@@ -895,7 +885,7 @@ export default class SASjs {
sasjsWaitingRequest.requestPromise.promise = new Promise(
(resolve, reject) => {
if (isError) {
reject({ MESSAGE: errorMsg })
reject(new ErrorResponse(errorMsg))
}
const headers: any = {}
if (this.csrfTokenWeb) {
@@ -961,9 +951,12 @@ export default class SASjs {
if (jsonResponseText !== '') {
resolve(JSON.parse(jsonResponseText))
} else {
reject({
MESSAGE: this.parseSAS9ErrorResponse(responseText)
})
reject(
new ErrorResponse(
'Job WEB execution failed',
this.parseSAS9ErrorResponse(responseText)
)
)
}
} else if (
config.serverType === ServerType.SASViya &&
@@ -976,15 +969,30 @@ export default class SASjs {
try {
resolve(JSON.parse(resText))
} catch (e) {
reject({ MESSAGE: resText })
reject(
new ErrorResponse(
'Job WEB debug response parsing failed',
{ response: resText, exception: e }
)
)
}
},
(err: any) => {
reject({ MESSAGE: err })
reject(
new ErrorResponse(
'Job WEB debug response parsing failed',
err
)
)
}
)
} catch (e) {
reject({ MESSAGE: responseText })
reject(
new ErrorResponse(
'Job WEB debug response parsing failed',
{ response: responseText, exception: e }
)
)
}
} else {
this.updateUsername(responseText)
@@ -992,14 +1000,19 @@ export default class SASjs {
const parsedJson = JSON.parse(responseText)
resolve(parsedJson)
} catch (e) {
reject({ MESSAGE: responseText })
reject(
new ErrorResponse('Job WEB response parsing failed', {
response: responseText,
exception: e
})
)
}
}
}
}
})
.catch((e: Error) => {
reject(e)
reject(new ErrorResponse('Job WEB request failed', e))
})
}
)
@@ -1074,28 +1087,33 @@ export default class SASjs {
resolve(resText)
})
} else {
reject('No debug info in response')
reject('No debug info found in response.')
}
})
}
private async getJobUri(sasJob: string) {
if (!this.sasViyaApiClient) return ''
const jobMap: any = await this.sasViyaApiClient.getAppLocMap()
let uri = ''
if (jobMap.size) {
const jobKey = sasJob.split('/')[0]
const jobName = sasJob.split('/')[1]
let folderPath
let jobName: string
if (isRelativePath(sasJob)) {
folderPath = sasJob.split('/')[0]
jobName = sasJob.split('/')[1]
} else {
const folderPathParts = sasJob.split('/')
jobName = folderPathParts.pop() || ''
folderPath = folderPathParts.join('/')
}
const locJobs = jobMap.get(jobKey)
if (locJobs) {
const job = locJobs.find(
(el: any) => el.name === jobName && el.contentType === 'jobDefinition'
)
if (job) {
uri = job.uri
}
const locJobs = await this.sasViyaApiClient.getJobsInFolder(folderPath)
if (locJobs) {
const job = locJobs.find(
(el: any) => el.name === jobName && el.contentType === 'jobDefinition'
)
if (job) {
uri = job.uri
}
}
return uri
@@ -1353,7 +1371,7 @@ export default class SASjs {
)
break
default:
throw new Error(`Unidenitied member present in Json: ${member.name}`)
throw new Error(`Unidentified member '${member.name}' provided.`)
}
if (member.type === 'folder' && member.members && member.members.length)
await this.createFoldersAndServices(
@@ -1365,4 +1383,14 @@ export default class SASjs {
)
})
}
private isMethodSupported(method: string, serverType: string) {
if (this.sasjsConfig.serverType !== serverType) {
throw new Error(
`Method '${method}' is only supported on ${
serverType === ServerType.SAS9 ? 'SAS9' : 'SAS Viya'
} servers.`
)
}
}
}

View File

@@ -78,7 +78,7 @@ export class SessionManager {
if (!this.currentContext) {
const { result: contexts } = await this.request<{
items: Context[]
}>(`${this.serverUrl}/compute/contexts`, {
}>(`${this.serverUrl}/compute/contexts?limit=10000`, {
headers: this.getHeaders(accessToken)
})
@@ -93,7 +93,7 @@ export class SessionManager {
if (!currentContext) {
throw new Error(
`The context ${this.contextName} was not found on the server ${this.serverUrl}`
`The context '${this.contextName}' was not found on the server ${this.serverUrl}.`
)
}
@@ -128,7 +128,7 @@ export class SessionManager {
if (sessionState === 'pending') {
if (stateLink) {
if (!silent) {
console.log('Polling session status... \n')
console.log('Polling session status... \n') // ?
}
const { result: state } = await this.request<string>(
`${this.serverUrl}${stateLink.href}?wait=30`,
@@ -140,7 +140,7 @@ export class SessionManager {
sessionState = state.trim()
if (!silent) {
console.log(`Current state: ${sessionState}\n`)
console.log(`Current state is '${sessionState}'\n`)
}
resolve(sessionState)
}

View File

@@ -0,0 +1,26 @@
export class ErrorResponse {
body: ErrorBody
constructor(message: string, details?: any) {
let detailsString = ''
let raw
try {
detailsString = JSON.stringify(details)
} catch {
raw = details
}
this.body = {
message,
details: detailsString,
raw
}
}
}
interface ErrorBody {
message: string
details: string
raw: any
}

View File

@@ -1,8 +1,8 @@
import { ServerType } from './ServerType'
/**
* Specifies the configuration for the SASjs instance.
*
* Specifies the configuration for the SASjs instance - eg where and how to
* connect to SAS.
*/
export class SASjsConfig {
/**
@@ -11,21 +11,50 @@ export class SASjsConfig {
* streamed.
*/
serverUrl: string = ''
/**
* The location of the Stored Process Web Application. By default the adapter
* will use '/SASStoredProcess/do' on SAS 9.
*/
pathSAS9: string = ''
/**
* The location of the Job Execution Web Application. By default the adapter
* will use '/SASJobExecution' on SAS Viya.
*/
pathSASViya: string = ''
/**
* The appLoc is the parent folder under which the SAS services (STPs or Job
* Execution Services) are stored.
* Execution Services) are stored. We recommend that each app is stored in
* a dedicated parent folder (the appLoc) and the services are grouped inside
* subfolders within the appLoc - allowing functionality to be restricted
* according to those groups at backend.
* When using appLoc, the paths provided in the `request` function should be
* _without_ a leading slash (/).
*/
appLoc: string = ''
/**
* Can be SAS9 or SASVIYA
* Can be `SAS9` or `SASVIYA`.
*/
serverType: ServerType | null = null
/**
* Set to `true` to enable additional debugging.
*/
debug: boolean = true
/**
* The name of the compute context to use when calling the Viya APIs directly.
* Example value: 'SAS Job Execution compute context'
* If set to missing or empty, and useComputeApi is true, the adapter will use
* the JES APIs. If provided, the Job Code will be executed in pooled
* compute sessions on this named context.
*/
contextName: string = ''
/**
* Set to `false` to use the Job Execution Web Service. To enhance VIYA
* performance, set to `true` and provide a `contextName` on which to run
* the code. When running on a named context, the code executes under the
* user identity. When running as a Job Execution service, the code runs
* under the identity in the JES context. If no `contextName` is provided,
* and `useComputeApi` is `true`, then the service will run as a Job, except
* triggered using the APIs instead of the Job Execution Web Service broker.
*/
useComputeApi = false
}

View File

@@ -1,5 +1,5 @@
/**
* Represents requests that are queued, pending a signon event
* Represents requests that are queued, pending a signon event.
*
*/
export interface SASjsWaitingRequest {

View File

@@ -1,5 +1,5 @@
/**
* Server type - Viya or SAS9.
* Server type that can be `Viya` or `SAS9`.
*
*/
export enum ServerType {

View File

@@ -1,5 +1,5 @@
/**
* Represents a object that is passed to file uploader
* Represents an object that is passed to the file uploader.
*
*/
export interface UploadFile {

View File

@@ -1,7 +1,10 @@
export * from './Context'
export * from './CsrfToken'
export * from './ErrorResponse'
export * from './Folder'
export * from './Job'
export * from './JobDefinition'
export * from './JobResult'
export * from './Link'
export * from './SASjsConfig'
export * from './SASjsRequest'

View File

@@ -1,7 +1,7 @@
import { SASjsRequest } from '../types/SASjsRequest'
/**
* Comparator for SASjs request timestamps
* Comparator for SASjs request timestamps.
*
*/
export const compareTimestamps = (a: SASjsRequest, b: SASjsRequest) => {

View File

@@ -4,6 +4,9 @@ export * from './convertToCsv'
export * from './isAuthorizeFormRequired'
export * from './isLoginRequired'
export * from './isLoginSuccess'
export * from './isRelativePath'
export * from './isUri'
export * from './isUrl'
export * from './makeRequest'
export * from './needsRetry'
export * from './parseAndSubmitAuthorizeForm'
@@ -13,5 +16,3 @@ export * from './parseSasViyaLog'
export * from './serialize'
export * from './splitChunks'
export * from './parseWeboutResponse'
export * from './isUri'
export * from './isUrl'

View File

@@ -0,0 +1,2 @@
export const isRelativePath = (uri: string): boolean =>
!!uri && !uri.startsWith('/')

View File

@@ -1,5 +1,5 @@
/**
* Checks if string is in URI format
* @param str string to check
* Checks if string is in URI format.
* @param str - string to check.
*/
export const isUri = (str: string): boolean => /^\/folders\/folders\//.test(str)

View File

@@ -1,3 +1,7 @@
/**
* Checks if string is in URL format.
* @param url - string to check.
*/
export const isUrl = (url: string): boolean => {
const pattern = new RegExp(
'^(http://|https://)[a-z0-9]+([-.]{1}[a-z0-9]+)*.[a-z]{2,5}(:[0-9]{1,5})?(/.*)?$',

View File

@@ -37,13 +37,28 @@ export async function makeRequest<T>(
...request,
headers: { ...request.headers, [tokenHeader]: token }
}
return fetch(url, retryRequest).then((res) => {
etag = res.headers.get('ETag')
return responseTransform(res)
})
} else {
let body: any = await response.text()
try {
body = JSON.parse(body)
body.message = `Forbidden. Check your permissions and user groups. ${
body.message || ''
}`
body = JSON.stringify(body)
} catch (_) {}
return Promise.reject({ status: response.status, body })
}
} else {
const body = await response.text()
let body: any = await response.text()
if (needsRetry(body)) {
if (retryCount < retryLimit) {
@@ -65,6 +80,18 @@ export async function makeRequest<T>(
}
}
if (response.status === 401) {
try {
body = JSON.parse(body)
body.message = `Unauthorized request. Check your credentials(client, secret, access token). ${
body.message || ''
}`
body = JSON.stringify(body)
} catch (_) {}
}
return Promise.reject({ status: response.status, body })
}
} else {
@@ -104,5 +131,6 @@ export async function makeRequest<T>(
return responseTransformed
}
})
return { result, etag }
}

View File

@@ -11,11 +11,11 @@
"outline": [
{
"SAS Adapter": {
"SASjs": "classes/reflection-708.reflection-180.sasjs",
"SASjs": "classes/reflection-717.reflection-180.sasjs",
"Types": "modules/types"
},
"SAS Viya API Client": "classes/reflection-708.reflection-180.sasviyaapiclient",
"SAS 9 API Client": "classes/reflection-708.reflection-180.sas9apiclient"
"SAS Viya API Client": "classes/reflection-717.reflection-180.sasviyaapiclient",
"SAS 9 API Client": "classes/reflection-717.reflection-180.sas9apiclient"
}
],
"links": [

View File

@@ -1,49 +1,57 @@
const path = require("path");
const webpack = require("webpack");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
const path = require('path')
const webpack = require('webpack')
const terserPlugin = require('terser-webpack-plugin')
const browserConfig = {
entry: "./src/index.ts",
devtool: "inline-source-map",
mode: "development",
entry: './src/index.ts',
devtool: 'inline-source-map',
mode: 'production',
optimization: {
minimize: false,
minimizer: [
new terserPlugin({
cache: true,
parallel: true,
sourceMap: true,
terserOptions: {}
})
]
},
module: {
rules: [
{
test: /\.ts?$/,
use: "ts-loader",
exclude: /node_modules/,
},
],
use: 'ts-loader',
exclude: /node_modules/
}
]
},
resolve: {
extensions: [".ts", ".js"],
extensions: ['.ts', '.js']
},
output: {
filename: "index.js",
path: path.resolve(__dirname, "build"),
libraryTarget: "umd",
library: "SASjs",
filename: 'index.js',
path: path.resolve(__dirname, 'build'),
libraryTarget: 'umd',
library: 'SASjs'
},
plugins: [
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /en/),
new webpack.SourceMapDevToolPlugin({
filename: null,
exclude: [/node_modules/],
test: /\.ts($|\?)/i,
test: /\.ts($|\?)/i
}),
],
};
new webpack.IgnorePlugin(/\/iconv-loader$/)
]
}
const nodeConfig = {
...browserConfig,
target: "node",
target: 'node',
output: {
...browserConfig.output,
path: path.resolve(__dirname, "build", "node"),
},
};
path: path.resolve(__dirname, 'build', 'node')
}
}
module.exports = [browserConfig, nodeConfig];
module.exports = [browserConfig, nodeConfig]