@equinor/echo-framework 0.8.8 → 0.9.2

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 (68) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +6 -6
  3. package/dist/{47deeba42768c5d1.svg → 063009f06499d102.svg} +8 -8
  4. package/dist/_virtual/_tslib.js +1 -1
  5. package/dist/components/contextualAppLinks/externalLinkButtons/externalLinkButtons.helpers.d.ts +1 -2
  6. package/dist/components/realTimeData/components/contextButton/RealTimeContextButton.d.ts +1 -0
  7. package/dist/components/realTimeData/components/contextPopover/Popover.d.ts +4 -1
  8. package/dist/hooks/hookLibrary.d.ts +1 -1
  9. package/dist/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js +2 -2
  10. package/dist/node_modules/@microsoft/signalr/dist/esm/Errors.js +3 -3
  11. package/dist/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js +6 -4
  12. package/dist/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js +16 -14
  13. package/dist/node_modules/@microsoft/signalr/dist/esm/HubConnection.js +14 -10
  14. package/dist/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js +14 -10
  15. package/dist/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js +8 -5
  16. package/dist/node_modules/@microsoft/signalr/dist/esm/Utils.js +5 -3
  17. package/dist/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js +6 -5
  18. package/dist/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js +2 -2
  19. package/dist/services/api/api-manager.d.ts +10 -1
  20. package/dist/services/api/api-tag-details.d.ts +1 -2
  21. package/dist/services/eventCallbacks/plantChanged.d.ts +1 -1
  22. package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkButtons.helpers.js +8 -8
  23. package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToCommApp.js +6 -4
  24. package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToMcApp.js +6 -4
  25. package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToProCoSys.js +4 -2
  26. package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToSap.js +4 -2
  27. package/dist/src/components/errorBoundary/errorBoundary.js +2 -2
  28. package/dist/src/components/externalLinkButton/externalLinkButton.js +4 -2
  29. package/dist/src/components/pageMenu/version/version.js +4 -2
  30. package/dist/src/components/plantSelector/plantSelector.js +4 -2
  31. package/dist/src/components/projectSelector/ProcosysProjectSelector.js +4 -2
  32. package/dist/src/components/realTimeData/RealTimePopoverButton.js +18 -2
  33. package/dist/src/components/realTimeData/components/connectorForIMSTag/RealTimeConnectorForIMSTag.js +14 -0
  34. package/dist/src/components/realTimeData/components/contextButton/RealTimeContextButton.js +4 -4
  35. package/dist/src/components/realTimeData/hooks/useRealTimeHub.js +4 -2
  36. package/dist/src/components/realTimeData/hooks/useSignalR.js +20 -6
  37. package/dist/src/hooks/useTagDetails.js +6 -4
  38. package/dist/src/icons/common/Evision.svg.js +1 -2
  39. package/dist/src/icons/common/Fusion.svg.js +1 -2
  40. package/dist/src/icons/common/McApp.svg.js +1 -2
  41. package/dist/src/icons/common/Notification.svg.js +1 -2
  42. package/dist/src/icons/common/ProCoSysIcon.svg.js +1 -2
  43. package/dist/src/icons/common/Robim.svg.js +1 -2
  44. package/dist/src/icons/common/SapLogo.svg.js +1 -2
  45. package/dist/src/icons/common/SemiIcon.svg.js +2 -3
  46. package/dist/src/icons/common/Stid.svg.js +1 -2
  47. package/dist/src/icons/common/TR2000.svg.js +1 -2
  48. package/dist/src/icons/common/WorkOrder.svg.js +1 -2
  49. package/dist/src/icons/common/Yammer.svg.js +1 -2
  50. package/dist/src/icons/equinor-logo.js +9 -9
  51. package/dist/src/index.js +31 -74
  52. package/dist/src/index2.js +201 -0
  53. package/dist/src/services/api/api-manager.js +111 -49
  54. package/dist/src/services/api/api-plantinfo.js +135 -14
  55. package/dist/src/services/api/api-plants.js +40 -5
  56. package/dist/src/services/api/api-realtimedata.js +15 -4
  57. package/dist/src/services/api/api-tag-details.js +8 -5
  58. package/dist/src/services/api/api-tags.js +61 -2
  59. package/dist/src/services/api/api-version.js +76 -10
  60. package/dist/src/services/eventCallbacks/plantChanged.js +6 -2
  61. package/dist/src/utils/copyText.js +6 -2
  62. package/dist/src/utils/plantInfo.js +24 -20
  63. package/dist/src/utils/startup.js +6 -4
  64. package/dist/src/utils/taskCache.js +89 -0
  65. package/dist/utils/navigationUtils.d.ts +1 -1
  66. package/dist/utils/taskCache.d.ts +23 -0
  67. package/dist/utils/taskCache.test.d.ts +1 -0
  68. package/package.json +118 -117
