@sassoftware/viya-serverjs 0.3.0 → 0.4.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.
Files changed (81) hide show
  1. package/.babelrc +6 -6
  2. package/.dockerignore +2 -2
  3. package/.env +29 -28
  4. package/.env.proxy +32 -32
  5. package/.env.server +30 -30
  6. package/.eslintignore +3 -3
  7. package/.eslintrc.json +42 -42
  8. package/Dockerfile +44 -44
  9. package/README.md +99 -99
  10. package/cli.js +9 -9
  11. package/lib/config.js +16 -16
  12. package/lib/handlers/appCallback.js +23 -24
  13. package/lib/handlers/codeAuth.js +17 -18
  14. package/lib/handlers/decodeJwt.js +3 -3
  15. package/lib/handlers/favicon.js +22 -25
  16. package/lib/handlers/getApp.js +20 -21
  17. package/lib/handlers/getApp2.js +22 -25
  18. package/lib/handlers/getUser.js +14 -17
  19. package/lib/handlers/index.js +3 -3
  20. package/lib/handlers/keepAlive.js +28 -31
  21. package/lib/handlers/keepAlive2.js +9 -12
  22. package/lib/handlers/logon.js +12 -15
  23. package/lib/handlers/logout.js +24 -28
  24. package/lib/handlers/proxyMapUri.js +6 -11
  25. package/lib/handlers/proxyOnResponse.js +6 -7
  26. package/lib/handlers/reactDev.js +22 -25
  27. package/lib/handlers/setCookies.js +52 -53
  28. package/lib/iService.js +82 -87
  29. package/lib/index.js +23 -21
  30. package/lib/parseDocker.js +3 -3
  31. package/lib/plugins/SASauth.js +30 -32
  32. package/lib/plugins/appCookie.js +36 -38
  33. package/lib/plugins/setContext.js +22 -25
  34. package/lib/plugins/setDefaultRoutes.js +61 -58
  35. package/lib/plugins/setupAuth.js +35 -38
  36. package/lib/plugins/setupUserRoutes.js +16 -16
  37. package/lib/plugins/token.js +9 -10
  38. package/lib/schemes/SASTokenScheme.js +24 -27
  39. package/package.json +85 -79
  40. package/public/data/Cluster_SDOH1.sas +181 -181
  41. package/public/data/Cluster_SDOH6.sas +179 -179
  42. package/public/data/NeuralNetwork_High_med.sas +2408 -2408
  43. package/public/data/NeuralNetwork_high_med1.sas +2408 -2408
  44. package/public/data/cars.csv +429 -429
  45. package/public/data/cmdList.txt +15 -15
  46. package/public/data/iris.csv +151 -151
  47. package/public/index.html +354 -350
  48. package/public/indexProxy.html +351 -351
  49. package/public/simplesubmit.html +233 -0
  50. package/server.js +362 -362
  51. package/src/config.js +90 -90
  52. package/src/handlers/appCallback.js +40 -40
  53. package/src/handlers/codeAuth.js +31 -31
  54. package/src/handlers/decodeJwt.js +10 -10
  55. package/src/handlers/favicon.js +23 -23
  56. package/src/handlers/getApp.js +52 -52
  57. package/src/handlers/getApp2.js +25 -25
  58. package/src/handlers/getUser.js +20 -20
  59. package/src/handlers/index.js +36 -36
  60. package/src/handlers/keepAlive.js +53 -53
  61. package/src/handlers/keepAlive2.js +12 -12
  62. package/src/handlers/logon.js +23 -23
  63. package/src/handlers/logout.js +42 -42
  64. package/src/handlers/proxyMapUri.js +25 -25
  65. package/src/handlers/proxyOnResponse.js +11 -11
  66. package/src/handlers/reactDev.js +29 -29
  67. package/src/handlers/setCookies.js +81 -79
  68. package/src/iService.js +346 -345
  69. package/src/index.js +251 -249
  70. package/src/parseDocker.js +32 -32
  71. package/src/plugins/SASauth.js +78 -78
  72. package/src/plugins/appCookie.js +51 -49
  73. package/src/plugins/setContext.js +33 -33
  74. package/src/plugins/setDefaultRoutes.js +256 -253
  75. package/src/plugins/setupAuth.js +49 -49
  76. package/src/plugins/setupUserRoutes.js +47 -47
  77. package/src/plugins/token.js +10 -10
  78. package/src/schemes/SASTokenScheme.js +43 -43
  79. package/src/visionIndex.html +23 -23
  80. package/start.sh +14 -14
  81. package/tls/viyatls.sh +2 -2
