@factset/frontgate-js-sdk 6.10.1 → 6.10.3

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.
@@ -2298,7 +2298,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
2298
2298
  function isSubscriptionLossMessage(response) {
2299
2299
  return response.name === "Foundation::SubscriptionLossMessage";
2300
2300
  }
2301
- const PACKAGE_JSON = { version: "6.10.1", package: "@factset/frontgate-js-sdk" };
2301
+ const PACKAGE_JSON = { version: "6.10.3", package: "@factset/frontgate-js-sdk" };
2302
2302
  function getClientInformation() {
2303
2303
  const navigator2 = getNavigator();
2304
2304
  return {
@@ -3317,7 +3317,12 @@ var __privateWrapper = (obj, member, setter, getter) => ({
3317
3317
  const protocolPrefix = protocolType ? `${protocolType}.` : "";
3318
3318
  const subProtocols = [`${protocolPrefix}ws-${protocolVersion}.mdgms.com`];
3319
3319
  const wsConf = { url: wsUrl, subProtocols };
3320
- await this.hooks.callHook("frontgateConnection:beforeConnect", wsConf);
3320
+ try {
3321
+ await this.hooks.callHook("frontgateConnection:beforeConnect", wsConf);
3322
+ } catch (error) {
3323
+ __privateSet(this, _wsStateInternal, "disconnected");
3324
+ throw error;
3325
+ }
3321
3326
  this.log(LogLevel.DEBUG, `Connecting to ${wsConf.url} with subprotocols ${wsConf.subProtocols}`);
3322
3327
  const promise = new Promise((resolve, reject) => {
3323
3328
  if (!__privateGet(this, _wsConf)) {
@@ -3343,9 +3348,10 @@ var __privateWrapper = (obj, member, setter, getter) => ({
3343
3348
  __privateGet(this, _ws).onclose = (closeEvent) => {
3344
3349
  unhookOnFrontgateConnectionAuthenticated == null ? void 0 : unhookOnFrontgateConnectionAuthenticated();
3345
3350
  this.log(LogLevel.DEBUG, "Disconnected", closeEvent);
3346
- void this.hooks.callHook("frontgateConnection:disconnected", closeEvent);
3347
3351
  if (__privateGet(this, _wsStateInternal) === "connecting" || __privateGet(this, _wsStateInternal) === "connected") {
3348
3352
  reject(JSON.stringify(closeEvent));
3353
+ } else {
3354
+ void this.hooks.callHook("frontgateConnection:disconnected", closeEvent);
3349
3355
  }
3350
3356
  clearInterval(__privateGet(this, _keepAliveTimer));
3351
3357
  __privateSet(this, _wsStateInternal, "disconnected");
@@ -3393,13 +3399,13 @@ var __privateWrapper = (obj, member, setter, getter) => ({
3393
3399
  });
3394
3400
  }
3395
3401
  isConnected() {
3396
- return __privateGet(this, _wsStateInternal) === "authenticated";
3402
+ return __privateGet(this, _instances, wsState_get) === "authenticated";
3397
3403
  }
3398
3404
  isDisconnected() {
3399
3405
  return __privateGet(this, _wsStateInternal) !== "authenticated";
3400
3406
  }
3401
3407
  isReadyToConnect() {
3402
- return __privateGet(this, _wsStateInternal) === "disconnected";
3408
+ return __privateGet(this, _instances, wsState_get) === "disconnected";
3403
3409
  }
3404
3410
  }, _ws = new WeakMap(), _wsConf = new WeakMap(), _wsStateInternal = new WeakMap(), _keepAliveTimer = new WeakMap(), _jobId = new WeakMap(), _idApplication = new WeakMap(), _idUser = new WeakMap(), _instances = new WeakSet(), wsState_get = function() {
3405
3411
  if (__privateGet(this, _ws) && __privateGet(this, _ws).readyState < 2) {
@@ -4220,15 +4226,16 @@ var __privateWrapper = (obj, member, setter, getter) => ({
4220
4226
  auth: {}
4221
4227
  };
4222
4228
  };
4223
- const reconnect = () => {
4229
+ const reconnect = (reconnectDelaysInMs) => {
4224
4230
  const mixinReconnect = (Base) => {
4225
4231
  var _reconnectAttempts, _reconnectDelays, _reconnectTimer, _a2;
4226
4232
  return _a2 = class extends Base {
4227
4233
  constructor(...args) {
4228
4234
  super(...args);
4229
4235
  __privateAdd(this, _reconnectAttempts, 0);
4230
- __privateAdd(this, _reconnectDelays, [1e3, 2e3, 4e3, 8e3, 16e3, 32e3]);
4236
+ __privateAdd(this, _reconnectDelays);
4231
4237
  __privateAdd(this, _reconnectTimer);
4238
+ __privateSet(this, _reconnectDelays, reconnectDelaysInMs ?? [1e3, 2e3, 4e3, 8e3, 16e3, 32e3]);
4232
4239
  const reconenctFn = (error) => {
4233
4240
  if (error.code !== 1e3) {
4234
4241
  if (__privateGet(this, _reconnectTimer)) {
@@ -4237,7 +4244,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
4237
4244
  __privateSet(this, _reconnectAttempts, 0);
4238
4245
  }
4239
4246
  let reconnectDelayIndex = __privateGet(this, _reconnectAttempts);
4240
- if (__privateGet(this, _reconnectAttempts) > __privateGet(this, _reconnectDelays).length) {
4247
+ if (__privateGet(this, _reconnectAttempts) >= __privateGet(this, _reconnectDelays).length) {
4241
4248
  reconnectDelayIndex = __privateGet(this, _reconnectDelays).length - 1;
4242
4249
  }
4243
4250
  const reconnectDelay = __privateGet(this, _reconnectDelays)[reconnectDelayIndex];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@factset/frontgate-js-sdk",
3
3
  "author": "Factset GmbH",
4
- "version": "6.10.1",
4
+ "version": "6.10.3",
5
5
  "description": "Typescript based client to request and subscribe values from mdg2 (frontgate)",
6
6
  "license": "Apache-2.0",
7
7
  "main": "./dist/lib/node/index.js",