@equinor/echo-framework 0.7.4 → 0.7.5

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 (60) hide show
  1. package/dist/__tests__/realTimeDataHooks.test.d.ts +1 -0
  2. package/dist/__tests__/realTimeDataUtils.test.d.ts +1 -0
  3. package/dist/_virtual/_tslib.js +14 -0
  4. package/dist/components/errorBoundary/errorBoundary.d.ts +1 -0
  5. package/dist/components/index.d.ts +1 -0
  6. package/dist/components/realTimeData/RealTimePopoverButton.d.ts +18 -0
  7. package/dist/components/realTimeData/components/IMSDropdown/RealTimeIMSDropdown.d.ts +7 -0
  8. package/dist/components/realTimeData/components/IMSDropdown/index.d.ts +1 -0
  9. package/dist/components/realTimeData/components/connectorForIMSTag/RealTimeConnectorForIMSTag.d.ts +6 -0
  10. package/dist/components/realTimeData/components/connectorForIMSTag/index.d.ts +1 -0
  11. package/dist/components/realTimeData/components/contextButton/RealTimeContextButton.d.ts +6 -0
  12. package/dist/components/realTimeData/components/contextButton/index.d.ts +1 -0
  13. package/dist/components/realTimeData/components/contextPopover/Popover.d.ts +6 -0
  14. package/dist/components/realTimeData/components/contextPopover/index.d.ts +1 -0
  15. package/dist/components/realTimeData/components/index.d.ts +4 -0
  16. package/dist/components/realTimeData/hooks/index.d.ts +3 -0
  17. package/dist/components/realTimeData/hooks/useRealTimeHub.d.ts +13 -0
  18. package/dist/components/realTimeData/hooks/useSignalR.d.ts +9 -0
  19. package/dist/components/realTimeData/hooks/useSignalRListener.d.ts +4 -0
  20. package/dist/components/realTimeData/index.d.ts +1 -0
  21. package/dist/node_modules/@microsoft/signalr/dist/esm/AbortController.js +54 -0
  22. package/dist/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js +96 -0
  23. package/dist/node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js +47 -0
  24. package/dist/node_modules/@microsoft/signalr/dist/esm/Errors.js +287 -0
  25. package/dist/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js +281 -0
  26. package/dist/node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js +86 -0
  27. package/dist/node_modules/@microsoft/signalr/dist/esm/HeaderNames.js +20 -0
  28. package/dist/node_modules/@microsoft/signalr/dist/esm/HttpClient.js +82 -0
  29. package/dist/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js +1167 -0
  30. package/dist/node_modules/@microsoft/signalr/dist/esm/HubConnection.js +1342 -0
  31. package/dist/node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js +165 -0
  32. package/dist/node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js +33 -0
  33. package/dist/node_modules/@microsoft/signalr/dist/esm/ILogger.js +37 -0
  34. package/dist/node_modules/@microsoft/signalr/dist/esm/ITransport.js +37 -0
  35. package/dist/node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js +179 -0
  36. package/dist/node_modules/@microsoft/signalr/dist/esm/Loggers.js +35 -0
  37. package/dist/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js +444 -0
  38. package/dist/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js +235 -0
  39. package/dist/node_modules/@microsoft/signalr/dist/esm/Subject.js +99 -0
  40. package/dist/node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js +45 -0
  41. package/dist/node_modules/@microsoft/signalr/dist/esm/Utils.js +433 -0
  42. package/dist/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js +263 -0
  43. package/dist/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js +133 -0
  44. package/dist/services/api/api-realtimedata.d.ts +2 -0
  45. package/dist/src/components/realTimeData/RealTimePopoverButton.js +136 -0
  46. package/dist/src/components/realTimeData/components/IMSDropdown/RealTimeIMSDropdown.js +81 -0
  47. package/dist/src/components/realTimeData/components/IMSDropdown/RealTimeIMSDropdown.module.css.js +15 -0
  48. package/dist/src/components/realTimeData/components/connectorForIMSTag/IMSConnector.module.css.js +16 -0
  49. package/dist/src/components/realTimeData/components/connectorForIMSTag/RealTimeConnectorForIMSTag.js +110 -0
  50. package/dist/src/components/realTimeData/components/contextButton/RealTimeContextButton.js +75 -0
  51. package/dist/src/components/realTimeData/components/contextButton/RealTimeContextButton.module.css.js +15 -0
  52. package/dist/src/components/realTimeData/components/contextPopover/Popover.js +37 -0
  53. package/dist/src/components/realTimeData/components/contextPopover/Popover.module.css.js +15 -0
  54. package/dist/src/components/realTimeData/hooks/useRealTimeHub.js +122 -0
  55. package/dist/src/components/realTimeData/hooks/useSignalR.js +159 -0
  56. package/dist/src/components/realTimeData/hooks/useSignalRListener.js +22 -0
  57. package/dist/src/index.js +3 -0
  58. package/dist/src/services/api/api-realtimedata.js +42 -0
  59. package/dist/types/realtimedata.d.ts +18 -0
  60. package/package.json +23 -20