package/lib/iService.js CHANGED
@@ -5,9 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports["default"] = void 0;
8
+ var _file = require("@hapi/inert/lib/file");
8
9
  var _setupAuth = _interopRequireDefault(require("./plugins/setupAuth"));
9
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
10
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
11
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
12
+ 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); }
11
13
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
14
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
13
15
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
@@ -21,22 +23,22 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
21
23
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
22
24
  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); }
23
25
  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); }); }; }
24
- /*
25
- * ------------------------------------------------------------------------------------
26
- * * Copyright (c) SAS Institute Inc.
27
- * * Licensed under the Apache License, Version 2.0 (the "License");
28
- * * you may not use this file except in compliance with the License.
29
- * * You may obtain a copy of the License at
30
- * *
31
- * * http://www.apache.org/licenses/LICENSE-2.0
32
- * *
33
- * * Unless required by applicable law or agreed to in writing, software
34
- * * distributed under the License is distributed on an "AS IS" BASIS,
35
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
36
- * * See the License for the specific language governing permissions and
37
- * limitations under the License.
38
- * ----------------------------------------------------------------------------------------
39
- *
26
+ /*
27
+ * ------------------------------------------------------------------------------------
28
+ * * Copyright (c) SAS Institute Inc.
29
+ * * Licensed under the Apache License, Version 2.0 (the "License");
30
+ * * you may not use this file except in compliance with the License.
31
+ * * You may obtain a copy of the License at
32
+ * *
33
+ * * http://www.apache.org/licenses/LICENSE-2.0
34
+ * *
35
+ * * Unless required by applicable law or agreed to in writing, software
36
+ * * distributed under the License is distributed on an "AS IS" BASIS,
37
+ * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
38
+ * * See the License for the specific language governing permissions and
39
+ * limitations under the License.
40
+ * ----------------------------------------------------------------------------------------
41
+ *
40
42
  */
41
43
 
42
44
  var fs = require('fs');
