@sassoftware/viya-serverjs 0.1.1 → 0.2.0
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/.babelrc +6 -0
- package/.dockerignore +2 -0
- package/.env +29 -0
- package/.env.proxy +31 -0
- package/.env.server +29 -0
- package/.eslintignore +4 -0
- package/.eslintrc.json +42 -0
- package/Dockerfile +44 -0
- package/README.md +6 -4
- package/cli.js +9 -0
- package/images/viya-apiserverjs.png +0 -0
- package/lib/{core/config.js → config.js} +5 -24
- package/lib/handlers/appCallback.js +62 -0
- package/lib/handlers/codeAuth.js +61 -0
- package/lib/{core/handlers → handlers}/decodeJwt.js +2 -2
- package/lib/handlers/favicon.js +45 -0
- package/lib/handlers/getApp.js +77 -0
- package/lib/handlers/getApp2.js +48 -0
- package/lib/handlers/getUser.js +49 -0
- package/lib/{core/handlers → handlers}/index.js +2 -2
- package/lib/handlers/keepAlive.js +99 -0
- package/lib/handlers/keepAlive2.js +33 -0
- package/lib/handlers/logon.js +44 -0
- package/lib/handlers/logout.js +88 -0
- package/lib/handlers/proxyMapUri.js +78 -0
- package/lib/handlers/proxyOnResponse.js +26 -0
- package/lib/handlers/reactDev.js +52 -0
- package/lib/handlers/setCookies.js +110 -0
- package/lib/{core/iService.js → iService.js} +45 -30
- package/lib/index.js +177 -10
- package/lib/{core/parseDocker.js → parseDocker.js} +1 -1
- package/lib/plugins/SASauth.js +101 -0
- package/lib/plugins/appCookie.js +99 -0
- package/lib/plugins/setContext.js +56 -0
- package/lib/{core/plugins → plugins}/setDefaultRoutes.js +67 -58
- package/lib/plugins/setupAuth.js +87 -0
- package/lib/{core/plugins → plugins}/setupUserRoutes.js +21 -12
- package/lib/plugins/token.js +31 -0
- package/lib/schemes/SASTokenScheme.js +71 -0
- package/package.json +54 -10
- package/packages/core/config.js +86 -0
- package/packages/core/handlers/appCallback.js +40 -0
- package/packages/core/handlers/codeAuth.js +31 -0
- package/packages/core/handlers/decodeJwt.js +11 -0
- package/packages/core/handlers/favicon.js +24 -0
- package/packages/core/handlers/getApp.js +41 -0
- package/packages/core/handlers/getApp2.js +26 -0
- package/packages/core/handlers/getUser.js +20 -0
- package/packages/core/handlers/index.js +36 -0
- package/packages/core/handlers/keepAlive.js +54 -0
- package/packages/core/handlers/keepAlive2.js +13 -0
- package/packages/core/handlers/logon.js +24 -0
- package/packages/core/handlers/logout.js +43 -0
- package/{lib → packages}/core/handlers/proxyMapUri.js +25 -36
- package/packages/core/handlers/proxyOnResponse.js +12 -0
- package/packages/core/handlers/reactDev.js +30 -0
- package/packages/core/handlers/setCookies.js +78 -0
- package/packages/core/iService.js +369 -0
- package/packages/core/index.js +249 -0
- package/packages/core/parseDocker.js +33 -0
- package/packages/core/plugins/SASauth.js +79 -0
- package/packages/core/plugins/appCookie.js +49 -0
- package/packages/core/plugins/setContext.js +34 -0
- package/packages/core/plugins/setDefaultRoutes.js +262 -0
- package/packages/core/plugins/setupAuth.js +48 -0
- package/packages/core/plugins/setupUserRoutes.js +48 -0
- package/packages/core/plugins/token.js +10 -0
- package/packages/core/schemes/SASTokenScheme.js +43 -0
- package/packages/core/visionIndex.html +24 -0
- package/packages/examples/apitest/.env +11 -0
- package/packages/examples/apitest/.eslintrc.json +42 -0
- package/packages/examples/apitest/Dockerfile +41 -0
- package/packages/examples/apitest/api.js +88 -0
- package/packages/examples/apitest/appenv.js +6 -0
- package/packages/examples/apitest/docker-compose.yml +10 -0
- package/packages/examples/apitest/package.json +19 -0
- package/packages/examples/apitest/public/data/Cluster_SDOH1.sas +182 -0
- package/packages/examples/apitest/public/data/Cluster_SDOH6.sas +180 -0
- package/packages/examples/apitest/public/data/LeNet_snzrle.astore +0 -0
- package/packages/examples/apitest/public/data/NeuralNetwork_High_med.sas +2409 -0
- package/packages/examples/apitest/public/data/NeuralNetwork_high_med1.sas +2409 -0
- 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 +429 -0
- package/packages/examples/apitest/public/data/cluster_test2.sas7bdat +0 -0
- package/packages/examples/apitest/public/data/cmdList.txt +15 -0
- package/packages/examples/apitest/public/data/gradBoost.sashdat +0 -0
- package/packages/examples/apitest/public/data/iris.csv +151 -0
- 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 +316 -0
- package/packages/examples/apitest/public/index2.html +102 -0
- package/packages/examples/apitest/public/logon.html +42 -0
- package/packages/examples/apitest/public/myapp/secondary.html +1 -0
- package/packages/examples/apitest/public/myapp/test.js +2 -0
- package/packages/examples/apitest/public/onlogoff.html +53 -0
- package/packages/examples/apitest/start.sh +15 -0
- package/packages/examples/app/.env +32 -0
- package/packages/examples/app/.envProxy +19 -0
- package/packages/examples/app/.envimpl +12 -0
- package/packages/examples/app/.eslintrc.json +42 -0
- package/packages/examples/app/Dockerfile +42 -0
- package/packages/examples/app/appenv.js +6 -0
- package/packages/examples/app/certs/ca.crt +19 -0
- package/packages/examples/app/certs/tls.crt +25 -0
- package/packages/examples/app/certs/tls.key +28 -0
- package/packages/examples/app/certs/tls.sh +5 -0
- package/packages/examples/app/docker-compose.yml +12 -0
- package/packages/examples/app/index.js +15 -0
- package/packages/examples/app/package.json +20 -0
- package/packages/examples/app/public/casread.html +324 -0
- package/packages/examples/app/public/data/Cluster_SDOH1.sas +182 -0
- package/packages/examples/app/public/data/Cluster_SDOH6.sas +180 -0
- package/packages/examples/app/public/data/LeNet_snzrle.astore +0 -0
- package/packages/examples/app/public/data/NeuralNetwork_High_med.sas +2409 -0
- package/packages/examples/app/public/data/NeuralNetwork_high_med1.sas +2409 -0
- 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 +429 -0
- package/packages/examples/app/public/data/cluster_test2.sas7bdat +0 -0
- package/packages/examples/app/public/data/cmdList.txt +15 -0
- package/packages/examples/app/public/data/gradBoost.sashdat +0 -0
- package/packages/examples/app/public/data/iris.csv +151 -0
- 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 +332 -0
- package/packages/examples/app/public/indexProxy.html +346 -0
- package/packages/examples/app/public/indextest.html +316 -0
- package/packages/examples/app/public/logon.html +44 -0
- package/packages/examples/app/public/micburger.html +345 -0
- package/packages/examples/app/public/micburger.txt.html +311 -0
- package/packages/examples/app/public/myapp/secondary.html +1 -0
- package/packages/examples/app/public/myapp/test.js +2 -0
- package/packages/examples/app/public/sara.txt +345 -0
- package/packages/examples/app/public/testva2.html +311 -0
- package/packages/examples/app/startup.sh +15 -0
- package/packages/examples/appdocker/.env +21 -0
- package/packages/examples/appdocker/.envProxy +22 -0
- package/packages/examples/appdocker/.envimpl +12 -0
- package/packages/examples/appdocker/.eslintrc.json +42 -0
- package/packages/examples/appdocker/Dockerfile +43 -0
- package/packages/examples/appdocker/appenv.js +6 -0
- package/packages/examples/appdocker/certs/ca.crt +19 -0
- package/packages/examples/appdocker/certs/tls.crt +25 -0
- package/packages/examples/appdocker/certs/tls.key +28 -0
- package/packages/examples/appdocker/certs/tls.sh +5 -0
- package/packages/examples/appdocker/docker-compose.yml +12 -0
- package/packages/examples/appdocker/index.js +15 -0
- package/packages/examples/appdocker/package.json +20 -0
- package/packages/examples/appdocker/public/data/Cluster_SDOH1.sas +182 -0
- package/packages/examples/appdocker/public/data/Cluster_SDOH6.sas +180 -0
- package/packages/examples/appdocker/public/data/LeNet_snzrle.astore +0 -0
- package/packages/examples/appdocker/public/data/NeuralNetwork_High_med.sas +2409 -0
- package/packages/examples/appdocker/public/data/NeuralNetwork_high_med1.sas +2409 -0
- 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 +429 -0
- package/packages/examples/appdocker/public/data/cluster_test2.sas7bdat +0 -0
- package/packages/examples/appdocker/public/data/cmdList.txt +15 -0
- package/packages/examples/appdocker/public/data/gradBoost.sashdat +0 -0
- package/packages/examples/appdocker/public/data/iris.csv +151 -0
- 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 +346 -0
- package/packages/examples/appdocker/public/indexProxy.html +346 -0
- package/packages/examples/appdocker/public/indextest.html +316 -0
- package/packages/examples/appdocker/public/logon.html +44 -0
- package/packages/examples/appdocker/public/myapp/secondary.html +1 -0
- package/packages/examples/appdocker/public/myapp/test.js +2 -0
- package/packages/examples/appdocker/startup.sh +15 -0
- package/packages/examples/apptest/.env +28 -0
- package/packages/examples/apptest/.envProxy +22 -0
- package/packages/examples/apptest/.envimpl +12 -0
- package/packages/examples/apptest/.eslintrc.json +42 -0
- package/packages/examples/apptest/Dockerfile +44 -0
- package/packages/examples/apptest/appDir/app1/design.html +350 -0
- package/packages/examples/apptest/appDir/app1/index.html +353 -0
- package/packages/examples/apptest/appDir/index.html +350 -0
- package/packages/examples/apptest/appenv.js +6 -0
- package/packages/examples/apptest/docker-compose.yml +12 -0
- package/packages/examples/apptest/index.js +444 -0
- package/packages/examples/apptest/package.json +24 -0
- package/packages/examples/apptest/public/casread2.html +321 -0
- package/packages/examples/apptest/public/data/Cluster_SDOH1.sas +182 -0
- package/packages/examples/apptest/public/data/Cluster_SDOH6.sas +180 -0
- package/packages/examples/apptest/public/data/LeNet_snzrle.astore +0 -0
- package/packages/examples/apptest/public/data/NeuralNetwork_High_med.sas +2409 -0
- package/packages/examples/apptest/public/data/NeuralNetwork_high_med1.sas +2409 -0
- 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 +429 -0
- package/packages/examples/apptest/public/data/cluster_test2.sas7bdat +0 -0
- package/packages/examples/apptest/public/data/cmdList.txt +15 -0
- package/packages/examples/apptest/public/data/gradBoost.sashdat +0 -0
- package/packages/examples/apptest/public/data/iris.csv +151 -0
- package/packages/examples/apptest/public/data/model1.sas7bdat +0 -0
- package/packages/examples/apptest/public/design.html +349 -0
- package/packages/examples/apptest/public/favicon.ico +0 -0
- package/packages/examples/apptest/public/help.html +1 -0
- package/packages/examples/apptest/public/index.html +353 -0
- package/packages/examples/apptest/public/index2.html +353 -0
- package/packages/examples/apptest/public/indexProxy.html +346 -0
- package/packages/examples/apptest/public/indextest.html +316 -0
- package/packages/examples/apptest/public/logon.html +44 -0
- package/packages/examples/apptest/public/myapp/q.html +349 -0
- package/packages/examples/apptest/public/myapp/secondary.html +1 -0
- package/packages/examples/apptest/public/myapp/test.js +2 -0
- package/packages/examples/apptest/public/push1.html +187 -0
- package/packages/examples/apptest/startup.sh +15 -0
- package/packages/examples/apptesti/.env +13 -0
- package/packages/examples/apptesti/.eslintrc.json +42 -0
- package/packages/examples/apptesti/Dockerfile +42 -0
- package/packages/examples/apptesti/appenv.js +6 -0
- package/packages/examples/apptesti/certs/ca.crt +19 -0
- package/packages/examples/apptesti/certs/tls.crt +25 -0
- package/packages/examples/apptesti/certs/tls.key +28 -0
- package/packages/examples/apptesti/certs/tls.sh +5 -0
- package/packages/examples/apptesti/docker-compose.yml +12 -0
- package/{lib/cli.js → packages/examples/apptesti/index.js} +4 -5
- package/packages/examples/apptesti/package.json +20 -0
- package/packages/examples/apptesti/public/data/Cluster_SDOH1.sas +182 -0
- package/packages/examples/apptesti/public/data/Cluster_SDOH6.sas +180 -0
- package/packages/examples/apptesti/public/data/LeNet_snzrle.astore +0 -0
- package/packages/examples/apptesti/public/data/NeuralNetwork_High_med.sas +2409 -0
- package/packages/examples/apptesti/public/data/NeuralNetwork_high_med1.sas +2409 -0
- 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 +429 -0
- package/packages/examples/apptesti/public/data/cluster_test2.sas7bdat +0 -0
- package/packages/examples/apptesti/public/data/cmdList.txt +15 -0
- package/packages/examples/apptesti/public/data/gradBoost.sashdat +0 -0
- package/packages/examples/apptesti/public/data/iris.csv +151 -0
- 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 +346 -0
- package/packages/examples/apptesti/public/indexProxy.html +346 -0
- package/packages/examples/apptesti/public/indextest.html +316 -0
- package/packages/examples/apptesti/public/logon.html +44 -0
- package/packages/examples/apptesti/public/main.html +346 -0
- package/packages/examples/apptesti/public/myapp/secondary.html +1 -0
- package/packages/examples/apptesti/public/myapp/test.js +2 -0
- package/packages/examples/apptesti/startup.sh +15 -0
- package/packages/examples/basic/.env +10 -0
- package/packages/examples/basic/.eslintrc.json +42 -0
- package/packages/examples/basic/Dockerfile +41 -0
- package/packages/examples/basic/api.js +88 -0
- package/packages/examples/basic/appenv.js +6 -0
- package/packages/examples/basic/docker-compose.yml +10 -0
- package/packages/examples/basic/package.json +19 -0
- package/packages/examples/basic/public/data/Cluster_SDOH1.sas +182 -0
- package/packages/examples/basic/public/data/Cluster_SDOH6.sas +180 -0
- package/packages/examples/basic/public/data/LeNet_snzrle.astore +0 -0
- package/packages/examples/basic/public/data/NeuralNetwork_High_med.sas +2409 -0
- package/packages/examples/basic/public/data/NeuralNetwork_high_med1.sas +2409 -0
- 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 +429 -0
- package/packages/examples/basic/public/data/cluster_test2.sas7bdat +0 -0
- package/packages/examples/basic/public/data/cmdList.txt +15 -0
- package/packages/examples/basic/public/data/gradBoost.sashdat +0 -0
- package/packages/examples/basic/public/data/iris.csv +151 -0
- 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 +29 -0
- package/packages/examples/basic/public/index2.html +102 -0
- package/packages/examples/basic/public/logon.html +42 -0
- package/packages/examples/basic/public/myapp/secondary.html +1 -0
- package/packages/examples/basic/public/myapp/test.js +2 -0
- package/packages/examples/basic/public/onlogoff.html +53 -0
- package/packages/examples/basic/start.sh +15 -0
- package/packages/examples/proxytest/.env +23 -0
- package/packages/examples/proxytest/.envimpl +11 -0
- package/packages/examples/proxytest/.eslintrc.json +42 -0
- package/packages/examples/proxytest/Dockerfile +42 -0
- package/packages/examples/proxytest/appenv.js +6 -0
- package/packages/examples/proxytest/docker-compose.yml +12 -0
- package/packages/examples/proxytest/index.js +57 -0
- package/packages/examples/proxytest/package.json +18 -0
- package/packages/examples/proxytest/public/data/Cluster_SDOH1.sas +182 -0
- package/packages/examples/proxytest/public/data/Cluster_SDOH6.sas +180 -0
- package/packages/examples/proxytest/public/data/LeNet_snzrle.astore +0 -0
- package/packages/examples/proxytest/public/data/NeuralNetwork_High_med.sas +2409 -0
- package/packages/examples/proxytest/public/data/NeuralNetwork_high_med1.sas +2409 -0
- 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 +429 -0
- package/packages/examples/proxytest/public/data/cluster_test2.sas7bdat +0 -0
- package/packages/examples/proxytest/public/data/cmdList.txt +15 -0
- package/packages/examples/proxytest/public/data/gradBoost.sashdat +0 -0
- package/packages/examples/proxytest/public/data/iris.csv +151 -0
- 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 +357 -0
- package/packages/examples/proxytest/public/index.js +57 -0
- package/packages/examples/proxytest/public/indextest.html +316 -0
- package/packages/examples/proxytest/public/logon.html +44 -0
- package/packages/examples/proxytest/public/main.html +357 -0
- package/packages/examples/proxytest/public/myapp/secondary.html +1 -0
- package/packages/examples/proxytest/public/myapp/test.js +2 -0
- package/packages/examples/proxytest/public/restaf.js +2461 -0
- package/packages/examples/proxytest/public/restaf.min.js +11 -0
- package/packages/examples/proxytest/public/sas/iris.txt +10 -0
- package/packages/examples/proxytest/startup.sh +15 -0
- package/public/casread2.html +321 -0
- package/public/data/Cluster_SDOH1.sas +182 -0
- package/public/data/Cluster_SDOH6.sas +180 -0
- package/public/data/LeNet_snzrle.astore +0 -0
- package/public/data/NeuralNetwork_High_med.sas +2409 -0
- package/public/data/NeuralNetwork_high_med1.sas +2409 -0
- package/public/data/ast/GBlocalcopy.sasast +0 -0
- package/public/data/ast/LeNet_snzrle.astore +0 -0
- package/public/data/ast/gb_IrisGB.sasast +0 -0
- package/public/data/ast/paysimsvdd.sasast +0 -0
- package/public/data/ast/svmlocalcopy.sasast +0 -0
- package/public/data/cars.csv +429 -0
- package/public/data/cluster_test2.sas7bdat +0 -0
- package/public/data/cmdList.txt +15 -0
- package/public/data/gradBoost.sashdat +0 -0
- package/public/data/iris.csv +151 -0
- package/public/data/model1.sas7bdat +0 -0
- package/public/design.html +350 -0
- package/public/display.html +354 -0
- package/public/favicon.ico +0 -0
- package/public/help.html +1 -0
- package/public/index.html +354 -0
- package/public/index2.html +353 -0
- package/public/indexProxy.html +350 -0
- package/public/indextest.html +316 -0
- package/public/logon.html +44 -0
- package/public/myapp/q.html +349 -0
- package/public/myapp/secondary.html +1 -0
- package/public/myapp/test.js +2 -0
- package/public/push1.html +187 -0
- package/server.js +444 -0
- package/src/config.js +90 -0
- package/src/handlers/appCallback.js +40 -0
- package/src/handlers/codeAuth.js +31 -0
- package/src/handlers/decodeJwt.js +11 -0
- package/src/handlers/favicon.js +24 -0
- package/src/handlers/getApp.js +52 -0
- package/src/handlers/getApp2.js +26 -0
- package/src/handlers/getUser.js +20 -0
- package/src/handlers/index.js +36 -0
- package/src/handlers/keepAlive.js +54 -0
- package/src/handlers/keepAlive2.js +13 -0
- package/src/handlers/logon.js +24 -0
- package/src/handlers/logout.js +43 -0
- package/src/handlers/proxyMapUri.js +56 -0
- package/src/handlers/proxyOnResponse.js +12 -0
- package/src/handlers/reactDev.js +30 -0
- package/src/handlers/setCookies.js +76 -0
- package/src/iService.js +369 -0
- package/src/index.js +243 -0
- package/src/parseDocker.js +32 -0
- package/src/plugins/SASauth.js +79 -0
- package/src/plugins/appCookie.js +49 -0
- package/src/plugins/setContext.js +34 -0
- package/src/plugins/setDefaultRoutes.js +262 -0
- package/src/plugins/setupAuth.js +48 -0
- package/src/plugins/setupUserRoutes.js +48 -0
- package/src/plugins/token.js +10 -0
- package/src/schemes/SASTokenScheme.js +43 -0
- package/src/visionIndex.html +24 -0
- package/start.sh +15 -0
- package/lib/core/handlers/appCallback.js +0 -51
- package/lib/core/handlers/codeAuth.js +0 -61
- package/lib/core/handlers/favicon.js +0 -45
- package/lib/core/handlers/getApp.js +0 -67
- package/lib/core/handlers/getApp2.js +0 -48
- package/lib/core/handlers/getUser.js +0 -49
- package/lib/core/handlers/keepAlive.js +0 -96
- package/lib/core/handlers/keepAlive2.js +0 -33
- package/lib/core/handlers/logon.js +0 -44
- package/lib/core/handlers/logout.js +0 -88
- package/lib/core/handlers/proxyOnResponse.js +0 -26
- package/lib/core/handlers/reactDev.js +0 -52
- package/lib/core/handlers/setCookies.js +0 -116
- package/lib/core/index.js +0 -195
- package/lib/core/plugins/SASauth.js +0 -100
- package/lib/core/plugins/appCookie.js +0 -98
- package/lib/core/plugins/setContext.js +0 -55
- package/lib/core/plugins/setupAuth.js +0 -86
- package/lib/core/plugins/token.js +0 -31
- package/lib/core/schemes/SASTokenScheme.js +0 -71
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script>
|
|
24
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.26.0/polyfill.min.js"></script>
|
|
25
|
+
|
|
26
|
+
<script type="text/plain" src="sas/iris.txt"></script>
|
|
27
|
+
</html>head>
|
|
28
|
+
<script>
|
|
29
|
+
|
|
@@ -0,0 +1,102 @@
|
|
|
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/dist/restaf.js"></script>
|
|
35
|
+
<script src="https://unpkg.com/@sassoftware/restaflib/dist/restaflib.js"></script>
|
|
36
|
+
<script src="/viyaapp/appenv"></script>
|
|
37
|
+
<script src="/viyaapp/user"></script>
|
|
38
|
+
<script async src="https://unpkg.com/@sassoftware/va-report-components/dist/umd/va-report-components.js"></script>
|
|
39
|
+
<style>
|
|
40
|
+
.container {
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
flex-wrap: nowrap;
|
|
44
|
+
min-height: 800px;
|
|
45
|
+
}
|
|
46
|
+
.elabel {
|
|
47
|
+
display: inline-block;
|
|
48
|
+
|
|
49
|
+
clear: left;
|
|
50
|
+
width: 250px;
|
|
51
|
+
text-align: right;
|
|
52
|
+
}
|
|
53
|
+
.einput {
|
|
54
|
+
display: inline-block;
|
|
55
|
+
}
|
|
56
|
+
.div1 {
|
|
57
|
+
border: 1px solid black;
|
|
58
|
+
background: lightskyblue;
|
|
59
|
+
}
|
|
60
|
+
.div2 {
|
|
61
|
+
border: 1px solid black;
|
|
62
|
+
background: lightskyblue;
|
|
63
|
+
height: 200px;
|
|
64
|
+
}
|
|
65
|
+
</style>
|
|
66
|
+
|
|
67
|
+
<script>
|
|
68
|
+
let store = restaf.initStore();
|
|
69
|
+
function setup () {
|
|
70
|
+
}
|
|
71
|
+
function runApi(route) {
|
|
72
|
+
let config = {
|
|
73
|
+
url: `${window.location.protocol}//${window.location.host}/${route}`,
|
|
74
|
+
withCredentials: true
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
store.request(config)
|
|
78
|
+
.then ( r => {
|
|
79
|
+
|
|
80
|
+
document.getElementById('output').innerHTML = r.data;
|
|
81
|
+
})
|
|
82
|
+
.catch( err => alert(err));
|
|
83
|
+
}
|
|
84
|
+
</script>
|
|
85
|
+
</head>
|
|
86
|
+
<body onload="setup()">
|
|
87
|
+
<h1 id="head">Hi</h1>
|
|
88
|
+
<div>
|
|
89
|
+
<button onclick="runApi('runSpre')">
|
|
90
|
+
Press to run runSpre
|
|
91
|
+
</button>
|
|
92
|
+
<br />
|
|
93
|
+
<br />
|
|
94
|
+
<button onclick="runApi('runCas')">
|
|
95
|
+
Press to make a call to /runCas
|
|
96
|
+
</button>
|
|
97
|
+
</div>
|
|
98
|
+
<div>
|
|
99
|
+
<pre id="output"></pre>
|
|
100
|
+
</div>
|
|
101
|
+
</body>
|
|
102
|
+
</html>
|
|
@@ -0,0 +1,42 @@
|
|
|
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/restaf/dist/restaf.min.js"></script>
|
|
25
|
+
<script type="text/javascript" src="/appenv"></script>
|
|
26
|
+
|
|
27
|
+
<script>
|
|
28
|
+
function logonButton() {
|
|
29
|
+
let store = restaf.initStore();
|
|
30
|
+
store.logon(LOGONPAYLOAD)
|
|
31
|
+
.then ( r => {
|
|
32
|
+
console.log(r);
|
|
33
|
+
})
|
|
34
|
+
.catch( err => alert(JSON.stringify(err, null, 4)))
|
|
35
|
+
}
|
|
36
|
+
</script>
|
|
37
|
+
</head>
|
|
38
|
+
|
|
39
|
+
<body onload="logonButton()">
|
|
40
|
+
</script>
|
|
41
|
+
</body>
|
|
42
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<h1> Alternate entry point </h1>
|
|
@@ -0,0 +1,53 @@
|
|
|
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@rc1/dist/restaf.js"></script>
|
|
35
|
+
<script src="https://unpkg.com/@sassoftware/restaflib@rc1/dist/restaflib.min.js"></script>
|
|
36
|
+
<script src="/appenv"></script>
|
|
37
|
+
|
|
38
|
+
</head>
|
|
39
|
+
<script>
|
|
40
|
+
|
|
41
|
+
function startapp() {
|
|
42
|
+
// window.location.replace(`${window.location.protocol}//${window.location.host}/${LOGONPAYLOAD.appName}`);
|
|
43
|
+
let url = `${window.location.protocol}//${window.location.host}/${LOGONPAYLOAD.appName}`
|
|
44
|
+
window.location.replace(url);
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
</script>
|
|
48
|
+
<body>
|
|
49
|
+
<h1 id="head">What is next?</h1>
|
|
50
|
+
<button onclick="startapp()">Logon</button>
|
|
51
|
+
|
|
52
|
+
</body>
|
|
53
|
+
</html>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Azure wants to prefix the app env
|
|
3
|
+
# Use this to set the env that this server expects
|
|
4
|
+
|
|
5
|
+
# https://docs.microsoft.com/en-us/azure/app-service/reference-app-settings?tabs=kudu%2Cdotnet
|
|
6
|
+
env | grep APPSETTING_
|
|
7
|
+
|
|
8
|
+
if [[ ! -z "$APPSETTING_VIYA_SERVER" ]];
|
|
9
|
+
then
|
|
10
|
+
export VIYA_SERVER=$APPSETTING_VIYA_SERVER
|
|
11
|
+
echo VIYA SERVER= $VIYA_SERVER
|
|
12
|
+
else
|
|
13
|
+
echo "No custom application overrides"
|
|
14
|
+
fi
|
|
15
|
+
npm run indocker
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
APPHOST=localhost
|
|
2
|
+
APPENTRY=index.html
|
|
3
|
+
VIYA_SERVER=
|
|
4
|
+
APPPORT=8080
|
|
5
|
+
APPNAME=viyaapp
|
|
6
|
+
AUTHFLOW=code
|
|
7
|
+
CLIENTID=clientapp
|
|
8
|
+
CLIENTSECRET=secret
|
|
9
|
+
REDIRECT=
|
|
10
|
+
USETOKEN=YES
|
|
11
|
+
PROXYSERVER=https://viya.kumar-zv1-azure-nginx-84560a6e.unx.sas.com
|
|
12
|
+
|
|
13
|
+
APPENV_PROXYSERVER=https://localhost:8080/viyaapp/proxy
|
|
14
|
+
APPENV_XYZ=AA
|
|
15
|
+
|
|
16
|
+
# APPENV_PUPID=NSHOST=https://sas-logon-app.viya.svc.cluster.local
|
|
17
|
+
|
|
18
|
+
# NAMESPACE=viya
|
|
19
|
+
# TLS_CERT=./certs/tls.crt
|
|
20
|
+
# TLS_KEY=./certs/tls.key
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"root": true,
|
|
3
|
+
"env": {
|
|
4
|
+
"browser": true,
|
|
5
|
+
"node": true,
|
|
6
|
+
"es6": true
|
|
7
|
+
},
|
|
8
|
+
"parser": "@babel/eslint-parser",
|
|
9
|
+
"extends": ["eslint:recommended", "prettier"],
|
|
10
|
+
"parserOptions": {
|
|
11
|
+
"requireConfigFile": false,
|
|
12
|
+
"babelOptions": {"configFile": "./.babelrc"},
|
|
13
|
+
"ecmaVersion": 6,
|
|
14
|
+
"sourceType": "module",
|
|
15
|
+
"ecmaFeatures": {
|
|
16
|
+
"jsx": true
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"rules": {
|
|
20
|
+
"key-spacing": [
|
|
21
|
+
2,
|
|
22
|
+
{
|
|
23
|
+
"align": "colon"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"jsx-quotes": [2, "prefer-double"],
|
|
27
|
+
"no-console": 0,
|
|
28
|
+
"no-unused-vars": [
|
|
29
|
+
1,
|
|
30
|
+
{
|
|
31
|
+
"args": "none"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"no-debugger": 0,
|
|
35
|
+
"react/prop-types": 0,
|
|
36
|
+
"array-bracket-spacing": [2, "never"],
|
|
37
|
+
"space-in-parens": [2, "never"],
|
|
38
|
+
"space-before-function-paren": [2, "always"],
|
|
39
|
+
"semi": [2, "always"],
|
|
40
|
+
"no-prototype-builtins": 0
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
FROM node:12.16.1-alpine
|
|
2
|
+
LABEL maintainer="deva.kumar@sas.com"
|
|
3
|
+
WORKDIR /usr/src/app
|
|
4
|
+
COPY . .
|
|
5
|
+
# COPY package*.json ./
|
|
6
|
+
RUN npm install
|
|
7
|
+
# RUN npm run build
|
|
8
|
+
|
|
9
|
+
# will auto change to localhost in non-docker environments
|
|
10
|
+
ENV APPHOST=0.0.0.0
|
|
11
|
+
ENV PORT=8080
|
|
12
|
+
EXPOSE $PORT
|
|
13
|
+
#######################################################################
|
|
14
|
+
# You can override these(but in container leave APPHOST as shown below)
|
|
15
|
+
########################################################################
|
|
16
|
+
|
|
17
|
+
# set this the same as EXPOSE here and override in env or as -p option in dockerrun
|
|
18
|
+
# ENV APPPORT=8080
|
|
19
|
+
|
|
20
|
+
ENV APPNAME=viyaapp
|
|
21
|
+
# ENV AUTHFLOW=code
|
|
22
|
+
# ENV CLIENTID=clientapp
|
|
23
|
+
# ENV CLIENTSECRET=secret
|
|
24
|
+
# ENV HAPIDEBUG=YES
|
|
25
|
+
# ENV LOGLEVEL=info
|
|
26
|
+
# ENV USETOKEN=YES
|
|
27
|
+
|
|
28
|
+
#sample setup for creating a temporary cert and key
|
|
29
|
+
ENV TLS_CREATE="C:US,ST:NC,L:Cary,O:SAS Institute,OU:STO,CN:localhost"
|
|
30
|
+
|
|
31
|
+
# You can specify your own cet and key
|
|
32
|
+
# ENV TLS_CERT=../../../certs/cert64.cer
|
|
33
|
+
# ENV TLS_KEY=../../../certs/pubkey64.pem
|
|
34
|
+
|
|
35
|
+
# Samesite specification
|
|
36
|
+
ENV SAMESITE=None,secure
|
|
37
|
+
|
|
38
|
+
# If your Viya instance still has a unsigned certificate set this value prior to invoking the server
|
|
39
|
+
ENV NODE_TLS_REJECT_UNAUTHORIZED=0
|
|
40
|
+
|
|
41
|
+
#####################################################################
|
|
42
|
+
CMD ["npm", "run", "indocker"]
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
const rafServer = require('@sassoftware/viya-appserverjs');
|
|
6
|
+
debugger;
|
|
7
|
+
rafServer.icli(null, getCustomHandlers, null);
|
|
8
|
+
|
|
9
|
+
function getCustomHandlers () {
|
|
10
|
+
let appName = `/${process.env.APPNAME}`; /* does not have to be this - your choice */
|
|
11
|
+
let routes = [
|
|
12
|
+
{
|
|
13
|
+
method : ['GET'],
|
|
14
|
+
path : `${appName}/testproxy/{*params}`,
|
|
15
|
+
options: {
|
|
16
|
+
handler: async (req,h) => {
|
|
17
|
+
debugger;
|
|
18
|
+
console.log('++++++++++++++++++++++ in testroute');
|
|
19
|
+
let context = req.pre.context;
|
|
20
|
+
return context;
|
|
21
|
+
},
|
|
22
|
+
description: 'Test get Route',
|
|
23
|
+
notes : 'Echo context',
|
|
24
|
+
tags : ['api']
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
method : ['POST'],
|
|
29
|
+
path : `${appName}/testproxy/{*params}`,
|
|
30
|
+
options: {
|
|
31
|
+
handler: async (req,h) => {
|
|
32
|
+
debugger;
|
|
33
|
+
console.log('++++++++++++++++++++++ in post');
|
|
34
|
+
let context = req.pre.context;
|
|
35
|
+
return context;
|
|
36
|
+
},
|
|
37
|
+
description: 'Create a dataset with specified nummber of columns and rows',
|
|
38
|
+
notes : 'Uses restaf',
|
|
39
|
+
tags : ['api'],
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
];
|
|
43
|
+
return routes;
|
|
44
|
+
}
|
|
45
|
+
// eslint-disable-next-line no-unused-vars
|
|
46
|
+
function customize (key, _options){
|
|
47
|
+
debugger;
|
|
48
|
+
let info = {
|
|
49
|
+
SWAGGEROPTIONS: {},
|
|
50
|
+
APPENV : null
|
|
51
|
+
};
|
|
52
|
+
return info[key];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "apptest",
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "app.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"start": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 node index.js --env=./.env --docker=./Dockerfile",
|
|
8
|
+
"starti": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 node index.js --env=./.envimpl --docker=./Dockerfile",
|
|
9
|
+
"debug": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 node --inspect-brk index.js --env=./.env --docker=./Dockerfile",
|
|
10
|
+
"indocker": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 node index.js"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [],
|
|
13
|
+
"author": "",
|
|
14
|
+
"license": "ISC",
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"cross-env": ">=7.0.0"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/*--------------------------------------------------
|
|
2
|
+
The options statement below should be placed
|
|
3
|
+
before the data step when submitting this code.
|
|
4
|
+
--------------------------------------------------*/
|
|
5
|
+
/*options VALIDMEMNAME=EXTEND VALIDVARNAME=ANY;*/
|
|
6
|
+
/*------------------------------------------
|
|
7
|
+
Generated SAS Scoring Code
|
|
8
|
+
Date : 02Jul2019:21:19:56
|
|
9
|
+
Locale : en_US
|
|
10
|
+
Model Type : Cluster
|
|
11
|
+
Interval variable: SDOH_PMU(SDOH1 Physically Mentally Unhealthy)
|
|
12
|
+
Interval variable: SDOH_Per_Adults_Bachelors(SDOH2 Education)
|
|
13
|
+
Interval variable: SDOH_Unemployment_Rate(SDOH4 Unemployment Rate)
|
|
14
|
+
Interval variable: SDOH_Median_Household_Income(SDOH3 Median Household Income)
|
|
15
|
+
------------------------------------------*/
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
length _WARN_ $4;
|
|
19
|
+
label _WARN_ = 'Warnings';
|
|
20
|
+
label _CLUSTER_ID_ = 'Cluster ID';
|
|
21
|
+
label _DISTANCE_ = 'Distance to Centroid';
|
|
22
|
+
|
|
23
|
+
_i_ = 0;
|
|
24
|
+
_j_ = 0;
|
|
25
|
+
_k_ = 0;
|
|
26
|
+
_l_ = 0;
|
|
27
|
+
_dist_ = 0;
|
|
28
|
+
_minDist_ = 0;
|
|
29
|
+
_found_ = 0;
|
|
30
|
+
_unknown_ = 0;
|
|
31
|
+
_unknownflag_ = 0;
|
|
32
|
+
_intMindist2cntr_ = 0;
|
|
33
|
+
_missingflag4Int_ = 0;
|
|
34
|
+
_numberOfIntVars_ = 4;
|
|
35
|
+
_minDistInt_ = 0;
|
|
36
|
+
label _STANDARDIZED_DISTANCE_ = 'Standardized Distance to Centroid';
|
|
37
|
+
|
|
38
|
+
drop _i_;
|
|
39
|
+
drop _j_;
|
|
40
|
+
drop _k_;
|
|
41
|
+
drop _l_;
|
|
42
|
+
drop _dist_;
|
|
43
|
+
drop _minDist_;
|
|
44
|
+
drop _minDistInt_;
|
|
45
|
+
drop _unknown_;
|
|
46
|
+
drop _unknownflag_;
|
|
47
|
+
drop _found_;
|
|
48
|
+
drop _intMindist2cntr_;
|
|
49
|
+
drop _missingflag4Int_;
|
|
50
|
+
drop _numberOfIntVars_;
|
|
51
|
+
drop _minDistInt_;
|
|
52
|
+
|
|
53
|
+
array _intVals_67{4} _temporary_;
|
|
54
|
+
array _intStdVals_67{4} _temporary_;
|
|
55
|
+
array _intVars_67[4] _temporary_;
|
|
56
|
+
_intVars_67[1] =
|
|
57
|
+
SDOH_PMU;
|
|
58
|
+
_intVars_67[2] =
|
|
59
|
+
SDOH_Per_Adults_Bachelors;
|
|
60
|
+
_intVars_67[3] =
|
|
61
|
+
SDOH_Unemployment_Rate;
|
|
62
|
+
_intVars_67[4] =
|
|
63
|
+
SDOH_Median_Household_Income;
|
|
64
|
+
array _cntrcoordsInt_67{4,4} _temporary_ (
|
|
65
|
+
5.6752109618776
|
|
66
|
+
34.574068577069
|
|
67
|
+
5.5249572649573
|
|
68
|
+
65162.262238794
|
|
69
|
+
6.1728412355737
|
|
70
|
+
28.076500921419
|
|
71
|
+
8.4815044247788
|
|
72
|
+
50250.811599193
|
|
73
|
+
5.5563377592335
|
|
74
|
+
27.69585347275
|
|
75
|
+
3.586724137931
|
|
76
|
+
55456.199169472
|
|
77
|
+
7.1425816544567
|
|
78
|
+
23.193113163492
|
|
79
|
+
5.9483653846154
|
|
80
|
+
45013.481439879
|
|
81
|
+
);
|
|
82
|
+
array _stdcntrcoordsInt_67 {4,4} _temporary_ (
|
|
83
|
+
-0.545947986801
|
|
84
|
+
1.2465170251288
|
|
85
|
+
-0.140043320021
|
|
86
|
+
1.2424484776721
|
|
87
|
+
0.080847377302
|
|
88
|
+
-0.09555849286
|
|
89
|
+
1.0754374093924
|
|
90
|
+
-0.456774851619
|
|
91
|
+
-0.695675960102
|
|
92
|
+
-0.17418139437
|
|
93
|
+
-0.936879929639
|
|
94
|
+
0.1364012391051
|
|
95
|
+
1.3022939633885
|
|
96
|
+
-1.104224427884
|
|
97
|
+
0.0340260867236
|
|
98
|
+
-1.053590936451
|
|
99
|
+
);
|
|
100
|
+
array _stdscaleInt_67 {4} _temporary_ (
|
|
101
|
+
0.7939278147152
|
|
102
|
+
4.8414322208822
|
|
103
|
+
2.4324097357342
|
|
104
|
+
8775.4507500947
|
|
105
|
+
);
|
|
106
|
+
array _stdcenterInt_67 {4} _temporary_ (
|
|
107
|
+
6.1086542539869
|
|
108
|
+
28.539140887732
|
|
109
|
+
5.8656
|
|
110
|
+
54259.216813453
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
*************** check missing interval value ******************;
|
|
114
|
+
_missingflag4Int_ = 0;
|
|
115
|
+
do _i_ = 1 to _numberOfIntVars_ until(_missingflag4Int_);
|
|
116
|
+
if missing( _intVars_67[_i_] ) then
|
|
117
|
+
_missingflag4Int_ = 1;
|
|
118
|
+
end;
|
|
119
|
+
|
|
120
|
+
if (_missingflag4Int_ = 1) then
|
|
121
|
+
substr(_WARN_, 1, 1) = 'M';
|
|
122
|
+
********** prepare interval variable values *********;
|
|
123
|
+
do _i_ = 1 to _numberOfIntVars_;
|
|
124
|
+
if missing (_intVars_67[_i_] ) then do;
|
|
125
|
+
_intVals_67[_i_] = .;
|
|
126
|
+
_intStdVals_67[_i_] = .;
|
|
127
|
+
end; else do;
|
|
128
|
+
if missing (_stdscaleInt_67[_i_] ) then do;
|
|
129
|
+
_intStdVals_67[_i_] = ( _intVars_67[_i_] - _stdcenterInt_67[_i_]);
|
|
130
|
+
end; else do;
|
|
131
|
+
_intStdVals_67[_i_] = ( _intVars_67[_i_] - _stdcenterInt_67[_i_])
|
|
132
|
+
/ _stdscaleInt_67[_i_];
|
|
133
|
+
end;
|
|
134
|
+
_intVals_67[_i_] = _intVars_67[_i_];
|
|
135
|
+
end;
|
|
136
|
+
end;
|
|
137
|
+
****************** find the closest cluster ******************;
|
|
138
|
+
if _missingflag4Int_ > 0 then
|
|
139
|
+
do;
|
|
140
|
+
_CLUSTER_ID_ = .;
|
|
141
|
+
_DISTANCE_ = .;
|
|
142
|
+
_minDistInt_ = .;
|
|
143
|
+
_STANDARDIZED_DISTANCE_ = .;
|
|
144
|
+
end;
|
|
145
|
+
else
|
|
146
|
+
do;
|
|
147
|
+
_CLUSTER_ID_ = .;
|
|
148
|
+
_minDist_ = 8.988465674E307;
|
|
149
|
+
do _i_=1 to 4;
|
|
150
|
+
_intMindist2cntr_ = 0;
|
|
151
|
+
do _j_=1 to 4;
|
|
152
|
+
_dist_ = _intStdVals_67{_j_} - _stdcntrcoordsInt_67{_i_,_j_};
|
|
153
|
+
_dist_ = _dist_ ** 2;
|
|
154
|
+
_intMindist2cntr_ = _intMindist2cntr_ + _dist_;
|
|
155
|
+
end;
|
|
156
|
+
_intMindist2cntr_ = _intMindist2cntr_ ** 0.5;
|
|
157
|
+
if( _minDist_ > _intMindist2cntr_) then do;
|
|
158
|
+
_CLUSTER_ID_ = _i_;
|
|
159
|
+
_minDist_ = _intMindist2cntr_;
|
|
160
|
+
end;
|
|
161
|
+
_STANDARDIZED_DISTANCE_ = _minDist_;
|
|
162
|
+
end;
|
|
163
|
+
_DISTANCE_ = 8.988465674E307;
|
|
164
|
+
_i_ = _CLUSTER_ID_;
|
|
165
|
+
_intMindist2cntr_ = 0;
|
|
166
|
+
do _j_=1 to 4;
|
|
167
|
+
_dist_ = _intVals_67{_j_} - _cntrcoordsInt_67{_i_,_j_};
|
|
168
|
+
_dist_ = _dist_ ** 2;
|
|
169
|
+
_intMindist2cntr_ = _intMindist2cntr_ + _dist_;
|
|
170
|
+
end;
|
|
171
|
+
_intMindist2cntr_ = _intMindist2cntr_ ** 0.5;
|
|
172
|
+
_DISTANCE_ = _intMindist2cntr_;
|
|
173
|
+
end;
|
|
174
|
+
|
|
175
|
+
if (MISSING('_CLUSTER_ID_'n))then _CLUSTER_ID_ = -1; /*------------------------------------------*/
|
|
176
|
+
drop '_CLUSTER_ID_'n '_DISTANCE_'n '_WARN_'n '_STANDARDIZED_DISTANCE_'n;
|
|
177
|
+
'_CLUSTER_ID__67'n='_CLUSTER_ID_'n;
|
|
178
|
+
'_DISTANCE__67'n='_DISTANCE_'n;
|
|
179
|
+
'_WARN__67'n='_WARN_'n;
|
|
180
|
+
'_STANDARDIZED_DISTANCE__67'n='_STANDARDIZED_DISTANCE_'n;
|
|
181
|
+
/*------------------------------------------*/
|
|
182
|
+
run;
|