@factset/frontgate-js-sdk 7.0.1 → 7.0.4

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 (52) hide show
  1. package/CHANGELOG.md +81 -15
  2. package/dist/lib/esnext/message/response/Mdg2Response.js +8 -5
  3. package/dist/lib/esnext/mixins/HTTPProxyRequestMixin.js +4 -4
  4. package/dist/lib/esnext/mixins/LoggerMixin.js +3 -3
  5. package/dist/lib/esnext/mixins/auth/SessionAuthMixin.js +2 -2
  6. package/dist/lib/esnext/mixins/auth/TokenAuthMixin.js +2 -2
  7. package/dist/lib/esnext/mixins/connection/FrontgateWSMixin.js +9 -9
  8. package/dist/lib/esnext/mixins/subscription/EndpointSubscriptionMixin.js +3 -2
  9. package/dist/lib/esnext/mixins/subscription/RawSubscriptionMixin.js +11 -11
  10. package/dist/lib/esnext/util/functions.js +4 -5
  11. package/dist/lib/esnext/version.js +1 -1
  12. package/dist/lib/node/message/response/Mdg2Response.js +8 -5
  13. package/dist/lib/node/mixins/HTTPProxyRequestMixin.js +4 -4
  14. package/dist/lib/node/mixins/LoggerMixin.js +3 -3
  15. package/dist/lib/node/mixins/auth/SessionAuthMixin.js +2 -2
  16. package/dist/lib/node/mixins/auth/TokenAuthMixin.js +2 -2
  17. package/dist/lib/node/mixins/connection/FrontgateWSMixin.js +9 -9
  18. package/dist/lib/node/mixins/subscription/EndpointSubscriptionMixin.js +3 -2
  19. package/dist/lib/node/mixins/subscription/RawSubscriptionMixin.js +11 -11
  20. package/dist/lib/node/util/functions.js +4 -5
  21. package/dist/lib/node/version.js +1 -1
  22. package/dist/lib/types/common/interfaces/result/HTTPProxyRequestResult.d.ts +1 -1
  23. package/dist/lib/types/common/interfaces/result/RequestResult.d.ts +1 -1
  24. package/dist/lib/types/logger/AbstractLogger.d.ts +1 -1
  25. package/dist/lib/types/logger/ConsoleLogger.d.ts +7 -7
  26. package/dist/lib/types/logger/LoggerInterface.d.ts +6 -6
  27. package/dist/lib/types/message/request/HTTPProxyRequest.d.ts +1 -1
  28. package/dist/lib/types/mixins/AuthTokenRequestMixin.d.ts +1 -1
  29. package/dist/lib/types/mixins/EndpointRequestMixin.d.ts +2 -2
  30. package/dist/lib/types/mixins/HTTPProxyRequestMixin.d.ts +2 -3
  31. package/dist/lib/types/mixins/LoggerMixin.d.ts +2 -2
  32. package/dist/lib/types/mixins/MessageCompressorMixin.d.ts +2 -2
  33. package/dist/lib/types/mixins/OpenTelemetryMixin.d.ts +2 -2
  34. package/dist/lib/types/mixins/PingMixin.d.ts +1 -1
  35. package/dist/lib/types/mixins/ReconnectMixin.d.ts +4 -4
  36. package/dist/lib/types/mixins/RemoteLoggerMixin.d.ts +1 -1
  37. package/dist/lib/types/mixins/RequestMixin.d.ts +1 -1
  38. package/dist/lib/types/mixins/auth/AppAuthMixin.d.ts +8 -8
  39. package/dist/lib/types/mixins/auth/CookieTokenAuthMixin.d.ts +1 -1
  40. package/dist/lib/types/mixins/auth/FetchAuthenticationMixin.d.ts +25 -25
  41. package/dist/lib/types/mixins/auth/SessionAuthMixin.d.ts +31 -31
  42. package/dist/lib/types/mixins/auth/TokenAuthMixin.d.ts +3 -3
  43. package/dist/lib/types/mixins/auth/UserCredentialAuthMixin.d.ts +8 -8
  44. package/dist/lib/types/mixins/auth/UserPasswordAuthMixin.d.ts +8 -8
  45. package/dist/lib/types/mixins/connection/FrontgateWSMixin.d.ts +20 -20
  46. package/dist/lib/types/mixins/connection/index.d.ts +1 -2
  47. package/dist/lib/types/mixins/subscription/EndpointSubscriptionMixin.d.ts +4 -4
  48. package/dist/lib/types/mixins/subscription/RawSubscriptionMixin.d.ts +3 -3
  49. package/dist/lib/types/util/functions.d.ts +1 -2
  50. package/dist/lib/umd/mdg2.client.min.umd.js +1 -1
  51. package/dist/lib/umd/mdg2.client.umd.js +44 -38
  52. package/package.json +6 -8
