@equinor/echo-framework 0.7.3 → 0.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__tests__/realTimeDataHooks.test.d.ts +1 -0
- package/dist/__tests__/realTimeDataUtils.test.d.ts +1 -0
- package/dist/_virtual/_tslib.js +14 -0
- package/dist/components/errorBoundary/errorBoundary.d.ts +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/panel/corePanelLeft.d.ts +4 -1
- package/dist/components/panel/corePanelRight.d.ts +4 -1
- package/dist/components/realTimeData/RealTimePopoverButton.d.ts +18 -0
- package/dist/components/realTimeData/components/IMSDropdown/RealTimeIMSDropdown.d.ts +7 -0
- package/dist/components/realTimeData/components/IMSDropdown/index.d.ts +1 -0
- package/dist/components/realTimeData/components/connectorForIMSTag/RealTimeConnectorForIMSTag.d.ts +6 -0
- package/dist/components/realTimeData/components/connectorForIMSTag/index.d.ts +1 -0
- package/dist/components/realTimeData/components/contextButton/RealTimeContextButton.d.ts +6 -0
- package/dist/components/realTimeData/components/contextButton/index.d.ts +1 -0
- package/dist/components/realTimeData/components/contextPopover/Popover.d.ts +6 -0
- package/dist/components/realTimeData/components/contextPopover/index.d.ts +1 -0
- package/dist/components/realTimeData/components/index.d.ts +4 -0
- package/dist/components/realTimeData/hooks/index.d.ts +3 -0
- package/dist/components/realTimeData/hooks/useRealTimeHub.d.ts +13 -0
- package/dist/components/realTimeData/hooks/useSignalR.d.ts +9 -0
- package/dist/components/realTimeData/hooks/useSignalRListener.d.ts +4 -0
- package/dist/components/realTimeData/index.d.ts +1 -0
- package/dist/coreApplication/EchoBarComponent.d.ts +6 -0
- package/dist/coreApplication/EchoContent.d.ts +1 -0
- package/dist/coreApplication/index.d.ts +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useIsLandscape.d.ts +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/node_modules/@microsoft/signalr/dist/esm/AbortController.js +54 -0
- package/dist/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js +96 -0
- package/dist/node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js +47 -0
- package/dist/node_modules/@microsoft/signalr/dist/esm/Errors.js +287 -0
- package/dist/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js +281 -0
- package/dist/node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js +86 -0
- package/dist/node_modules/@microsoft/signalr/dist/esm/HeaderNames.js +20 -0
- package/dist/node_modules/@microsoft/signalr/dist/esm/HttpClient.js +82 -0
- package/dist/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js +1167 -0
- package/dist/node_modules/@microsoft/signalr/dist/esm/HubConnection.js +1342 -0
- package/dist/node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js +165 -0
- package/dist/node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js +33 -0
- package/dist/node_modules/@microsoft/signalr/dist/esm/ILogger.js +37 -0
- package/dist/node_modules/@microsoft/signalr/dist/esm/ITransport.js +37 -0
- package/dist/node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js +179 -0
- package/dist/node_modules/@microsoft/signalr/dist/esm/Loggers.js +35 -0
- package/dist/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js +444 -0
- package/dist/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js +235 -0
- package/dist/node_modules/@microsoft/signalr/dist/esm/Subject.js +99 -0
- package/dist/node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js +45 -0
- package/dist/node_modules/@microsoft/signalr/dist/esm/Utils.js +433 -0
- package/dist/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js +263 -0
- package/dist/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js +133 -0
- package/dist/services/api/api-realtimedata.d.ts +2 -0
- package/dist/src/components/containers/layout.module.css.js +4 -1
- package/dist/src/components/containers/layouts.js +38 -8
- package/dist/src/components/panel/corePanelLeft.js +5 -2
- package/dist/src/components/panel/corePanelLeft.module.css.js +1 -1
- package/dist/src/components/panel/corePanelRight.js +4 -2
- package/dist/src/components/panel/corePanelRight.module.css.js +1 -1
- package/dist/src/components/projectSelector/ProcosysProjectSelector.js +1 -1
- package/dist/src/components/realTimeData/RealTimePopoverButton.js +136 -0
- package/dist/src/components/realTimeData/components/IMSDropdown/RealTimeIMSDropdown.js +81 -0
- package/dist/src/components/realTimeData/components/IMSDropdown/RealTimeIMSDropdown.module.css.js +15 -0
- package/dist/src/components/realTimeData/components/connectorForIMSTag/IMSConnector.module.css.js +16 -0
- package/dist/src/components/realTimeData/components/connectorForIMSTag/RealTimeConnectorForIMSTag.js +110 -0
- package/dist/src/components/realTimeData/components/contextButton/RealTimeContextButton.js +75 -0
- package/dist/src/components/realTimeData/components/contextButton/RealTimeContextButton.module.css.js +15 -0
- package/dist/src/components/realTimeData/components/contextPopover/Popover.js +37 -0
- package/dist/src/components/realTimeData/components/contextPopover/Popover.module.css.js +15 -0
- package/dist/src/components/realTimeData/hooks/useRealTimeHub.js +122 -0
- package/dist/src/components/realTimeData/hooks/useSignalR.js +159 -0
- package/dist/src/components/realTimeData/hooks/useSignalRListener.js +22 -0
- package/dist/src/coreApplication/EchoBarComponent.js +113 -0
- package/dist/src/coreApplication/EchoContent.js +7 -2
- package/dist/src/hooks/useIsLandscape.js +52 -0
- package/dist/src/index.js +9 -0
- package/dist/src/services/api/api-realtimedata.js +42 -0
- package/dist/types/realtimedata.d.ts +18 -0
- package/package.json +30 -27
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
4
|
+
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
+
|
|
9
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
10
|
+
|
|
11
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
12
|
+
|
|
13
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
14
|
+
|
|
15
|
+
Object.defineProperty(exports, '__esModule', {
|
|
16
|
+
value: true
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
var Utils = require('./Utils.js'); // Licensed to the .NET Foundation under one or more agreements.
|
|
20
|
+
|
|
21
|
+
/** Stream implementation to stream items to the server. */
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
var Subject = /*#__PURE__*/function () {
|
|
25
|
+
function Subject() {
|
|
26
|
+
_classCallCheck(this, Subject);
|
|
27
|
+
|
|
28
|
+
this.observers = [];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
_createClass(Subject, [{
|
|
32
|
+
key: "next",
|
|
33
|
+
value: function next(item) {
|
|
34
|
+
var _iterator = _createForOfIteratorHelper(this.observers),
|
|
35
|
+
_step;
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
39
|
+
var observer = _step.value;
|
|
40
|
+
observer.next(item);
|
|
41
|
+
}
|
|
42
|
+
} catch (err) {
|
|
43
|
+
_iterator.e(err);
|
|
44
|
+
} finally {
|
|
45
|
+
_iterator.f();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}, {
|
|
49
|
+
key: "error",
|
|
50
|
+
value: function error(err) {
|
|
51
|
+
var _iterator2 = _createForOfIteratorHelper(this.observers),
|
|
52
|
+
_step2;
|
|
53
|
+
|
|
54
|
+
try {
|
|
55
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
56
|
+
var observer = _step2.value;
|
|
57
|
+
|
|
58
|
+
if (observer.error) {
|
|
59
|
+
observer.error(err);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
} catch (err) {
|
|
63
|
+
_iterator2.e(err);
|
|
64
|
+
} finally {
|
|
65
|
+
_iterator2.f();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}, {
|
|
69
|
+
key: "complete",
|
|
70
|
+
value: function complete() {
|
|
71
|
+
var _iterator3 = _createForOfIteratorHelper(this.observers),
|
|
72
|
+
_step3;
|
|
73
|
+
|
|
74
|
+
try {
|
|
75
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
76
|
+
var observer = _step3.value;
|
|
77
|
+
|
|
78
|
+
if (observer.complete) {
|
|
79
|
+
observer.complete();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
} catch (err) {
|
|
83
|
+
_iterator3.e(err);
|
|
84
|
+
} finally {
|
|
85
|
+
_iterator3.f();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}, {
|
|
89
|
+
key: "subscribe",
|
|
90
|
+
value: function subscribe(observer) {
|
|
91
|
+
this.observers.push(observer);
|
|
92
|
+
return new Utils.SubjectSubscription(this, observer);
|
|
93
|
+
}
|
|
94
|
+
}]);
|
|
95
|
+
|
|
96
|
+
return Subject;
|
|
97
|
+
}();
|
|
98
|
+
|
|
99
|
+
exports.Subject = Subject;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
|
+
|
|
5
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
6
|
+
|
|
7
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, '__esModule', {
|
|
10
|
+
value: true
|
|
11
|
+
}); // Licensed to the .NET Foundation under one or more agreements.
|
|
12
|
+
// The .NET Foundation licenses this file to you under the MIT license.
|
|
13
|
+
// Not exported from index
|
|
14
|
+
|
|
15
|
+
/** @private */
|
|
16
|
+
|
|
17
|
+
var TextMessageFormat = /*#__PURE__*/function () {
|
|
18
|
+
function TextMessageFormat() {
|
|
19
|
+
_classCallCheck(this, TextMessageFormat);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
_createClass(TextMessageFormat, null, [{
|
|
23
|
+
key: "write",
|
|
24
|
+
value: function write(output) {
|
|
25
|
+
return "".concat(output).concat(TextMessageFormat.RecordSeparator);
|
|
26
|
+
}
|
|
27
|
+
}, {
|
|
28
|
+
key: "parse",
|
|
29
|
+
value: function parse(input) {
|
|
30
|
+
if (input[input.length - 1] !== TextMessageFormat.RecordSeparator) {
|
|
31
|
+
throw new Error("Message is incomplete.");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
var messages = input.split(TextMessageFormat.RecordSeparator);
|
|
35
|
+
messages.pop();
|
|
36
|
+
return messages;
|
|
37
|
+
}
|
|
38
|
+
}]);
|
|
39
|
+
|
|
40
|
+
return TextMessageFormat;
|
|
41
|
+
}();
|
|
42
|
+
|
|
43
|
+
TextMessageFormat.RecordSeparatorCode = 0x1e;
|
|
44
|
+
TextMessageFormat.RecordSeparator = String.fromCharCode(TextMessageFormat.RecordSeparatorCode);
|
|
45
|
+
exports.TextMessageFormat = TextMessageFormat;
|
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
|
|
9
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
+
|
|
11
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
12
|
+
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
14
|
+
|
|
15
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
16
|
+
|
|
17
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
|
+
|
|
19
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
20
|
+
|
|
21
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
22
|
+
|
|
23
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
24
|
+
|
|
25
|
+
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); }
|
|
26
|
+
|
|
27
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
28
|
+
|
|
29
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
30
|
+
|
|
31
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
32
|
+
|
|
33
|
+
Object.defineProperty(exports, '__esModule', {
|
|
34
|
+
value: true
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
var ILogger = require('./ILogger.js');
|
|
38
|
+
|
|
39
|
+
var Loggers = require('./Loggers.js'); // Licensed to the .NET Foundation under one or more agreements.
|
|
40
|
+
// Version token that will be replaced by the prepack command
|
|
41
|
+
|
|
42
|
+
/** The version of the SignalR client. */
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
var VERSION = "6.0.2";
|
|
46
|
+
/** @private */
|
|
47
|
+
|
|
48
|
+
var Arg = /*#__PURE__*/function () {
|
|
49
|
+
function Arg() {
|
|
50
|
+
_classCallCheck(this, Arg);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
_createClass(Arg, null, [{
|
|
54
|
+
key: "isRequired",
|
|
55
|
+
value: function isRequired(val, name) {
|
|
56
|
+
if (val === null || val === undefined) {
|
|
57
|
+
throw new Error("The '".concat(name, "' argument is required."));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
key: "isNotEmpty",
|
|
62
|
+
value: function isNotEmpty(val, name) {
|
|
63
|
+
if (!val || val.match(/^\s*$/)) {
|
|
64
|
+
throw new Error("The '".concat(name, "' argument should not be empty."));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}, {
|
|
68
|
+
key: "isIn",
|
|
69
|
+
value: function isIn(val, values, name) {
|
|
70
|
+
// TypeScript enums have keys for **both** the name and the value of each enum member on the type itself.
|
|
71
|
+
if (!(val in values)) {
|
|
72
|
+
throw new Error("Unknown ".concat(name, " value: ").concat(val, "."));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}]);
|
|
76
|
+
|
|
77
|
+
return Arg;
|
|
78
|
+
}();
|
|
79
|
+
/** @private */
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
var Platform = /*#__PURE__*/function () {
|
|
83
|
+
function Platform() {
|
|
84
|
+
_classCallCheck(this, Platform);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
_createClass(Platform, null, [{
|
|
88
|
+
key: "isBrowser",
|
|
89
|
+
get: // react-native has a window but no document so we should check both
|
|
90
|
+
function get() {
|
|
91
|
+
return (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" && _typeof(window.document) === "object";
|
|
92
|
+
} // WebWorkers don't have a window object so the isBrowser check would fail
|
|
93
|
+
|
|
94
|
+
}, {
|
|
95
|
+
key: "isWebWorker",
|
|
96
|
+
get: function get() {
|
|
97
|
+
return (typeof self === "undefined" ? "undefined" : _typeof(self)) === "object" && "importScripts" in self;
|
|
98
|
+
} // react-native has a window but no document
|
|
99
|
+
|
|
100
|
+
}, {
|
|
101
|
+
key: "isReactNative",
|
|
102
|
+
get: function get() {
|
|
103
|
+
return (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" && typeof window.document === "undefined";
|
|
104
|
+
} // Node apps shouldn't have a window object, but WebWorkers don't either
|
|
105
|
+
// so we need to check for both WebWorker and window
|
|
106
|
+
|
|
107
|
+
}, {
|
|
108
|
+
key: "isNode",
|
|
109
|
+
get: function get() {
|
|
110
|
+
return !this.isBrowser && !this.isWebWorker && !this.isReactNative;
|
|
111
|
+
}
|
|
112
|
+
}]);
|
|
113
|
+
|
|
114
|
+
return Platform;
|
|
115
|
+
}();
|
|
116
|
+
/** @private */
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
function getDataDetail(data, includeContent) {
|
|
120
|
+
var detail = "";
|
|
121
|
+
|
|
122
|
+
if (isArrayBuffer(data)) {
|
|
123
|
+
detail = "Binary data of length ".concat(data.byteLength);
|
|
124
|
+
|
|
125
|
+
if (includeContent) {
|
|
126
|
+
detail += ". Content: '".concat(formatArrayBuffer(data), "'");
|
|
127
|
+
}
|
|
128
|
+
} else if (typeof data === "string") {
|
|
129
|
+
detail = "String data of length ".concat(data.length);
|
|
130
|
+
|
|
131
|
+
if (includeContent) {
|
|
132
|
+
detail += ". Content: '".concat(data, "'");
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return detail;
|
|
137
|
+
}
|
|
138
|
+
/** @private */
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
function formatArrayBuffer(data) {
|
|
142
|
+
var view = new Uint8Array(data); // Uint8Array.map only supports returning another Uint8Array?
|
|
143
|
+
|
|
144
|
+
var str = "";
|
|
145
|
+
view.forEach(function (num) {
|
|
146
|
+
var pad = num < 16 ? "0" : "";
|
|
147
|
+
str += "0x".concat(pad).concat(num.toString(16), " ");
|
|
148
|
+
}); // Trim of trailing space.
|
|
149
|
+
|
|
150
|
+
return str.substr(0, str.length - 1);
|
|
151
|
+
} // Also in signalr-protocol-msgpack/Utils.ts
|
|
152
|
+
|
|
153
|
+
/** @private */
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
function isArrayBuffer(val) {
|
|
157
|
+
return val && typeof ArrayBuffer !== "undefined" && (val instanceof ArrayBuffer || // Sometimes we get an ArrayBuffer that doesn't satisfy instanceof
|
|
158
|
+
val.constructor && val.constructor.name === "ArrayBuffer");
|
|
159
|
+
}
|
|
160
|
+
/** @private */
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
function sendMessage(_x, _x2, _x3, _x4, _x5, _x6, _x7) {
|
|
164
|
+
return _sendMessage.apply(this, arguments);
|
|
165
|
+
}
|
|
166
|
+
/** @private */
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
function _sendMessage() {
|
|
170
|
+
_sendMessage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(logger, transportName, httpClient, url, accessTokenFactory, content, options) {
|
|
171
|
+
var headers, token, _getUserAgentHeader, _getUserAgentHeader2, name, value, responseType, response;
|
|
172
|
+
|
|
173
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
174
|
+
while (1) {
|
|
175
|
+
switch (_context.prev = _context.next) {
|
|
176
|
+
case 0:
|
|
177
|
+
headers = {};
|
|
178
|
+
|
|
179
|
+
if (!accessTokenFactory) {
|
|
180
|
+
_context.next = 6;
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
_context.next = 4;
|
|
185
|
+
return accessTokenFactory();
|
|
186
|
+
|
|
187
|
+
case 4:
|
|
188
|
+
token = _context.sent;
|
|
189
|
+
|
|
190
|
+
if (token) {
|
|
191
|
+
headers = _defineProperty({}, "Authorization", "Bearer ".concat(token));
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
case 6:
|
|
195
|
+
_getUserAgentHeader = getUserAgentHeader(), _getUserAgentHeader2 = _slicedToArray(_getUserAgentHeader, 2), name = _getUserAgentHeader2[0], value = _getUserAgentHeader2[1];
|
|
196
|
+
headers[name] = value;
|
|
197
|
+
logger.log(ILogger.LogLevel.Trace, "(".concat(transportName, " transport) sending data. ").concat(getDataDetail(content, options.logMessageContent), "."));
|
|
198
|
+
responseType = isArrayBuffer(content) ? "arraybuffer" : "text";
|
|
199
|
+
_context.next = 12;
|
|
200
|
+
return httpClient.post(url, {
|
|
201
|
+
content: content,
|
|
202
|
+
headers: _objectSpread(_objectSpread({}, headers), options.headers),
|
|
203
|
+
responseType: responseType,
|
|
204
|
+
timeout: options.timeout,
|
|
205
|
+
withCredentials: options.withCredentials
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
case 12:
|
|
209
|
+
response = _context.sent;
|
|
210
|
+
logger.log(ILogger.LogLevel.Trace, "(".concat(transportName, " transport) request complete. Response status: ").concat(response.statusCode, "."));
|
|
211
|
+
|
|
212
|
+
case 14:
|
|
213
|
+
case "end":
|
|
214
|
+
return _context.stop();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}, _callee);
|
|
218
|
+
}));
|
|
219
|
+
return _sendMessage.apply(this, arguments);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function createLogger(logger) {
|
|
223
|
+
if (logger === undefined) {
|
|
224
|
+
return new ConsoleLogger(ILogger.LogLevel.Information);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (logger === null) {
|
|
228
|
+
return Loggers.NullLogger.instance;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (logger.log !== undefined) {
|
|
232
|
+
return logger;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return new ConsoleLogger(logger);
|
|
236
|
+
}
|
|
237
|
+
/** @private */
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
var SubjectSubscription = /*#__PURE__*/function () {
|
|
241
|
+
function SubjectSubscription(subject, observer) {
|
|
242
|
+
_classCallCheck(this, SubjectSubscription);
|
|
243
|
+
|
|
244
|
+
this._subject = subject;
|
|
245
|
+
this._observer = observer;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
_createClass(SubjectSubscription, [{
|
|
249
|
+
key: "dispose",
|
|
250
|
+
value: function dispose() {
|
|
251
|
+
var index = this._subject.observers.indexOf(this._observer);
|
|
252
|
+
|
|
253
|
+
if (index > -1) {
|
|
254
|
+
this._subject.observers.splice(index, 1);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (this._subject.observers.length === 0 && this._subject.cancelCallback) {
|
|
258
|
+
this._subject.cancelCallback()["catch"](function (_) {});
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}]);
|
|
262
|
+
|
|
263
|
+
return SubjectSubscription;
|
|
264
|
+
}();
|
|
265
|
+
/** @private */
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
var ConsoleLogger = /*#__PURE__*/function () {
|
|
269
|
+
function ConsoleLogger(minimumLogLevel) {
|
|
270
|
+
_classCallCheck(this, ConsoleLogger);
|
|
271
|
+
|
|
272
|
+
this._minLevel = minimumLogLevel;
|
|
273
|
+
this.out = console;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
_createClass(ConsoleLogger, [{
|
|
277
|
+
key: "log",
|
|
278
|
+
value: function log(logLevel, message) {
|
|
279
|
+
if (logLevel >= this._minLevel) {
|
|
280
|
+
var msg = "[".concat(new Date().toISOString(), "] ").concat(ILogger.LogLevel[logLevel], ": ").concat(message);
|
|
281
|
+
|
|
282
|
+
switch (logLevel) {
|
|
283
|
+
case ILogger.LogLevel.Critical:
|
|
284
|
+
case ILogger.LogLevel.Error:
|
|
285
|
+
this.out.error(msg);
|
|
286
|
+
break;
|
|
287
|
+
|
|
288
|
+
case ILogger.LogLevel.Warning:
|
|
289
|
+
this.out.warn(msg);
|
|
290
|
+
break;
|
|
291
|
+
|
|
292
|
+
case ILogger.LogLevel.Information:
|
|
293
|
+
this.out.info(msg);
|
|
294
|
+
break;
|
|
295
|
+
|
|
296
|
+
default:
|
|
297
|
+
// console.debug only goes to attached debuggers in Node, so we use console.log for Trace and Debug
|
|
298
|
+
this.out.log(msg);
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}]);
|
|
304
|
+
|
|
305
|
+
return ConsoleLogger;
|
|
306
|
+
}();
|
|
307
|
+
/** @private */
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
function getUserAgentHeader() {
|
|
311
|
+
var userAgentHeaderName = "X-SignalR-User-Agent";
|
|
312
|
+
|
|
313
|
+
if (Platform.isNode) {
|
|
314
|
+
userAgentHeaderName = "User-Agent";
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
return [userAgentHeaderName, constructUserAgent(VERSION, getOsName(), getRuntime(), getRuntimeVersion())];
|
|
318
|
+
}
|
|
319
|
+
/** @private */
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
function constructUserAgent(version, os, runtime, runtimeVersion) {
|
|
323
|
+
// Microsoft SignalR/[Version] ([Detailed Version]; [Operating System]; [Runtime]; [Runtime Version])
|
|
324
|
+
var userAgent = "Microsoft SignalR/";
|
|
325
|
+
var majorAndMinor = version.split(".");
|
|
326
|
+
userAgent += "".concat(majorAndMinor[0], ".").concat(majorAndMinor[1]);
|
|
327
|
+
userAgent += " (".concat(version, "; ");
|
|
328
|
+
|
|
329
|
+
if (os && os !== "") {
|
|
330
|
+
userAgent += "".concat(os, "; ");
|
|
331
|
+
} else {
|
|
332
|
+
userAgent += "Unknown OS; ";
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
userAgent += "".concat(runtime);
|
|
336
|
+
|
|
337
|
+
if (runtimeVersion) {
|
|
338
|
+
userAgent += "; ".concat(runtimeVersion);
|
|
339
|
+
} else {
|
|
340
|
+
userAgent += "; Unknown Runtime Version";
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
userAgent += ")";
|
|
344
|
+
return userAgent;
|
|
345
|
+
} // eslint-disable-next-line spaced-comment
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
function getOsName() {
|
|
349
|
+
if (Platform.isNode) {
|
|
350
|
+
switch (process.platform) {
|
|
351
|
+
case "win32":
|
|
352
|
+
return "Windows NT";
|
|
353
|
+
|
|
354
|
+
case "darwin":
|
|
355
|
+
return "macOS";
|
|
356
|
+
|
|
357
|
+
case "linux":
|
|
358
|
+
return "Linux";
|
|
359
|
+
|
|
360
|
+
default:
|
|
361
|
+
return process.platform;
|
|
362
|
+
}
|
|
363
|
+
} else {
|
|
364
|
+
return "";
|
|
365
|
+
}
|
|
366
|
+
} // eslint-disable-next-line spaced-comment
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
function getRuntimeVersion() {
|
|
370
|
+
if (Platform.isNode) {
|
|
371
|
+
return process.versions.node;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
return undefined;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
function getRuntime() {
|
|
378
|
+
if (Platform.isNode) {
|
|
379
|
+
return "NodeJS";
|
|
380
|
+
} else {
|
|
381
|
+
return "Browser";
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
/** @private */
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
function getErrorString(e) {
|
|
388
|
+
if (e.stack) {
|
|
389
|
+
return e.stack;
|
|
390
|
+
} else if (e.message) {
|
|
391
|
+
return e.message;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
return "".concat(e);
|
|
395
|
+
}
|
|
396
|
+
/** @private */
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
function getGlobalThis() {
|
|
400
|
+
// globalThis is semi-new and not available in Node until v12
|
|
401
|
+
if (typeof globalThis !== "undefined") {
|
|
402
|
+
return globalThis;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
if (typeof self !== "undefined") {
|
|
406
|
+
return self;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
if (typeof window !== "undefined") {
|
|
410
|
+
return window;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
if (typeof global !== "undefined") {
|
|
414
|
+
return global;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
throw new Error("could not find global");
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
exports.Arg = Arg;
|
|
421
|
+
exports.ConsoleLogger = ConsoleLogger;
|
|
422
|
+
exports.Platform = Platform;
|
|
423
|
+
exports.SubjectSubscription = SubjectSubscription;
|
|
424
|
+
exports.VERSION = VERSION;
|
|
425
|
+
exports.constructUserAgent = constructUserAgent;
|
|
426
|
+
exports.createLogger = createLogger;
|
|
427
|
+
exports.formatArrayBuffer = formatArrayBuffer;
|
|
428
|
+
exports.getDataDetail = getDataDetail;
|
|
429
|
+
exports.getErrorString = getErrorString;
|
|
430
|
+
exports.getGlobalThis = getGlobalThis;
|
|
431
|
+
exports.getUserAgentHeader = getUserAgentHeader;
|
|
432
|
+
exports.isArrayBuffer = isArrayBuffer;
|
|
433
|
+
exports.sendMessage = sendMessage;
|