@sassoftware/viya-serverjs 0.5.0 → 0.5.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.
package/.env CHANGED
@@ -4,9 +4,9 @@ APPLOC=./public
4
4
  # VIYA_SERVER=your viya server
5
5
 
6
6
  APPPORT=8080
7
- APPNAME=viyaapp
7
+ APPNAME=mcpapp
8
8
  AUTHFLOW=code
9
- CLIENTID=viyaapp
9
+ CLIENTID=mcpapp
10
10
  CLIENTSECRET=jellico
11
11
 
12
12
  REDIRECT=
@@ -14,6 +14,7 @@ REDIRECT=
14
14
  HTTPS=true
15
15
 
16
16
 
17
+
17
18
  # Most modern browsers do not accept self-signed certs from localhost
18
19
  # Options:
19
20
 
package/lib/iService.js CHANGED
@@ -181,6 +181,7 @@ function iService(userRouteTable, useDefault, asset, allAppEnv, serverMode, user
181
181
  },
182
182
  });
183
183
  */
184
+ //
184
185
  // setup authentication related plugins
185
186
  options = {
186
187
  serverMode: serverMode,
@@ -57,6 +57,7 @@ function setupUserRoutes(u, options) {
57
57
  } else if (rx.options.auth === 'logon') {
58
58
  rx.options.auth = options.authLogon;
59
59
  }
60
+ console.log('route auth', rx.options.auth);
60
61
  return rx;
61
62
  });
62
63
  return routes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sassoftware/viya-serverjs",
3
- "version": "0.5.0",
3
+ "version": "0.5.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",
@@ -32,6 +32,7 @@
32
32
  "test": "node cli --env=./.env --docker=./Dockerfile",
33
33
  "submit": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 APPENTRY=simplesubmit.html node cli --env=./.env --docker=./Dockerfile",
34
34
  "server": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 node server.js --env=./.env.server --docker=./Dockerfile",
35
+ "server2": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 node server.js --env=./.env --docker=./Dockerfile",
35
36
  "debug": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 node --inspect-brk server.js --env=./.env.server --docker=./Dockerfile",
36
37
  "proxy": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 node cli --env=./.env.proxy --docker=./Dockerfile",
37
38
  "pub": "npm publish --tag dev --access public",
package/public/help.html CHANGED
@@ -1 +1 @@
1
- <h1> Hellp</h1>
1
+ <h1> Hello</h1>
package/server.js CHANGED
@@ -22,7 +22,7 @@ function getCustomHandler() {
22
22
  let hf = 'help.html';
23
23
  return h.file(hf);
24
24
  },
25
- auth: false,
25
+ auth: true,
26
26
  description: "Help",
27
27
  notes: "Help",
28
28
  tags: ["app"],
@@ -30,16 +30,19 @@ function getCustomHandler() {
30
30
  },
31
31
  {
32
32
  method: ["GET"],
33
- path: `${appName}/new`,
33
+ path: `/mcp`,
34
34
  options: {
35
35
  files: {
36
36
  relativeTo: "./public",
37
37
  },
38
38
  handler: async (req, h) => {
39
- console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>in new');
39
+ console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>in mcp');
40
+ console.log(req.auth.credentials);
41
+ debugger;
42
+ console.log(req.context);
40
43
  return h.file('index.html');
41
44
  },
42
- // auth: 'logon',
45
+ auth: 'logon',
43
46
  description: "Create new application",
44
47
  notes: "Index file created from env data",
45
48
  tags: ["app"],
package/src/iService.js CHANGED
@@ -152,6 +152,7 @@ function iService (userRouteTable, useDefault, asset, allAppEnv, serverMode, use
152
152
  });
153
153
  */
154
154
 
155
+ //
155
156
  // setup authentication related plugins
156
157
 
157
158
  let options = {
@@ -25,11 +25,7 @@ function setupUserRoutes (u, options) {
25
25
  let ux = (typeof u === 'function') ? u() : u;
26
26
  let routes = ux.map(rx => {
27
27
  //let rx = {...r};
28
- /* change it to options */
29
- if (rx.config != null) {
30
- rx.options = {...rx.config};
31
- delete rx.config;
32
- }
28
+
33
29
  if (rx.options.pre == null) {
34
30
  rx.options.pre = [{method: setContext, assign: 'context'}];
35
31
  } else{
@@ -41,7 +37,7 @@ function setupUserRoutes (u, options) {
41
37
  } else if (rx.options.auth === 'logon') {
42
38
  rx.options.auth = options.authLogon;
43
39
  }
44
-
40
+ console.log('route auth', rx.options.auth);
45
41
  return rx;
46
42
  });
47
43
  return routes;