@@ -0,0 +1,201 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', {
4
+ value: true
5
+ });
6
+
7
+ require('./globalStyles.css.js');
8
+
9
+ var index$1 = require('./hooks/index.js');
10
+
11
+ var hookLibrary = require('./hooks/hookLibrary.js');
12
+
13
+ var apiPlantinfo = require('./services/api/api-plantinfo.js');
14
+
15
+ var apiTagDetails = require('./services/api/api-tag-details.js');
16
+
17
+ var componentRegistry = require('./services/componentRegistry/componentRegistry.js');
18
+
19
+ var legendUtils = require('./utils/legendUtils.js');
20
+
21
+ var navigationUtils = require('./utils/navigationUtils.js');
22
+
23
+ require('@equinor/echo-core');
24
+
25
+ require('react');
26
+
27
+ require('./components/appLinks/AppLinks.module.css.js');
28
+
29
+ require('@equinor/echo-components');
30
+
31
+ require('./components/containers/layout.module.css.js');
32
+
33
+ var externalLinkButton = require('./components/externalLinkButton/externalLinkButton.js');
34
+
35
+ require('./services/api/api-manager.js');
36
+
37
+ require('./services/echopediaAnalyticsModule/echopediaAnalyticsModule.js');
38
+
39
+ require('@equinor/echo-utils');
40
+
41
+ var pingableSources = require('./types/pingableSources.js');
42
+
43
+ var index = require('./components/contextualAppLinks/index.js');
44
+
45
+ require('./components/echoLogo/echoLogo.module.css.js');
46
+
47
+ var errorBoundary = require('./components/errorBoundary/errorBoundary.js');
48
+
49
+ var footer = require('./components/footer/footer.js');
50
+
51
+ require('@equinor/eds-core-react');
52
+
53
+ require('./components/lazyLoading/appLoadingIndicator.module.css.js');
54
+
55
+ require('@equinor/echo-base');
56
+
57
+ require('./components/pageMenu/accordionItem.module.css.js');
58
+
59
+ require('react-router-dom');
60
+
61
+ require('./components/pageMenu/Navigation/applicationList.module.css.js');
62
+
63
+ require('./components/pageMenu/pageMenu.module.css.js');
64
+
65
+ require('./components/pageMenu/pageMenuDrawerItem.module.css.js');
66
+
67
+ require('./components/pageMenu/settings/settings.module.css.js');
68
+
69
+ require('./components/pageMenu/version/version.module.css.js');
70
+
71
+ require('./components/panel/corePanelLeft.js');
72
+
73
+ require('./components/panel/corePanelRight.js');
74
+
75
+ var panelButton = require('./components/panelButton/panelButton.js');
76
+
77
+ require('./components/projectSelector/ProcosysProjectSelector.module.css.js');
78
+
79
+ require('@equinor/echo-search');
80
+
81
+ require('./components/realTimeData/components/connectorForIMSTag/IMSConnector.module.css.js');
82
+
83
+ require('../node_modules/@microsoft/signalr/dist/esm/ILogger.js');
84
+
85
+ require('../node_modules/@microsoft/signalr/dist/esm/Loggers.js');
86
+
87
+ require('../node_modules/@microsoft/signalr/dist/esm/HubConnection.js');
88
+
89
+ require('../node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js');
90
+
91
+ require('../node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js');
92
+
93
+ require('../node_modules/@microsoft/signalr/dist/esm/ITransport.js');
94
+
95
+ require('../node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js');
96
+
97
+ require('./components/realTimeData/components/contextPopover/Popover.module.css.js');
98
+
99
+ require('./components/realTimeData/components/contextButton/RealTimeContextButton.module.css.js');
100
+
101
+ require('./components/realTimeData/components/IMSDropdown/RealTimeIMSDropdown.module.css.js');
102
+
103
+ require('../node_modules/tiny-warning/dist/tiny-warning.esm.js');
104
+
105
+ require('../node_modules/tiny-invariant/dist/tiny-invariant.esm.js');
106
+
107
+ require('./components/searchMenu/searchMenu.module.css.js');
108
+
109
+ require('./components/tagNumber/tagNo.module.css.js');
110
+
111
+ require('./components/toaster/toaster.module.css.js');
112
+
113
+ require('./coreApplication/EchoEventHandler.module.css.js');
114
+
115
+ var extensions = require('./types/extensions.js');
116
+
117
+ var legend = require('./types/legend.js');
118
+
119
+ var registerEchopediaComponent = componentRegistry.componentRegistry.registerComponent;
120
+ var EchoFramework = Object.freeze({
121
+ Utils: Object.freeze({
122
+ Navigation: Object.freeze({
123
+ goToExternalLink: navigationUtils.goToExternalLink
124
+ }),
125
+ Color: Object.freeze({
126
+ getLegendStatusColor: legendUtils.getLegendStatusColor
127
+ })
128
+ }),
129
+ Hooks: Object.freeze(Object.assign(Object.assign({}, hookLibrary.HookLibrary), index$1)),
130
+ EchopediaComponentLibrary: Object.freeze({
131
+ getTagItem: componentRegistry.componentRegistry.getTagItem
132
+ }),
133
+ APIs: Object.freeze({
134
+ getPlantsInfo: apiPlantinfo.getPlantsInfo,
135
+ getTagDetails: apiTagDetails.getTagDetails
136
+ })
137
+ });
138
+ Object.defineProperty(exports, 'RegisteredHookName', {
139
+ enumerable: true,
140
+ get: function get() {
141
+ return hookLibrary.RegisteredHookName;
142
+ }
143
+ });
144
+ Object.defineProperty(exports, 'RegisteredComponentName', {
145
+ enumerable: true,
146
+ get: function get() {
147
+ return componentRegistry.RegisteredComponentName;
148
+ }
149
+ });
150
+ exports.getLegendStatusColor = legendUtils.getLegendStatusColor;
151
+ exports.legendTypeToLegendStatus = legendUtils.legendTypeToLegendStatus;
152
+ exports.valueToEnum = legendUtils.valueToEnum;
153
+ exports.goToExternalLink = navigationUtils.goToExternalLink;
154
+ exports.ExternalLinkButton = externalLinkButton.ExternalLinkButton;
155
+ Object.defineProperty(exports, 'ExternalLinkButtonStyle', {
156
+ enumerable: true,
157
+ get: function get() {
158
+ return externalLinkButton.ExternalLinkButtonStyle;
159
+ }
160
+ });
161
+ Object.defineProperty(exports, 'PingableSources', {
162
+ enumerable: true,
163
+ get: function get() {
164
+ return pingableSources.PingableSources;
165
+ }
166
+ });
167
+ exports.ContextualAppLinks = index.ContextualAppLinks;
168
+ exports.ErrorBoundary = errorBoundary.ErrorBoundary;
169
+ exports.Footer = footer.Footer;
170
+ Object.defineProperty(exports, 'FooterType', {
171
+ enumerable: true,
172
+ get: function get() {
173
+ return footer.FooterType;
174
+ }
175
+ });
176
+ Object.defineProperty(exports, 'Variants', {
177
+ enumerable: true,
178
+ get: function get() {
179
+ return panelButton.Variants;
180
+ }
181
+ });
182
+ Object.defineProperty(exports, 'ExtendableComponentName', {
183
+ enumerable: true,
184
+ get: function get() {
185
+ return extensions.ExtendableComponentName;
186
+ }
187
+ });
188
+ Object.defineProperty(exports, 'LegendStatus', {
189
+ enumerable: true,
190
+ get: function get() {
191
+ return legend.LegendStatus;
192
+ }
193
+ });
194
+ Object.defineProperty(exports, 'LegendType', {
195
+ enumerable: true,
196
+ get: function get() {
197
+ return legend.LegendType;
198
+ }
199
+ });
200
+ exports["default"] = EchoFramework;
201
+ exports.registerEchopediaComponent = registerEchopediaComponent;
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ 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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
4
+
3
5
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
6
 