package/CHANGELOG.md CHANGED
@@ -1,16 +1,70 @@
1
+ ## <small>7.0.4 (2025-11-06)</small>
2
+
3
+ * fix(demo-node): do not override env variable in code [9350000]
4
+ * fix(prepublish): use new import assertion syntax [e3bed89]
5
+ * fix(subscriptions): remove inflights on error [33697ce]
6
+ * fix(vite): use version without cve [1b615e6]
7
+ * chore(backstage): document further annotations [3865292]
8
+ * chore(backstage): fix documentation url [2d3c734]
9
+ * chore(Backstage): update Backstage metadata [12e6ebc]
10
+ * chore(Backstage): update Backstage metadata [9084922]
11
+ * chore(deps): lock file maintenance [968e56c]
12
+ * chore(deps): lock file maintenance [9739db8]
13
+ * chore(deps): update dependency happy-dom to ^20.0.2 [security] [bfda52c]
14
+ * chore(deps): update dependency happy-dom to v20 [security] [06475bc]
15
+ * chore(deps): update dependency node to v24 [272a875]
16
+ * chore(deps): update dependency node to v24 [515f36c]
17
+ * chore(deps): update dependency nx to v22 [62d9329]
18
+ * chore(deps): update softprops/action-gh-release action to v2.4.1 [2b084a1], closes [softprops/action-#release]
19
+ * chore(deps): update vitest monorepo to v4 [cfbe7ce]
20
+ * chore(release): update changelog for v7.0.3 [e60b73f]
21
+ * refactor(client): deduplicate imports [e8d5571]
22
+ * refactor(client): deduplicate imports [9a414fd]
23
+ * refactor(client): improve readability [ef9baa4]
24
+ * refactor(client): nicely type timeout [21d0925]
25
+ * refactor(client): properly type logger [0ac4b52]
26
+ * refactor(client): remove redundant type next to any [297f481]
27
+ * refactor(client): replace not-null assertions with expressive type assertions [b4a1622]
28
+ * refactor(client): use this type [2fc3772]
29
+ * refactor(demo-builder): deduplicate imports [d5a9e14]
30
+ * refactor(demo-builder): deduplicate imports [5287d89]
31
+ * refactor(demo-builder): remove unnecessary assignment [96f74aa]
32
+ * refactor(lint): use optional chain expression [356964e]
33
+ * Remove fortify action [69d60e9]
34
+
35
+
36
+
37
+ ## <small>7.0.2 (2025-10-09)</small>
38
+
39
+ * chore(deps): lock file maintenance [e8dd0a6]
40
+ * chore(deps): lock file maintenance [2f82edc]
41
+ * chore(deps): lock file maintenance [da9e5e2]
42
+ * chore(deps): lock file maintenance [6e51dfc]
43
+ * chore(deps): remove deprecated @types/bcryptjs [280a123]
44
+ * chore(deps): remove obsolete package [1810338]
45
+ * chore(deps): update actions/setup-python action to v6 [6469271]
46
+ * chore(deps): update dependency @fds/lint-standards to v28 [3bfd5f9]
47
+ * chore(deps): update dependency @fds/lint-standards to v29 [90367f8]
48
+ * chore(deps): update dependency happy-dom to v19 [32960ea]
49
+ * chore(deps): update dependency vite to ^7.1.5 [security] [8879b32]
50
+ * chore(deps): update softprops/action-gh-release action to v2.3.3 [00f18bb], closes [softprops/action-#release]
51
+ * chore(deps): update softprops/action-gh-release action to v2.3.4 [1bf3bad], closes [softprops/action-#release]
52
+ * chore(deps): update softprops/action-gh-release action to v2.4.0 [6fa1a5e], closes [softprops/action-#release]
53
+ * chore(deps): update sonarsource/sonarqube-scan-action action to v6 [6efaefa]
54
+ * chore(deps): update yarn to v4.10.0 [b47a139]
55
+ * chore(deps): update yarn to v4.10.3 [7759d0a]
56
+ * chore(epr): inform users about the npm release [8849286]
57
+ * chore(release): update changelog for v7.0.2 [e53f1ed]
58
+ * feat(functions): remove depracted usage of navigator props [3d6a16f]
59
+ * fix(deps): update dependency lerna to v9 [976a3ba]
60
+ * fix(functions): dont rely on navigator beeing populated [10b56b4]
61
+ * refactor(variables): rename to prevent shadowing [e8caa54]
62
+ * docs(release): document process to force correct latest version [8b4f115]
63
+
64
+
65
+
1
66
  ## <small>7.0.1 (2025-09-03)</small>
2
67
 
3
- * fix(build): remove sourcemaps [7cae368]
4
- * fix(client): generate changelog correctly [0c798ae]
5
- * fix(demo): use newer endpoints [5f8e758]
6
- * fix(fetch-authentication-mixin): log correct object [2f3adbb]
7
- * fix(fetch-authentication-mixin): remove wrong inheritance [68d8fc6]
8
- * fix(ga): prevent shell injection [723d5c3]
9
- * fix(release): add changelog to release [49089a0]
10
- * fix(release): change release action [bfb0d9b]
11
- * fix(release): ommit lerna tags to not destroy changelog [9e8faf6]
12
- * fix(release): use fixes from v6 release [c395dc9]
13
- * fix(subscriptions): catch inflight requests [d40394a]
14
68
  * chore(changelog): refresh changelog [a0a3d56]
15
69
  * chore(deps): lock file maintenance [c2a734e]
16
70
  * chore(deps): replace dependency npm-run-all with npm-run-all2 ^5.0.0 [59bf6a4]
@@ -26,7 +80,19 @@
26
80
  * chore(deps): update yarn to v4.9.4 [9f5af73]
27
81
  * chore(docs): add release documentation [ee22da6]
28
82
  * chore(package): align parallelization to drop dependency [3d5e19f]
83
+ * chore(release): update changelog for v7.0.1 [3b03eda]
29
84
  * chore(repo): update deps [bf03d29]
85
+ * fix(build): remove sourcemaps [7cae368]
86
+ * fix(client): generate changelog correctly [0c798ae]
87
+ * fix(demo): use newer endpoints [5f8e758]
88
+ * fix(fetch-authentication-mixin): log correct object [2f3adbb]
89
+ * fix(fetch-authentication-mixin): remove wrong inheritance [68d8fc6]
90
+ * fix(ga): prevent shell injection [723d5c3]
91
+ * fix(release): add changelog to release [49089a0]
92
+ * fix(release): change release action [bfb0d9b]
93
+ * fix(release): ommit lerna tags to not destroy changelog [9e8faf6]
94
+ * fix(release): use fixes from v6 release [c395dc9]
95
+ * fix(subscriptions): catch inflight requests [d40394a]
30
96
 
31
97
 
32
98
 
@@ -79,9 +145,9 @@
79
145
  * chore(deps): update dependency vite to v7 [ff16a47]
80
146
  * chore(deps): update dependency vite-tsconfig-paths to v5 [307fd61]
81
147
  * chore(deps): update factset/waffle-actions action to v2.5.2 [617d450]
82
- * chore(deps): update peaceiris/actions-gh-pages action to v3.9.3 [2070e37]
83
- * chore(deps): update peaceiris/actions-gh-pages action to v4 [6569746]
84
- * chore(deps): update softprops/action-gh-release action to v2 [cba8093]
148
+ * chore(deps): update peaceiris/actions-gh-pages action to v3.9.3 [2070e37], closes [peaceiris/actions-#pages]
149
+ * chore(deps): update peaceiris/actions-gh-pages action to v4 [6569746], closes [peaceiris/actions-#pages]
150
+ * chore(deps): update softprops/action-gh-release action to v2 [cba8093], closes [softprops/action-#release]
85
151
  * chore(deps): update sonarsource/sonarqube-scan-action action to v5 [5876377]
86
152
  * chore(deps): update yarn to v4.9.2 [750d175]
87
153
  * feat(auth): remove depracted auth interfaces [01da6bd]
@@ -375,7 +441,7 @@
375
441
 
376
442
  ## <small>6.2.5 (2024-04-29)</small>
377
443
 
378
- * chore(gh-actions): upgrade sonarcloud action [84b0aaa]
444
+ * chore(gh-actions): upgrade sonarcloud action [84b0aaa], closes [#actions]
379
445
  * chore(repo): bump version.ts [b84a41c]
380
446
  * chore(repo): update changelog [b16b9a8]
381
447
  * feat(subscriptions): add request options [8703cc3]
@@ -15,13 +15,16 @@ export class Mdg2Response {
15
15
  return this.raw.header.id_service;
16
16
  }
17
17
  isUpdateMessage() {
18
- return (Object.hasOwnProperty.call(this.raw, 'header') &&
19
- (Object.hasOwnProperty.call(this.raw.header, 'id_service') || Object.hasOwnProperty.call(this.raw.header, 'id_job')) &&
20
- this.raw.Message.endsWith('Update'));
18
+ if (!Object.hasOwnProperty.call(this.raw, 'header')) {
19
+ return false;
20
+ }
21
+ return (Object.hasOwnProperty.call(this.raw.header, 'id_service') || Object.hasOwnProperty.call(this.raw.header, 'id_job')) && this.raw.Message.endsWith('Update');
21
22
  }
22
23
  isLossMessage() {
23
- return (Object.hasOwnProperty.call(this.raw, 'header') &&
24
- (Object.hasOwnProperty.call(this.raw.header, 'id_service') || Object.hasOwnProperty.call(this.raw.header, 'id_job')) &&
24
+ if (!Object.hasOwnProperty.call(this.raw, 'header')) {
25
+ return false;
26
+ }
27
+ return ((Object.hasOwnProperty.call(this.raw.header, 'id_service') || Object.hasOwnProperty.call(this.raw.header, 'id_job')) &&
25
28
  (this.raw.Message.endsWith('LossMessage') || this.raw.Message.endsWith('Loss')));
26
29
  }
27
30
  }
@@ -5,13 +5,13 @@ export const httpProxyRequest = () => {
5
5
  const mixinHTTPProxyRequestable = (Base) => {
6
6
  return class extends Base {
7
7
  async requestProxyEndpoint(method, path, body, options, timeOutInMs = this.defaultTimeoutInMs) {
8
- const httpProxyRequest = new HTTPProxyRequest(method, path, options);
8
+ const request = new HTTPProxyRequest(method, path, options);
9
9
  if (body) {
10
- httpProxyRequest.setBody(body);
10
+ request.setBody(body);
11
11
  }
12
- httpProxyRequest.header.setTimeout(timeOutInMs);
12
+ request.header.setTimeout(timeOutInMs);
13
13
  const msg = {
14
- message: httpProxyRequest.getPtlMessage(),
14
+ message: request.getPtlMessage(),
15
15
  callbackType: 'job',
16
16
  callbackId: '',
17
17
  };
@@ -1,13 +1,13 @@
1
1
  import { createExtendedMixinFactory } from '.';
2
- export const logger = (logger, logLevel) => {
2
+ export const logger = (loggerInstance, logLevel) => {
3
3
  if (logLevel) {
4
- logger.setLevel(logLevel);
4
+ loggerInstance.setLevel(logLevel);
5
5
  }
6
6
  const mixinLogger = (Base) => {
7
7
  return class extends Base {
8
8
  constructor(...args) {
9
9
  super(...args);
10
- this.logger = logger;
10
+ this.logger = loggerInstance;
11
11
  }
12
12
  };
13
13
  };
@@ -126,8 +126,8 @@ export const sessionAuth = (config, idApplication, username, password, deploymen
126
126
  _sharedSecret = new WeakMap(),
127
127
  _clientSecret = new WeakMap(),
128
128
  _instances = new WeakSet(),
129
- _requestOtpAuthenticationTokenForSessionHandling = async function _requestOtpAuthenticationTokenForSessionHandling(lifetimeSeconds = AuthenticationTokenRequest.LIFETIME_SECONDS_MAXIMUM, idUser = ID_USER_AUTHENTICATED, idApplication = ID_APP_AUTHENTICATED, timeOutInMs = this.defaultTimeoutInMs) {
130
- const request = new AuthenticationTokenRequest(lifetimeSeconds, idUser, idApplication, timeOutInMs, true);
129
+ _requestOtpAuthenticationTokenForSessionHandling = async function _requestOtpAuthenticationTokenForSessionHandling(lifetimeSeconds = AuthenticationTokenRequest.LIFETIME_SECONDS_MAXIMUM, idUser = ID_USER_AUTHENTICATED, idApplicationOtp = ID_APP_AUTHENTICATED, timeOutInMs = this.defaultTimeoutInMs) {
130
+ const request = new AuthenticationTokenRequest(lifetimeSeconds, idUser, idApplicationOtp, timeOutInMs, true);
131
131
  const msg = {
132
132
  message: request.getPtlMessage(),
133
133
  callbackType: 'job',
@@ -44,8 +44,8 @@ export const tokenAuth = (token) => {
44
44
  };
45
45
  this.hooks.hook('frontgateConnection:connected', authFn);
46
46
  }
47
- set token(token) {
48
- __classPrivateFieldSet(this, _token, token, "f");
47
+ set token(newToken) {
48
+ __classPrivateFieldSet(this, _token, newToken, "f");
49
49
  }
50
50
  },
51
51
  _token = new WeakMap(),
@@ -19,8 +19,8 @@ export const wsConnection = (conf) => {
19
19
  const mixinConnectableWS = (Base) => {
20
20
  var _instances, _ws, _wsConf, _wsStateInternal, _keepAliveTimer, _jobId, _idApplication, _idUser, _wsState_get, _message_buffer_size, _msgBuffer, _getDisconnectMessage, _getKeepAliveMessage, _sendMessage, _respondToMessage, _addJobIdToMessage, _prepareMessage, _createErrorMessage, _applyDefaultsToConfig, _a;
21
21
  return _a = class extends Base {
22
- set conf(conf) {
23
- const internalConf = __classPrivateFieldGet(this, _instances, "m", _applyDefaultsToConfig).call(this, conf);
22
+ set conf(newConf) {
23
+ const internalConf = __classPrivateFieldGet(this, _instances, "m", _applyDefaultsToConfig).call(this, newConf);
24
24
  __classPrivateFieldSet(this, _message_buffer_size, internalConf.messageBufferSize, "f");
25
25
  __classPrivateFieldSet(this, _wsConf, internalConf, "f");
26
26
  }
@@ -312,16 +312,16 @@ export const wsConnection = (conf) => {
312
312
  details: error,
313
313
  });
314
314
  },
315
- _applyDefaultsToConfig = function _applyDefaultsToConfig(conf) {
316
- const maxIdleIntervalInS = conf.maximumIdleIntervalInS ?? 60;
317
- const maxIdleInterval = conf.maximumIdleInterval ?? maxIdleIntervalInS * 1000000;
315
+ _applyDefaultsToConfig = function _applyDefaultsToConfig(oldConf) {
316
+ const maxIdleIntervalInS = oldConf.maximumIdleIntervalInS ?? 60;
317
+ const maxIdleInterval = oldConf.maximumIdleInterval ?? maxIdleIntervalInS * 1000000;
318
318
  return {
319
- ...conf,
320
- payloadContent: conf.payloadContent ?? 'foundation',
319
+ ...oldConf,
320
+ payloadContent: oldConf.payloadContent ?? 'foundation',
321
321
  maximumIdleIntervalInS: maxIdleIntervalInS,
322
322
  maximumIdleInterval: maxIdleInterval,
323
- tls: conf.tls ?? true,
324
- messageBufferSize: conf.messageBufferSize ?? 512,
323
+ tls: oldConf.tls ?? true,
324
+ messageBufferSize: oldConf.messageBufferSize ?? 512,
325
325
  };
326
326
  },
327
327
  _a;
@@ -193,7 +193,6 @@ export const endpointSubscriptions = (originalConfig) => {
193
193
  __classPrivateFieldGet(this, _subscriptions, "f").set(key, observer);
194
194
  const currentSubscounts = __classPrivateFieldGet(this, _subscriptionCounts, "f").get(key) ?? 0;
195
195
  __classPrivateFieldGet(this, _subscriptionCounts, "f").set(key, currentSubscounts + 1);
196
- __classPrivateFieldGet(this, _inFlights, "f").delete(key);
197
196
  resolve(observer);
198
197
  });
199
198
  })
@@ -202,7 +201,9 @@ export const endpointSubscriptions = (originalConfig) => {
202
201
  });
203
202
  });
204
203
  const rejectReason = `Request timeout reached (${timeOutInMs} ms) for ${subscriptionMsg.message.Message}`;
205
- const wrappedTimeoutPromise = useTimeout(timeOutInMs, rejectReason, promise);
204
+ const wrappedTimeoutPromise = useTimeout(timeOutInMs, rejectReason, promise).finally(() => {
205
+ __classPrivateFieldGet(this, _inFlights, "f").delete(key);
206
+ });
206
207
  __classPrivateFieldGet(this, _inFlights, "f").set(key, wrappedTimeoutPromise);
207
208
  return wrappedTimeoutPromise;
208
209
  }
@@ -68,19 +68,19 @@ export const rawSubscriptions = () => {
68
68
  this.log(LogLevel.INFO, `Resubscribing to ${key} due to reconnect`);
69
69
  await this.hooks.callHook('frontgateConnection:sendMessage', subscriptionMsg);
70
70
  const resubscribePromise = new Promise((res, rej) => {
71
- this.hooks.hookOnce(`frontgateConnection:response:${subscriptionMsg.callbackId}`, (response) => {
72
- if (response.Message.includes('Error') || response.Message.includes('PermissionDenied')) {
73
- const err = new ErrorResponse(response);
74
- this.log(LogLevel.ERROR, `Unexpected resp: ${response.Message}`);
71
+ this.hooks.hookOnce(`frontgateConnection:response:${subscriptionMsg.callbackId}`, (resubscribeResponse) => {
72
+ if (resubscribeResponse.Message.includes('Error') || resubscribeResponse.Message.includes('PermissionDenied')) {
73
+ const err = new ErrorResponse(resubscribeResponse);
74
+ this.log(LogLevel.ERROR, `Unexpected resp: ${resubscribeResponse.Message}`);
75
75
  rej(err);
76
76
  return;
77
77
  }
78
- const subscriptionKey = subscriptionType === 'connection' ? `${response.header.id_service}-${request.getPtlMessage().id_notation}` : response.header.id_job;
79
- const cancelationRequest = typeof CancelationRequestConstructor === 'undefined'
80
- ? new CancelSubscriptionRequest(response.header.id_job)
81
- : new CancelationRequestConstructor(response.header.id_service, request.getPtlMessage().id_notation);
82
- observer.idJob = response.header.id_job;
83
- removeMessageUpdateHook = this.hooks.hook(`frontgateConnection:response:${subscriptionKey}`, (update) => {
78
+ const resubscriptionKey = subscriptionType === 'connection' ? `${resubscribeResponse.header.id_service}-${request.getPtlMessage().id_notation}` : resubscribeResponse.header.id_job;
79
+ const resubscriptionCancelationRequest = typeof CancelationRequestConstructor === 'undefined'
80
+ ? new CancelSubscriptionRequest(resubscribeResponse.header.id_job)
81
+ : new CancelationRequestConstructor(resubscribeResponse.header.id_service, request.getPtlMessage().id_notation);
82
+ observer.idJob = resubscribeResponse.header.id_job;
83
+ removeMessageUpdateHook = this.hooks.hook(`frontgateConnection:response:${resubscriptionKey}`, (update) => {
84
84
  if (update.Message.includes('Error') || update.Message.includes('PermissionDenied')) {
85
85
  this.log(LogLevel.ERROR, `Unexpected response: ${update.Message}`);
86
86
  const err = new ErrorResponse(update);
@@ -99,7 +99,7 @@ export const rawSubscriptions = () => {
99
99
  }
100
100
  this.log(LogLevel.INFO, `Unsubscribing from ${key}`);
101
101
  const unsubscribeMsg = {
102
- message: cancelationRequest.getPtlMessage(),
102
+ message: resubscriptionCancelationRequest.getPtlMessage(),
103
103
  callbackType: 'job',
104
104
  callbackId: '',
105
105
  };
@@ -11,11 +11,11 @@ export function getUuid2() {
11
11
  export function getClientInformation() {
12
12
  const navigator = getNavigator();
13
13
  return {
14
- userAgent: navigator.userAgent,
15
- platform: navigator.platform,
14
+ userAgent: navigator.userAgent ?? 'unknown',
15
+ platform: 'frontgate-js-sdk',
16
16
  version: PACKAGE_JSON.version,
17
17
  package: PACKAGE_JSON.package,
18
- mobile: /Mobi/i.test(navigator.userAgent),
18
+ mobile: /Mobi/i.test(navigator.userAgent ?? 'unknown'),
19
19
  };
20
20
  }
21
21
  export function getNavigator() {
@@ -25,10 +25,9 @@ export function getNavigator() {
25
25
  if (typeof process !== 'undefined') {
26
26
  return {
27
27
  userAgent: `node.js/io.js, ${process.version}`,
28
- platform: `${process.platform}_${process.arch}`,
29
28
  };
30
29
  }
31
- return { userAgent: 'unknown', platform: 'unknown' };
30
+ return { userAgent: 'unknown' };
32
31
  }
33
32
  export const encodeSpanContext = (spanContext) => {
34
33
  const buffer = [18, 20, 9];
@@ -1 +1 @@
1
- export const PACKAGE_JSON = { version: '7.0.1', package: '@factset/frontgate-js-sdk' };
1
+ export const PACKAGE_JSON = { version: '7.0.4', package: '@factset/frontgate-js-sdk' };
@@ -18,13 +18,16 @@ class Mdg2Response {
18
18
  return this.raw.header.id_service;
19
19
  }
20
20
  isUpdateMessage() {
21
- return (Object.hasOwnProperty.call(this.raw, 'header') &&
22
- (Object.hasOwnProperty.call(this.raw.header, 'id_service') || Object.hasOwnProperty.call(this.raw.header, 'id_job')) &&
23
- this.raw.Message.endsWith('Update'));
21
+ if (!Object.hasOwnProperty.call(this.raw, 'header')) {
22
+ return false;
23
+ }
24
+ return (Object.hasOwnProperty.call(this.raw.header, 'id_service') || Object.hasOwnProperty.call(this.raw.header, 'id_job')) && this.raw.Message.endsWith('Update');
24
25
  }
25
26
  isLossMessage() {
26
- return (Object.hasOwnProperty.call(this.raw, 'header') &&
27
- (Object.hasOwnProperty.call(this.raw.header, 'id_service') || Object.hasOwnProperty.call(this.raw.header, 'id_job')) &&
27
+ if (!Object.hasOwnProperty.call(this.raw, 'header')) {
28
+ return false;
29
+ }
30
+ return ((Object.hasOwnProperty.call(this.raw.header, 'id_service') || Object.hasOwnProperty.call(this.raw.header, 'id_job')) &&
28
31
  (this.raw.Message.endsWith('LossMessage') || this.raw.Message.endsWith('Loss')));
29
32
  }
30
33
  }
@@ -8,13 +8,13 @@ const httpProxyRequest = () => {
8
8
  const mixinHTTPProxyRequestable = (Base) => {
9
9
  return class extends Base {
10
10
  async requestProxyEndpoint(method, path, body, options, timeOutInMs = this.defaultTimeoutInMs) {
11
- const httpProxyRequest = new message_1.HTTPProxyRequest(method, path, options);
11
+ const request = new message_1.HTTPProxyRequest(method, path, options);
12
12
  if (body) {
13
- httpProxyRequest.setBody(body);
13
+ request.setBody(body);
14
14
  }
15
- httpProxyRequest.header.setTimeout(timeOutInMs);
15
+ request.header.setTimeout(timeOutInMs);
16
16
  const msg = {
17
- message: httpProxyRequest.getPtlMessage(),
17
+ message: request.getPtlMessage(),
18
18
  callbackType: 'job',
19
19
  callbackId: '',
20
20
  };
@@ -2,15 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.logger = void 0;
4
4
  const _1 = require(".");
5
- const logger = (logger, logLevel) => {
5
+ const logger = (loggerInstance, logLevel) => {
6
6
  if (logLevel) {
7
- logger.setLevel(logLevel);
7
+ loggerInstance.setLevel(logLevel);
8
8
  }
9
9
  const mixinLogger = (Base) => {
10
10
  return class extends Base {
11
11
  constructor(...args) {
12
12
  super(...args);
13
- this.logger = logger;
13
+ this.logger = loggerInstance;
14
14
  }
15
15
  };
16
16
  };
@@ -129,8 +129,8 @@ const sessionAuth = (config, idApplication, username, password, deploymentStage)
129
129
  _sharedSecret = new WeakMap(),
130
130
  _clientSecret = new WeakMap(),
131
131
  _instances = new WeakSet(),
132
- _requestOtpAuthenticationTokenForSessionHandling = async function _requestOtpAuthenticationTokenForSessionHandling(lifetimeSeconds = message_1.AuthenticationTokenRequest.LIFETIME_SECONDS_MAXIMUM, idUser = authentication_1.ID_USER_AUTHENTICATED, idApplication = authentication_1.ID_APP_AUTHENTICATED, timeOutInMs = this.defaultTimeoutInMs) {
133
- const request = new message_1.AuthenticationTokenRequest(lifetimeSeconds, idUser, idApplication, timeOutInMs, true);
132
+ _requestOtpAuthenticationTokenForSessionHandling = async function _requestOtpAuthenticationTokenForSessionHandling(lifetimeSeconds = message_1.AuthenticationTokenRequest.LIFETIME_SECONDS_MAXIMUM, idUser = authentication_1.ID_USER_AUTHENTICATED, idApplicationOtp = authentication_1.ID_APP_AUTHENTICATED, timeOutInMs = this.defaultTimeoutInMs) {
133
+ const request = new message_1.AuthenticationTokenRequest(lifetimeSeconds, idUser, idApplicationOtp, timeOutInMs, true);
134
134
  const msg = {
135
135
  message: request.getPtlMessage(),
136
136
  callbackType: 'job',
@@ -47,8 +47,8 @@ const tokenAuth = (token) => {
47
47
  };
48
48
  this.hooks.hook('frontgateConnection:connected', authFn);
49
49
  }
50
- set token(token) {
51
- __classPrivateFieldSet(this, _token, token, "f");
50
+ set token(newToken) {
51
+ __classPrivateFieldSet(this, _token, newToken, "f");
52
52
  }
53
53
  },
54
54
  _token = new WeakMap(),
@@ -25,8 +25,8 @@ const wsConnection = (conf) => {
25
25
  const mixinConnectableWS = (Base) => {
26
26
  var _instances, _ws, _wsConf, _wsStateInternal, _keepAliveTimer, _jobId, _idApplication, _idUser, _wsState_get, _message_buffer_size, _msgBuffer, _getDisconnectMessage, _getKeepAliveMessage, _sendMessage, _respondToMessage, _addJobIdToMessage, _prepareMessage, _createErrorMessage, _applyDefaultsToConfig, _a;
27
27
  return _a = class extends Base {
28
- set conf(conf) {
29
- const internalConf = __classPrivateFieldGet(this, _instances, "m", _applyDefaultsToConfig).call(this, conf);
28
+ set conf(newConf) {
29
+ const internalConf = __classPrivateFieldGet(this, _instances, "m", _applyDefaultsToConfig).call(this, newConf);
30
30
  __classPrivateFieldSet(this, _message_buffer_size, internalConf.messageBufferSize, "f");
31
31
  __classPrivateFieldSet(this, _wsConf, internalConf, "f");
32
32
  }
@@ -318,16 +318,16 @@ const wsConnection = (conf) => {
318
318
  details: error,
319
319
  });
320
320
  },
321
- _applyDefaultsToConfig = function _applyDefaultsToConfig(conf) {
322
- const maxIdleIntervalInS = conf.maximumIdleIntervalInS ?? 60;
323
- const maxIdleInterval = conf.maximumIdleInterval ?? maxIdleIntervalInS * 1000000;
321
+ _applyDefaultsToConfig = function _applyDefaultsToConfig(oldConf) {
322
+ const maxIdleIntervalInS = oldConf.maximumIdleIntervalInS ?? 60;
323
+ const maxIdleInterval = oldConf.maximumIdleInterval ?? maxIdleIntervalInS * 1000000;
324
324
  return {
325
- ...conf,
326
- payloadContent: conf.payloadContent ?? 'foundation',
325
+ ...oldConf,
326
+ payloadContent: oldConf.payloadContent ?? 'foundation',
327
327
  maximumIdleIntervalInS: maxIdleIntervalInS,
328
328
  maximumIdleInterval: maxIdleInterval,
329
- tls: conf.tls ?? true,
330
- messageBufferSize: conf.messageBufferSize ?? 512,
329
+ tls: oldConf.tls ?? true,
330
+ messageBufferSize: oldConf.messageBufferSize ?? 512,
331
331
  };
332
332
  },
333
333
  _a;
@@ -196,7 +196,6 @@ const endpointSubscriptions = (originalConfig) => {
196
196
  __classPrivateFieldGet(this, _subscriptions, "f").set(key, observer);
197
197
  const currentSubscounts = __classPrivateFieldGet(this, _subscriptionCounts, "f").get(key) ?? 0;
198
198
  __classPrivateFieldGet(this, _subscriptionCounts, "f").set(key, currentSubscounts + 1);
199
- __classPrivateFieldGet(this, _inFlights, "f").delete(key);
200
199
  resolve(observer);
201
200
  });
202
201
  })
@@ -205,7 +204,9 @@ const endpointSubscriptions = (originalConfig) => {
205
204
  });
206
205
  });
207
206
  const rejectReason = `Request timeout reached (${timeOutInMs} ms) for ${subscriptionMsg.message.Message}`;
208
- const wrappedTimeoutPromise = (0, functions_1.useTimeout)(timeOutInMs, rejectReason, promise);
207
+ const wrappedTimeoutPromise = (0, functions_1.useTimeout)(timeOutInMs, rejectReason, promise).finally(() => {
208
+ __classPrivateFieldGet(this, _inFlights, "f").delete(key);
209
+ });
209
210
  __classPrivateFieldGet(this, _inFlights, "f").set(key, wrappedTimeoutPromise);
210
211
  return wrappedTimeoutPromise;
211
212
  }
@@ -71,19 +71,19 @@ const rawSubscriptions = () => {
71
71
  this.log(logger_1.LogLevel.INFO, `Resubscribing to ${key} due to reconnect`);
72
72
  await this.hooks.callHook('frontgateConnection:sendMessage', subscriptionMsg);
73
73
  const resubscribePromise = new Promise((res, rej) => {
74
- this.hooks.hookOnce(`frontgateConnection:response:${subscriptionMsg.callbackId}`, (response) => {
75
- if (response.Message.includes('Error') || response.Message.includes('PermissionDenied')) {
76
- const err = new message_1.ErrorResponse(response);
77
- this.log(logger_1.LogLevel.ERROR, `Unexpected resp: ${response.Message}`);
74
+ this.hooks.hookOnce(`frontgateConnection:response:${subscriptionMsg.callbackId}`, (resubscribeResponse) => {
75
+ if (resubscribeResponse.Message.includes('Error') || resubscribeResponse.Message.includes('PermissionDenied')) {
76
+ const err = new message_1.ErrorResponse(resubscribeResponse);
77
+ this.log(logger_1.LogLevel.ERROR, `Unexpected resp: ${resubscribeResponse.Message}`);
78
78
  rej(err);
79
79
  return;
80
80
  }
81
- const subscriptionKey = subscriptionType === 'connection' ? `${response.header.id_service}-${request.getPtlMessage().id_notation}` : response.header.id_job;
82
- const cancelationRequest = typeof CancelationRequestConstructor === 'undefined'
83
- ? new message_1.CancelSubscriptionRequest(response.header.id_job)
84
- : new CancelationRequestConstructor(response.header.id_service, request.getPtlMessage().id_notation);
85
- observer.idJob = response.header.id_job;
86
- removeMessageUpdateHook = this.hooks.hook(`frontgateConnection:response:${subscriptionKey}`, (update) => {
81
+ const resubscriptionKey = subscriptionType === 'connection' ? `${resubscribeResponse.header.id_service}-${request.getPtlMessage().id_notation}` : resubscribeResponse.header.id_job;
82
+ const resubscriptionCancelationRequest = typeof CancelationRequestConstructor === 'undefined'
83
+ ? new message_1.CancelSubscriptionRequest(resubscribeResponse.header.id_job)
84
+ : new CancelationRequestConstructor(resubscribeResponse.header.id_service, request.getPtlMessage().id_notation);
85
+ observer.idJob = resubscribeResponse.header.id_job;
86
+ removeMessageUpdateHook = this.hooks.hook(`frontgateConnection:response:${resubscriptionKey}`, (update) => {
87
87
  if (update.Message.includes('Error') || update.Message.includes('PermissionDenied')) {
88
88
  this.log(logger_1.LogLevel.ERROR, `Unexpected response: ${update.Message}`);
89
89
  const err = new message_1.ErrorResponse(update);
@@ -102,7 +102,7 @@ const rawSubscriptions = () => {
102
102
  }
103
103
  this.log(logger_1.LogLevel.INFO, `Unsubscribing from ${key}`);
104
104
  const unsubscribeMsg = {
105
- message: cancelationRequest.getPtlMessage(),
105
+ message: resubscriptionCancelationRequest.getPtlMessage(),
106
106
  callbackType: 'job',
107
107
  callbackId: '',
108
108
  };
@@ -18,11 +18,11 @@ function getUuid2() {
18
18
  function getClientInformation() {
19
19
  const navigator = getNavigator();
20
20
  return {
21
- userAgent: navigator.userAgent,
22
- platform: navigator.platform,
21
+ userAgent: navigator.userAgent ?? 'unknown',
22
+ platform: 'frontgate-js-sdk',
23
23
  version: version_1.PACKAGE_JSON.version,
24
24
  package: version_1.PACKAGE_JSON.package,
25
- mobile: /Mobi/i.test(navigator.userAgent),
25
+ mobile: /Mobi/i.test(navigator.userAgent ?? 'unknown'),
26
26
  };
27
27
  }
28
28
  function getNavigator() {
@@ -32,10 +32,9 @@ function getNavigator() {
32
32
  if (typeof process !== 'undefined') {
33
33
  return {
34
34
  userAgent: `node.js/io.js, ${process.version}`,
35
- platform: `${process.platform}_${process.arch}`,
36
35
  };
37
36
  }
38
- return { userAgent: 'unknown', platform: 'unknown' };
37
+ return { userAgent: 'unknown' };
39
38
  }
40
39
  const encodeSpanContext = (spanContext) => {
41
40
  const buffer = [18, 20, 9];
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PACKAGE_JSON = void 0;
4
- exports.PACKAGE_JSON = { version: '7.0.1', package: '@factset/frontgate-js-sdk' };
4
+ exports.PACKAGE_JSON = { version: '7.0.4', package: '@factset/frontgate-js-sdk' };
@@ -1,6 +1,6 @@
1
1
  import type { RequestResult } from './RequestResult';
2
2
  import type { HTTPProxyResponse } from '../../../message';
3
3
  export interface HTTPProxyRequestResult extends RequestResult {
4
- data: any | any[];
4
+ data: any;
5
5
  response: HTTPProxyResponse;
6
6
  }
@@ -1,5 +1,5 @@
1
1
  import type { Mdg2Response } from '../../../message';
2
2
  export interface RequestResult {
3
- data: any | any[];
3
+ data: any;
4
4
  response: Mdg2Response;
5
5
  }
@@ -28,5 +28,5 @@ export declare abstract class AbstractLogger {
28
28
  protected shouldLog(method: string): boolean;
29
29
  private setDefaultLevelFromLocalStorage;
30
30
  static getLogLevel(loglevel: string): LogLevel;
31
- static getLogger(name: string, LoggerClass: any): LoggerInterface;
31
+ static getLogger(name: string, LoggerClass: new (name: string) => LoggerInterface): LoggerInterface;
32
32
  }
@@ -2,13 +2,13 @@ import type { LoggerInterface } from './LoggerInterface';
2
2
  import type { LogLevel } from './AbstractLogger';
3
3
  import { AbstractLogger } from './AbstractLogger';
4
4
  export declare class ConsoleLogger extends AbstractLogger implements LoggerInterface {
5
- trace: any;
6
- debug: any;
7
- info: any;
8
- warn: any;
9
- error: any;
10
- fatal: any;
5
+ trace: (...args: unknown[]) => void;
6
+ debug: (...args: unknown[]) => void;
7
+ info: (...args: unknown[]) => void;
8
+ warn: (...args: unknown[]) => void;
9
+ error: (...args: unknown[]) => void;
10
+ fatal: (...args: unknown[]) => void;
11
11
  setLevel(level: LogLevel): void;
12
- protected getLogMethod(level: string): any;
12
+ protected getLogMethod(level: string): (...args: unknown[]) => void;
13
13
  static getLogger(name?: string): LoggerInterface;
14
14
  }
@@ -1,11 +1,11 @@
1
1
  import type { Level } from './AbstractLogger';
2
2
  export interface LoggerInterface {
3
- trace: (...args: any[]) => void;
4
- debug: (...args: any[]) => void;
5
- info: (...args: any[]) => void;
6
- warn: (...args: any[]) => void;
7
- error: (...args: any[]) => void;
8
- fatal: (...args: any[]) => void;
3
+ trace: (...args: unknown[]) => void;
4
+ debug: (...args: unknown[]) => void;
5
+ info: (...args: unknown[]) => void;
6
+ warn: (...args: unknown[]) => void;
7
+ error: (...args: unknown[]) => void;
8
+ fatal: (...args: unknown[]) => void;
9
9
  setLevel: (level: Level, persist?: boolean) => void;
10
10
  getLevel: () => Level;
11
11
  getName: () => string;