@sassoftware/viya-serverjs 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +4 -4
- package/.env.proxy +4 -3
- package/.env.server +5 -4
- package/Dockerfile +3 -3
- package/cli.js +2 -2
- package/lib/config.js +62 -62
- package/lib/handlers/logon.js +39 -39
- package/lib/handlers/proxyMapUri.js +49 -75
- package/lib/handlers/setCookies.js +73 -72
- package/lib/iService.js +401 -401
- package/lib/plugins/appCookie.js +98 -98
- package/lib/plugins/setDefaultRoutes.js +272 -222
- package/lib/plugins/setupAuth.js +68 -67
- package/package.json +1 -1
- package/public/index.html +8 -2
- package/public/indexProxy.html +1 -0
- package/server.js +5 -116
- package/src/handlers/proxyMapUri.js +2 -30
- package/src/handlers/setCookies.js +3 -1
- package/src/iService.js +1 -0
- package/src/plugins/appCookie.js +3 -3
- package/src/plugins/setDefaultRoutes.js +7 -3
- package/src/plugins/setupAuth.js +3 -1
- package/{packages/examples/app/certs/tls.sh → tls/viyatls.sh} +0 -2
- package/packages/core/config.js +0 -86
- package/packages/core/handlers/appCallback.js +0 -40
- package/packages/core/handlers/codeAuth.js +0 -31
- package/packages/core/handlers/decodeJwt.js +0 -11
- package/packages/core/handlers/favicon.js +0 -24
- package/packages/core/handlers/getApp.js +0 -41
- package/packages/core/handlers/getApp2.js +0 -26
- package/packages/core/handlers/getUser.js +0 -20
- package/packages/core/handlers/index.js +0 -36
- package/packages/core/handlers/keepAlive.js +0 -54
- package/packages/core/handlers/keepAlive2.js +0 -13
- package/packages/core/handlers/logon.js +0 -24
- package/packages/core/handlers/logout.js +0 -43
- package/packages/core/handlers/proxyMapUri.js +0 -53
- package/packages/core/handlers/proxyOnResponse.js +0 -12
- package/packages/core/handlers/reactDev.js +0 -30
- package/packages/core/handlers/setCookies.js +0 -78
- package/packages/core/iService.js +0 -369
- package/packages/core/index.js +0 -249
- package/packages/core/parseDocker.js +0 -33
- package/packages/core/plugins/SASauth.js +0 -79
- package/packages/core/plugins/appCookie.js +0 -49
- package/packages/core/plugins/setContext.js +0 -34
- package/packages/core/plugins/setDefaultRoutes.js +0 -262
- package/packages/core/plugins/setupAuth.js +0 -48
- package/packages/core/plugins/setupUserRoutes.js +0 -48
- package/packages/core/plugins/token.js +0 -10
- package/packages/core/schemes/SASTokenScheme.js +0 -43
- package/packages/core/visionIndex.html +0 -24
- package/packages/examples/apitest/.env +0 -11
- package/packages/examples/apitest/.eslintrc.json +0 -42
- package/packages/examples/apitest/Dockerfile +0 -41
- package/packages/examples/apitest/api.js +0 -88
- package/packages/examples/apitest/appenv.js +0 -6
- package/packages/examples/apitest/docker-compose.yml +0 -10
- package/packages/examples/apitest/package.json +0 -19
- package/packages/examples/apitest/public/data/Cluster_SDOH1.sas +0 -182
- package/packages/examples/apitest/public/data/Cluster_SDOH6.sas +0 -180
- package/packages/examples/apitest/public/data/LeNet_snzrle.astore +0 -0
- package/packages/examples/apitest/public/data/NeuralNetwork_High_med.sas +0 -2409
- package/packages/examples/apitest/public/data/NeuralNetwork_high_med1.sas +0 -2409
- package/packages/examples/apitest/public/data/ast/GBlocalcopy.sasast +0 -0
- package/packages/examples/apitest/public/data/ast/LeNet_snzrle.astore +0 -0
- package/packages/examples/apitest/public/data/ast/gb_IrisGB.sasast +0 -0
- package/packages/examples/apitest/public/data/ast/paysimsvdd.sasast +0 -0
- package/packages/examples/apitest/public/data/ast/svmlocalcopy.sasast +0 -0
- package/packages/examples/apitest/public/data/cars.csv +0 -429
- package/packages/examples/apitest/public/data/cluster_test2.sas7bdat +0 -0
- package/packages/examples/apitest/public/data/cmdList.txt +0 -15
- package/packages/examples/apitest/public/data/gradBoost.sashdat +0 -0
- package/packages/examples/apitest/public/data/iris.csv +0 -151
- package/packages/examples/apitest/public/data/model1.sas7bdat +0 -0
- package/packages/examples/apitest/public/favicon.ico +0 -0
- package/packages/examples/apitest/public/index.html +0 -316
- package/packages/examples/apitest/public/index2.html +0 -102
- package/packages/examples/apitest/public/logon.html +0 -42
- package/packages/examples/apitest/public/myapp/secondary.html +0 -1
- package/packages/examples/apitest/public/myapp/test.js +0 -2
- package/packages/examples/apitest/public/onlogoff.html +0 -53
- package/packages/examples/apitest/start.sh +0 -15
- package/packages/examples/app/.env +0 -32
- package/packages/examples/app/.envProxy +0 -19
- package/packages/examples/app/.envimpl +0 -12
- package/packages/examples/app/.eslintrc.json +0 -42
- package/packages/examples/app/Dockerfile +0 -42
- package/packages/examples/app/appenv.js +0 -6
- package/packages/examples/app/certs/ca.crt +0 -19
- package/packages/examples/app/certs/tls.crt +0 -25
- package/packages/examples/app/certs/tls.key +0 -28
- package/packages/examples/app/docker-compose.yml +0 -12
- package/packages/examples/app/index.js +0 -15
- package/packages/examples/app/package.json +0 -20
- package/packages/examples/app/public/casread.html +0 -324
- package/packages/examples/app/public/data/Cluster_SDOH1.sas +0 -182
- package/packages/examples/app/public/data/Cluster_SDOH6.sas +0 -180
- package/packages/examples/app/public/data/LeNet_snzrle.astore +0 -0
- package/packages/examples/app/public/data/NeuralNetwork_High_med.sas +0 -2409
- package/packages/examples/app/public/data/NeuralNetwork_high_med1.sas +0 -2409
- package/packages/examples/app/public/data/ast/GBlocalcopy.sasast +0 -0
- package/packages/examples/app/public/data/ast/LeNet_snzrle.astore +0 -0
- package/packages/examples/app/public/data/ast/gb_IrisGB.sasast +0 -0
- package/packages/examples/app/public/data/ast/paysimsvdd.sasast +0 -0
- package/packages/examples/app/public/data/ast/svmlocalcopy.sasast +0 -0
- package/packages/examples/app/public/data/cars.csv +0 -429
- package/packages/examples/app/public/data/cluster_test2.sas7bdat +0 -0
- package/packages/examples/app/public/data/cmdList.txt +0 -15
- package/packages/examples/app/public/data/gradBoost.sashdat +0 -0
- package/packages/examples/app/public/data/iris.csv +0 -151
- package/packages/examples/app/public/data/model1.sas7bdat +0 -0
- package/packages/examples/app/public/favicon.ico +0 -0
- package/packages/examples/app/public/index.html +0 -332
- package/packages/examples/app/public/indexProxy.html +0 -346
- package/packages/examples/app/public/indextest.html +0 -316
- package/packages/examples/app/public/logon.html +0 -44
- package/packages/examples/app/public/micburger.html +0 -345
- package/packages/examples/app/public/micburger.txt.html +0 -311
- package/packages/examples/app/public/myapp/secondary.html +0 -1
- package/packages/examples/app/public/myapp/test.js +0 -2
- package/packages/examples/app/public/sara.txt +0 -345
- package/packages/examples/app/public/testva2.html +0 -311
- package/packages/examples/app/startup.sh +0 -15
- package/packages/examples/appdocker/.env +0 -21
- package/packages/examples/appdocker/.envProxy +0 -22
- package/packages/examples/appdocker/.envimpl +0 -12
- package/packages/examples/appdocker/.eslintrc.json +0 -42
- package/packages/examples/appdocker/Dockerfile +0 -43
- package/packages/examples/appdocker/appenv.js +0 -6
- package/packages/examples/appdocker/certs/ca.crt +0 -19
- package/packages/examples/appdocker/certs/tls.crt +0 -25
- package/packages/examples/appdocker/certs/tls.key +0 -28
- package/packages/examples/appdocker/certs/tls.sh +0 -5
- package/packages/examples/appdocker/docker-compose.yml +0 -12
- package/packages/examples/appdocker/index.js +0 -15
- package/packages/examples/appdocker/package.json +0 -20
- package/packages/examples/appdocker/public/data/Cluster_SDOH1.sas +0 -182
- package/packages/examples/appdocker/public/data/Cluster_SDOH6.sas +0 -180
- package/packages/examples/appdocker/public/data/LeNet_snzrle.astore +0 -0
- package/packages/examples/appdocker/public/data/NeuralNetwork_High_med.sas +0 -2409
- package/packages/examples/appdocker/public/data/NeuralNetwork_high_med1.sas +0 -2409
- package/packages/examples/appdocker/public/data/ast/GBlocalcopy.sasast +0 -0
- package/packages/examples/appdocker/public/data/ast/LeNet_snzrle.astore +0 -0
- package/packages/examples/appdocker/public/data/ast/gb_IrisGB.sasast +0 -0
- package/packages/examples/appdocker/public/data/ast/paysimsvdd.sasast +0 -0
- package/packages/examples/appdocker/public/data/ast/svmlocalcopy.sasast +0 -0
- package/packages/examples/appdocker/public/data/cars.csv +0 -429
- package/packages/examples/appdocker/public/data/cluster_test2.sas7bdat +0 -0
- package/packages/examples/appdocker/public/data/cmdList.txt +0 -15
- package/packages/examples/appdocker/public/data/gradBoost.sashdat +0 -0
- package/packages/examples/appdocker/public/data/iris.csv +0 -151
- package/packages/examples/appdocker/public/data/model1.sas7bdat +0 -0
- package/packages/examples/appdocker/public/favicon.ico +0 -0
- package/packages/examples/appdocker/public/index.html +0 -346
- package/packages/examples/appdocker/public/indexProxy.html +0 -346
- package/packages/examples/appdocker/public/indextest.html +0 -316
- package/packages/examples/appdocker/public/logon.html +0 -44
- package/packages/examples/appdocker/public/myapp/secondary.html +0 -1
- package/packages/examples/appdocker/public/myapp/test.js +0 -2
- package/packages/examples/appdocker/startup.sh +0 -15
- package/packages/examples/apptest/.env +0 -28
- package/packages/examples/apptest/.envProxy +0 -22
- package/packages/examples/apptest/.envimpl +0 -12
- package/packages/examples/apptest/.eslintrc.json +0 -42
- package/packages/examples/apptest/Dockerfile +0 -44
- package/packages/examples/apptest/appDir/app1/design.html +0 -350
- package/packages/examples/apptest/appDir/app1/index.html +0 -353
- package/packages/examples/apptest/appDir/index.html +0 -350
- package/packages/examples/apptest/appenv.js +0 -6
- package/packages/examples/apptest/docker-compose.yml +0 -12
- package/packages/examples/apptest/index.js +0 -444
- package/packages/examples/apptest/package.json +0 -24
- package/packages/examples/apptest/public/casread2.html +0 -321
- package/packages/examples/apptest/public/data/Cluster_SDOH1.sas +0 -182
- package/packages/examples/apptest/public/data/Cluster_SDOH6.sas +0 -180
- package/packages/examples/apptest/public/data/LeNet_snzrle.astore +0 -0
- package/packages/examples/apptest/public/data/NeuralNetwork_High_med.sas +0 -2409
- package/packages/examples/apptest/public/data/NeuralNetwork_high_med1.sas +0 -2409
- package/packages/examples/apptest/public/data/ast/GBlocalcopy.sasast +0 -0
- package/packages/examples/apptest/public/data/ast/LeNet_snzrle.astore +0 -0
- package/packages/examples/apptest/public/data/ast/gb_IrisGB.sasast +0 -0
- package/packages/examples/apptest/public/data/ast/paysimsvdd.sasast +0 -0
- package/packages/examples/apptest/public/data/ast/svmlocalcopy.sasast +0 -0
- package/packages/examples/apptest/public/data/cars.csv +0 -429
- package/packages/examples/apptest/public/data/cluster_test2.sas7bdat +0 -0
- package/packages/examples/apptest/public/data/cmdList.txt +0 -15
- package/packages/examples/apptest/public/data/gradBoost.sashdat +0 -0
- package/packages/examples/apptest/public/data/iris.csv +0 -151
- package/packages/examples/apptest/public/data/model1.sas7bdat +0 -0
- package/packages/examples/apptest/public/design.html +0 -349
- package/packages/examples/apptest/public/favicon.ico +0 -0
- package/packages/examples/apptest/public/help.html +0 -1
- package/packages/examples/apptest/public/index.html +0 -353
- package/packages/examples/apptest/public/index2.html +0 -353
- package/packages/examples/apptest/public/indexProxy.html +0 -346
- package/packages/examples/apptest/public/indextest.html +0 -316
- package/packages/examples/apptest/public/logon.html +0 -44
- package/packages/examples/apptest/public/myapp/q.html +0 -349
- package/packages/examples/apptest/public/myapp/secondary.html +0 -1
- package/packages/examples/apptest/public/myapp/test.js +0 -2
- package/packages/examples/apptest/public/push1.html +0 -187
- package/packages/examples/apptest/startup.sh +0 -15
- package/packages/examples/apptesti/.env +0 -13
- package/packages/examples/apptesti/.eslintrc.json +0 -42
- package/packages/examples/apptesti/Dockerfile +0 -42
- package/packages/examples/apptesti/appenv.js +0 -6
- package/packages/examples/apptesti/certs/ca.crt +0 -19
- package/packages/examples/apptesti/certs/tls.crt +0 -25
- package/packages/examples/apptesti/certs/tls.key +0 -28
- package/packages/examples/apptesti/certs/tls.sh +0 -5
- package/packages/examples/apptesti/docker-compose.yml +0 -12
- package/packages/examples/apptesti/index.js +0 -7
- package/packages/examples/apptesti/package.json +0 -20
- package/packages/examples/apptesti/public/data/Cluster_SDOH1.sas +0 -182
- package/packages/examples/apptesti/public/data/Cluster_SDOH6.sas +0 -180
- package/packages/examples/apptesti/public/data/LeNet_snzrle.astore +0 -0
- package/packages/examples/apptesti/public/data/NeuralNetwork_High_med.sas +0 -2409
- package/packages/examples/apptesti/public/data/NeuralNetwork_high_med1.sas +0 -2409
- package/packages/examples/apptesti/public/data/ast/GBlocalcopy.sasast +0 -0
- package/packages/examples/apptesti/public/data/ast/LeNet_snzrle.astore +0 -0
- package/packages/examples/apptesti/public/data/ast/gb_IrisGB.sasast +0 -0
- package/packages/examples/apptesti/public/data/ast/paysimsvdd.sasast +0 -0
- package/packages/examples/apptesti/public/data/ast/svmlocalcopy.sasast +0 -0
- package/packages/examples/apptesti/public/data/cars.csv +0 -429
- package/packages/examples/apptesti/public/data/cluster_test2.sas7bdat +0 -0
- package/packages/examples/apptesti/public/data/cmdList.txt +0 -15
- package/packages/examples/apptesti/public/data/gradBoost.sashdat +0 -0
- package/packages/examples/apptesti/public/data/iris.csv +0 -151
- package/packages/examples/apptesti/public/data/model1.sas7bdat +0 -0
- package/packages/examples/apptesti/public/favicon.ico +0 -0
- package/packages/examples/apptesti/public/index.html +0 -346
- package/packages/examples/apptesti/public/indexProxy.html +0 -346
- package/packages/examples/apptesti/public/indextest.html +0 -316
- package/packages/examples/apptesti/public/logon.html +0 -44
- package/packages/examples/apptesti/public/main.html +0 -346
- package/packages/examples/apptesti/public/myapp/secondary.html +0 -1
- package/packages/examples/apptesti/public/myapp/test.js +0 -2
- package/packages/examples/apptesti/startup.sh +0 -15
- package/packages/examples/basic/.env +0 -10
- package/packages/examples/basic/.eslintrc.json +0 -42
- package/packages/examples/basic/Dockerfile +0 -41
- package/packages/examples/basic/api.js +0 -88
- package/packages/examples/basic/appenv.js +0 -6
- package/packages/examples/basic/docker-compose.yml +0 -10
- package/packages/examples/basic/package.json +0 -19
- package/packages/examples/basic/public/data/Cluster_SDOH1.sas +0 -182
- package/packages/examples/basic/public/data/Cluster_SDOH6.sas +0 -180
- package/packages/examples/basic/public/data/LeNet_snzrle.astore +0 -0
- package/packages/examples/basic/public/data/NeuralNetwork_High_med.sas +0 -2409
- package/packages/examples/basic/public/data/NeuralNetwork_high_med1.sas +0 -2409
- package/packages/examples/basic/public/data/ast/GBlocalcopy.sasast +0 -0
- package/packages/examples/basic/public/data/ast/LeNet_snzrle.astore +0 -0
- package/packages/examples/basic/public/data/ast/gb_IrisGB.sasast +0 -0
- package/packages/examples/basic/public/data/ast/paysimsvdd.sasast +0 -0
- package/packages/examples/basic/public/data/ast/svmlocalcopy.sasast +0 -0
- package/packages/examples/basic/public/data/cars.csv +0 -429
- package/packages/examples/basic/public/data/cluster_test2.sas7bdat +0 -0
- package/packages/examples/basic/public/data/cmdList.txt +0 -15
- package/packages/examples/basic/public/data/gradBoost.sashdat +0 -0
- package/packages/examples/basic/public/data/iris.csv +0 -151
- package/packages/examples/basic/public/data/model1.sas7bdat +0 -0
- package/packages/examples/basic/public/favicon.ico +0 -0
- package/packages/examples/basic/public/index.html +0 -29
- package/packages/examples/basic/public/index2.html +0 -102
- package/packages/examples/basic/public/logon.html +0 -42
- package/packages/examples/basic/public/myapp/secondary.html +0 -1
- package/packages/examples/basic/public/myapp/test.js +0 -2
- package/packages/examples/basic/public/onlogoff.html +0 -53
- package/packages/examples/basic/start.sh +0 -15
- package/packages/examples/proxytest/.env +0 -23
- package/packages/examples/proxytest/.envimpl +0 -11
- package/packages/examples/proxytest/.eslintrc.json +0 -42
- package/packages/examples/proxytest/Dockerfile +0 -42
- package/packages/examples/proxytest/appenv.js +0 -6
- package/packages/examples/proxytest/docker-compose.yml +0 -12
- package/packages/examples/proxytest/index.js +0 -57
- package/packages/examples/proxytest/package.json +0 -18
- package/packages/examples/proxytest/public/data/Cluster_SDOH1.sas +0 -182
- package/packages/examples/proxytest/public/data/Cluster_SDOH6.sas +0 -180
- package/packages/examples/proxytest/public/data/LeNet_snzrle.astore +0 -0
- package/packages/examples/proxytest/public/data/NeuralNetwork_High_med.sas +0 -2409
- package/packages/examples/proxytest/public/data/NeuralNetwork_high_med1.sas +0 -2409
- package/packages/examples/proxytest/public/data/ast/GBlocalcopy.sasast +0 -0
- package/packages/examples/proxytest/public/data/ast/LeNet_snzrle.astore +0 -0
- package/packages/examples/proxytest/public/data/ast/gb_IrisGB.sasast +0 -0
- package/packages/examples/proxytest/public/data/ast/paysimsvdd.sasast +0 -0
- package/packages/examples/proxytest/public/data/ast/svmlocalcopy.sasast +0 -0
- package/packages/examples/proxytest/public/data/cars.csv +0 -429
- package/packages/examples/proxytest/public/data/cluster_test2.sas7bdat +0 -0
- package/packages/examples/proxytest/public/data/cmdList.txt +0 -15
- package/packages/examples/proxytest/public/data/gradBoost.sashdat +0 -0
- package/packages/examples/proxytest/public/data/iris.csv +0 -151
- package/packages/examples/proxytest/public/data/model1.sas7bdat +0 -0
- package/packages/examples/proxytest/public/favicon.ico +0 -0
- package/packages/examples/proxytest/public/index.html +0 -357
- package/packages/examples/proxytest/public/index.js +0 -57
- package/packages/examples/proxytest/public/indextest.html +0 -316
- package/packages/examples/proxytest/public/logon.html +0 -44
- package/packages/examples/proxytest/public/main.html +0 -357
- package/packages/examples/proxytest/public/myapp/secondary.html +0 -1
- package/packages/examples/proxytest/public/myapp/test.js +0 -2
- package/packages/examples/proxytest/public/restaf.js +0 -2461
- package/packages/examples/proxytest/public/restaf.min.js +0 -11
- package/packages/examples/proxytest/public/sas/iris.txt +0 -10
- package/packages/examples/proxytest/startup.sh +0 -15
- package/public/casread2.html +0 -321
- package/public/design.html +0 -350
- package/public/display.html +0 -354
- package/public/index2.html +0 -353
- package/public/indextest.html +0 -316
- package/public/logon.html +0 -44
- package/public/myapp/q.html +0 -349
- package/public/myapp/secondary.html +0 -1
- package/public/myapp/test.js +0 -2
- package/public/push1.html +0 -187
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
<html lang="en">
|
|
2
|
-
<head>
|
|
3
|
-
<meta charset="UTF-8" />
|
|
4
|
-
<script src="https://unpkg.com/@sassoftware/restaf@4.9.3/dist/restaf.js">
|
|
5
|
-
window.addEventListener('error', function(e) {
|
|
6
|
-
console.log(e.target);
|
|
7
|
-
}, true);
|
|
8
|
-
</script>
|
|
9
|
-
<script src="https://unpkg.com/@sassoftware/restaflib@4.9.3/dist/restaflib.js">
|
|
10
|
-
window.addEventListener('error', function(e) {
|
|
11
|
-
console.log(e.target);
|
|
12
|
-
}, true);
|
|
13
|
-
|
|
14
|
-
</script>
|
|
15
|
-
|
|
16
|
-
<script>
|
|
17
|
-
let store = restaf.initStore({ casProxy: true });
|
|
18
|
-
console.log("store config: ", JSON.stringify(store.config, null, 4));
|
|
19
|
-
let LOGONPAYLOAD = {
|
|
20
|
-
host: window.location.ancestorOrigins[0],
|
|
21
|
-
authType: 'server',
|
|
22
|
-
};
|
|
23
|
-
function checkLinks(name, r, rel) {
|
|
24
|
-
debugger;
|
|
25
|
-
let linkl = r.links().size;
|
|
26
|
-
console.log(`Service name: ${name} LinkCount: ${linkl}`);
|
|
27
|
-
if (linkl === 0) {
|
|
28
|
-
debugger;
|
|
29
|
-
console.log(r.status);
|
|
30
|
-
console.log(JSON.stringify(r.items(), null, 4));
|
|
31
|
-
document.getElementById(
|
|
32
|
-
"output0"
|
|
33
|
-
).innerHTML = `Service name: ${name} LinkCount: ${linkl}\n
|
|
34
|
-
${JSON.stringify(r.items(), null,4)}`;
|
|
35
|
-
;
|
|
36
|
-
throw `Service name: ${name} LinkCount: ${linkl}. Processing stopped`;
|
|
37
|
-
}
|
|
38
|
-
if (r.links(rel) == null) {
|
|
39
|
-
debugger;
|
|
40
|
-
document.getElementById(
|
|
41
|
-
"output0"
|
|
42
|
-
).innerHTML = `Service name: ${name} rel: ${rel} is null.\n
|
|
43
|
-
Processing stopped`;
|
|
44
|
-
throw `Service name: ${name} rel: ${rel} is null. Processing stopped`;
|
|
45
|
-
}
|
|
46
|
-
return linkl;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async function initSession() {
|
|
50
|
-
console.log(LOGONPAYLOAD);
|
|
51
|
-
debugger;
|
|
52
|
-
let msg = await store.logon(LOGONPAYLOAD);
|
|
53
|
-
console.log("logon status", msg);
|
|
54
|
-
/*
|
|
55
|
-
let { identities } = await store.addServices("identities");
|
|
56
|
-
let name = "user";
|
|
57
|
-
if (identities.links("currentUser") != null) {
|
|
58
|
-
let c = await store.apiCall(identities.links("currentUser"));
|
|
59
|
-
name = c.items("id");
|
|
60
|
-
} else {
|
|
61
|
-
console.log("NOTE: Call to identities service returned no links");
|
|
62
|
-
}
|
|
63
|
-
console.log(name);
|
|
64
|
-
*/
|
|
65
|
-
}
|
|
66
|
-
function setup() {
|
|
67
|
-
document.getElementById("output").innerHTML = "...initializing";
|
|
68
|
-
initSession()
|
|
69
|
-
.then((r) => {
|
|
70
|
-
document.getElementById("output").innerHTML = "ready";
|
|
71
|
-
})
|
|
72
|
-
.catch((e) => {
|
|
73
|
-
console.log(e);
|
|
74
|
-
console.log(JSON.stringify(e.detail, null, 4));
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
</script>
|
|
78
|
-
<script>
|
|
79
|
-
function runit(type) {
|
|
80
|
-
document.getElementById("output").innerHTML = "...running";
|
|
81
|
-
document.getElementById("output0").innerHTML = " ";
|
|
82
|
-
let testcase;
|
|
83
|
-
switch (type) {
|
|
84
|
-
case "native": {
|
|
85
|
-
testcase = SASfileService2;
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
case "files": {
|
|
89
|
-
testcase = SASfileService;
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
case "compute": {
|
|
93
|
-
testcase = dsCompute;
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
case "cas": {
|
|
97
|
-
debugger;
|
|
98
|
-
testcase = runCas;
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
case "casnative": {
|
|
102
|
-
debugger;
|
|
103
|
-
testcase = runCas2;
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
default: {
|
|
107
|
-
testcase = SASfileService2;
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
testcase(store)
|
|
113
|
-
.then((r) => {
|
|
114
|
-
document.getElementById("output").innerHTML = JSON.stringify(
|
|
115
|
-
r,
|
|
116
|
-
null,
|
|
117
|
-
4
|
|
118
|
-
);
|
|
119
|
-
})
|
|
120
|
-
.catch((err) => {
|
|
121
|
-
document.getElementById("output").innerHTML = JSON.stringify(
|
|
122
|
-
err,
|
|
123
|
-
null,
|
|
124
|
-
4
|
|
125
|
-
);
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
async function runCas(store) {
|
|
130
|
-
debugger;
|
|
131
|
-
try {
|
|
132
|
-
let { casManagement } = await store.addServices("casManagement");
|
|
133
|
-
debugger;
|
|
134
|
-
checkLinks("casManagement", casManagement, "servers");
|
|
135
|
-
debugger;
|
|
136
|
-
let servers = await store.apiCall(casManagement.links("servers"));
|
|
137
|
-
let serverName = servers.itemsList(0);
|
|
138
|
-
console.log(`server name: `, serverName);
|
|
139
|
-
let rafLink = servers.itemsCmd(serverName, "createSession");
|
|
140
|
-
if (rafLink == null) {
|
|
141
|
-
console.log("no createSession link");
|
|
142
|
-
console.log(JSON.stringify(rafLink.items(), null, 4));
|
|
143
|
-
throw "no createSession link";
|
|
144
|
-
}
|
|
145
|
-
console.log(JSON.stringify(rafLink));
|
|
146
|
-
|
|
147
|
-
let session = await store.apiCall(
|
|
148
|
-
servers.itemsCmd(serverName, "createSession")
|
|
149
|
-
);
|
|
150
|
-
checkLinks("session", session, "execute");
|
|
151
|
-
let payload = {
|
|
152
|
-
action: "builtins.echo",
|
|
153
|
-
data: { code: { x: 1 } },
|
|
154
|
-
};
|
|
155
|
-
console.log(JSON.stringify(session.links("execute"), null, 4));
|
|
156
|
-
let r = await store.runAction(session, payload);
|
|
157
|
-
console.log("echo completed");
|
|
158
|
-
await store.apiCall(session.links("delete"));
|
|
159
|
-
return r.items();
|
|
160
|
-
}
|
|
161
|
-
catch(err) {
|
|
162
|
-
debugger;
|
|
163
|
-
console.log(JSON.stringify(err, null,4));
|
|
164
|
-
document.getElementById("output0").innerHTML = `${JSON.stringify(err, null,4)}`;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
async function runCas2(store) {
|
|
168
|
-
debugger;
|
|
169
|
-
let result;
|
|
170
|
-
try {
|
|
171
|
-
debugger;
|
|
172
|
-
let config = {
|
|
173
|
-
method: 'GET',
|
|
174
|
-
url: LOGONPAYLOAD.host+ '/casManagement/',
|
|
175
|
-
withCredentials: true,
|
|
176
|
-
headers: {
|
|
177
|
-
'Content-Type': 'application/vnd.sas.api+json',
|
|
178
|
-
'Accept' : 'application/json, application/vnd.sas.api+json',
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
debugger;
|
|
183
|
-
let r = await store.request(config);
|
|
184
|
-
console.log(r.data);
|
|
185
|
-
result = r.data;
|
|
186
|
-
debugger;
|
|
187
|
-
}
|
|
188
|
-
catch (err) {
|
|
189
|
-
debugger;
|
|
190
|
-
console.log(err);
|
|
191
|
-
result = err;
|
|
192
|
-
debugger;
|
|
193
|
-
}
|
|
194
|
-
return result;
|
|
195
|
-
return ;
|
|
196
|
-
}
|
|
197
|
-
async function SASfileService2(store) {
|
|
198
|
-
debugger;
|
|
199
|
-
let result;
|
|
200
|
-
try {
|
|
201
|
-
debugger;
|
|
202
|
-
let config = {
|
|
203
|
-
method: 'GET',
|
|
204
|
-
url: LOGONPAYLOAD.host+ '/files/',
|
|
205
|
-
withCredentials: true,
|
|
206
|
-
headers: {
|
|
207
|
-
'Content-Type': 'application/vnd.sas.api+json',
|
|
208
|
-
'Accept' : 'application/json, application/vnd.sas.api+json',
|
|
209
|
-
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
debugger;
|
|
213
|
-
let r = await store.request(config);
|
|
214
|
-
console.log(r.data);
|
|
215
|
-
result = r.data;
|
|
216
|
-
debugger;
|
|
217
|
-
}
|
|
218
|
-
catch (err) {
|
|
219
|
-
console.log(err);
|
|
220
|
-
result = err;
|
|
221
|
-
debugger;
|
|
222
|
-
}
|
|
223
|
-
return result;
|
|
224
|
-
return ;
|
|
225
|
-
}
|
|
226
|
-
async function SASfileService(store) {
|
|
227
|
-
debugger;
|
|
228
|
-
let result;
|
|
229
|
-
try {
|
|
230
|
-
debugger;
|
|
231
|
-
let { files } = await store.addServices("files");
|
|
232
|
-
debugger;
|
|
233
|
-
result = files.links();
|
|
234
|
-
}
|
|
235
|
-
catch (err) {
|
|
236
|
-
console.log(err);
|
|
237
|
-
result = err;
|
|
238
|
-
// throw 'ERROR: Call to file service failed';
|
|
239
|
-
debugger;
|
|
240
|
-
}
|
|
241
|
-
return result;
|
|
242
|
-
}
|
|
243
|
-
async function dsCompute(store) {
|
|
244
|
-
let log = null;
|
|
245
|
-
let { compute } = await store.addServices("compute");
|
|
246
|
-
|
|
247
|
-
let contexts = await store.apiCall(compute.links("contexts"));
|
|
248
|
-
|
|
249
|
-
// lookup the name of the first context and then use it to get the associated createSession restafLink
|
|
250
|
-
let createSession = contexts.itemsCmd(
|
|
251
|
-
contexts.itemsList(0),
|
|
252
|
-
"createSession"
|
|
253
|
-
);
|
|
254
|
-
let session = await store.apiCall(createSession);
|
|
255
|
-
|
|
256
|
-
// Now run a simple data step in that session
|
|
257
|
-
let payload = {
|
|
258
|
-
data: {
|
|
259
|
-
code: [`data _null_; do i = 1 to 100; x=1; end; run; `],
|
|
260
|
-
},
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
// Now execute the data step and wait for completion
|
|
264
|
-
let job = await store.apiCall(session.links("execute"), payload);
|
|
265
|
-
let status = await store.jobState(job, null, 5, 2);
|
|
266
|
-
|
|
267
|
-
if (status.data === "running") {
|
|
268
|
-
throw `ERROR: Job did not complete in allotted time`;
|
|
269
|
-
} else {
|
|
270
|
-
switch (status.data) {
|
|
271
|
-
case "warning":
|
|
272
|
-
console.log(`Warning: check your log for warnings`);
|
|
273
|
-
break;
|
|
274
|
-
case "error":
|
|
275
|
-
throw `Please correct errors and rerun program`;
|
|
276
|
-
default:
|
|
277
|
-
log = await store.apiCall(status.job.links("log"));
|
|
278
|
-
break;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
return log === null ? status : log.items();
|
|
282
|
-
}
|
|
283
|
-
</script>
|
|
284
|
-
</head>
|
|
285
|
-
<body onload="setup()">
|
|
286
|
-
<h1 id="head">Hi</h1>
|
|
287
|
-
<div>
|
|
288
|
-
<button onclick="runit('files')">
|
|
289
|
-
Press to make a call to file service
|
|
290
|
-
</button>
|
|
291
|
-
<br />
|
|
292
|
-
<br />
|
|
293
|
-
<button onclick="runit('native')">
|
|
294
|
-
Press to make a call to file service native
|
|
295
|
-
</button>
|
|
296
|
-
<br />
|
|
297
|
-
<br />
|
|
298
|
-
<button onclick="runit('compute')">
|
|
299
|
-
Press to make a call compute service
|
|
300
|
-
</button>
|
|
301
|
-
<br />
|
|
302
|
-
<br />
|
|
303
|
-
<button onclick="runit('cas')">Press to make a call to cas echo</button>
|
|
304
|
-
<br />
|
|
305
|
-
<br />
|
|
306
|
-
<button onclick="runit('casnative')">Press to call casmanagement native</button>
|
|
307
|
-
<br />
|
|
308
|
-
</div>
|
|
309
|
-
<div>
|
|
310
|
-
<pre id="output"></pre>
|
|
311
|
-
</div>
|
|
312
|
-
<div>
|
|
313
|
-
<pre id="output0"></pre>
|
|
314
|
-
</div>
|
|
315
|
-
</body>
|
|
316
|
-
</html>
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<!--
|
|
3
|
-
~ /* ------------------------------------------------------------------------------------
|
|
4
|
-
~ * Copyright (c) SAS Institute Inc.
|
|
5
|
-
~ * Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
~ * you may not use this file except in compliance with the License.
|
|
7
|
-
~ * You may obtain a copy of the License at
|
|
8
|
-
~ *
|
|
9
|
-
~ * http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
~ *
|
|
11
|
-
~ * Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
~ * distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
~ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
~ * See the License for the specific language governing permissions and
|
|
15
|
-
~ * limitations under the License.
|
|
16
|
-
~ ----------------------------------------------------------------------------------------*/
|
|
17
|
-
~
|
|
18
|
-
-->
|
|
19
|
-
|
|
20
|
-
<html lang="en">
|
|
21
|
-
|
|
22
|
-
<head>
|
|
23
|
-
<meta charset="UTF-8">
|
|
24
|
-
<script src="https://unpkg.com/@sassoftware/restaf@next"></script>
|
|
25
|
-
<script type="text/javascript" src="/appenv"></script>
|
|
26
|
-
|
|
27
|
-
<script>
|
|
28
|
-
function logonButton() {
|
|
29
|
-
debuggger;
|
|
30
|
-
let store = restaf.initStore();
|
|
31
|
-
store.logon(LOGONPAYLOAD)
|
|
32
|
-
.then ( r => {
|
|
33
|
-
console.log(r);
|
|
34
|
-
})
|
|
35
|
-
.catch( err => alert(JSON.stringify(err, null, 4)))
|
|
36
|
-
}
|
|
37
|
-
</script>
|
|
38
|
-
</head>
|
|
39
|
-
|
|
40
|
-
<body onload="logonButton()">
|
|
41
|
-
<p> In logon.html</p>
|
|
42
|
-
</script>
|
|
43
|
-
</body>
|
|
44
|
-
</html>
|
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<!--
|
|
3
|
-
~ /* ------------------------------------------------------------------------------------
|
|
4
|
-
~ * Copyright (c) SAS Institute Inc.
|
|
5
|
-
~ * Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
~ * you may not use this file except in compliance with the License.
|
|
7
|
-
~ * You may obtain a copy of the License at
|
|
8
|
-
~ *
|
|
9
|
-
~ * http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
~ *
|
|
11
|
-
~ * Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
~ * distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
~ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
~ * See the License for the specific language governing permissions and
|
|
15
|
-
~ * limitations under the License.
|
|
16
|
-
~ ----------------------------------------------------------------------------------------*/
|
|
17
|
-
~
|
|
18
|
-
-->
|
|
19
|
-
|
|
20
|
-
<html lang="en">
|
|
21
|
-
<head>
|
|
22
|
-
<meta charset="UTF-8" />
|
|
23
|
-
|
|
24
|
-
<script
|
|
25
|
-
crossorigin
|
|
26
|
-
src="https://unpkg.com/react@16/umd/react.production.min.js"
|
|
27
|
-
></script>
|
|
28
|
-
<script
|
|
29
|
-
crossorigin
|
|
30
|
-
src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"
|
|
31
|
-
></script>
|
|
32
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script>
|
|
33
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.26.0/polyfill.min.js"></script>
|
|
34
|
-
<script src="https://unpkg.com/@sassoftware/restaf@5.2.4/dist/restaf.js"></script>
|
|
35
|
-
<script src="https://unpkg.com/@sassoftware/restaflib@5.2.4/dist/restaflib.js"></script>
|
|
36
|
-
<!--script src="/appenv"></script>-->
|
|
37
|
-
|
|
38
|
-
<style>
|
|
39
|
-
.container {
|
|
40
|
-
display: flex;
|
|
41
|
-
flex-direction: column;
|
|
42
|
-
flex-wrap: nowrap;
|
|
43
|
-
min-height: 800px;
|
|
44
|
-
}
|
|
45
|
-
.elabel {
|
|
46
|
-
display: inline-block;
|
|
47
|
-
|
|
48
|
-
clear: left;
|
|
49
|
-
width: 250px;
|
|
50
|
-
text-align: right;
|
|
51
|
-
}
|
|
52
|
-
.einput {
|
|
53
|
-
display: inline-block;
|
|
54
|
-
}
|
|
55
|
-
.div1 {
|
|
56
|
-
border: 1px solid black;
|
|
57
|
-
background: lightskyblue;
|
|
58
|
-
}
|
|
59
|
-
.div2 {
|
|
60
|
-
border: 1px solid black;
|
|
61
|
-
background: lightskyblue;
|
|
62
|
-
height: 200px;
|
|
63
|
-
}
|
|
64
|
-
</style>
|
|
65
|
-
|
|
66
|
-
<script>
|
|
67
|
-
debugger;
|
|
68
|
-
let LOGONPAYLOAD= {
|
|
69
|
-
host: 'https://viya.kumar-zv1-azure-nginx-84560a6e.unx.sas.com',
|
|
70
|
-
authType: 'server'
|
|
71
|
-
}
|
|
72
|
-
let store = restaf.initStore({
|
|
73
|
-
casProxy: true});
|
|
74
|
-
debugger; console.log(store.config);
|
|
75
|
-
|
|
76
|
-
let session = null;
|
|
77
|
-
let servers = null;
|
|
78
|
-
let services = null;
|
|
79
|
-
let files = null;
|
|
80
|
-
let reports = null;
|
|
81
|
-
let compute = null;
|
|
82
|
-
|
|
83
|
-
function setup() {
|
|
84
|
-
debugger;
|
|
85
|
-
document.getElementById('output').innerHTML = '...initializing';
|
|
86
|
-
|
|
87
|
-
initSession()
|
|
88
|
-
.then(r => {
|
|
89
|
-
document.getElementById('output').innerHTML = 'ready';
|
|
90
|
-
keepAlive();
|
|
91
|
-
})
|
|
92
|
-
.catch(e => {
|
|
93
|
-
|
|
94
|
-
console.log(e);
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
function keepAlive() {
|
|
98
|
-
if (LOGONPAYLOAD.keepAlive != null) {
|
|
99
|
-
let interval = 120;
|
|
100
|
-
let timeout = 14400;
|
|
101
|
-
if (LOGONPAYLOAD.timers != null) {
|
|
102
|
-
let opts = LOGONPAYLOAD.timers.split(',');
|
|
103
|
-
interval = parseInt(opts[ 0 ]);
|
|
104
|
-
timeout = parseInt(opts[ 1 ]);
|
|
105
|
-
}
|
|
106
|
-
console.log(`Keepalive is active`);
|
|
107
|
-
store.keepViyaAlive(LOGONPAYLOAD.keepAlive, interval, timeout, () => {
|
|
108
|
-
console.log('timed out at', Date());
|
|
109
|
-
let params = `scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no,width=0,height=0,left=-1000,top=-1000`;
|
|
110
|
-
window.open(`${appOptions.logonPayload.host}/SASLogon/timedout`, 'Timed Out', params);
|
|
111
|
-
return true;
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
function logoff() {
|
|
117
|
-
let url = `${window.location.protocol}//${window.location.host}/${LOGONPAYLOAD.appName}/logout?callbackUrl=onlogoff.html`;
|
|
118
|
-
window.location.replace(url);
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
async function initSession() {
|
|
123
|
-
|
|
124
|
-
console.log(LOGONPAYLOAD);
|
|
125
|
-
debugger;
|
|
126
|
-
let msg = await store.logon(LOGONPAYLOAD);
|
|
127
|
-
console.log(msg);
|
|
128
|
-
|
|
129
|
-
// let { identities } = await store.addServices('identities');
|
|
130
|
-
let name = 'user';
|
|
131
|
-
// if (identities.links('currentUser') != null) {
|
|
132
|
-
// let c = await store.apiCall(identities.links('currentUser'));
|
|
133
|
-
// name = c.items('id');
|
|
134
|
-
// }
|
|
135
|
-
console.log(name);
|
|
136
|
-
debugger;
|
|
137
|
-
return 'done';
|
|
138
|
-
}
|
|
139
|
-
function runit(type) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
document.getElementById('output').innerHTML = '...running';
|
|
143
|
-
let testcase;
|
|
144
|
-
switch (type) {
|
|
145
|
-
case 'files': {
|
|
146
|
-
testcase = SASfileService;
|
|
147
|
-
break;
|
|
148
|
-
}
|
|
149
|
-
case 'compute': {
|
|
150
|
-
testcase = dsCompute;
|
|
151
|
-
break;
|
|
152
|
-
}
|
|
153
|
-
case 'cas': {
|
|
154
|
-
testcase = runCas;
|
|
155
|
-
break;
|
|
156
|
-
}
|
|
157
|
-
case 'timedout': {
|
|
158
|
-
testcase = timedout;
|
|
159
|
-
break;
|
|
160
|
-
}
|
|
161
|
-
case 'redir': {
|
|
162
|
-
testcase= noaction;
|
|
163
|
-
|
|
164
|
-
break;
|
|
165
|
-
}
|
|
166
|
-
case 'spre': {
|
|
167
|
-
testcase= spre;
|
|
168
|
-
|
|
169
|
-
break;
|
|
170
|
-
}
|
|
171
|
-
default: {
|
|
172
|
-
testcase = SASfileService;
|
|
173
|
-
break;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
testcase(store)
|
|
178
|
-
.then(r => {
|
|
179
|
-
document.getElementById(
|
|
180
|
-
'output'
|
|
181
|
-
).innerHTML = JSON.stringify(r, null, 4);
|
|
182
|
-
})
|
|
183
|
-
.catch(err => {
|
|
184
|
-
|
|
185
|
-
document.getElementById(
|
|
186
|
-
'output'
|
|
187
|
-
).innerHTML = JSON.stringify(err, null, 4);
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
async function noaction() {
|
|
191
|
-
r = {msg: 'redirects completed'};
|
|
192
|
-
return r;
|
|
193
|
-
}
|
|
194
|
-
async function spre(store) {
|
|
195
|
-
let p = {
|
|
196
|
-
method: 'GET',
|
|
197
|
-
url : 'http://localhost:3000/api/test',
|
|
198
|
-
withCredentials: true
|
|
199
|
-
}
|
|
200
|
-
let r = await store.request(p);
|
|
201
|
-
return r.data;
|
|
202
|
-
}
|
|
203
|
-
async function timedout(store) {
|
|
204
|
-
console.log('timed out at', Date() );
|
|
205
|
-
let params = `scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no,width=0,height=0,left=-1000,top=-1000`;
|
|
206
|
-
window.open(`${LOGONPAYLOAD.host}/SASLogon/timedout`,'Timed Out', params);
|
|
207
|
-
return true;
|
|
208
|
-
}
|
|
209
|
-
async function runCas(store) {
|
|
210
|
-
|
|
211
|
-
let {casManagement} = await store.addServices('casManagement');
|
|
212
|
-
let servers = await store.apiCall(
|
|
213
|
-
casManagement.links('servers')
|
|
214
|
-
);
|
|
215
|
-
let serverName = servers.itemsList(0);
|
|
216
|
-
let session = await store.apiCall(
|
|
217
|
-
servers.itemsCmd(serverName, 'createSession')
|
|
218
|
-
);
|
|
219
|
-
let payload = {
|
|
220
|
-
action: 'builtins.echo',
|
|
221
|
-
data: { code: { x: 1 } }
|
|
222
|
-
};
|
|
223
|
-
console.log(JSON.stringify(session.links("execute"), null, 4));
|
|
224
|
-
let r = await store.runAction(session, payload);
|
|
225
|
-
console.log('echo completed');
|
|
226
|
-
await store.apiCall(session.links('delete'));
|
|
227
|
-
return r.items();
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
async function SASfileService(store) {
|
|
231
|
-
debugger;
|
|
232
|
-
let content;
|
|
233
|
-
try {
|
|
234
|
-
debugger;
|
|
235
|
-
let {files} = await store.addServices('files');
|
|
236
|
-
debugger;
|
|
237
|
-
console.log(JSON.stringify(files.links(), null, 4));
|
|
238
|
-
//console.log('items - should be an array of files(empty array is ok)')
|
|
239
|
-
// console.log(files.items().toJS());
|
|
240
|
-
let payload = {
|
|
241
|
-
data: { x: 1, y: 'This was saved earlier in the step' },
|
|
242
|
-
headers: { 'content-type': 'application/json' }
|
|
243
|
-
};
|
|
244
|
-
let createCmd = files.links('create');
|
|
245
|
-
let newFile = await store.apiCall(createCmd, payload);
|
|
246
|
-
debugger;
|
|
247
|
-
console.log(JSON.stringify(newFile.links('content'), null, 4));
|
|
248
|
-
content = await store.apiCall(newFile.links('content'));
|
|
249
|
-
|
|
250
|
-
} catch(err) {
|
|
251
|
-
console.log(JSON.stringify(err, null, 4));
|
|
252
|
-
debugger;
|
|
253
|
-
}
|
|
254
|
-
console.log(content);
|
|
255
|
-
return content.items();
|
|
256
|
-
}
|
|
257
|
-
async function dsCompute(store) {
|
|
258
|
-
let log = null;
|
|
259
|
-
debugger;
|
|
260
|
-
let {compute} = await store.addServices('compute');
|
|
261
|
-
let servers = await store.apiCall(compute.links('servers'));
|
|
262
|
-
|
|
263
|
-
let contexts = await store.apiCall(compute.links('contexts'));
|
|
264
|
-
|
|
265
|
-
// lookup the name of the first context and then use it to get the associated createSession restafLink
|
|
266
|
-
let createSession = contexts.itemsCmd(
|
|
267
|
-
contexts.itemsList(0),
|
|
268
|
-
'createSession'
|
|
269
|
-
);
|
|
270
|
-
let session = await store.apiCall(createSession);
|
|
271
|
-
|
|
272
|
-
// Now run a simple data step in that session
|
|
273
|
-
let payload = {
|
|
274
|
-
data: {
|
|
275
|
-
code: [`data _null_; do i = 1 to 100; x=1; end; run; `]
|
|
276
|
-
}
|
|
277
|
-
};
|
|
278
|
-
|
|
279
|
-
// Now execute the data step and wait for completion
|
|
280
|
-
let job = await store.apiCall(
|
|
281
|
-
session.links('execute'),
|
|
282
|
-
payload
|
|
283
|
-
);
|
|
284
|
-
let status = await store.jobState(job, null, 5, 2);
|
|
285
|
-
|
|
286
|
-
if (status.data === 'running') {
|
|
287
|
-
throw `ERROR: Job did not complete in allotted time`;
|
|
288
|
-
} else {
|
|
289
|
-
switch (status.data) {
|
|
290
|
-
case 'warning':
|
|
291
|
-
console.log(`Warning: check your log for warnings`);
|
|
292
|
-
break;
|
|
293
|
-
case 'error':
|
|
294
|
-
throw `Please correct errors and rerun program`;
|
|
295
|
-
default:
|
|
296
|
-
log = await store.apiCall(status.job.links('log'));
|
|
297
|
-
break;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
return log === null ? status : log.items();
|
|
301
|
-
}
|
|
302
|
-
</script>
|
|
303
|
-
</head>
|
|
304
|
-
<body onload="setup()">
|
|
305
|
-
<h1 id="head">Hi</h1>
|
|
306
|
-
<div>
|
|
307
|
-
<button onclick="runit('redir')">
|
|
308
|
-
Press to do some redirs
|
|
309
|
-
</button>
|
|
310
|
-
<button onclick="runit('files')">
|
|
311
|
-
Press to make a call to file service
|
|
312
|
-
</button>
|
|
313
|
-
<br />
|
|
314
|
-
<br />
|
|
315
|
-
<button onclick="runit('compute')">
|
|
316
|
-
Press to make a call compute service
|
|
317
|
-
</button>
|
|
318
|
-
<br />
|
|
319
|
-
<br />
|
|
320
|
-
<button onclick="runit('cas')">
|
|
321
|
-
Press to make a call to cas echo
|
|
322
|
-
</button>
|
|
323
|
-
<br />
|
|
324
|
-
<br />
|
|
325
|
-
<button onclick="runit('spre')">
|
|
326
|
-
REST call
|
|
327
|
-
</button>
|
|
328
|
-
<br />
|
|
329
|
-
<br />
|
|
330
|
-
<input id='filename'> </input>
|
|
331
|
-
<button onclick="runit('timedout')">
|
|
332
|
-
Press to test timedout
|
|
333
|
-
</button>
|
|
334
|
-
<br />
|
|
335
|
-
<br />
|
|
336
|
-
<button onclick="logoff()">
|
|
337
|
-
logoff
|
|
338
|
-
</button>
|
|
339
|
-
<br />
|
|
340
|
-
</div>
|
|
341
|
-
<div>
|
|
342
|
-
<pre id="output"></pre>
|
|
343
|
-
</div>
|
|
344
|
-
</body>
|
|
345
|
-
</html>
|