@@ -54,10 +56,10 @@ var os = require('os');
54
56
  function iService(userRouteTable, useDefault, asset, allAppEnv, serverMode, userInfo) {
55
57
  // process.env.APPHOST_ADDR = process.env.APPHOST;
56
58
  var init = /*#__PURE__*/function () {
57
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
59
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
58
60
  var defaultMaxBytes, maxBytes, isSameSite, isSecure, _process$env$SAMESITE, _process$env$SAMESITE2, s1, s2, sConfig, hapiServer, nodeCacheOptions, storeCache, visionOptions, options, swaggerOptions, override, allRoutes, hh, msg;
59
- return _regeneratorRuntime().wrap(function _callee$(_context) {
60
- while (1) switch (_context.prev = _context.next) {
61
+ return _regenerator().w(function (_context) {
62
+ while (1) switch (_context.n) {
61
63
  case 0:
62
64
  if (process.env.APPHOST === '*') {
63
65
  process.env.APPHOST = os.hostname();
@@ -93,10 +95,10 @@ function iService(userRouteTable, useDefault, asset, allAppEnv, serverMode, user
93
95
  origin: ['*'],
94
96
  credentials: true,
95
97
  "headers": ["Accept", "Authorization", "Content-Type", "If-None-Match", "Accept-language"]
96
- /*
97
- 'Access-Control-Allow-Methods': ['GET', 'POST', 'OPTIONS'],
98
- additionalHeaders : ['multipart/form-data', 'content-disposition'],
99
- additionalExposedHeaders : ['location'],
98
+ /*
99
+ 'Access-Control-Allow-Methods': ['GET', 'POST', 'OPTIONS'],
100
+ additionalHeaders : ['multipart/form-data', 'content-disposition'],
101
+ additionalExposedHeaders : ['location'],
100
102
  */
101
103
  }
102
104
  }
@@ -108,19 +110,19 @@ function iService(userRouteTable, useDefault, asset, allAppEnv, serverMode, user
108
110
  }
109
111
  debug(JSON.stringify(sConfig, null, 4));
110
112
  if (!(process.env.HTTPS === 'true')) {
111
- _context.next = 16;
113
+ _context.n = 2;
112
114
  break;
113
115
  }
114
- _context.next = 12;
116
+ _context.n = 1;
115
117
  return getCertificates();
116
- case 12:
117
- sConfig.tls = _context.sent;
118
+ case 1:
119
+ sConfig.tls = _context.v;
118
120
  debug('Setup of SSL certificates completed');
119
- _context.next = 17;
121
+ _context.n = 3;
120
122
  break;
121
- case 16:
123
+ case 2:
122
124
  debug('Running with no SSL certificates');
123
- case 17:
125
+ case 3:
124
126
  if (asset !== null) {
125
127
  sConfig.routes.files = {
126
128
  relativeTo: asset
@@ -128,9 +130,9 @@ function iService(userRouteTable, useDefault, asset, allAppEnv, serverMode, user
128
130
  }
129
131
  debug2("Application information: \n\t\tAPPLOC : ".concat(process.env.APPLOC, "\n\t\tAPPENTRY: ").concat(process.env.APPENTRY, "\n"));
130
132
  hapiServer = Hapi.server(sConfig);
131
- /*
132
- const cache = hapiServer.cache({ segment: 'sessions', expiresIn: 3 * 24 * 60 * 60 * 1000 });
133
- hapiServer.app.cache = cache;
133
+ /*
134
+ const cache = hapiServer.cache({ segment: 'sessions', expiresIn: 3 * 24 * 60 * 60 * 1000 });
135
+ hapiServer.app.cache = cache;
134
136
  */
135
137
  nodeCacheOptions = {
136
138
  stdTTL: 24 * 60 * 60 * 1000,
@@ -150,34 +152,34 @@ function iService(userRouteTable, useDefault, asset, allAppEnv, serverMode, user
150
152
  relativeTo: __dirname,
151
153
  path: '.'
152
154
  };
153
- _context.next = 26;
155
+ _context.n = 4;
154
156
  return hapiServer.register(Vision);
155
- case 26:
157
+ case 4:
156
158
  hapiServer.views(visionOptions);
157
- _context.next = 29;
159
+ _context.n = 5;
158
160
  return hapiServer.register(inert);
159
- case 29:
161
+ case 5:
160
162
  if (!(process.env.HTTPS === 'true')) {
161
- _context.next = 32;
163
+ _context.n = 6;
162
164
  break;
163
165
  }
164
- _context.next = 32;
166
+ _context.n = 6;
165
167
  return hapiServer.register({
166
168
  plugin: require('hapi-require-https'),
167
169
  options: {}
168
170
  });
169
- case 32:
170
- _context.next = 34;
171
+ case 6:
172
+ _context.n = 7;
171
173
  return hapiServer.register(H202);
172
- case 34:
173
- /*
174
- await hapiServer.register({
175
- plugin : require('hapi-pino'),
176
- options: {
177
- prettyPrint: process.env.NODE_ENV !== 'production',
178
- level : process.env.LOGLEVEL == null ? 'silent' : process.env.LOGLEVEL,
179
- },
180
- });
174
+ case 7:
175
+ /*
176
+ await hapiServer.register({
177
+ plugin : require('hapi-pino'),
178
+ options: {
179
+ prettyPrint: process.env.NODE_ENV !== 'production',
180
+ level : process.env.LOGLEVEL == null ? 'silent' : process.env.LOGLEVEL,
181
+ },
182
+ });
181
183
  */
182
184
  // setup authentication related plugins
183
185
  options = {
@@ -208,12 +210,12 @@ function iService(userRouteTable, useDefault, asset, allAppEnv, serverMode, user
208
210
  };
209
211
  debug2('Options', options);
210
212
  if (!(process.env.AUTHFLOW != null)) {
211
- _context.next = 40;
213
+ _context.n = 9;
212
214
  break;
213
215
  }
214
- _context.next = 39;
216
+ _context.n = 8;
215
217
  return (0, _setupAuth["default"])(hapiServer, options);
216
- case 39:
218
+ case 8:
217
219
  if (process.env.PREAUTH === 'YES') {
218
220
  console.log('Preauth enabled');
219
221
  hapiServer.ext('onPreAuth', function (request, h) {
@@ -229,10 +231,10 @@ function iService(userRouteTable, useDefault, asset, allAppEnv, serverMode, user
229
231
  return h["continue"];
230
232
  });
231
233
  }
232
- case 40:
234
+ case 9:
233
235
  console.log('Plugin', process.env.PLUGIN);
234
236
  if (!(process.env.PLUGIN === 'hapi-swagger' && serverMode === 'api')) {
235
- _context.next = 49;
237
+ _context.n = 11;
236
238
  break;
237
239
  }
238
240
  swaggerOptions = {
@@ -257,27 +259,27 @@ function iService(userRouteTable, useDefault, asset, allAppEnv, serverMode, user
257
259
  swaggerOptions = _objectSpread(_objectSpread({}, swaggerOptions), override);
258
260
  }
259
261
  debug('Swagger Options:', swaggerOptions);
260
- _context.next = 47;
262
+ _context.n = 10;
261
263
  return hapiServer.register({
262
264
  plugin: serverMode,
263
265
  options: swaggerOptions
264
266
  });
265
- case 47:
266
- _context.next = 50;
267
+ case 10:
268
+ _context.n = 12;
267
269
  break;
268
- case 49:
270
+ case 11:
269
271
  if (process.env.PLUGIN == 'hapi-openapi' && serverMode === 'api') {
270
272
  console.log('hapi-openapi', 'coming soon');
271
273
  }
272
- case 50:
274
+ case 12:
273
275
  //
274
276
  // Start server
275
277
  //
276
278
  // eslint-disable-next-line no-unused-vars
277
279
  allRoutes = hapiServer.table();
278
- _context.next = 53;
280
+ _context.n = 13;
279
281
  return hapiServer.start();
280
- case 53:
282
+ case 13:
281
283
  hh = hapiServer.info.uri;
282
284
  hh = hh.replace(/0.0.0.0/, 'localhost');
283
285
  console.log('====================================================================================');
@@ -288,9 +290,8 @@ function iService(userRouteTable, useDefault, asset, allAppEnv, serverMode, user
288
290
  process.env.APPSERVER = "".concat(hh, "/").concat(process.env.APPNAME);
289
291
  process.env.HEALTH = 'true';
290
292
  console.log('====================================================================================');
291
- case 63:
292
- case "end":
293
- return _context.stop();
293
+ case 14:
294
+ return _context.a(2);
294
295
  }
295
296
  }, _callee);
296
297
  }));
@@ -308,15 +309,15 @@ function getCertificates() {
308
309
  return _getCertificates.apply(this, arguments);
309
310
  }
310
311
  function _getCertificates() {
311
- _getCertificates = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
312
+ _getCertificates = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
312
313
  var options, tlsdir;
313
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
314
- while (1) switch (_context2.prev = _context2.next) {
314
+ return _regenerator().w(function (_context2) {
315
+ while (1) switch (_context2.n) {
315
316
  case 0:
316
317
  options = null;
317
318
  tlsdir = process.env.SSLCERT;
318
319
  if (!(tlsdir != null && tlsdir.trim().length > 0)) {
319
- _context2.next = 7;
320
+ _context2.n = 1;
320
321
  break;
321
322
  }
322
323
  console.log('ssl CERTIFICATES', tlsdir);
@@ -335,20 +336,17 @@ function _getCertificates() {
335
336
  }
336
337
  options.rejectUnauthorized = true;
337
338
  }
338
- _context2.next = 12;
339
+ _context2.n = 3;
339
340
  break;
340
- case 7:
341
+ case 1:
341
342
  console.log('No SSL certificates found, generating self-signed certificates');
342
- _context2.next = 10;
343
+ _context2.n = 2;
343
344
  return getTls();
344
- case 10:
345
- options = _context2.sent;
345
+ case 2:
346
+ options = _context2.v;
346
347
  options.rejectUnauthorized = false;
347
- case 12:
348
- return _context2.abrupt("return", options);
349
- case 13:
350
- case "end":
351
- return _context2.stop();
348
+ case 3:
349
+ return _context2.a(2, options);
352
350
  }
353
351
  }, _callee2);
354
352
  }));
@@ -358,10 +356,10 @@ function getTls() {
358
356
  return _getTls.apply(this, arguments);
359
357
  }
360
358
  function _getTls() {
361
- _getTls = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
359
+ _getTls = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
362
360
  var options, subjt, subj, d, attr, pems, tls;
363
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
364
- while (1) switch (_context3.prev = _context3.next) {
361
+ return _regenerator().w(function (_context3) {
362
+ while (1) switch (_context3.n) {
365
363
  case 0:
366
364
  options = {
367
365
  keySize: 2048,
@@ -428,10 +426,7 @@ function _getTls() {
428
426
  cert: pems.cert,
429
427
  key: pems["private"]
430
428
  };
431
- return _context3.abrupt("return", tls);
432
- case 11:
433
- case "end":
434
- return _context3.stop();
429
+ return _context3.a(2, tls);
435
430
  }
436
431
  }, _callee3);
437
432
  }));
package/lib/index.js CHANGED
@@ -5,28 +5,30 @@ require("regenerator-runtime/runtime");
5
5
  var _fs = _interopRequireDefault(require("fs"));
6
6
  var _iService = _interopRequireDefault(require("./iService"));
7
7
  var _config = _interopRequireDefault(require("./config"));
8
+ var _yargs = _interopRequireDefault(require("yargs"));
9
+ var _helpers = require("yargs/helpers");
8
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
9
- /*
10
- * ------------------------------------------------------------------------------------
11
- * * Copyright (c) SAS Institute Inc.
12
- * * Licensed under the Apache License, Version 2.0 (the 'License');
13
- * * you may not use this file except in compliance with the License.
14
- * * You may obtain a copy of the License at
15
- * *
16
- * * http://www.apache.org/licenses/LICENSE-2.0
17
- * *
18
- * * Unless required by applicable law or agreed to in writing, software
19
- * * distributed under the License is distributed on an 'AS IS' BASIS,
20
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
- * * See the License for the specific language governing permissions and
22
- * limitations under the License.
23
- * ----------------------------------------------------------------------------------------
24
- *
11
+ /*
12
+ * ------------------------------------------------------------------------------------
13
+ * * Copyright (c) SAS Institute Inc.
14
+ * * Licensed under the Apache License, Version 2.0 (the 'License');
15
+ * * you may not use this file except in compliance with the License.
16
+ * * You may obtain a copy of the License at
17
+ * *
18
+ * * http://www.apache.org/licenses/LICENSE-2.0
19
+ * *
20
+ * * Unless required by applicable law or agreed to in writing, software
21
+ * * distributed under the License is distributed on an 'AS IS' BASIS,
22
+ * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
+ * * See the License for the specific language governing permissions and
24
+ * limitations under the License.
25
+ * ----------------------------------------------------------------------------------------
26
+ *
25
27
  */
26
28
 
27
29
  var debug = require("debug")("startup");
28
30
  module.exports = function core(uTable, useDefault, serverMode, customize, swaggerfcn) {
29
- var argv = require("yargs").argv;
31
+ var argv = (0, _yargs["default"])((0, _helpers.hideBin)(process.argv)).argv;
30
32
  var env = argv.env == null ? null : argv.env;
31
33
  var appenv = argv.appenv == null ? null : argv.appenv;
32
34
  var docker = argv.docker == null ? null : argv.docker;
@@ -94,10 +96,10 @@ function getAllEnv(userData) {
94
96
  host = null;
95
97
  }
96
98
 
97
- /*
98
- if (process.env.AUTHTYPE != null) {
99
- process.env.AUTHFLOW = process.env.AUTHTYPE;
100
- }
99
+ /*
100
+ if (process.env.AUTHTYPE != null) {
101
+ process.env.AUTHFLOW = process.env.AUTHTYPE;
102
+ }
101
103
  */
102
104
 
103
105
  var authflow = trimit("AUTHFLOW");
@@ -1,6 +1,6 @@
1
- /*
2
- * Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
- * SPDX-License-Identifier: Apache-2.0
1
+ /*
2
+ * Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  'use strict';
6
6
 
@@ -1,25 +1,25 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
4
+ 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); }
5
5
  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); }
6
6
  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); }); }; }
7
- /*
8
- * ------------------------------------------------------------------------------------
9
- * * Copyright (c) SAS Institute Inc.
10
- * * Licensed under the Apache License, Version 2.0 (the "License");
11
- * * you may not use this file except in compliance with the License.
12
- * * You may obtain a copy of the License at
13
- * *
14
- * * http://www.apache.org/licenses/LICENSE-2.0
15
- * *
16
- * * Unless required by applicable law or agreed to in writing, software
17
- * * distributed under the License is distributed on an "AS IS" BASIS,
18
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
- * * See the License for the specific language governing permissions and
20
- * limitations under the License.
21
- * ----------------------------------------------------------------------------------------
22
- *
7
+ /*
8
+ * ------------------------------------------------------------------------------------
9
+ * * Copyright (c) SAS Institute Inc.
10
+ * * Licensed under the Apache License, Version 2.0 (the "License");
11
+ * * you may not use this file except in compliance with the License.
12
+ * * You may obtain a copy of the License at
13
+ * *
14
+ * * http://www.apache.org/licenses/LICENSE-2.0
15
+ * *
16
+ * * Unless required by applicable law or agreed to in writing, software
17
+ * * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ * ----------------------------------------------------------------------------------------
22
+ *
23
23
  */
24
24
 
25
25
  var bell = require('@hapi/bell');
@@ -34,10 +34,10 @@ function iSASauth(_x, _x2) {
34
34
  return _iSASauth.apply(this, arguments);
35
35
  }
36
36
  function _iSASauth() {
37
- _iSASauth = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(server, options) {
37
+ _iSASauth = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(server, options) {
38
38
  var bellAuthOptions, provider, host;
39
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
40
- while (1) switch (_context2.prev = _context2.next) {
39
+ return _regenerator().w(function (_context2) {
40
+ while (1) switch (_context2.n) {
41
41
  case 0:
42
42
  debug('in iSASauth');
43
43
  debug('options', options);
@@ -58,15 +58,14 @@ function _iSASauth() {
58
58
  token: host + '/oauth/token',
59
59
  profileMethod: 'get',
60
60
  profile: function () {
61
- var _profile = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(credentials, params, get) {
62
- return _regeneratorRuntime().wrap(function _callee$(_context) {
63
- while (1) switch (_context.prev = _context.next) {
61
+ var _profile = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(credentials, params, get) {
62
+ return _regenerator().w(function (_context) {
63
+ while (1) switch (_context.n) {
64
64
  case 0:
65
65
  server.log('SASAuth profile', credentials);
66
66
  debug('credentials', credentials);
67
- case 2:
68
- case "end":
69
- return _context.stop();
67
+ case 1:
68
+ return _context.a(2);
70
69
  }
71
70
  }, _callee);
72
71
  }));
@@ -87,13 +86,12 @@ function _iSASauth() {
87
86
  // console.log('SASAuth options', bellAuthOptions);
88
87
  debug('belloptions', bellAuthOptions);
89
88
  server.log('SASAuth', bellAuthOptions);
90
- _context2.next = 11;
89
+ _context2.n = 1;
91
90
  return server.register(bell);
92
- case 11:
91
+ case 1:
93
92
  server.auth.strategy('sas', 'bell', bellAuthOptions);
94
- case 12:
95
- case "end":
96
- return _context2.stop();
93
+ case 2:
94
+ return _context2.a(2);
97
95
  }
98
96
  }, _callee2);
99
97
  }));