@@ -0,0 +1,281 @@
1
+ 'use strict';
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 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; }
6
+
7
+ 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; }
8
+
9
+ 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; }
10
+
11
+ 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); } }
12
+
13
+ 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); }); }; }
14
+
15
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16
+
17
+ 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); } }
18
+
19
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
20
+
21
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
22
+
23
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
24
+
25
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
26
+
27
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
28
+
29
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
30
+
31
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
32
+
33
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
34
+
35
+ Object.defineProperty(exports, '__esModule', {
36
+ value: true
37
+ });
38
+
39
+ var Errors = require('./Errors.js');
40
+
41
+ var HttpClient = require('./HttpClient.js');
42
+
43
+ var ILogger = require('./ILogger.js');
44
+
45
+ var Utils = require('./Utils.js'); // Licensed to the .NET Foundation under one or more agreements.
46
+
47
+
48
+ var FetchHttpClient = /*#__PURE__*/function (_HttpClient$HttpClien) {
49
+ _inherits(FetchHttpClient, _HttpClient$HttpClien);
50
+
51
+ var _super = _createSuper(FetchHttpClient);
52
+
53
+ function FetchHttpClient(logger) {
54
+ var _this;
55
+
56
+ _classCallCheck(this, FetchHttpClient);
57
+
58
+ _this = _super.call(this);
59
+ _this._logger = logger;
60
+
61
+ if (typeof fetch === "undefined") {
62
+ // In order to ignore the dynamic require in webpack builds we need to do this magic
63
+ // @ts-ignore: TS doesn't know about these names
64
+ var requireFunc = typeof __webpack_require__ === "function" ? __non_webpack_require__ : require; // Cookies aren't automatically handled in Node so we need to add a CookieJar to preserve cookies across requests
65
+
66
+ _this._jar = new (requireFunc("tough-cookie").CookieJar)();
67
+ _this._fetchType = requireFunc("node-fetch"); // node-fetch doesn't have a nice API for getting and setting cookies
68
+ // fetch-cookie will wrap a fetch implementation with a default CookieJar or a provided one
69
+
70
+ _this._fetchType = requireFunc("fetch-cookie")(_this._fetchType, _this._jar);
71
+ } else {
72
+ _this._fetchType = fetch.bind(Utils.getGlobalThis());
73
+ }
74
+
75
+ if (typeof AbortController === "undefined") {
76
+ // In order to ignore the dynamic require in webpack builds we need to do this magic
77
+ // @ts-ignore: TS doesn't know about these names
78
+ var _requireFunc = typeof __webpack_require__ === "function" ? __non_webpack_require__ : require; // Node needs EventListener methods on AbortController which our custom polyfill doesn't provide
79
+
80
+
81
+ _this._abortControllerType = _requireFunc("abort-controller");
82
+ } else {
83
+ _this._abortControllerType = AbortController;
84
+ }
85
+
86
+ return _this;
87
+ }
88
+ /** @inheritDoc */
89
+
90
+
91
+ _createClass(FetchHttpClient, [{
92
+ key: "send",
93
+ value: function () {
94
+ var _send = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(request) {
95
+ var _this2 = this;
96
+
97
+ var abortController, error, timeoutId, msTimeout, response, errorMessage, content, payload;
98
+ return regeneratorRuntime.wrap(function _callee$(_context) {
99
+ while (1) {
100
+ switch (_context.prev = _context.next) {
101
+ case 0:
102
+ if (!(request.abortSignal && request.abortSignal.aborted)) {
103
+ _context.next = 2;
104
+ break;
105
+ }
106
+
107
+ throw new Errors.AbortError();
108
+
109
+ case 2:
110
+ if (request.method) {
111
+ _context.next = 4;
112
+ break;
113
+ }
114
+
115
+ throw new Error("No method defined.");
116
+
117
+ case 4:
118
+ if (request.url) {
119
+ _context.next = 6;
120
+ break;
121
+ }
122
+
123
+ throw new Error("No url defined.");
124
+
125
+ case 6:
126
+ abortController = new this._abortControllerType();
127
+
128
+ // Hook our abortSignal into the abort controller
129
+ if (request.abortSignal) {
130
+ request.abortSignal.onabort = function () {
131
+ abortController.abort();
132
+ error = new Errors.AbortError();
133
+ };
134
+ } // If a timeout has been passed in, setup a timeout to call abort
135
+ // Type needs to be any to fit window.setTimeout and NodeJS.setTimeout
136
+
137
+
138
+ timeoutId = null;
139
+
140
+ if (request.timeout) {
141
+ msTimeout = request.timeout;
142
+ timeoutId = setTimeout(function () {
143
+ abortController.abort();
144
+
145
+ _this2._logger.log(ILogger.LogLevel.Warning, "Timeout from HTTP request.");
146
+
147
+ error = new Errors.TimeoutError();
148
+ }, msTimeout);
149
+ }
150
+
151
+ _context.prev = 10;
152
+ _context.next = 13;
153
+ return this._fetchType(request.url, {
154
+ body: request.content,
155
+ cache: "no-cache",
156
+ credentials: request.withCredentials === true ? "include" : "same-origin",
157
+ headers: _objectSpread({
158
+ "Content-Type": "text/plain;charset=UTF-8",
159
+ "X-Requested-With": "XMLHttpRequest"
160
+ }, request.headers),
161
+ method: request.method,
162
+ mode: "cors",
163
+ redirect: "follow",
164
+ signal: abortController.signal
165
+ });
166
+
167
+ case 13:
168
+ response = _context.sent;
169
+ _context.next = 22;
170
+ break;
171
+
172
+ case 16:
173
+ _context.prev = 16;
174
+ _context.t0 = _context["catch"](10);
175
+
176
+ if (!error) {
177
+ _context.next = 20;
178
+ break;
179
+ }
180
+
181
+ throw error;
182
+
183
+ case 20:
184
+ this._logger.log(ILogger.LogLevel.Warning, "Error from HTTP request. ".concat(_context.t0, "."));
185
+
186
+ throw _context.t0;
187
+
188
+ case 22:
189
+ _context.prev = 22;
190
+
191
+ if (timeoutId) {
192
+ clearTimeout(timeoutId);
193
+ }
194
+
195
+ if (request.abortSignal) {
196
+ request.abortSignal.onabort = null;
197
+ }
198
+
199
+ return _context.finish(22);
200
+
201
+ case 26:
202
+ if (response.ok) {
203
+ _context.next = 31;
204
+ break;
205
+ }
206
+
207
+ _context.next = 29;
208
+ return deserializeContent(response, "text");
209
+
210
+ case 29:
211
+ errorMessage = _context.sent;
212
+ throw new Errors.HttpError(errorMessage || response.statusText, response.status);
213
+
214
+ case 31:
215
+ content = deserializeContent(response, request.responseType);
216
+ _context.next = 34;
217
+ return content;
218
+
219
+ case 34:
220
+ payload = _context.sent;
221
+ return _context.abrupt("return", new HttpClient.HttpResponse(response.status, response.statusText, payload));
222
+
223
+ case 36:
224
+ case "end":
225
+ return _context.stop();
226
+ }
227
+ }
228
+ }, _callee, this, [[10, 16, 22, 26]]);
229
+ }));
230
+
231
+ function send(_x) {
232
+ return _send.apply(this, arguments);
233
+ }
234
+
235
+ return send;
236
+ }()
237
+ }, {
238
+ key: "getCookieString",
239
+ value: function getCookieString(url) {
240
+ var cookies = "";
241
+
242
+ if (Utils.Platform.isNode && this._jar) {
243
+ // @ts-ignore: unused variable
244
+ this._jar.getCookies(url, function (e, c) {
245
+ return cookies = c.join("; ");
246
+ });
247
+ }
248
+
249
+ return cookies;
250
+ }
251
+ }]);
252
+
253
+ return FetchHttpClient;
254
+ }(HttpClient.HttpClient);
255
+
256
+ function deserializeContent(response, responseType) {
257
+ var content;
258
+
259
+ switch (responseType) {
260
+ case "arraybuffer":
261
+ content = response.arrayBuffer();
262
+ break;
263
+
264
+ case "text":
265
+ content = response.text();
266
+ break;
267
+
268
+ case "blob":
269
+ case "document":
270
+ case "json":
271
+ throw new Error("".concat(responseType, " is not supported."));
272
+
273
+ default:
274
+ content = response.text();
275
+ break;
276
+ }
277
+
278
+ return content;
279
+ }
280
+
281
+ exports.FetchHttpClient = FetchHttpClient;
@@ -0,0 +1,86 @@
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
+ });
12
+
13
+ var TextMessageFormat = require('./TextMessageFormat.js');
14
+
15
+ var Utils = require('./Utils.js'); // Licensed to the .NET Foundation under one or more agreements.
16
+
17
+ /** @private */
18
+
19
+
20
+ var HandshakeProtocol = /*#__PURE__*/function () {
21
+ function HandshakeProtocol() {
22
+ _classCallCheck(this, HandshakeProtocol);
23
+ }
24
+
25
+ _createClass(HandshakeProtocol, [{
26
+ key: "writeHandshakeRequest",
27
+ value: // Handshake request is always JSON
28
+ function writeHandshakeRequest(handshakeRequest) {
29
+ return TextMessageFormat.TextMessageFormat.write(JSON.stringify(handshakeRequest));
30
+ }
31
+ }, {
32
+ key: "parseHandshakeResponse",
33
+ value: function parseHandshakeResponse(data) {
34
+ var messageData;
35
+ var remainingData;
36
+
37
+ if (Utils.isArrayBuffer(data)) {
38
+ // Format is binary but still need to read JSON text from handshake response
39
+ var binaryData = new Uint8Array(data);
40
+ var separatorIndex = binaryData.indexOf(TextMessageFormat.TextMessageFormat.RecordSeparatorCode);
41
+
42
+ if (separatorIndex === -1) {
43
+ throw new Error("Message is incomplete.");
44
+ } // content before separator is handshake response
45
+ // optional content after is additional messages
46
+
47
+
48
+ var responseLength = separatorIndex + 1;
49
+ messageData = String.fromCharCode.apply(null, Array.prototype.slice.call(binaryData.slice(0, responseLength)));
50
+ remainingData = binaryData.byteLength > responseLength ? binaryData.slice(responseLength).buffer : null;
51
+ } else {
52
+ var textData = data;
53
+
54
+ var _separatorIndex = textData.indexOf(TextMessageFormat.TextMessageFormat.RecordSeparator);
55
+
56
+ if (_separatorIndex === -1) {
57
+ throw new Error("Message is incomplete.");
58
+ } // content before separator is handshake response
59
+ // optional content after is additional messages
60
+
61
+
62
+ var _responseLength = _separatorIndex + 1;
63
+
64
+ messageData = textData.substring(0, _responseLength);
65
+ remainingData = textData.length > _responseLength ? textData.substring(_responseLength) : null;
66
+ } // At this point we should have just the single handshake message
67
+
68
+
69
+ var messages = TextMessageFormat.TextMessageFormat.parse(messageData);
70
+ var response = JSON.parse(messages[0]);
71
+
72
+ if (response.type) {
73
+ throw new Error("Expected a handshake response from the server.");
74
+ }
75
+
76
+ var responseMessage = response; // multiple messages could have arrived with handshake
77
+ // return additional data to be parsed as usual, or null if all parsed
78
+
79
+ return [remainingData, responseMessage];
80
+ }
81
+ }]);
82
+
83
+ return HandshakeProtocol;
84
+ }();
85
+
86
+ exports.HandshakeProtocol = HandshakeProtocol;
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ 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); } }
4
+
5
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
6
+
7
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
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
+
14
+ var HeaderNames = /*#__PURE__*/_createClass(function HeaderNames() {
15
+ _classCallCheck(this, HeaderNames);
16
+ });
17
+
18
+ HeaderNames.Authorization = "Authorization";
19
+ HeaderNames.Cookie = "Cookie";
20
+ exports.HeaderNames = HeaderNames;
@@ -0,0 +1,82 @@
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 _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; }
8
+
9
+ 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); } }
10
+
11
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
12
+
13
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
+
15
+ Object.defineProperty(exports, '__esModule', {
16
+ value: true
17
+ }); // Licensed to the .NET Foundation under one or more agreements.
18
+ // The .NET Foundation licenses this file to you under the MIT license.
19
+
20
+ /** Represents an HTTP response. */
21
+
22
+ var HttpResponse = /*#__PURE__*/_createClass(function HttpResponse(statusCode, statusText, content) {
23
+ _classCallCheck(this, HttpResponse);
24
+
25
+ this.statusCode = statusCode;
26
+ this.statusText = statusText;
27
+ this.content = content;
28
+ });
29
+ /** Abstraction over an HTTP client.
30
+ *
31
+ * This class provides an abstraction over an HTTP client so that a different implementation can be provided on different platforms.
32
+ */
33
+
34
+
35
+ var HttpClient = /*#__PURE__*/function () {
36
+ function HttpClient() {
37
+ _classCallCheck(this, HttpClient);
38
+ }
39
+
40
+ _createClass(HttpClient, [{
41
+ key: "get",
42
+ value: function get(url, options) {
43
+ return this.send(_objectSpread(_objectSpread({}, options), {}, {
44
+ method: "GET",
45
+ url: url
46
+ }));
47
+ }
48
+ }, {
49
+ key: "post",
50
+ value: function post(url, options) {
51
+ return this.send(_objectSpread(_objectSpread({}, options), {}, {
52
+ method: "POST",
53
+ url: url
54
+ }));
55
+ }
56
+ }, {
57
+ key: "delete",
58
+ value: function _delete(url, options) {
59
+ return this.send(_objectSpread(_objectSpread({}, options), {}, {
60
+ method: "DELETE",
61
+ url: url
62
+ }));
63
+ }
64
+ /** Gets all cookies that apply to the specified URL.
65
+ *
66
+ * @param url The URL that the cookies are valid for.
67
+ * @returns {string} A string containing all the key-value cookie pairs for the specified URL.
68
+ */
69
+ // @ts-ignore
70
+
71
+ }, {
72
+ key: "getCookieString",
73
+ value: function getCookieString(url) {
74
+ return "";
75
+ }
76
+ }]);
77
+
78
+ return HttpClient;
79
+ }();
80
+
81
+ exports.HttpClient = HttpClient;
82
+ exports.HttpResponse = HttpResponse;