@sassoftware/viya-serverjs 0.6.1-0 → 0.6.1-1

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.
@@ -23,7 +23,7 @@ function _getApp() {
23
23
  return _regenerator().w(function (_context) {
24
24
  while (1) switch (_context.n) {
25
25
  case 0:
26
- console.log('In getApp handler', options);
26
+ debug('In getApp handler', options);
27
27
  if (!(process.env.AUTHFLOW === 'implicit')) {
28
28
  _context.n = 1;
29
29
  break;
@@ -51,16 +51,16 @@ function _getApp() {
51
51
  }
52
52
  debug('calling codeauth');
53
53
  r = (0, _codeAuth["default"])(req, h, options);
54
- console.log(options.userCache);
54
+ debug(options.userCache);
55
55
  return _context.a(2, r);
56
56
  case 2:
57
57
  debug('default processing in getapp');
58
- console.log('Processing non authenticated use case');
58
+ debug('Processing non authenticated use case');
59
59
  indexHTML = process.env.APPENTRY == null ? 'index.html' : process.env.APPENTRY;
60
60
  if (process.env.REDIRECT != null) {
61
61
  indexHTML = process.env.REDIRECT;
62
62
  }
63
- console.log('redirecting to ', indexHTML);
63
+ debug('redirecting to ', indexHTML);
64
64
  if (!indexHTML.startsWith('/')) {
65
65
  _context.n = 3;
66
66
  break;
@@ -8,6 +8,7 @@ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present,
8
8
  function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
9
9
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
10
10
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
11
+ var debug = require('debug')('proxyMapUri');
11
12
  function proxyMapUri(_x) {
12
13
  return _proxyMapUri.apply(this, arguments);
13
14
  }
@@ -18,22 +19,22 @@ function _proxyMapUri() {
18
19
  while (1) switch (_context.n) {
19
20
  case 0:
20
21
  credentials = req.auth.credentials;
21
- console.log('------------------------------------------');
22
+ debug('------------------------------------------');
22
23
  if (credentials != null) {
23
24
  sid = credentials.sid;
24
- console.log('sid=', sid);
25
+ debug('sid=', sid);
25
26
  }
26
27
  path = process.env.VIYA_SERVER; //let path = (process.env.PROXYSERVER == null) ? process.env.VIYA_SERVER : process.env.PROXYSERVER;
27
- console.log('proxying to= ', path);
28
+ debug('proxying to= ', path);
28
29
  params = req.params;
29
- console.log('params=', params);
30
+ debug('params=', params);
30
31
  search = req.url.search;
31
- console.log('query=', search);
32
+ debug('query=', search);
32
33
  uri = path + '/' + params.param;
33
34
  if (search != null && search.trim().length > 0) {
34
35
  uri = uri + search;
35
36
  }
36
- console.log('destination= ', uri);
37
+ debug('destination= ', uri);
37
38
  return _context.a(2, {
38
39
  uri: uri
39
40
  });
@@ -52,7 +52,7 @@ function _setCookies() {
52
52
  options.userCache = _objectSpread({}, credentials);
53
53
  debug(options.allAppEnv.LOGONPAYLOAD);
54
54
  }
55
- console.log('userCache', options.userCache);
55
+ debug('userCache', options.userCache);
56
56
  _context.n = 2;
57
57
  return req.server.app.cache.set(sid, credentials, 0);
58
58
  case 2:
@@ -25,6 +25,8 @@ function _asyncToGenerator(n) { return function () { var t = this, e = arguments
25
25
  * ---------------------------------------------------------------------------------------
26
26
  *
27
27
  */
28
+
29
+ var debug = require('debug')('context');
28
30
  function setContext(_x, _x2) {
29
31
  return _setContext.apply(this, arguments);
30
32
  }
@@ -35,8 +37,7 @@ function _setContext() {
35
37
  while (1) switch (_context.n) {
36
38
  case 0:
37
39
  credentials = req.auth.credentials;
38
- console.log('in setContext');
39
- console.log('credentials=', credentials);
40
+ debug(credentials);
40
41
  context = {
41
42
  path: req.path,
42
43
  params: req.params,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sassoftware/viya-serverjs",
3
- "version": "0.6.1-0",
3
+ "version": "0.6.1-1",
4
4
  "description": "Easy to use app server for SAS Viya applications",
5
5
  "author": "Deva Kumaraswamy <deva.kumar@sas.com>",
6
6
  "license": "Apache-2.0",
package/server.js CHANGED
@@ -32,7 +32,7 @@ function getCustomHandler() {
32
32
  },
33
33
  {
34
34
  method: ["GET"],
35
- path: `${appName}/new`,
35
+ path: `/new`,
36
36
  options: {
37
37
  files: {
38
38
  relativeTo: "./public",
@@ -7,7 +7,7 @@ import codeAuth from './codeAuth';
7
7
  let debug = require('debug')('getapp');
8
8
 
9
9
  async function getApp (options, req, h) {
10
- console.log('In getApp handler', options);
10
+ debug('In getApp handler', options);
11
11
  if (process.env.AUTHFLOW === 'implicit') {
12
12
  let x = `${process.env.VIYA_SERVER}/SASLogon/oauth/authorize?response_type=token&client_id=${process.env.CLIENTID}`;
13
13
  let redirect = `${process.env.APPNAME}/callback`;
@@ -30,18 +30,18 @@ async function getApp (options, req, h) {
30
30
 
31
31
  debug('calling codeauth');
32
32
  let r = codeAuth(req, h, options);
33
- console.log(options.userCache);
33
+ debug(options.userCache);
34
34
  return r;
35
35
 
36
36
  } else {
37
37
  debug('default processing in getapp');
38
- console.log('Processing non authenticated use case');
38
+ debug('Processing non authenticated use case');
39
39
 
40
40
  let indexHTML = process.env.APPENTRY == null ? 'index.html' : process.env.APPENTRY;
41
41
  if (process.env.REDIRECT != null) {
42
42
  indexHTML = process.env.REDIRECT;
43
43
  }
44
- console.log('redirecting to ', indexHTML);
44
+ debug('redirecting to ', indexHTML);
45
45
  if (indexHTML.startsWith('/')) {
46
46
  indexHTML = `/${process.env.APPNAME}${indexHTML}`;
47
47
  return h.redirect(indexHTML);
@@ -1,23 +1,24 @@
1
+ let debug = require('debug')('proxyMapUri');
1
2
  async function proxyMapUri (req) {
2
3
  let credentials = req.auth.credentials;
3
- console.log('------------------------------------------');
4
+ debug('------------------------------------------');
4
5
  if (credentials != null) {
5
6
  let sid = credentials.sid;
6
- console.log('sid=', sid);
7
+ debug('sid=', sid);
7
8
  }
8
9
 
9
10
  let path = process.env.VIYA_SERVER;
10
11
  //let path = (process.env.PROXYSERVER == null) ? process.env.VIYA_SERVER : process.env.PROXYSERVER;
11
- console.log('proxying to= ', path);
12
+ debug('proxying to= ', path);
12
13
  let params = req.params;
13
- console.log('params=', params);
14
+ debug('params=', params);
14
15
  let search = req.url.search;
15
- console.log('query=', search);
16
+ debug('query=', search);
16
17
  let uri = path + '/' + params.param;
17
18
  if (search != null && search.trim().length > 0) {
18
19
  uri = uri + search;
19
20
  }
20
- console.log('destination= ',uri);
21
+ debug('destination= ',uri);
21
22
  return {
22
23
  uri: uri
23
24
  };
@@ -26,7 +26,7 @@ async function setCookies (req, h, options) {
26
26
  options.userCache = {...credentials};
27
27
  debug(options.allAppEnv.LOGONPAYLOAD);
28
28
  }
29
- console.log('userCache', options.userCache);
29
+ debug('userCache', options.userCache);
30
30
 
31
31
  await req.server.app.cache.set(sid, credentials, 0);
32
32
  // Can we get away without setting cookie for this session?
@@ -16,11 +16,10 @@
16
16
  *
17
17
  */
18
18
 
19
-
19
+ let debug = require('debug')('context');
20
20
  async function setContext (req,h){
21
- let credentials = req.auth.credentials;
22
- console.log('in setContext');
23
- console.log('credentials=', credentials);
21
+ let credentials = req.auth.credentials
22
+ debug(credentials);
24
23
  let context = {
25
24
  path : req.path,
26
25
  params : req.params,