5
7
  Object.defineProperty(exports, '__esModule', {
@@ -12,6 +14,8 @@ var echoBase = require('@equinor/echo-base');
12
14
 
13
15
  var EchoCore = require('@equinor/echo-core');
14
16
 
17
+ var taskCache = require('../../utils/taskCache.js');
18
+
15
19
  function _interopDefaultLegacy(e) {
16
20
  return e && _typeof(e) === 'object' && 'default' in e ? e : {
17
21
  'default': e
@@ -21,106 +25,164 @@ function _interopDefaultLegacy(e) {
21
25
  var EchoCore__default = /*#__PURE__*/_interopDefaultLegacy(EchoCore);
22
26
 
23
27
  var baseApiUrl = EchoCore.EchoEnv.env().REACT_APP_API_URL;
28
+ var oneHourInMs = 1000 * 60 * 60;
29
+ var Cache = new taskCache.TaskCache({
30
+ maxItems: 20,
31
+ defaultTimeToLiveMilliseconds: oneHourInMs * 4
32
+ });
24
33
 
25
- function request(url, requestType, abortSignal) {
26
- return _tslib.__awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
27
- var response, contentType, text;
28
- return regeneratorRuntime.wrap(function _callee$(_context) {
34
+ function request(_ref) {
35
+ var cache = _ref.cache,
36
+ url = _ref.url,
37
+ abortSignal = _ref.abortSignal;
38
+ return _tslib.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
39
+ var currentRequest;
40
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
29
41
  while (1) {
30
42
  switch (_context.prev = _context.next) {
31
43
  case 0:
32
- _context.next = 2;
44
+ currentRequest = Cache.get(url);
45
+
46
+ if (currentRequest) {
47
+ _context.next = 13;
48
+ break;
49
+ }
50
+
51
+ _context.prev = 2;
52
+ currentRequest = {
53
+ task: runRequest(url, abortSignal),
54
+ key: url,
55
+ timeToLiveMilliseconds: cache.timeToLiveMilliseconds
56
+ };
57
+
58
+ if (cache.isEnabled) {
59
+ Cache.add(currentRequest);
60
+ }
61
+
62
+ _context.next = 7;
63
+ return currentRequest.task;
64
+
65
+ case 7:
66
+ _context.next = 13;
67
+ break;
68
+
69
+ case 9:
70
+ _context.prev = 9;
71
+ _context.t0 = _context["catch"](2);
72
+
73
+ if (cache.isEnabled && currentRequest) {
74
+ currentRequest.timeToLiveMilliseconds = 1000 * 10; //we should be able to retry after 10 seconds if error
75
+
76
+ Cache.add(currentRequest);
77
+ }
78
+
79
+ throw _context.t0;
80
+
81
+ case 13:
82
+ _context.next = 15;
83
+ return currentRequest.task;
84
+
85
+ case 15:
86
+ return _context.abrupt("return", _context.sent);
87
+
88
+ case 16:
89
+ case "end":
90
+ return _context.stop();
91
+ }
92
+ }
93
+ }, _callee, null, [[2, 9]]);
94
+ }));
95
+ }
96
+
97
+ function runRequest(url, abortSignal) {
98
+ return _tslib.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
99
+ var response, contentType, text;
100
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
101
+ while (1) {
102
+ switch (_context2.prev = _context2.next) {
103
+ case 0:
104
+ _context2.next = 2;
33
105
  return EchoCore__default["default"].EchoClient.fetch(url, undefined, undefined, undefined, abortSignal);
34
106
 
35
107
  case 2:
36
- response = _context.sent;
108
+ response = _context2.sent;
37
109
  contentType = response.headers.get('content-type');
38
110
 
39
111
  if (!((response.status === 200 || response.status === 202) && contentType && contentType.indexOf('application/json') !== -1)) {
40
- _context.next = 18;
112
+ _context2.next = 16;
41
113
  break;
42
114
  }
43
115
 
44
- _context.prev = 5;
45
- _context.t0 = JSON;
46
- _context.next = 9;
116
+ _context2.prev = 5;
117
+ _context2.t0 = JSON;
118
+ _context2.next = 9;
47
119
  return response.text();
48
120
 
49
121
  case 9:
50
- _context.t1 = _context.sent;
51
- requestType = _context.t0.parse.call(_context.t0, _context.t1);
52
- _context.next = 16;
53
- break;
122
+ _context2.t1 = _context2.sent;
123
+ return _context2.abrupt("return", _context2.t0.parse.call(_context2.t0, _context2.t1));
54
124
 
55
125
  case 13:
56
- _context.prev = 13;
57
- _context.t2 = _context["catch"](5);
126
+ _context2.prev = 13;
127
+ _context2.t2 = _context2["catch"](5);
58
128
  throw new echoBase.BaseError({
59
129
  name: '[framework.api-manager.request]',
60
130
  message: 'Could not parse JSON',
61
131
  innerError: {
62
- parseError: _context.t2,
132
+ parseError: _context2.t2,
63
133
  url: url
64
134
  }
65
135
  });
66
136
 
67
137
  case 16:
68
- _context.next = 39;
69
- break;
70
-
71
- case 18:
72
138
  if (!((response.status === 200 || response.status === 202) && contentType && contentType.indexOf('text/plain') !== -1)) {
73
- _context.next = 25;
139
+ _context2.next = 21;
74
140
  break;
75
141
  }
76
142
 
77
- _context.next = 21;
143
+ _context2.next = 19;
78
144
  return response.text();
79
145
 
80
- case 21:
81
- text = _context.sent;
82
- requestType = text;
83
- _context.next = 39;
84
- break;
146
+ case 19:
147
+ text = _context2.sent;
148
+ return _context2.abrupt("return", text);
85
149
 
86
- case 25:
150
+ case 21:
87
151
  if (!((response.status === 200 || response.status === 202) && contentType && contentType.indexOf('image/') >= 0 || contentType && contentType.indexOf('video/') >= 0)) {
88
- _context.next = 39;
152
+ _context2.next = 35;
89
153
  break;
90
154
  }
91
155
 
92
- _context.prev = 26;
93
- _context.next = 29;
156
+ _context2.prev = 22;
157
+ _context2.next = 25;
94
158
  return response.arrayBuffer();
95
159
 
96
- case 29:
97
- requestType = _context.sent;
98
- _context.next = 39;
99
- break;
160
+ case 25:
161
+ return _context2.abrupt("return", _context2.sent);
100
162
 
101
- case 32:
102
- _context.prev = 32;
103
- _context.t3 = _context["catch"](26);
163
+ case 28:
164
+ _context2.prev = 28;
165
+ _context2.t3 = _context2["catch"](22);
104
166
 
105
- if (!(typeof _context.t3 === 'string')) {
106
- _context.next = 38;
167
+ if (!(typeof _context2.t3 === 'string')) {
168
+ _context2.next = 34;
107
169
  break;
108
170
  }
109
171
 
110
- throw new Error(_context.t3);
172
+ throw new Error(_context2.t3);
111
173
 
112
- case 38:
113
- throw new Error("Unknown error while processing request. The exception in string format: ".concat(JSON.stringify(_context.t3)));
174
+ case 34:
175
+ throw new Error("Unknown error while processing request. The exception in string format: ".concat(JSON.stringify(_context2.t3)));
114
176
 
115
- case 39:
116
- return _context.abrupt("return", requestType);
177
+ case 35:
178
+ return _context2.abrupt("return", undefined);
117
179
 
118
- case 40:
180
+ case 36:
119
181
  case "end":
120
- return _context.stop();
182
+ return _context2.stop();
121
183
  }
122
184
  }
123
- }, _callee, null, [[5, 13], [26, 32]]);
185
+ }, _callee2, null, [[5, 13], [22, 28]]);
124
186
  }));
