1
0
mirror of https://github.com/sasjs/adapter.git synced 2025-12-11 01:14:36 +00:00

Compare commits

...

212 Commits

Author SHA1 Message Date
Yury Shkoda
6a3ab7032f Merge pull request #284 from sasjs/error-handling
fix(error-handling): fixed console.log
2021-03-09 18:07:53 +03:00
Yury Shkoda
d818d14cb4 Merge branch 'master' into error-handling 2021-03-09 18:07:46 +03:00
Yury Shkoda
599c130395 fix(error-handling): fixed console.log 2021-03-09 18:06:27 +03:00
Yury Shkoda
9ef2759e27 Merge pull request #283 from sasjs/error-handling
fix(error-handling): catching unhandled promise rejection
2021-03-09 17:15:10 +03:00
Yury Shkoda
43355c88d4 Merge branch 'master' into error-handling 2021-03-09 17:12:45 +03:00
Yury Shkoda
15e1acaf4f fix(error-handling): catching unhandled promise rejection 2021-03-09 17:11:29 +03:00
Yury Shkoda
ec77ffdd88 Merge pull request #282 from sasjs/error-handling
fix(error-handling): console logged error
2021-03-09 15:55:39 +03:00
Yury Shkoda
9797c1ca84 Merge branch 'master' into error-handling 2021-03-09 15:53:40 +03:00
Yury Shkoda
bbe9633dc8 fix(error-handling): console logged error 2021-03-09 15:52:00 +03:00
Muhammad Saad
e7ba09793c Merge pull request #272 from sasjs/dependabot/npm_and_yarn/semantic-release-17.4.1
chore(deps-dev): bump semantic-release from 17.3.9 to 17.4.1
2021-03-09 15:32:57 +05:00
Muhammad Saad
c0c0800e61 Merge branch 'master' into dependabot/npm_and_yarn/semantic-release-17.4.1 2021-03-09 15:31:46 +05:00
Muhammad Saad
0bd9d8f93f Merge pull request #278 from sasjs/dependabot/npm_and_yarn/webpack-5.24.4
chore(deps-dev): bump webpack from 5.21.2 to 5.24.4
2021-03-09 15:31:37 +05:00
dependabot-preview[bot]
214fc2d5cd chore(deps-dev): bump semantic-release from 17.3.9 to 17.4.1
Bumps [semantic-release](https://github.com/semantic-release/semantic-release) from 17.3.9 to 17.4.1.
- [Release notes](https://github.com/semantic-release/semantic-release/releases)
- [Commits](https://github.com/semantic-release/semantic-release/compare/v17.3.9...v17.4.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-09 10:30:56 +00:00
Muhammad Saad
55b0e2f934 Merge branch 'master' into dependabot/npm_and_yarn/webpack-5.24.4 2021-03-09 15:30:18 +05:00
Muhammad Saad
609cd4ed6d Merge pull request #280 from sasjs/dependabot/npm_and_yarn/typedoc-0.20.30
chore(deps-dev): bump typedoc from 0.19.2 to 0.20.30
2021-03-09 15:29:36 +05:00
dependabot-preview[bot]
2b20bbdcc8 chore(deps-dev): bump typedoc from 0.19.2 to 0.20.30
Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.19.2 to 0.20.30.
- [Release notes](https://github.com/TypeStrong/TypeDoc/releases)
- [Commits](https://github.com/TypeStrong/TypeDoc/compare/v0.19.2...v0.20.30)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-09 10:27:54 +00:00
dependabot-preview[bot]
946a95bea1 chore(deps-dev): bump webpack from 5.21.2 to 5.24.4
Bumps [webpack](https://github.com/webpack/webpack) from 5.21.2 to 5.24.4.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.21.2...v5.24.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-09 10:27:51 +00:00
Muhammad Saad
7ec1c152e3 Merge pull request #279 from sasjs/dependabot/npm_and_yarn/sasjs/utils-2.6.3
chore(deps): bump @sasjs/utils from 2.5.0 to 2.6.3
2021-03-09 15:26:27 +05:00
dependabot-preview[bot]
0cf1110018 chore(deps): bump @sasjs/utils from 2.5.0 to 2.6.3
Bumps [@sasjs/utils](https://github.com/sasjs/utils) from 2.5.0 to 2.6.3.
- [Release notes](https://github.com/sasjs/utils/releases)
- [Commits](https://github.com/sasjs/utils/compare/v2.5.0...v2.6.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-09 07:52:39 +00:00
Yury Shkoda
9c5ada6fa1 Merge pull request #277 from sasjs/error-handling
fix(error-handling): added catch block to poll job state
2021-03-09 10:24:14 +03:00
Yury Shkoda
0f5702e21b fix(lint): used latest version of prettier 2021-03-09 10:21:52 +03:00
Yury Shkoda
f10d6ec80a fix(lint): updated dependencies 2021-03-09 09:55:43 +03:00
Yury Shkoda
490215df90 fix(lint): fixed code style 2021-03-09 09:53:35 +03:00
Yury Shkoda
9d27451813 fix(lint): fixed code style 2021-03-09 09:44:10 +03:00
Yury Shkoda
a977f59675 fix(error-handling): added catch block to poll job state 2021-03-09 09:35:01 +03:00
Krishna Acondy
47be5e77e5 Merge pull request #269 from sasjs/tests-258
test: issue 258
2021-03-02 12:24:46 +00:00
Mihajlo Medjedovic
d517e79ec0 chore: cleanup 2021-03-02 13:13:03 +01:00
Mihajlo Medjedovic
8714ecdde8 test: issue 258 2021-02-26 14:40:07 +01:00
Muhammad Saad
2cffc57209 Merge pull request #259 from sasjs/issue-258
Issue 258
2021-02-25 18:41:21 +05:00
Muhammad Saad
4e43687de2 Merge branch 'master' into issue-258 2021-02-25 18:37:35 +05:00
Muhammad Saad
f8dab83e37 Merge pull request #267 from sasjs/error-handling
chore(error-handling): removed redundant catch block
2021-02-25 18:36:19 +05:00
Yury Shkoda
655af03cf3 chore(error-handling): removed redundant catch block 2021-02-25 15:20:35 +03:00
Yury Shkoda
0a4dd00edb Merge pull request #266 from sasjs/error-handling
fix(RequestClient): add catch block to authorize method
2021-02-25 12:59:47 +03:00
Yury Shkoda
55b4929c54 Merge branch 'master' into error-handling 2021-02-25 12:58:25 +03:00
Yury Shkoda
8eb73a6b3c fix(RequestClient): add catch block to authorize method 2021-02-25 12:55:34 +03:00
Krishna Acondy
0aeb201625 Merge branch 'master' into issue-258 2021-02-25 07:59:43 +00:00
Yury Shkoda
e0140a23c2 Merge pull request #264 from sasjs/error-handling
fix(RequestClient): improved handleError method
2021-02-25 09:52:40 +03:00
Yury Shkoda
ff6698a9d1 chore: removed async from parseResponse method 2021-02-25 09:51:00 +03:00
Yury Shkoda
843d498b72 fix(RequestClient): improved handleError method 2021-02-25 09:14:49 +03:00
Mihajlo Medjedovic
349612a065 Merge branch 'issue-258' of github.com:sasjs/adapter into issue-258 2021-02-24 14:11:12 +01:00
Mihajlo Medjedovic
e48b22128d chore: small fix, error was not beign returned 2021-02-24 14:11:00 +01:00
Krishna Acondy
14dfe4ec51 Merge branch 'master' into issue-258 2021-02-24 12:47:16 +00:00
Yury Shkoda
f679b17cbe Merge pull request #263 from sasjs/error-handling
fix(docs): updated docs
2021-02-24 15:44:11 +03:00
Yury Shkoda
36a0f0e743 Merge branch 'master' into error-handling 2021-02-24 15:39:40 +03:00
Yury Shkoda
ad563b9bc8 fix(docs): updated docs 2021-02-24 15:37:31 +03:00
Mihajlo Medjedovic
e0051bf276 chore: test fixing 2021-02-24 13:15:14 +01:00
Mihajlo Medjedovic
7b72998e1c Merge branches 'issue-258' and 'master' of github.com:sasjs/adapter 2021-02-24 12:57:24 +01:00
Yury Shkoda
893cce7f21 Merge pull request #262 from sasjs/error-handling
fix(startComputeJob): improved error handling
2021-02-24 14:50:15 +03:00
Yury Shkoda
bf7e8fd0e6 chore(startComputeJob): improved error handling 2021-02-24 12:49:41 +03:00
Mihajlo Medjedovic
66d02cf1d1 style: lint 2021-02-23 23:01:08 +01:00
Mihajlo Medjedovic
f2c8e40430 chore: cleanup, parseResponse optimization 2021-02-23 22:58:48 +01:00
Mihajlo Medjedovic
4b28ee8e73 style: lint 2021-02-23 22:36:32 +01:00
Mihajlo Medjedovic
c7e54cfe9f fix: web approach login callback and debug issue 2021-02-23 22:36:11 +01:00
Yury Shkoda
50be3acc78 Merge pull request #190 from sasjs/issue-186
feat: listFolder and improvements
2021-02-22 16:40:09 +03:00
Mihajlo Medjedovic
66c12a69bb typedoc: generated 2021-02-22 14:25:35 +01:00
Mihajlo Medjedovic
e2058f0c71 Merge branch 'issue-186' of github.com:sasjs/adapter into issue-186 2021-02-22 14:25:09 +01:00
Mihajlo Medjedovic
75a74152a5 chore: grammar fixing 2021-02-22 14:24:25 +01:00
Yury Shkoda
9344c4fd35 fixed grammar 2021-02-22 16:16:18 +03:00
Yury Shkoda
be0fe00076 fixed grammar 2021-02-22 16:12:56 +03:00
Yury Shkoda
a2069ee48b fixed grammar 2021-02-22 16:11:56 +03:00
Mihajlo Medjedovic
907885cf85 style: lint 2021-02-22 13:56:06 +01:00
Mihajlo Medjedovic
f10ed3236e test: fixing 2021-02-22 13:46:31 +01:00
Mihajlo Medjedovic
a852a0af7c chore: typo fix 2021-02-22 11:53:16 +01:00
Mihajlo Medjedovic
03f3550774 docs: generated 2021-02-22 11:40:08 +01:00
Mihajlo Medjedovic
2e8d06f9e1 Merge branch 'master' into issue-186 2021-02-22 11:39:44 +01:00
Krishna Acondy
1d31ec4dcc Merge pull request #218 from sasjs/axios-fetch
fix(*): replace native fetch calls with axios
2021-02-15 12:50:13 +00:00
Krishna Acondy
4407ed68ae Merge branch 'master' of https://github.com/sasjs/adapter into axios-fetch 2021-02-15 12:46:11 +00:00
Krishna Acondy
b3359f2138 Merge pull request #241 from sasjs/dependabot/npm_and_yarn/webpack-5.21.2
chore(deps-dev): bump webpack from 5.13.0 to 5.21.2
2021-02-15 08:43:03 +00:00
dependabot-preview[bot]
cff9104adf chore(deps-dev): bump webpack from 5.13.0 to 5.21.2
Bumps [webpack](https://github.com/webpack/webpack) from 5.13.0 to 5.21.2.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.13.0...v5.21.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-15 08:41:19 +00:00
Krishna Acondy
b73f821c19 Merge pull request #250 from sasjs/dependabot/npm_and_yarn/sasjs/utils-2.5.0
chore(deps): bump @sasjs/utils from 2.0.2 to 2.5.0
2021-02-15 08:39:09 +00:00
dependabot-preview[bot]
dd3c1a7375 chore(deps): bump @sasjs/utils from 2.0.2 to 2.5.0
Bumps [@sasjs/utils](https://github.com/sasjs/utils) from 2.0.2 to 2.5.0.
- [Release notes](https://github.com/sasjs/utils/releases)
- [Commits](https://github.com/sasjs/utils/compare/v2.0.2...v2.5.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-15 08:37:17 +00:00
Krishna Acondy
c10b5368af Merge pull request #251 from sasjs/dependabot/npm_and_yarn/semantic-release-17.3.9
chore(deps-dev): bump semantic-release from 17.3.1 to 17.3.9
2021-02-15 08:35:10 +00:00
dependabot-preview[bot]
2df66765c0 chore(deps-dev): bump semantic-release from 17.3.1 to 17.3.9
Bumps [semantic-release](https://github.com/semantic-release/semantic-release) from 17.3.1 to 17.3.9.
- [Release notes](https://github.com/semantic-release/semantic-release/releases)
- [Commits](https://github.com/semantic-release/semantic-release/compare/v17.3.1...v17.3.9)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-15 08:29:58 +00:00
Krishna Acondy
ed65545571 Merge pull request #248 from sasjs/dependabot/npm_and_yarn/ts-loader-8.0.17
chore(deps-dev): bump ts-loader from 8.0.14 to 8.0.17
2021-02-15 08:27:46 +00:00
dependabot-preview[bot]
b4ae486520 chore(deps-dev): bump ts-loader from 8.0.14 to 8.0.17
Bumps [ts-loader](https://github.com/TypeStrong/ts-loader) from 8.0.14 to 8.0.17.
- [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.14...v8.0.17)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-15 08:23:51 +00:00
Krishna Acondy
bb7b3d0b84 Merge pull request #249 from sasjs/dependabot/npm_and_yarn/typescript-3.9.9
chore(deps-dev): bump typescript from 3.9.7 to 3.9.9
2021-02-15 08:21:44 +00:00
dependabot-preview[bot]
65b34aa015 chore(deps-dev): bump typescript from 3.9.7 to 3.9.9
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 3.9.7 to 3.9.9.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v3.9.7...v3.9.9)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-15 08:12:05 +00:00
Krishna Acondy
b3c9303def Merge pull request #235 from sasjs/dependabot/npm_and_yarn/webpack-cli-4.5.0
chore(deps-dev): bump webpack-cli from 4.3.1 to 4.5.0
2021-02-15 08:09:42 +00:00
dependabot-preview[bot]
19dfda9b6a chore(deps-dev): bump webpack-cli from 4.3.1 to 4.5.0
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 4.3.1 to 4.5.0.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.3.1...webpack-cli@4.5.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-15 08:01:11 +00:00
Krishna Acondy
ce2abb448f Merge pull request #217 from sasjs/dependabot/npm_and_yarn/typedoc-neo-theme-1.1.0
chore(deps-dev): bump typedoc-neo-theme from 1.0.10 to 1.1.0
2021-02-15 07:59:06 +00:00
Krishna Acondy
413c3b8098 Merge branch 'axios-fetch' of https://github.com/sasjs/adapter into axios-fetch 2021-02-10 08:19:51 +00:00
Krishna Acondy
269514a44f fix(*): expose CSRF token, add getFolder API 2021-02-10 08:19:48 +00:00
Saad Jutt
5fc334dd8b chore: param 'insecure' removed 2021-02-09 17:57:01 +05:00
Krishna Acondy
1b251f1cea fix(auth): auto submit auth form if needed 2021-02-08 19:07:37 +00:00
Krishna Acondy
70d3e25c7f Merge branch 'axios-fetch' of https://github.com/sasjs/adapter into axios-fetch 2021-02-08 08:31:55 +00:00
Krishna Acondy
5e9b33e346 chore(*): fix sasjs tests 2021-02-08 08:31:42 +00:00
Krishna Acondy
eb52ec7532 Merge branch 'master' into axios-fetch 2021-02-06 13:23:30 +00:00
Krishna Acondy
f46c4bf3ca Merge branch 'axios-fetch' of https://github.com/sasjs/adapter into axios-fetch 2021-02-06 13:00:31 +00:00
Krishna Acondy
d8176912cf fix(requests): only allow insecure requests if https module is available 2021-02-06 13:00:27 +00:00
dependabot-preview[bot]
4c54ade2d3 chore(deps-dev): bump typedoc-neo-theme from 1.0.10 to 1.1.0
Bumps [typedoc-neo-theme](https://github.com/google/typedoc-neo-theme) from 1.0.10 to 1.1.0.
- [Release notes](https://github.com/google/typedoc-neo-theme/releases)
- [Commits](https://github.com/google/typedoc-neo-theme/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-06 06:54:47 +00:00
Yury Shkoda
52c41dfb3a Merge pull request #196 from sasjs/releaseScript
Release script
2021-02-06 09:52:44 +03:00
Yury Shkoda
36f0aa7411 Merge branch 'master' into releaseScript 2021-02-06 09:31:21 +03:00
Saad Jutt
a10e4ec264 fix(*): fix invalid typing 2021-02-05 19:03:20 +05:00
Krishna Acondy
851b6bc273 chore(*): change import to require 2021-02-05 12:21:33 +00:00
Krishna Acondy
23f8d31b1b fix(*): support multipart form data post 2021-02-05 11:10:57 +00:00
Krishna Acondy
a5683bcd07 fix(insecure-requests): add flag to config 2021-02-05 09:33:42 +00:00
Krishna Acondy
c7be71c781 fix(*): add the ability to ignore SSL errors 2021-02-05 08:56:40 +00:00
Krishna Acondy
594f274323 chore(*): bump dependencies for sasjs-tests 2021-02-05 08:24:13 +00:00
Krishna Acondy
ba1ed5e732 fix(job-execution): throw error if job name is empty 2021-02-05 08:23:25 +00:00
Krishna Acondy
613cc6b9ef chore(*): clean up, handle debug responses 2021-02-04 09:42:39 +00:00
Krishna Acondy
8edb00f869 fix(request-client): handle SAS9 error scenarios, clear CSRF tokens on log out 2021-02-03 09:34:34 +00:00
Krishna Acondy
60a1f84604 chore(*): clean up, address review comments 2021-02-02 08:42:01 +00:00
Krishna Acondy
36cfaee5db chore(*): fix package.json format 2021-02-02 08:21:25 +00:00
Krishna Acondy
cb607c93ca Merge branch 'master' into axios-fetch 2021-02-02 08:19:53 +00:00
Krishna Acondy
03b5e1d824 chore(*): refactor common functionality into JobExecutor, handle all auth-related scenarios 2021-02-02 08:18:48 +00:00
Krishna Acondy
85a530ae5a Merge pull request #231 from sasjs/insecure-connection
feat: enable insecure connection for accessToken
2021-01-29 12:10:41 +00:00
Krishna Acondy
2ea49a425f fix(*): post request bodies as JSON 2021-01-28 20:36:41 +00:00
Krishna Acondy
3c894c4147 fix(*): handled 404s, set correct accept headers 2021-01-28 19:25:23 +00:00
Krishna Acondy
23d151c919 chore(*): commit missed file 2021-01-28 17:02:19 +00:00
Krishna Acondy
6d1c4ff81a fix(*): fix compute job execution 2021-01-28 17:01:59 +00:00
Mihajlo Medjedovic
7a6e6e8333 chore: fix const 2021-01-28 11:25:21 +01:00
Krishna Acondy
0eba6bdcf4 chore(*): fix tests 2021-01-27 22:03:40 +00:00
Krishna Acondy
d7ecaf5932 fix(*): separate job execution code from main SASjs class 2021-01-27 20:30:13 +00:00
Saad Jutt
1fc6db114d chore: docs updated 2021-01-27 15:57:21 +05:00
Saad Jutt
8d203b8df4 chore: annotation added 2021-01-27 15:47:15 +05:00
Saad Jutt
39924ff078 chore: added 'https' 2021-01-26 18:45:21 +05:00
Saad Jutt
de25f106ec feat: enable insecure connection for accessToken 2021-01-26 17:17:46 +05:00
Krishna Acondy
e0d85f458b fix(*): store CSRF tokens in Request Client 2021-01-24 18:23:18 +00:00
Krishna Acondy
3a9cd46e6e chore(*): use server type from utils types 2021-01-24 16:02:34 +00:00
Krishna Acondy
301edab8ad chore(*): refactor and add tests 2021-01-24 15:08:35 +00:00
Krishna Acondy
aed39c2ec4 chore(*): refactor, move all auth-related code to auth folder 2021-01-24 13:07:15 +00:00
Yury Shkoda
cc594eca52 chore(SASViyaApiClient): fixed typo 2021-01-23 09:45:42 +03:00
Mihajlo Medjedovic
3fbca2835e chore: test fix 2021-01-22 15:45:44 +01:00
Mihajlo Medjedovic
61ed5c4fa7 Merge branch 'master' into issue-186 2021-01-22 14:46:46 +01:00
Krishna Acondy
e31774ae9d fix(*): fix login issue 2021-01-19 09:29:29 +00:00
Krishna Acondy
00f09179a8 chore(*): remove unnecessary imports 2021-01-19 09:07:40 +00:00
Krishna Acondy
4196901e01 chore(*): remove comment 2021-01-19 08:17:42 +00:00
Krishna Acondy
bf35dd072a chore(*): fix failing tests 2021-01-19 08:16:08 +00:00
Krishna Acondy
75e3fd018d chore(*): replace fetch calls with axios 2021-01-18 09:22:10 +00:00
Krishna Acondy
965dfff7c6 chore(*): use axios instead of fetch 2021-01-18 09:07:36 +00:00
Krishna Acondy
ff64dd22ad chore(*): use local axios instance 2021-01-18 09:01:07 +00:00
Krishna Acondy
e7cceab065 chore(*): add axios 2021-01-18 09:00:16 +00:00
Krishna Acondy
f789b8f7a2 fix(*): extracted auth logic into separate class, used axios instead of fetch 2021-01-18 08:59:58 +00:00
Yury Shkoda
c0b82c5125 Merge pull request #211 from sasjs/deps-fix
chore(deps): rolled back isomorphic-fetch
2021-01-13 15:38:27 +03:00
Yury Shkoda
1c1b5baefe chore(deps): rolled back isomorphic-fetch 2021-01-13 15:22:07 +03:00
Yury Shkoda
8b17aeaea2 Merge pull request #121 from sasjs/dependabot/npm_and_yarn/isomorphic-fetch-3.0.0
chore(deps): bump isomorphic-fetch from 2.2.1 to 3.0.0
2021-01-13 12:36:28 +03:00
Yury Shkoda
cb0d03c965 Merge branch 'master' into dependabot/npm_and_yarn/isomorphic-fetch-3.0.0 2021-01-13 12:34:40 +03:00
Yury Shkoda
9e77f3d64e Merge pull request #191 from sasjs/dependabot/npm_and_yarn/typedoc-0.19.2
chore(deps-dev): bump typedoc from 0.17.8 to 0.19.2
2021-01-13 12:34:03 +03:00
Yury Shkoda
25f61815dc Merge branch 'master' into dependabot/npm_and_yarn/typedoc-0.19.2 2021-01-13 12:30:51 +03:00
dependabot-preview[bot]
3a2252e69c chore(deps-dev): bump typedoc from 0.17.8 to 0.19.2
Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.17.8 to 0.19.2.
- [Release notes](https://github.com/TypeStrong/TypeDoc/releases)
- [Commits](https://github.com/TypeStrong/TypeDoc/compare/0.17.8...v0.19.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-13 09:30:42 +00:00
dependabot-preview[bot]
8a08980e6a chore(deps): bump isomorphic-fetch from 2.2.1 to 3.0.0
Bumps [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch) from 2.2.1 to 3.0.0.
- [Release notes](https://github.com/matthew-andrews/isomorphic-fetch/releases)
- [Commits](https://github.com/matthew-andrews/isomorphic-fetch/compare/v2.2.1...v3.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-13 09:30:40 +00:00
Yury Shkoda
d0f31771ad Merge pull request #194 from sasjs/dependabot/npm_and_yarn/semantic-release-17.3.1
chore(deps-dev): bump semantic-release from 17.3.0 to 17.3.1
2021-01-13 12:30:22 +03:00
Yury Shkoda
e9e2c9372d Merge branch 'master' into dependabot/npm_and_yarn/semantic-release-17.3.1 2021-01-13 12:28:50 +03:00
Yury Shkoda
70c4a095a0 Merge pull request #199 from sasjs/dependabot/npm_and_yarn/webpack-cli-4.3.1
chore(deps-dev): bump webpack-cli from 4.2.0 to 4.3.1
2021-01-13 12:28:29 +03:00
Yury Shkoda
82e2fc4445 Merge branch 'master' into dependabot/npm_and_yarn/webpack-cli-4.3.1 2021-01-13 12:26:22 +03:00
dependabot-preview[bot]
6661d81fdf chore(deps-dev): bump semantic-release from 17.3.0 to 17.3.1
Bumps [semantic-release](https://github.com/semantic-release/semantic-release) from 17.3.0 to 17.3.1.
- [Release notes](https://github.com/semantic-release/semantic-release/releases)
- [Commits](https://github.com/semantic-release/semantic-release/compare/v17.3.0...v17.3.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-13 09:26:20 +00:00
dependabot-preview[bot]
e76abaafa8 chore(deps-dev): bump webpack-cli from 4.2.0 to 4.3.1
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 4.2.0 to 4.3.1.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.2.0...webpack-cli@4.3.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-13 09:26:13 +00:00
Yury Shkoda
fbfc1c05d6 Merge pull request #200 from sasjs/dependabot/npm_and_yarn/typedoc-plugin-external-module-name-4.0.6
chore(deps-dev): bump typedoc-plugin-external-module-name from 4.0.5 to 4.0.6
2021-01-13 12:25:47 +03:00
Yury Shkoda
839c211c64 Merge branch 'master' into dependabot/npm_and_yarn/typedoc-plugin-external-module-name-4.0.6 2021-01-13 12:24:19 +03:00
Yury Shkoda
f3ff82143a Merge pull request #204 from sasjs/dependabot/npm_and_yarn/ts-loader-8.0.14
chore(deps-dev): bump ts-loader from 8.0.12 to 8.0.14
2021-01-13 12:24:02 +03:00
dependabot-preview[bot]
0dd0abae87 chore(deps-dev): bump typedoc-plugin-external-module-name
Bumps [typedoc-plugin-external-module-name](https://github.com/christopherthielen/typedoc-plugin-external-module-name) from 4.0.5 to 4.0.6.
- [Release notes](https://github.com/christopherthielen/typedoc-plugin-external-module-name/releases)
- [Changelog](https://github.com/christopherthielen/typedoc-plugin-external-module-name/blob/master/CHANGELOG.md)
- [Commits](https://github.com/christopherthielen/typedoc-plugin-external-module-name/compare/4.0.5...4.0.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-13 09:23:15 +00:00
Yury Shkoda
13781c993e Merge branch 'master' into dependabot/npm_and_yarn/ts-loader-8.0.14 2021-01-13 12:21:25 +03:00
Yury Shkoda
7616cacbec Merge pull request #205 from sasjs/dependabot/npm_and_yarn/types/jest-26.0.20
chore(deps-dev): bump @types/jest from 26.0.19 to 26.0.20
2021-01-13 12:21:01 +03:00
dependabot-preview[bot]
cab7d3c012 chore(deps-dev): bump ts-loader from 8.0.12 to 8.0.14
Bumps [ts-loader](https://github.com/TypeStrong/ts-loader) from 8.0.12 to 8.0.14.
- [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.12...v8.0.14)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-13 09:20:57 +00:00
Yury Shkoda
dfce676fdf Merge branch 'master' into dependabot/npm_and_yarn/types/jest-26.0.20 2021-01-13 12:18:53 +03:00
dependabot-preview[bot]
1890cab623 chore(deps-dev): bump @types/jest from 26.0.19 to 26.0.20
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 26.0.19 to 26.0.20.
- [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>
2021-01-13 09:18:44 +00:00
Yury Shkoda
4307d8fe43 Merge pull request #207 from sasjs/dependabot/npm_and_yarn/webpack-5.13.0
chore(deps-dev): bump webpack from 4.44.2 to 5.13.0
2021-01-13 12:18:17 +03:00
Yury Shkoda
8df6fdbee6 Merge branch 'master' into dependabot/npm_and_yarn/webpack-5.13.0 2021-01-13 12:16:49 +03:00
Yury Shkoda
ac5c2a3088 Merge pull request #210 from sasjs/dependabot/npm_and_yarn/sasjs/utils-2.0.2
chore(deps): bump @sasjs/utils from 1.5.0 to 2.0.2
2021-01-13 12:16:18 +03:00
dependabot-preview[bot]
0212b677ae chore(deps): bump @sasjs/utils from 1.5.0 to 2.0.2
Bumps [@sasjs/utils](https://github.com/sasjs/utils) from 1.5.0 to 2.0.2.
- [Release notes](https://github.com/sasjs/utils/releases)
- [Commits](https://github.com/sasjs/utils/compare/v1.5.0...v2.0.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-13 08:03:31 +00:00
Yury Shkoda
1a0d62d8f3 Merge pull request #209 from sasjs/job-status-fix
feat(*): improved session and job logging
2021-01-12 17:53:25 +03:00
Yury Shkoda
8f4d1c7aea chore(*): improved session and job state logging 2021-01-12 17:26:57 +03:00
dependabot-preview[bot]
2a4735c6f2 chore(deps-dev): bump webpack from 4.44.2 to 5.13.0
Bumps [webpack](https://github.com/webpack/webpack) from 4.44.2 to 5.13.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v4.44.2...v5.13.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-12 08:21:08 +00:00
Mihajlo Medjedovic
9b6ba3548f test: added tests for folder move function 2021-01-11 16:35:23 +01:00
Yury Shkoda
5a2ee88cbc fix(job-status): print job status only if it changes 2021-01-11 13:52:38 +03:00
Mihajlo Medjedovic
efa4c71b8a style: lint 2021-01-06 16:33:47 +01:00
Mihajlo Medjedovic
ecfc1a4bf8 fix: move function, test: added test for folder operations 2021-01-06 16:32:57 +01:00
Mihajlo Medjedovic
246b855c76 Merge branch 'master' into issue-186 2021-01-06 13:51:10 +01:00
Allan Bowe
b23f199334 Merge pull request #203 from sasjs/relative-service-paths
fix(relative-paths): process relative and absolute paths the same way
2021-01-05 21:02:45 +01:00
Krishna Acondy
ed5dabee9f fix(relative-paths): process relative and absolute paths the same way 2021-01-05 19:37:40 +00:00
Allan Bowe
0c88c5a522 Merge pull request #201 from sasjs/services-subfolder
fix(deploy-service-pack): deploy services into 'services' subfolder
2021-01-05 18:23:52 +01:00
Krishna Acondy
640e7015c8 fix(*): deploy services into 'services' subfolder 2021-01-05 17:19:05 +00:00
Mihajlo Medjedovic
80aa848617 style: lint 2021-01-05 16:21:46 +01:00
Mihajlo Medjedovic
acf045965e fix: move command improved 2021-01-05 16:21:18 +01:00
Mihajlo Medjedovic
5a7f64dc35 docs: generate 2021-01-04 13:37:14 +01:00
Mihajlo Medjedovic
de447b0727 Merge branch 'master' into issue-186 2021-01-04 13:36:44 +01:00
Mihajlo Medjedovic
a2906abf71 Merge branch 'master' into releaseScript 2020-12-30 13:40:22 +01:00
Yury Shkoda
2fd306f435 Merge pull request #195 from sasjs/v2-bump
test(coverage): enabled gathering coverage
2020-12-30 15:31:01 +03:00
Yury Shkoda
e3f779dbd1 test(coverage): enabled gathering coverage
BREAKING CHANGE: SASjs Adapter 2.0 - Electric Boogaloo
2020-12-30 15:04:59 +03:00
Yury Shkoda
1064f11663 Merge pull request #177 from sasjs/cli-issue-182
feat(context): moved context related logic to ContextManager
2020-12-30 13:24:34 +03:00
Yury Shkoda
46abc54cb0 chore(default-contexts): made default contexts private 2020-12-30 13:13:28 +03:00
Yury Shkoda
2c808a937a docs(*): updated docs 2020-12-30 11:43:10 +03:00
Yury Shkoda
52cf9a420f style(*): fixed styling 2020-12-30 11:42:31 +03:00
Yury Shkoda
2d29be45f5 test(contextManager): added unit tests 2020-12-30 11:38:56 +03:00
Yury Shkoda
a44222c3ba refactor(contextManager): used helper methods 2020-12-30 11:38:10 +03:00
Yury Shkoda
efc82101c1 chore(context-delete): renamed method 2020-12-30 11:36:10 +03:00
Yury Shkoda
09ce2fb6be chore(context-delete): renamed method 2020-12-30 11:35:41 +03:00
Yury Shkoda
a383388e54 feat(context-delete): restricted system compute context deletion 2020-12-29 11:42:14 +03:00
Yury Shkoda
362078b12c docs(context): updated docs 2020-12-29 11:12:33 +03:00
Yury Shkoda
9d0c3410a5 feat(context-edit): restricted editing system compute contexts 2020-12-29 11:11:26 +03:00
Yury Shkoda
dfb9c28f3a feat(createComputeContext): added throw an error if context already exists 2020-12-29 10:00:49 +03:00
Yury Shkoda
8d155283dd fix(context): fixed executeScript method 2020-12-24 13:54:19 +03:00
Mihajlo Medjedovic
ace16efd93 docs: generated 2020-12-23 14:23:44 +01:00
Mihajlo Medjedovic
13ae5ae756 Merge branch 'master' into issue-186 2020-12-23 14:23:26 +01:00
Yury Shkoda
d991ead86a Merge branch 'master' into cli-issue-182 2020-12-23 15:11:19 +03:00
Yury Shkoda
33a202fa1c Merge pull request #189 from sasjs/job-pid
feat(job-pid): added print PID of the executed job
2020-12-23 12:06:24 +03:00
Yury Shkoda
ff5463a84c chore(example): fixed example 2020-12-23 09:24:15 +03:00
Yury Shkoda
aa7c3ae4a9 docs(pid): updated docs 2020-12-23 09:18:49 +03:00
Yury Shkoda
2e66bfde4b chore(pid): made printing PID optional 2020-12-23 09:17:40 +03:00
Mihajlo Medjedovic
f1b035032f feat: listFolder and improvements 2020-12-22 19:24:33 +01:00
Yury Shkoda
16e21adb20 chore: updated docs 2020-12-22 16:58:14 +03:00
Yury Shkoda
01c5682c3d Merge branch 'job-pid' of https://github.com/sasjs/adapter into job-pid 2020-12-22 16:46:48 +03:00
Yury Shkoda
cfc8ff2837 chore: added 'Assign Reviewer' CI step 2020-12-22 16:46:16 +03:00
Yury Shkoda
edf25b471a chore: added 'Assign Reviewer' CI step 2020-12-22 16:41:22 +03:00
Yury Shkoda
bb894e6107 feat(job-pid): added print PID of the executed job 2020-12-22 16:21:24 +03:00
Yury Shkoda
6b3a0cdb13 wip(context): created ContextManager 2020-12-21 14:51:01 +03:00
Yury Shkoda
8c98a26160 chore(SessionManager): removed unnecessary comment 2020-12-11 08:50:44 +03:00
Yury Shkoda
bcd9310f26 feat(context): add public method createLauncherContext 2020-12-09 16:51:07 +03:00
Yury Shkoda
57e9b67207 feat(context): added create launcher context method 2020-12-09 16:41:29 +03:00
Mihajlo Medjedovic
1555afe771 ci: slack webhook secret update 2020-11-26 10:06:47 +01:00
Mihajlo Medjedovic
a2832f1e1a ci: slack webhook secret 2020-11-25 17:09:05 +01:00
Mihajlo Medjedovic
56f34508fa ci: after release ci will send slack message 2020-11-25 16:40:04 +01:00
136 changed files with 67722 additions and 20507 deletions

2
.env.example Normal file
View File

@@ -0,0 +1,2 @@
SERVER_URL=https://server.com
DEFAULT_COMPUTE_CONTEXT=SAS Job Execution compute context

9
.github/reviewer-lottery.yml vendored Normal file
View File

@@ -0,0 +1,9 @@
groups:
- name: SASjs Devs # name of the group
reviewers: 1 # how many reviewers do you want to assign?
usernames: # github usernames of the reviewers
- krishna-acondy
- YuryShkoda
- saadjutt01
- medjedovicm
- allanbowe

13
.github/workflows/assign-reviewer.yml vendored Normal file
View File

@@ -0,0 +1,13 @@
name: 'Assign Reviewer'
on:
pull_request:
types: [opened]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: uesteibar/reviewer-lottery@v1
with:
repo-token: ${{ secrets.GH_TOKEN }}

View File

@@ -25,3 +25,5 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Send Slack message
run: curl -X POST --data-urlencode "payload={\"channel\":\"#sasjs\", \"username\":\"GitHub CI\", \"text\":\"New version of @sasjs/adapter has been released! \n Please deploy and run `dctests` with new adapter to make sure everything is still in place.\", \"icon_emoji\":\":rocket:\"}" ${{ secrets.SLACK_WEBHOOK }}

8
.gitignore vendored
View File

@@ -1,2 +1,8 @@
node_modules
build
build
.env
/coverage
.DS_Store

View File

@@ -1,13 +0,0 @@
{
"defaultCommandTimeout": 10000,
"chromeWebSecurity": false,
"screenshotOnRunFailure": false,
"env": {
"serverUrl": "",
"appLoc": "/Public/app",
"serverType": "SAS9",
"debug": false,
"username": "",
"password": ""
}
}

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

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

1893
docs/classes/root.sasjs.html Normal file

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

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

179
docs/modules/auth.html Normal file

File diff suppressed because one or more lines are too long

144
docs/modules/auth_spec.html Normal file

File diff suppressed because one or more lines are too long

184
docs/modules/file.html Normal file

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

118
docs/modules/request.html Normal file

File diff suppressed because one or more lines are too long

129
docs/modules/root.html Normal file

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

@@ -1,10 +1,184 @@
// For a detailed explanation regarding each configuration property, visit:
// https://jestjs.io/docs/en/configuration.html
module.exports = {
roots: ["<rootDir>/src"],
testMatch: [
"**/__tests__/**/*.+(ts|tsx|js)",
"**/?(*.)+(spec|test).+(ts|tsx|js)"
],
testTimeout: 90000,
// All imported modules in your tests should be mocked automatically
// automock: false,
// Stop running tests after `n` failures
// bail: 1,
// Respect "browser" field in package.json when resolving modules
// browser: false,
// The directory where Jest should store its cached dependency information
// cacheDirectory: "/private/var/folders/7y/nmqg1srj29q6210rs9dfsdzc0000gn/T/jest_dx",
// Automatically clear mock calls and instances between every test
clearMocks: true,
// Indicates whether the coverage information should be collected while executing the test
// collectCoverage: false,
// An array of glob patterns indicating a set of files for which coverage information should be collected
// collectCoverageFrom: undefined,
// The directory where Jest should output its coverage files
coverageDirectory: 'coverage',
// An array of regexp pattern strings used to skip coverage collection
// coveragePathIgnorePatterns: [
// "/node_modules/"
// ],
// A list of reporter names that Jest uses when writing coverage reports
// coverageReporters: [
// "json",
// "text",
// "lcov",
// "clover"
// ],
// An object that configures minimum threshold enforcement for coverage results
// coverageThreshold: undefined,
// A path to a custom dependency extractor
// dependencyExtractor: undefined,
// Make calling deprecated APIs throw helpful error messages
// errorOnDeprecated: false,
// Force coverage collection from ignored files using an array of glob patterns
// forceCoverageMatch: [],
// A path to a module which exports an async function that is triggered once before all test suites
// globalSetup: undefined,
// A path to a module which exports an async function that is triggered once after all test suites
// globalTeardown: undefined,
// A set of global variables that need to be available in all test environments
// globals: {},
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
// maxWorkers: "50%",
// An array of directory names to be searched recursively up from the requiring module's location
// moduleDirectories: [
// "node_modules"
// ],
// An array of file extensions your modules use
// moduleFileExtensions: [
// "js",
// "json",
// "jsx",
// "ts",
// "tsx",
// "node"
// ],
// A map from regular expressions to module names that allow to stub out resources with a single module
moduleNameMapper: {},
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
// modulePathIgnorePatterns: [],
// Activates notifications for test results
// notify: false,
// An enum that specifies notification mode. Requires { notify: true }
// notifyMode: "failure-change",
// A preset that is used as a base for Jest's configuration
preset: 'ts-jest/presets/js-with-ts',
// Run tests from one or more projects
// projects: undefined,
// Use this configuration option to add custom reporters to Jest
// reporters: undefined,
// Automatically reset mock state between every test
// resetMocks: false,
// Reset the module registry before running each individual test
// resetModules: false,
// A path to a custom resolver
// resolver: undefined,
// Automatically restore mock state between every test
// restoreMocks: false,
// The root directory that Jest should scan for tests and modules within
// rootDir: undefined,
// A list of paths to directories that Jest should use to search for files in
// roots: [
// "<rootDir>"
// ],
// Allows you to use a custom runner instead of Jest's default test runner
// runner: "jest-runner",
// The paths to modules that run some code to configure or set up the testing environment before each test
setupFiles: [],
// A list of paths to modules that run some code to configure or set up the testing framework before each test
setupFilesAfterEnv: ['jest-extended'],
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
// snapshotSerializers: [],
// Options that will be passed to the testEnvironment
// testEnvironmentOptions: {},
// Adds a location field to test results
// testLocationInResults: false,
// The glob patterns Jest uses to detect test files
testMatch: ['**/*spec.[j|t]s?(x)'],
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
testPathIgnorePatterns: ['/node_modules/', '/build'],
// The regexp pattern or array of patterns that Jest uses to detect test files
// testRegex: [],
// This option allows the use of a custom results processor
// testResultsProcessor: undefined,
// This option allows use of a custom test runner
// testRunner: "jasmine2",
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
// testURL: "http://localhost",
// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
// timers: "real",
// A map from regular expressions to paths to transformers
transform: {
"^.+\\.(ts|tsx)$": "ts-jest"
'^.+\\.ts?$': 'ts-jest'
}
};
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
// transformIgnorePatterns: [
// '**/test/**/*.ts?(x)',
// '**/?(*.)+(spec|test).ts?(x)'
// ]
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
// unmockedModulePathPatterns: undefined,
// Indicates whether each individual test should be reported during the run
// verbose: undefined,
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
// watchPathIgnorePatterns: [],
// Whether to use watchman for file crawling
// watchman: true,
}

39963
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -7,7 +7,7 @@
"publish:lib": "npm run build && cd build && npm publish",
"lint:fix": "npx prettier --write 'src/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}'",
"lint": "npx prettier --check 'src/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}'",
"test": "jest",
"test": "jest --silent --coverage",
"prepublishOnly": "cp -r ./build/* . && rm -rf ./build",
"postpublish": "git clean -fd",
"semantic-release": "semantic-release",
@@ -36,29 +36,31 @@
},
"license": "ISC",
"devDependencies": {
"@types/isomorphic-fetch": "0.0.35",
"@types/jest": "^26.0.15",
"@types/jest": "^26.0.20",
"cp": "^0.2.0",
"jest": "^25.5.4",
"dotenv": "^8.2.0",
"jest": "^26.6.3",
"jest-extended": "^0.11.5",
"path": "^0.12.7",
"rimraf": "^3.0.2",
"semantic-release": "^17.3.0",
"semantic-release": "^17.4.1",
"terser-webpack-plugin": "^4.2.3",
"ts-jest": "^25.5.1",
"ts-loader": "^8.0.11",
"ts-loader": "^8.0.17",
"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",
"webpack": "^4.44.2",
"webpack-cli": "^4.2.0"
"typedoc": "^0.20.30",
"typedoc-neo-theme": "^1.1.0",
"typedoc-plugin-external-module-name": "^4.0.6",
"typescript": "^3.9.9",
"webpack": "^5.24.4",
"webpack-cli": "^4.5.0"
},
"main": "index.js",
"dependencies": {
"es6-promise": "^4.2.8",
"@sasjs/utils": "^2.6.3",
"axios": "^0.21.1",
"form-data": "^3.0.0",
"isomorphic-fetch": "^2.2.1"
"https": "^1.0.0"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -4,21 +4,18 @@
"homepage": ".",
"private": true,
"dependencies": {
"@sasjs/adapter": "^1.18.2",
"@sasjs/adapter": "^2.2.4",
"@sasjs/test-framework": "^1.4.0",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"@types/jest": "^26.0.3",
"@types/node": "^14.0.14",
"@types/react": "^16.9.41",
"@types/react-dom": "^16.9.8",
"@types/react-router-dom": "^5.1.5",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"@types/jest": "^26.0.20",
"@types/node": "^14.14.25",
"@types/react": "^17.0.1",
"@types/react-dom": "^17.0.0",
"@types/react-router-dom": "^5.1.7",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.1",
"typescript": "^3.9.6"
"react-scripts": "^4.0.2",
"typescript": "^4.1.3"
},
"scripts": {
"start": "react-scripts start",
@@ -45,6 +42,6 @@
]
},
"devDependencies": {
"node-sass": "^4.14.1"
"node-sass": "^5.0.0"
}
}

View File

@@ -6,7 +6,7 @@
"appLoc": "/Public/app",
"serverType": "SASVIYA",
"debug": false,
"contextName": "SharedCompute",
"contextName": "sasjs adapter compute context",
"useComputeApi": true
}
}

View File

@@ -1,15 +1,19 @@
import SASjs, { ServerType, SASjsConfig } from "@sasjs/adapter";
import SASjs, { SASjsConfig } from "@sasjs/adapter";
import { TestSuite } from "@sasjs/test-framework";
import { ServerType } from "@sasjs/utils/types";
const stringData: any = { table1: [{ col1: "first col value" }] };
const defaultConfig: SASjsConfig = {
serverUrl: window.location.origin,
pathSAS9: '/SASStoredProcess/do',
pathSASViya: '/SASJobExecution',
appLoc: '/Public/seedapp',
serverType: ServerType.SASViya,
pathSAS9: "/SASStoredProcess/do",
pathSASViya: "/SASJobExecution",
appLoc: "/Public/seedapp",
serverType: ServerType.SasViya,
debug: false,
contextName: 'SAS Job Execution compute context',
useComputeApi: false
contextName: "SAS Job Execution compute context",
useComputeApi: false,
allowInsecureRequests: false
};
const customConfig = {
@@ -17,7 +21,7 @@ const customConfig = {
pathSAS9: "sas9",
pathSASViya: "viya",
appLoc: "/Public/seedapp",
serverType: ServerType.SAS9,
serverType: ServerType.Sas9,
debug: false
};
@@ -39,15 +43,46 @@ export const basicTests = (
},
{
title: "Multiple Log in attempts",
description: "Should fail on first attempt and should log the user in on second attempt",
description:
"Should fail on first attempt and should log the user in on second attempt",
test: async () => {
await adapter.logOut()
await adapter.logIn('invalid', 'invalid')
return adapter.logIn(userName, password)
await adapter.logOut();
await adapter.logIn("invalid", "invalid");
return adapter.logIn(userName, password);
},
assertion: (response: any) =>
response && response.isLoggedIn && response.userName === userName
},
{
title: "Trigger login callback",
description:
"Should trigger required login callback and after successful login, it should finish the request",
test: async () => {
await adapter.logOut();
return await adapter.request("common/sendArr", stringData, null, () => {
adapter.logIn(userName, password);
});
},
assertion: (response: any) => {
return response.table1[0][0] === stringData.table1[0].col1;
}
},
{
title: "Request with debug on",
description:
"Should complete successful request with debugging switched on",
test: async () => {
const config = {
debug: true
}
return await adapter.request("common/sendArr", stringData, config)
},
assertion: (response: any) => {
return response.table1[0][0] === stringData.table1[0].col1;
}
},
{
title: "Default config",
description:

View File

@@ -12,7 +12,7 @@ export const computeTests = (adapter: SASjs): TestSuite => ({
return adapter.startComputeJob("/Public/app/common/sendArr", data);
},
assertion: (res: any) => {
const expectedProperties = ["id", "applicationName", "attributes"]
const expectedProperties = ["id", "applicationName", "attributes"];
return validate(expectedProperties, res);
}
},
@@ -21,11 +21,22 @@ export const computeTests = (adapter: SASjs): TestSuite => ({
description: "Should start a compute job and return the job",
test: () => {
const data: any = { table1: [{ col1: "first col value" }] };
return adapter.startComputeJob("/Public/app/common/sendArr", data, {}, "", true);
return adapter.startComputeJob(
"/Public/app/common/sendArr",
data,
{},
"",
true
);
},
assertion: (res: any) => {
const expectedProperties = ["id", "state", "creationTimeStamp", "jobConditionCode"]
return validate(expectedProperties, res.result);
const expectedProperties = [
"id",
"state",
"creationTimeStamp",
"jobConditionCode"
];
return validate(expectedProperties, res.job);
}
},
{
@@ -38,19 +49,19 @@ export const computeTests = (adapter: SASjs): TestSuite => ({
`output;`,
`end;`,
`run;`
]
];
return adapter.executeScriptSASViya(
'sasCode.sas',
"sasCode.sas",
fileLines,
'SAS Studio compute context',
"SAS Studio compute context",
undefined,
true
)
);
},
assertion: (res: any) => {
const expectedLogContent = `1 data;\\n2 do x=1 to 100;\\n3 output;\\n4 end;\\n5 run;\\n\\n`
const expectedLogContent = `1 data;\\n2 do x=1 to 100;\\n3 output;\\n4 end;\\n5 run;\\n\\n`;
return validateLog(expectedLogContent, res.log);
}
},
@@ -58,21 +69,21 @@ export const computeTests = (adapter: SASjs): TestSuite => ({
title: "Execute Script Viya - failed job",
description: "Should execute sas file and return log",
test: () => {
const fileLines = [
`%abort;`
]
return adapter.executeScriptSASViya(
'sasCode.sas',
fileLines,
'SAS Studio compute context',
undefined,
true
).catch((err: any) => err )
const fileLines = [`%abort;`];
return adapter
.executeScriptSASViya(
"sasCode.sas",
fileLines,
"SAS Studio compute context",
undefined,
true
)
.catch((err: any) => err);
},
assertion: (res: any) => {
const expectedLogContent = `1 %abort;\\nERROR: The %ABORT statement is not valid in open code.\\n`
const expectedLogContent = `1 %abort;\\nERROR: The %ABORT statement is not valid in open code.\\n`;
return validateLog(expectedLogContent, res.log);
}
}
@@ -80,16 +91,16 @@ export const computeTests = (adapter: SASjs): TestSuite => ({
});
const validateLog = (text: string, log: string): boolean => {
const isValid = JSON.stringify(log).includes(text)
const isValid = JSON.stringify(log).includes(text);
return isValid
}
return isValid;
};
const validate = (expectedProperties: string[], data: any): boolean => {
const actualProperties = Object.keys(data);
const isValid = expectedProperties.every(
(property) => actualProperties.includes(property)
const isValid = expectedProperties.every((property) =>
actualProperties.includes(property)
);
return isValid
}
return isValid;
};

View File

@@ -185,7 +185,8 @@ export const sendObjTests = (adapter: SASjs): TestSuite => ({
};
return adapter.request("common/sendObj", invalidData).catch((e) => e);
},
assertion: (error: any) => !!error && !!error.error && !!error.error.message
assertion: (error: any) =>
!!error && !!error.error && !!error.error.message
},
{
title: "Single string value",

View File

@@ -23,26 +23,23 @@ export const sasjsRequestTests = (adapter: SASjs): TestSuite => ({
},
{
title: "Make error and capture log",
description: "Should make an error and capture log, in the same time it is testing if debug override is working",
description:
"Should make an error and capture log, in the same time it is testing if debug override is working",
test: async () => {
return new Promise(async (resolve, reject) => {
adapter
.request("common/makeErr", data, {debug: true})
.then((res) => {
//no action here, this request must throw error
})
.catch((err) => {
let sasRequests = adapter.getSasRequests();
let makeErrRequest: any =
sasRequests.find((req) =>
req.serviceLink.includes("makeErr")
) || null;
return adapter
.request("common/makeErr", data, { debug: true })
.catch(() => {
const sasRequests = adapter.getSasRequests();
const makeErrRequest: any =
sasRequests.find((req) => req.serviceLink.includes("makeErr")) ||
null;
if (!makeErrRequest) resolve(false)
if (!makeErrRequest) return false;
resolve(!!(makeErrRequest.logFile && makeErrRequest.logFile.length > 0));
});
});
return !!(
makeErrRequest.logFile && makeErrRequest.logFile.length > 0
);
});
},
assertion: (response) => {
return response;

View File

@@ -17,7 +17,8 @@
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react"
"jsx": "react-jsx",
"noFallthroughCasesInSwitch": true
},
"include": [
"src"

450
src/ContextManager.ts Normal file
View File

@@ -0,0 +1,450 @@
import { Context, EditContextInput, ContextAllAttributes } from './types'
import { isUrl } from './utils'
import { prefixMessage } from '@sasjs/utils/error'
import { RequestClient } from './request/RequestClient'
export class ContextManager {
private defaultComputeContexts = [
'CAS Formats service compute context',
'Data Mining compute context',
'Import 9 service compute context',
'SAS Job Execution compute context',
'SAS Model Manager compute context',
'SAS Studio compute context',
'SAS Visual Forecasting compute context'
]
private defaultLauncherContexts = [
'CAS Formats service launcher context',
'Data Mining launcher context',
'Import 9 service launcher context',
'Job Flow Execution launcher context',
'SAS Job Execution launcher context',
'SAS Model Manager launcher context',
'SAS Studio launcher context',
'SAS Visual Forecasting launcher context'
]
get getDefaultComputeContexts() {
return this.defaultComputeContexts
}
get getDefaultLauncherContexts() {
return this.defaultLauncherContexts
}
constructor(private serverUrl: string, private requestClient: RequestClient) {
if (serverUrl) isUrl(serverUrl)
}
public async getComputeContexts(accessToken?: string) {
const { result: contexts } = await this.requestClient
.get<{ items: Context[] }>(
`${this.serverUrl}/compute/contexts?limit=10000`,
accessToken
)
.catch((err) => {
throw prefixMessage(err, 'Error while getting compute contexts. ')
})
const contextsList = contexts && contexts.items ? contexts.items : []
return contextsList.map((context: any) => ({
createdBy: context.createdBy,
id: context.id,
name: context.name,
version: context.version,
attributes: {}
}))
}
public async getLauncherContexts(accessToken?: string) {
const { result: contexts } = await this.requestClient
.get<{ items: Context[] }>(
`${this.serverUrl}/launcher/contexts?limit=10000`,
accessToken
)
.catch((err) => {
throw prefixMessage(err, 'Error while getting launcher contexts. ')
})
const contextsList = contexts && contexts.items ? contexts.items : []
return contextsList.map((context: any) => ({
createdBy: context.createdBy,
id: context.id,
name: context.name,
version: context.version,
attributes: {}
}))
}
public async createComputeContext(
contextName: string,
launchContextName: string,
sharedAccountId: string,
autoExecLines: string[],
accessToken?: string,
authorizedUsers?: string[]
) {
this.validateContextName(contextName)
this.isDefaultContext(
contextName,
this.defaultComputeContexts,
`Compute context '${contextName}' already exists.`
)
const existingComputeContexts = await this.getComputeContexts(accessToken)
if (
existingComputeContexts.find((context) => context.name === contextName)
) {
throw new Error(`Compute context '${contextName}' already exists.`)
}
if (launchContextName) {
if (!this.defaultLauncherContexts.includes(launchContextName)) {
const launcherContexts = await this.getLauncherContexts(accessToken)
if (
!launcherContexts.find(
(context) => context.name === launchContextName
)
) {
const description = `The launcher context for ${launchContextName}`
const launchType = 'direct'
const newLauncherContext = await this.createLauncherContext(
launchContextName,
description,
launchType,
accessToken
).catch((err) => {
throw new Error(`Error while creating launcher context. ${err}`)
})
if (newLauncherContext && newLauncherContext.name) {
launchContextName = newLauncherContext.name
} else {
throw new Error('Error while creating launcher context.')
}
}
}
}
const headers: any = {
'Content-Type': 'application/json'
}
if (accessToken) {
headers.Authorization = `Bearer ${accessToken}`
}
let attributes = { reuseServerProcesses: true } as object
if (sharedAccountId)
attributes = { ...attributes, runServerAs: sharedAccountId }
const requestBody: any = {
name: contextName,
launchContext: {
contextName: launchContextName || ''
},
attributes
}
if (authorizedUsers && authorizedUsers.length) {
requestBody['authorizedUsers'] = authorizedUsers
} else {
requestBody['authorizeAllAuthenticatedUsers'] = true
}
if (autoExecLines) {
requestBody.environment = { autoExecLines }
}
const { result: context } = await this.requestClient
.post<Context>(
`${this.serverUrl}/compute/contexts`,
requestBody,
accessToken
)
.catch((err) => {
throw prefixMessage(err, 'Error while creating compute context. ')
})
return context
}
public async createLauncherContext(
contextName: string,
description: string,
launchType = 'direct',
accessToken?: string
) {
if (!contextName) {
throw new Error('Context name is required.')
}
this.isDefaultContext(
contextName,
this.defaultLauncherContexts,
`Launcher context '${contextName}' already exists.`
)
const existingLauncherContexts = await this.getLauncherContexts(accessToken)
if (
existingLauncherContexts.find((context) => context.name === contextName)
) {
throw new Error(`Launcher context '${contextName}' already exists.`)
}
const headers: any = {
'Content-Type': 'application/json'
}
if (accessToken) {
headers.Authorization = `Bearer ${accessToken}`
}
const requestBody: any = {
name: contextName,
description: description,
launchType
}
const { result: context } = await this.requestClient
.post<Context>(
`${this.serverUrl}/launcher/contexts`,
requestBody,
accessToken
)
.catch((err) => {
throw prefixMessage(err, 'Error while creating launcher context. ')
})
return context
}
public async editComputeContext(
contextName: string,
editedContext: EditContextInput,
accessToken?: string
) {
this.validateContextName(contextName)
this.isDefaultContext(
contextName,
this.defaultComputeContexts,
'Editing default SAS compute contexts is not allowed.',
true
)
let originalContext
originalContext = await this.getComputeContextByName(
contextName,
accessToken
)
// Try to find context by id, when context name has been changed.
if (!originalContext) {
originalContext = await this.getComputeContextById(
editedContext.id!,
accessToken
)
}
const { result: context, etag } = await this.requestClient
.get<Context>(
`${this.serverUrl}/compute/contexts/${originalContext.id}`,
accessToken
)
.catch((err) => {
if (err && err.status === 404) {
throw new Error(
`The context '${contextName}' was not found on this server.`
)
}
throw err
})
// An If-Match header with the value of the last ETag for the context
// is required to be able to update it
// https://developer.sas.com/apis/rest/Compute/#update-a-context-definition
return await this.requestClient.put<Context>(
`/compute/contexts/${context.id}`,
{
...context,
...editedContext,
attributes: { ...context.attributes, ...editedContext.attributes }
},
accessToken,
{ 'If-Match': etag }
)
}
public async getComputeContextByName(
contextName: string,
accessToken?: string
): Promise<Context> {
const { result: contexts } = await this.requestClient
.get<{ items: Context[] }>(
`${this.serverUrl}/compute/contexts?filter=eq(name, "${contextName}")`,
accessToken
)
.catch((err) => {
throw prefixMessage(
err,
'Error while getting compute context by name. '
)
})
if (!contexts || !(contexts.items && contexts.items.length)) {
throw new Error(
`The context '${contextName}' was not found at '${this.serverUrl}'.`
)
}
return contexts.items[0]
}
public async getComputeContextById(
contextId: string,
accessToken?: string
): Promise<ContextAllAttributes> {
const {
result: context
} = await this.requestClient
.get<ContextAllAttributes>(
`${this.serverUrl}/compute/contexts/${contextId}`,
accessToken
)
.catch((err) => {
throw prefixMessage(err, 'Error while getting compute context by id. ')
})
return context
}
public async getExecutableContexts(
executeScript: Function,
accessToken?: string
) {
const { result: contexts } = await this.requestClient
.get<{ items: Context[] }>(
`${this.serverUrl}/compute/contexts?limit=10000`,
accessToken
)
.catch((err) => {
throw prefixMessage(err, 'Error while fetching compute contexts.')
})
const contextsList = contexts.items || []
const executableContexts: any[] = []
const promises = contextsList.map((context: any) => {
const linesOfCode = ['%put &=sysuserid;']
return () =>
executeScript(
`test-${context.name}`,
linesOfCode,
context.name,
accessToken,
null,
false,
true,
true
).catch((err: any) => err)
})
let results: any[] = []
for (const promise of promises) results.push(await promise())
results.forEach((result: any, index: number) => {
if (result && result.log) {
try {
const resultParsed = result.log
let sysUserId = ''
const sysUserIdLog = resultParsed
.split('\n')
.find((line: string) => line.startsWith('SYSUSERID='))
if (sysUserIdLog) {
sysUserId = sysUserIdLog.replace('SYSUSERID=', '')
executableContexts.push({
createdBy: contextsList[index].createdBy,
id: contextsList[index].id,
name: contextsList[index].name,
version: contextsList[index].version,
attributes: {
sysUserId
}
})
}
} catch (error) {
throw error
}
}
})
return executableContexts
}
public async deleteComputeContext(contextName: string, accessToken?: string) {
this.validateContextName(contextName)
this.isDefaultContext(
contextName,
this.defaultComputeContexts,
'Deleting default SAS compute contexts is not allowed.',
true
)
const headers: any = {
'Content-Type': 'application/json'
}
if (accessToken) {
headers.Authorization = `Bearer ${accessToken}`
}
const context = await this.getComputeContextByName(contextName, accessToken)
return await this.requestClient.delete<Context>(
`${this.serverUrl}/compute/contexts/${context.id}`,
accessToken
)
}
// TODO: implement editLauncherContext method
// TODO: implement deleteLauncherContext method
private validateContextName(name: string) {
if (!name) throw new Error('Context name is required.')
}
public isDefaultContext(
context: string,
defaultContexts: string[] = this.defaultComputeContexts,
errorMessage = '',
listDefaults = false
) {
if (defaultContexts.includes(context)) {
throw new Error(
`${errorMessage}${
listDefaults
? '\nDefault contexts:' +
defaultContexts.map((context, i) => `\n${i + 1}. ${context}`)
: ''
}`
)
}
}
}

View File

@@ -1,115 +1,70 @@
import { isLogInRequired, needsRetry, isUrl } from './utils'
import { CsrfToken } from './types/CsrfToken'
import { isUrl } from './utils'
import { UploadFile } from './types/UploadFile'
import { ErrorResponse } from './types'
const requestRetryLimit = 5
import { ErrorResponse, LoginRequiredError } from './types'
import { RequestClient } from './request/RequestClient'
export class FileUploader {
constructor(
private appLoc: string,
private serverUrl: string,
serverUrl: string,
private jobsPath: string,
private setCsrfTokenWeb: any,
private csrfToken: CsrfToken | null = null
private requestClient: RequestClient
) {
if (serverUrl) isUrl(serverUrl)
}
private retryCount = 0
public uploadFile(sasJob: string, files: UploadFile[], params: any) {
return new Promise((resolve, reject) => {
if (files?.length < 1)
reject(new ErrorResponse('At least one file must be provided.'))
if (!sasJob || sasJob === '')
reject(new ErrorResponse('sasJob must be provided.'))
if (files?.length < 1)
return Promise.reject(
new ErrorResponse('At least one file must be provided.')
)
if (!sasJob || sasJob === '')
return Promise.reject(new ErrorResponse('sasJob must be provided.'))
let paramsString = ''
let paramsString = ''
for (let param in params) {
if (params.hasOwnProperty(param)) {
paramsString += `&${param}=${params[param]}`
for (let param in params) {
if (params.hasOwnProperty(param)) {
paramsString += `&${param}=${params[param]}`
}
}
const program = this.appLoc
? this.appLoc.replace(/\/?$/, '/') + sasJob.replace(/^\//, '')
: sasJob
const uploadUrl = `${this.jobsPath}/?${
'_program=' + program
}${paramsString}`
const formData = new FormData()
for (let file of files) {
formData.append('file', file.file, file.fileName)
}
const csrfToken = this.requestClient.getCsrfToken('file')
if (csrfToken) formData.append('_csrf', csrfToken.value)
const headers = {
'cache-control': 'no-cache',
Accept: '*/*',
'Content-Type': 'text/plain'
}
return this.requestClient
.post(uploadUrl, formData, undefined, 'application/json', headers)
.then((res) =>
typeof res.result === 'string' ? JSON.parse(res.result) : res.result
)
.catch((err: Error) => {
if (err instanceof LoginRequiredError) {
return Promise.reject(
new ErrorResponse('You must be logged in to upload a file.', err)
)
}
}
const program = this.appLoc
? this.appLoc.replace(/\/?$/, '/') + sasJob.replace(/^\//, '')
: sasJob
const uploadUrl = `${this.serverUrl}${this.jobsPath}/?${
'_program=' + program
}${paramsString}`
const headers = {
'cache-control': 'no-cache'
}
const formData = new FormData()
for (let file of files) {
formData.append('file', file.file, file.fileName)
}
if (this.csrfToken) formData.append('_csrf', this.csrfToken.value)
fetch(uploadUrl, {
method: 'POST',
body: formData,
referrerPolicy: 'same-origin',
headers
return Promise.reject(
new ErrorResponse('File upload request failed.', err)
)
})
.then(async (response) => {
if (!response.ok) {
if (response.status === 403) {
const tokenHeader = response.headers.get('X-CSRF-HEADER')
if (tokenHeader) {
const token = response.headers.get(tokenHeader)
this.csrfToken = {
headerName: tokenHeader,
value: token || ''
}
this.setCsrfTokenWeb(this.csrfToken)
}
}
}
return response.text()
})
.then((responseText) => {
if (isLogInRequired(responseText))
reject(new ErrorResponse('You must be logged in to upload a file.'))
if (needsRetry(responseText)) {
if (this.retryCount < requestRetryLimit) {
this.retryCount++
this.uploadFile(sasJob, files, params).then(
(res: any) => resolve(res),
(err: any) => reject(err)
)
} else {
this.retryCount = 0
reject(responseText)
}
} else {
this.retryCount = 0
try {
resolve(JSON.parse(responseText))
} catch (e) {
reject(
new ErrorResponse(
'Error while parsing json from upload response.',
e
)
)
}
}
})
.catch((err: any) => {
reject(new ErrorResponse('Upload request failed.', err))
})
})
}
}

View File

@@ -1,3 +1,4 @@
import axios, { AxiosInstance } from 'axios'
import { isUrl } from './utils'
/**
@@ -5,8 +6,11 @@ import { isUrl } from './utils'
*
*/
export class SAS9ApiClient {
private httpClient: AxiosInstance
constructor(private serverUrl: string) {
if (serverUrl) isUrl(serverUrl)
this.httpClient = axios.create({ baseURL: this.serverUrl })
}
/**
@@ -38,18 +42,18 @@ export class SAS9ApiClient {
repositoryName: string
) {
const requestPayload = linesOfCode.join('\n')
const executeScriptRequest = {
method: 'PUT',
headers: {
Accept: 'application/json'
},
body: `command=${requestPayload}`
}
const executeScriptResponse = await fetch(
`${this.serverUrl}/sas/servers/${serverName}/cmd?repositoryName=${repositoryName}`,
executeScriptRequest
).then((res) => res.text())
return executeScriptResponse
const executeScriptResponse = await this.httpClient.put(
`/sas/servers/${serverName}/cmd?repositoryName=${repositoryName}`,
`command=${requestPayload}`,
{
headers: {
Accept: 'application/json'
},
responseType: 'text'
}
)
return executeScriptResponse.data
}
}

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More