125
187
  }
126
188
 
@@ -1,5 +1,9 @@
1
1
  'use strict';
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ 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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
6
+
3
7
  Object.defineProperty(exports, '__esModule', {
4
8
  value: true
5
9
  });
@@ -8,10 +12,14 @@ var _tslib = require('../../../_virtual/_tslib.js');
8
12
 
9
13
  var apiManager = require('./api-manager.js');
10
14
 
15
+ var tenMinutesInMs = 1000 * 60 * 10;
16
+
11
17
  function getPlantsInfo(instCode) {
12
- return _tslib.__awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
18
+ var _a;
19
+
20
+ return _tslib.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
13
21
  var url;
14
- return regeneratorRuntime.wrap(function _callee$(_context) {
22
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
15
23
  while (1) {
16
24
  switch (_context.prev = _context.next) {
17
25
  case 0:
@@ -21,9 +29,42 @@ function getPlantsInfo(instCode) {
21
29
  url += "?instCode=".concat(instCode);
22
30
  }
23
31
 
24
- return _context.abrupt("return", apiManager.request(url, []));
32
+ _context.next = 4;
33
+ return apiManager.request({
34
+ url: url,
35
+ cache: {
36
+ isEnabled: true
37
+ }
38
+ });
39
+
40
+ case 4:
41
+ _context.t1 = _a = _context.sent;
42
+ _context.t0 = _context.t1 !== null;
43
+
44
+ if (!_context.t0) {
45
+ _context.next = 8;
46
+ break;
47
+ }
48
+
49
+ _context.t0 = _a !== void 0;
50
+
51
+ case 8:
52
+ if (!_context.t0) {
53
+ _context.next = 12;
54
+ break;
55
+ }
56
+
57
+ _context.t2 = _a;
58
+ _context.next = 13;
59
+ break;
60
+
61
+ case 12:
62
+ _context.t2 = [];
25
63
 
26
- case 3:
64
+ case 13:
65
+ return _context.abrupt("return", _context.t2);
66
+
67
+ case 14:
27
68
  case "end":
28
69
  return _context.stop();
29
70
  }
@@ -33,16 +74,56 @@ function getPlantsInfo(instCode) {
33
74
  }
34
75
 
35
76
  function check3dPermissionForPlant(plantCode) {
36
- return _tslib.__awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
37
- var url;
38
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
77
+ var _a;
78
+
79
+ return _tslib.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
80
+ var url, defaultValue;
81
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
39
82
  while (1) {
40
83
  switch (_context2.prev = _context2.next) {
41
84
  case 0:
42
85
  url = "".concat(apiManager.baseApiUrl, "/echo-3d-model/platform/access/").concat(plantCode);
43
- return _context2.abrupt("return", apiManager.request(url, {}));
86
+ defaultValue = {
87
+ plantCodes: [],
88
+ timestamp: new Date()
89
+ };
90
+ _context2.next = 4;
91
+ return apiManager.request({
92
+ url: url,
93
+ cache: {
94
+ isEnabled: true,
95
+ timeToLiveMilliseconds: tenMinutesInMs
96
+ }
97
+ });
98
+
99
+ case 4:
100
+ _context2.t1 = _a = _context2.sent;
101
+ _context2.t0 = _context2.t1 !== null;
102
+
103
+ if (!_context2.t0) {
104
+ _context2.next = 8;
105
+ break;
106
+ }
44
107
 
45
- case 2:
108
+ _context2.t0 = _a !== void 0;
109
+
110
+ case 8:
111
+ if (!_context2.t0) {
112
+ _context2.next = 12;
113
+ break;
114
+ }
115
+
116
+ _context2.t2 = _a;
117
+ _context2.next = 13;
118
+ break;
119
+
120
+ case 12:
121
+ _context2.t2 = defaultValue;
122
+
123
+ case 13:
124
+ return _context2.abrupt("return", _context2.t2);
125
+
126
+ case 14:
46
127
  case "end":
47
128
  return _context2.stop();
48
129
  }
@@ -52,16 +133,56 @@ function check3dPermissionForPlant(plantCode) {
52
133
  }
53
134
 
54
135
  function getPermitted3dModels() {
55
- return _tslib.__awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
56
- var url;
57
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
136
+ var _a;
137
+
138
+ return _tslib.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
139
+ var url, defaultValue;
140
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
58
141
  while (1) {
59
142
  switch (_context3.prev = _context3.next) {
60
143
  case 0:
61
144
  url = "".concat(apiManager.baseApiUrl, "/echo-3d-model/platform/access");
62
- return _context3.abrupt("return", apiManager.request(url, {}));
145
+ defaultValue = {
146
+ plantCodes: [],
147
+ timestamp: new Date()
148
+ };
149
+ _context3.next = 4;
150
+ return apiManager.request({
151
+ url: url,
152
+ cache: {
153
+ isEnabled: true,
154
+ timeToLiveMilliseconds: tenMinutesInMs
155
+ }
156
+ });
157
+
158
+ case 4:
159
+ _context3.t1 = _a = _context3.sent;
160
+ _context3.t0 = _context3.t1 !== null;
161
+
162
+ if (!_context3.t0) {
163
+ _context3.next = 8;
164
+ break;
165
+ }
166
+
167
+ _context3.t0 = _a !== void 0;
168
+
169
+ case 8:
170
+ if (!_context3.t0) {
171
+ _context3.next = 12;
172
+ break;
173
+ }
174
+
175
+ _context3.t2 = _a;
176
+ _context3.next = 13;
177
+ break;
178
+
179
+ case 12:
180
+ _context3.t2 = defaultValue;
181
+
182
+ case 13:
183
+ return _context3.abrupt("return", _context3.t2);
63
184
 
64
- case 2:
185
+ case 14:
65
186
  case "end":
66
187
  return _context3.stop();
67
188
  }