@factset/frontgate-js-sdk 7.1.4 → 7.1.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.
- package/CHANGELOG.md +45 -24
- package/dist/lib/esnext/common/errors.js +4 -5
- package/dist/lib/esnext/index.js +1 -0
- package/dist/lib/esnext/message/interfaces/PtlMessage.js +4 -0
- package/dist/lib/esnext/message/interfaces/index.js +1 -0
- package/dist/lib/esnext/message/request/AuthenticationByTokenRequest.js +2 -2
- package/dist/lib/esnext/message/request/AuthenticationRequest.js +2 -0
- package/dist/lib/esnext/message/request/ConfigurationRequest.js +3 -3
- package/dist/lib/esnext/message/response/AuthenticationTokenResponse.js +3 -11
- package/dist/lib/esnext/message/response/HTTPProxyResponse.js +0 -4
- package/dist/lib/esnext/message/response/Mdg2Response.js +4 -1
- package/dist/lib/esnext/message/response/PingResponse.js +0 -6
- package/dist/lib/esnext/message/response/index.js +0 -3
- package/dist/lib/esnext/mixins/AuthTokenRequestMixin.js +1 -1
- package/dist/lib/esnext/mixins/EndpointRequestMixin.js +7 -7
- package/dist/lib/esnext/mixins/HTTPProxyRequestMixin.js +1 -1
- package/dist/lib/esnext/mixins/OpenTelemetryMixin.js +2 -1
- package/dist/lib/esnext/mixins/PingMixin.js +5 -1
- package/dist/lib/esnext/mixins/RequestMixin.js +6 -1
- package/dist/lib/esnext/mixins/auth/AppAuthMixin.js +3 -3
- package/dist/lib/esnext/mixins/auth/SessionAuthMixin.js +4 -4
- package/dist/lib/esnext/mixins/auth/UserCredentialAuthMixin.js +3 -3
- package/dist/lib/esnext/mixins/auth/UserPasswordAuthMixin.js +3 -3
- package/dist/lib/esnext/mixins/connection/FrontgateWSMixin.js +11 -9
- package/dist/lib/esnext/mixins/subscription/DataObserver.js +1 -2
- package/dist/lib/esnext/mixins/subscription/EndpointSubscriptionMixin.js +13 -12
- package/dist/lib/esnext/mixins/subscription/RawSubscriptionMixin.js +28 -15
- package/dist/lib/esnext/version.js +1 -1
- package/dist/lib/node/common/errors.js +6 -7
- package/dist/lib/node/index.js +1 -0
- package/dist/lib/node/message/interfaces/PtlMessage.js +11 -0
- package/dist/lib/node/message/interfaces/index.js +1 -0
- package/dist/lib/node/message/request/AuthenticationByTokenRequest.js +2 -2
- package/dist/lib/node/message/request/AuthenticationRequest.js +2 -0
- package/dist/lib/node/message/request/ConfigurationRequest.js +3 -3
- package/dist/lib/node/message/response/AuthenticationTokenResponse.js +3 -11
- package/dist/lib/node/message/response/HTTPProxyResponse.js +0 -4
- package/dist/lib/node/message/response/Mdg2Response.js +4 -1
- package/dist/lib/node/message/response/PingResponse.js +0 -6
- package/dist/lib/node/message/response/index.js +0 -3
- package/dist/lib/node/mixins/AuthTokenRequestMixin.js +1 -1
- package/dist/lib/node/mixins/EndpointRequestMixin.js +7 -7
- package/dist/lib/node/mixins/HTTPProxyRequestMixin.js +1 -1
- package/dist/lib/node/mixins/OpenTelemetryMixin.js +2 -1
- package/dist/lib/node/mixins/PingMixin.js +5 -1
- package/dist/lib/node/mixins/RequestMixin.js +6 -1
- package/dist/lib/node/mixins/auth/AppAuthMixin.js +3 -3
- package/dist/lib/node/mixins/auth/SessionAuthMixin.js +4 -4
- package/dist/lib/node/mixins/auth/UserCredentialAuthMixin.js +3 -3
- package/dist/lib/node/mixins/auth/UserPasswordAuthMixin.js +3 -3
- package/dist/lib/node/mixins/connection/FrontgateWSMixin.js +11 -9
- package/dist/lib/node/mixins/subscription/DataObserver.js +1 -2
- package/dist/lib/node/mixins/subscription/EndpointSubscriptionMixin.js +12 -11
- package/dist/lib/node/mixins/subscription/RawSubscriptionMixin.js +27 -14
- package/dist/lib/node/version.js +1 -1
- package/dist/lib/types/common/errors.d.ts +4 -8
- package/dist/lib/types/common/interfaces/index.d.ts +0 -1
- package/dist/lib/types/index.d.ts +1 -0
- package/dist/lib/types/message/interfaces/PtlMessage.d.ts +486 -0
- package/dist/lib/types/message/interfaces/index.d.ts +1 -0
- package/dist/lib/types/message/request/AbstractMdg2Request.d.ts +3 -3
- package/dist/lib/types/message/request/AuthenticationByTokenRequest.d.ts +5 -2
- package/dist/lib/types/message/request/AuthenticationRequest.d.ts +10 -9
- package/dist/lib/types/message/request/AuthenticationTokenRequest.d.ts +2 -1
- package/dist/lib/types/message/request/CancelSubscriptionRequest.d.ts +2 -1
- package/dist/lib/types/message/request/ConfigurationRequest.d.ts +7 -2
- package/dist/lib/types/message/request/HTTPProxyRequest.d.ts +2 -2
- package/dist/lib/types/message/request/HighLevelRequest.d.ts +2 -2
- package/dist/lib/types/message/request/PingRequest.d.ts +2 -8
- package/dist/lib/types/message/request/TransportLayerClientRequestHeader.d.ts +3 -26
- package/dist/lib/types/message/response/AuthenticationTokenResponse.d.ts +3 -3
- package/dist/lib/types/message/response/HTTPProxyResponse.d.ts +8 -24
- package/dist/lib/types/message/response/HighLevelResponse.d.ts +3 -1
- package/dist/lib/types/message/response/Mdg2Response.d.ts +6 -4
- package/dist/lib/types/message/response/PingResponse.d.ts +2 -1
- package/dist/lib/types/message/response/index.d.ts +0 -3
- package/dist/lib/types/message/update/HighLevelUpdate.d.ts +3 -1
- package/dist/lib/types/mixins/connection/index.d.ts +9 -3
- package/dist/lib/types/mixins/subscription/DataObserver.d.ts +2 -3
- package/dist/lib/umd/mdg2.client.min.umd.js +1 -1
- package/dist/lib/umd/mdg2.client.umd.js +169 -154
- package/package.json +2 -2
- package/dist/lib/esnext/common/interfaces/PtlMessage.js +0 -1
- package/dist/lib/esnext/message/response/AuthenticationResponse.js +0 -1
- package/dist/lib/esnext/message/response/ConfigurationResponse.js +0 -1
- package/dist/lib/esnext/message/response/DisconnectionMessage.js +0 -1
- package/dist/lib/esnext/message/response/ErrorResponse.js +0 -9
- package/dist/lib/node/common/interfaces/PtlMessage.js +0 -2
- package/dist/lib/node/message/response/AuthenticationResponse.js +0 -2
- package/dist/lib/node/message/response/ConfigurationResponse.js +0 -2
- package/dist/lib/node/message/response/DisconnectionMessage.js +0 -2
- package/dist/lib/node/message/response/ErrorResponse.js +0 -13
- package/dist/lib/types/common/interfaces/PtlMessage.d.ts +0 -5
- package/dist/lib/types/message/response/AuthenticationResponse.d.ts +0 -37
- package/dist/lib/types/message/response/ConfigurationResponse.d.ts +0 -44
- package/dist/lib/types/message/response/DisconnectionMessage.d.ts +0 -7
- package/dist/lib/types/message/response/ErrorResponse.d.ts +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,24 @@
|
|
|
1
|
+
## <small>7.1.5 (2026-07-06)</small>
|
|
2
|
+
|
|
3
|
+
* chore(deps): lock file maintenance [4f4410c]
|
|
4
|
+
* chore(deps): lock file maintenance [b5939a8]
|
|
5
|
+
* chore(deps): update actions/setup-python action to v6.3.0 [eb694db]
|
|
6
|
+
* chore(deps): update dependency conventional-changelog to v8 [1a83768]
|
|
7
|
+
* feat(client): remove dead code in PingResponse error handling [24d4d9b]
|
|
8
|
+
* feat(client): use actual Errors in DataObserver instead of faking ErrorResponses [5273791]
|
|
9
|
+
* feat(client): use properly types PtlMessage definitions [abeeca0]
|
|
10
|
+
* fix(client): correctly define AuthenticationRequestOptions [ddde3b3]
|
|
11
|
+
* fix(client): correctly type challenge [61e4a1c]
|
|
12
|
+
* docs(architecture): document mixins and hooks [08d9244]
|
|
13
|
+
* docs(contribution): add getting started guide [5791d47]
|
|
14
|
+
|
|
1
15
|
## <small>7.1.4 (2026-06-25)</small>
|
|
2
16
|
|
|
3
|
-
* fix(client): using fetchAuth adds Connectable interface [2b442ee]
|
|
4
|
-
* fix(review-app): build as prod to reflect release [232a674]
|
|
5
17
|
* chore(release): reenable update commands after non-version-update release [d77a54e]
|
|
18
|
+
* chore(release): update changelog for v7.1.4 [78a1306]
|
|
6
19
|
* chore(review-app): lift stack to ubuntu-24 [43fbcbd]
|
|
20
|
+
* fix(client): using fetchAuth adds Connectable interface [2b442ee]
|
|
21
|
+
* fix(review-app): build as prod to reflect release [232a674]
|
|
7
22
|
|
|
8
23
|
## <small>7.1.3 (2026-06-24)</small>
|
|
9
24
|
|
|
@@ -155,7 +170,7 @@
|
|
|
155
170
|
* chore(deps): update factset/waffle-actions action to v2.5.3 [ec62ef6]
|
|
156
171
|
* chore(deps): update factset/waffle-actions action to v2.5.4 [015093c]
|
|
157
172
|
* chore(deps): update lockfile [10360ec]
|
|
158
|
-
* chore(deps): update softprops/action-gh-release action to v2.5.0 [8e0e10e], closes [softprops/action
|
|
173
|
+
* chore(deps): update softprops/action-gh-release action to v2.5.0 [8e0e10e], closes [softprops/action-gh-release]
|
|
159
174
|
* chore(deps): update sonarsource/sonarqube-scan-action action to v7 [ec16d18]
|
|
160
175
|
* chore(deps): update yarn to v4.12.0 [0d94944]
|
|
161
176
|
* chore(release): update changelog for v7.0.6 [4f77be8]
|
|
@@ -184,7 +199,7 @@
|
|
|
184
199
|
* chore(deps): update dependency node to v24 [272a875]
|
|
185
200
|
* chore(deps): update dependency node to v24 [515f36c]
|
|
186
201
|
* chore(deps): update dependency nx to v22 [62d9329]
|
|
187
|
-
* chore(deps): update softprops/action-gh-release action to v2.4.1 [2b084a1], closes [softprops/action
|
|
202
|
+
* chore(deps): update softprops/action-gh-release action to v2.4.1 [2b084a1], closes [softprops/action-gh-release]
|
|
188
203
|
* chore(deps): update vitest monorepo to v4 [cfbe7ce]
|
|
189
204
|
* chore(release): update changelog for v7.0.3 [e60b73f]
|
|
190
205
|
* chore(release): update changelog for v7.0.4 [e2c2c86]
|
|
@@ -219,9 +234,9 @@
|
|
|
219
234
|
* chore(deps): update dependency @fds/lint-standards to v29 [90367f8]
|
|
220
235
|
* chore(deps): update dependency happy-dom to v19 [32960ea]
|
|
221
236
|
* chore(deps): update dependency vite to ^7.1.5 [security] [8879b32]
|
|
222
|
-
* chore(deps): update softprops/action-gh-release action to v2.3.3 [00f18bb], closes [softprops/action
|
|
223
|
-
* chore(deps): update softprops/action-gh-release action to v2.3.4 [1bf3bad], closes [softprops/action
|
|
224
|
-
* chore(deps): update softprops/action-gh-release action to v2.4.0 [6fa1a5e], closes [softprops/action
|
|
237
|
+
* chore(deps): update softprops/action-gh-release action to v2.3.3 [00f18bb], closes [softprops/action-gh-release]
|
|
238
|
+
* chore(deps): update softprops/action-gh-release action to v2.3.4 [1bf3bad], closes [softprops/action-gh-release]
|
|
239
|
+
* chore(deps): update softprops/action-gh-release action to v2.4.0 [6fa1a5e], closes [softprops/action-gh-release]
|
|
225
240
|
* chore(deps): update sonarsource/sonarqube-scan-action action to v6 [6efaefa]
|
|
226
241
|
* chore(deps): update yarn to v4.10.0 [b47a139]
|
|
227
242
|
* chore(deps): update yarn to v4.10.3 [7759d0a]
|
|
@@ -311,9 +326,9 @@
|
|
|
311
326
|
* chore(deps): update dependency vite to v7 [ff16a47]
|
|
312
327
|
* chore(deps): update dependency vite-tsconfig-paths to v5 [307fd61]
|
|
313
328
|
* chore(deps): update factset/waffle-actions action to v2.5.2 [617d450]
|
|
314
|
-
* chore(deps): update peaceiris/actions-gh-pages action to v3.9.3 [2070e37], closes [peaceiris/actions
|
|
315
|
-
* chore(deps): update peaceiris/actions-gh-pages action to v4 [6569746], closes [peaceiris/actions
|
|
316
|
-
* chore(deps): update softprops/action-gh-release action to v2 [cba8093], closes [softprops/action
|
|
329
|
+
* chore(deps): update peaceiris/actions-gh-pages action to v3.9.3 [2070e37], closes [peaceiris/actions-gh-pages]
|
|
330
|
+
* chore(deps): update peaceiris/actions-gh-pages action to v4 [6569746], closes [peaceiris/actions-gh-pages]
|
|
331
|
+
* chore(deps): update softprops/action-gh-release action to v2 [cba8093], closes [softprops/action-gh-release]
|
|
317
332
|
* chore(deps): update sonarsource/sonarqube-scan-action action to v5 [5876377]
|
|
318
333
|
* chore(deps): update yarn to v4.9.2 [750d175]
|
|
319
334
|
* feat(auth): remove depracted auth interfaces [01da6bd]
|
|
@@ -559,7 +574,7 @@
|
|
|
559
574
|
|
|
560
575
|
## <small>6.2.5 (2024-04-29)</small>
|
|
561
576
|
|
|
562
|
-
* chore(gh-actions): upgrade sonarcloud action [84b0aaa], closes [
|
|
577
|
+
* chore(gh-actions): upgrade sonarcloud action [84b0aaa], closes [gh-actions]
|
|
563
578
|
* chore(repo): bump version.ts [b84a41c]
|
|
564
579
|
* chore(repo): update changelog [b16b9a8]
|
|
565
580
|
* feat(subscriptions): add request options [8703cc3]
|
|
@@ -819,9 +834,12 @@
|
|
|
819
834
|
|
|
820
835
|
## <small>5.6.4 (2023-09-14)</small>
|
|
821
836
|
|
|
822
|
-
* v5.6.3 (#171) [224c1bd], closes [#171]
|
|
823
837
|
* v5.6.4 (#182) [abfb313], closes [#182]
|
|
824
838
|
* fix: refactor session handling code to make mdg2Client backward compatible (#179) [adfc5f0], closes [#179]
|
|
839
|
+
|
|
840
|
+
## <small>5.6.3 (2023-07-17)</small>
|
|
841
|
+
|
|
842
|
+
* v5.6.3 (#171) [224c1bd], closes [#171]
|
|
825
843
|
* Fix: fix undefined logger to endpointhandler from subscription Module (#167) [da440dd], closes [#167]
|
|
826
844
|
* Fix: Prevent form from submitting (#168) [832ecae], closes [#168]
|
|
827
845
|
|
|
@@ -1009,7 +1027,7 @@
|
|
|
1009
1027
|
### BREAKING CHANGE
|
|
1010
1028
|
|
|
1011
1029
|
* UserCredentialAuthentication constructor changed: idUser removed.
|
|
1012
|
-
UserPasswordAuthentication constructor changed: idUser removed.
|
|
1030
|
+
UserPasswordAuthentication constructor changed: idUser removed.
|
|
1013
1031
|
|
|
1014
1032
|
## 4.2.0 (2021-07-23)
|
|
1015
1033
|
|
|
@@ -1032,29 +1050,32 @@ UserPasswordAuthentication constructor changed: idUser removed.
|
|
|
1032
1050
|
|
|
1033
1051
|
## 4.0.0 (2021-06-01)
|
|
1034
1052
|
|
|
1053
|
+
* Updated function to boolean [86623f0]
|
|
1054
|
+
* Updated Readme for flagPermissionDenied [2f69a09]
|
|
1055
|
+
* Updated readme with how to enable flag_permission_denied_response [1dc9653]
|
|
1056
|
+
* v4.0.0 [0f2343e]
|
|
1057
|
+
* feat(demo): replace local- with sessionStorage [e1642d4]
|
|
1058
|
+
* feat(low-level-messages): remove all lowlevel messages [c7d4c2a]
|
|
1059
|
+
* feat(request): configured flag_permission_denied_response globally [9c2b654]
|
|
1060
|
+
* feat(request): support for flag_permission_denied_response for HighLevelRequests [8112a05]
|
|
1061
|
+
* feat(sessionModule): delete session module [81d2252]
|
|
1062
|
+
* feat(sessionModule): remove from demos [c23b3a5]
|
|
1063
|
+
|
|
1064
|
+
## <small>3.3.3 (2021-04-16)</small>
|
|
1065
|
+
|
|
1035
1066
|
* fix:(subscription loss) removed void as return type [74d6195]
|
|
1036
1067
|
* fix:(subscriptionloss) handling message from frontgate [4966cae]
|
|
1037
1068
|
* fix:(subscriptionloss) updated unit tests [59f79f7]
|
|
1038
1069
|
* fix:(subscriptionloss)Deleting lost job [043ca5c]
|
|
1039
1070
|
* job deleted outside the loop [c3dcfc0]
|
|
1040
|
-
* Updated function to boolean [86623f0]
|
|
1041
|
-
* Updated Readme for flagPermissionDenied [2f69a09]
|
|
1042
|
-
* Updated readme with how to enable flag_permission_denied_response [1dc9653]
|
|
1043
1071
|
* v3.3.3 [7cb7671]
|
|
1044
|
-
* v4.0.0 [0f2343e]
|
|
1045
1072
|
* feat(authentication): enforce clientCredentials parameter [b62222b]
|
|
1046
|
-
* feat(demo): replace local- with sessionStorage [e1642d4]
|
|
1047
1073
|
* feat(documentation): add documentation on using a proxy [40910a4]
|
|
1048
1074
|
* feat(FAS-491): implement client side ws timeout [da4860f]
|
|
1049
1075
|
* feat(FAS-491): take timeout from server response [bc9727b]
|
|
1050
1076
|
* feat(FAS-492): increase to 45sec [13c791a]
|
|
1051
1077
|
* feat(logger): document logging [fdc138e]
|
|
1052
|
-
* feat(low-level-messages): remove all lowlevel messages [c7d4c2a]
|
|
1053
1078
|
* feat(request-timeout): document usage [be1425e]
|
|
1054
|
-
* feat(request): configured flag_permission_denied_response globally [9c2b654]
|
|
1055
|
-
* feat(request): support for flag_permission_denied_response for HighLevelRequests [8112a05]
|
|
1056
|
-
* feat(sessionModule): delete session module [81d2252]
|
|
1057
|
-
* feat(sessionModule): remove from demos [c23b3a5]
|
|
1058
1079
|
|
|
1059
1080
|
## <small>3.3.2 (2021-02-03)</small>
|
|
1060
1081
|
|
|
@@ -1390,7 +1411,7 @@ UserPasswordAuthentication constructor changed: idUser removed.
|
|
|
1390
1411
|
* Update: release of version 0.1.2 [edd26cb]
|
|
1391
1412
|
* Update: updated lint task to use lint-standards repo; updated release task to newer version. [1bebb60]
|
|
1392
1413
|
* Update: updated Readme; fixed subscriptions [2950c68]
|
|
1393
|
-
* Feature: removed observe() from Mdg2Client and created a PushClient; added fieldInstanceId cache to
|
|
1414
|
+
* Feature: removed observe() from Mdg2Client and created a PushClient; added fieldInstanceId cache to [00f88e1]
|
|
1394
1415
|
* Docs: update Readme [0a3ead8]
|
|
1395
1416
|
* Fix: added babel-loader for Datamodel files, in order to uglify them [a46f007]
|
|
1396
1417
|
* Fix: creection of the repository reference [57b9823]
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export class
|
|
2
|
-
constructor(
|
|
3
|
-
super(
|
|
4
|
-
this.
|
|
5
|
-
this.code = 408;
|
|
1
|
+
export class UnexpectedResponseError extends Error {
|
|
2
|
+
constructor(response) {
|
|
3
|
+
super(`Unexpected response: ${response.Message}`);
|
|
4
|
+
this.response = response;
|
|
6
5
|
}
|
|
7
6
|
}
|
package/dist/lib/esnext/index.js
CHANGED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export const hasJobIdInRoot = (msg) => typeof msg.id_job !== 'undefined';
|
|
2
|
+
export const hasJobIdInHeader = (msg) => typeof msg.header?.id_job !== 'undefined';
|
|
3
|
+
export const isServiceAndNotationBased = (msg) => typeof msg.header?.id_service !== 'undefined' && typeof msg.id_notation !== 'undefined';
|
|
4
|
+
export const isPtlMessageWithHeader = (msg) => msg.header !== undefined;
|
|
@@ -21,10 +21,10 @@ export class AuthenticationByTokenRequest {
|
|
|
21
21
|
maximum_receivable_message_size: 1048576,
|
|
22
22
|
flags: 0,
|
|
23
23
|
cache_authentication_salt: {
|
|
24
|
-
value:
|
|
24
|
+
value: { b64: '' },
|
|
25
25
|
},
|
|
26
26
|
cache_authentication_encrypted_secret: {
|
|
27
|
-
encrypted_secret:
|
|
27
|
+
encrypted_secret: { b64: '' },
|
|
28
28
|
},
|
|
29
29
|
};
|
|
30
30
|
}
|
|
@@ -67,9 +67,9 @@ export class ConfigurationRequest {
|
|
|
67
67
|
if (typeof challenge === 'string') {
|
|
68
68
|
return Buffer.from(challenge, 'utf-8');
|
|
69
69
|
}
|
|
70
|
-
if (
|
|
71
|
-
return Buffer.from(challenge
|
|
70
|
+
if (Array.isArray(challenge)) {
|
|
71
|
+
return Buffer.from(challenge);
|
|
72
72
|
}
|
|
73
|
-
return Buffer.from(challenge);
|
|
73
|
+
return Buffer.from(challenge.b64, 'base64');
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
import { Mdg2Response } from './Mdg2Response';
|
|
2
1
|
import { timeToMilliseconds } from '../types';
|
|
3
|
-
export class AuthenticationTokenResponse
|
|
2
|
+
export class AuthenticationTokenResponse {
|
|
4
3
|
constructor(raw) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
throw new Error('Token not set in AuthenticationTokenResponse');
|
|
8
|
-
}
|
|
9
|
-
if (!this.raw.expiry.microseconds) {
|
|
10
|
-
throw new Error('Expiry not set in AuthenticationTokenResponse');
|
|
11
|
-
}
|
|
12
|
-
this.token = this.raw.token.value.b64;
|
|
13
|
-
this.expiry = parseInt(timeToMilliseconds(this.raw.expiry.microseconds), 10);
|
|
4
|
+
this.token = raw.token.value.b64;
|
|
5
|
+
this.expiry = parseInt(timeToMilliseconds(raw.expiry.microseconds), 10);
|
|
14
6
|
}
|
|
15
7
|
getToken() {
|
|
16
8
|
return this.token;
|
|
@@ -10,16 +10,12 @@ export class HTTPProxyResponse extends Mdg2Response {
|
|
|
10
10
|
catch (error) {
|
|
11
11
|
throw new Error(`Could not parse HTTPProxyResponse: ${error}`);
|
|
12
12
|
}
|
|
13
|
-
this.responseInfo = this.raw.info;
|
|
14
13
|
this.statusReason = this.raw.response.status_reason;
|
|
15
14
|
this.statusCode = this.raw.response.status_code.value;
|
|
16
15
|
}
|
|
17
16
|
get data() {
|
|
18
17
|
return this.responseData;
|
|
19
18
|
}
|
|
20
|
-
get meta() {
|
|
21
|
-
return this.responseData.meta;
|
|
22
|
-
}
|
|
23
19
|
get status() {
|
|
24
20
|
return {
|
|
25
21
|
code: this.statusCode,
|
|
@@ -12,7 +12,10 @@ export class Mdg2Response {
|
|
|
12
12
|
return this.raw.header.id_job;
|
|
13
13
|
}
|
|
14
14
|
get serviceId() {
|
|
15
|
-
|
|
15
|
+
if (this.raw.Message === 'Foundation::HTTPProxyResponse' || this.raw.Message === 'Foundation::HighLevelResponse') {
|
|
16
|
+
return this.raw.header.id_service;
|
|
17
|
+
}
|
|
18
|
+
throw new Error('Invalid message type');
|
|
16
19
|
}
|
|
17
20
|
isUpdateMessage() {
|
|
18
21
|
if (!Object.hasOwnProperty.call(this.raw, 'header')) {
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { timeToMilliseconds } from '../types';
|
|
2
2
|
export class PingResponse {
|
|
3
3
|
constructor(raw) {
|
|
4
|
-
if (raw.Message !== PingResponse.NAME) {
|
|
5
|
-
throw new Error(`Unsupported message=${raw.Message}`);
|
|
6
|
-
}
|
|
7
|
-
if (raw.Version !== PingResponse.VERSION) {
|
|
8
|
-
throw new Error(`Unsupported version=${raw.Version} for message=${raw.Message}`);
|
|
9
|
-
}
|
|
10
4
|
this._timeReceivedResponse = Date.now();
|
|
11
5
|
this._timeAtSender = Number(timeToMilliseconds(raw.time_at_sender.microseconds));
|
|
12
6
|
this._timeFromRequest = Number(timeToMilliseconds(raw.time_from_request.microseconds));
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
export * from './AuthenticationTokenResponse';
|
|
2
|
-
export * from './ConfigurationResponse';
|
|
3
|
-
export * from './DisconnectionMessage';
|
|
4
|
-
export * from './ErrorResponse';
|
|
5
2
|
export * from './HighLevelResponse';
|
|
6
3
|
export * from './HTTPProxyResponse';
|
|
7
4
|
export * from './Mdg2Response';
|
|
@@ -15,7 +15,7 @@ export const authTokenRequest = () => {
|
|
|
15
15
|
await this.hooks.callHook('frontgateConnection:sendMessage', msg);
|
|
16
16
|
const promise = new Promise((resolve, reject) => {
|
|
17
17
|
this.hooks.hookOnce(`frontgateConnection:response:${msg.callbackId}`, (response) => {
|
|
18
|
-
if (
|
|
18
|
+
if (response.Message !== 'Foundation::AuthenticationTokenResponse') {
|
|
19
19
|
reject(JSON.stringify(response));
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
@@ -35,19 +35,19 @@ export const endpointRequest = (config) => {
|
|
|
35
35
|
const hookResponse = () => {
|
|
36
36
|
this.hooks.hookOnce(`frontgateConnection:response:${msg.callbackId}`, (response) => {
|
|
37
37
|
try {
|
|
38
|
-
if (
|
|
38
|
+
if (response.Message !== 'Foundation::HighLevelResponse' && response.Message !== 'HighLevelResponse') {
|
|
39
39
|
reject(JSON.stringify(response));
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
if (!__classPrivateFieldGet(this, _instances, "m", _hasNextChunk).call(this, response)) {
|
|
43
43
|
chunkedData.push({
|
|
44
|
-
body: response.body
|
|
45
|
-
processingTime: response.header
|
|
44
|
+
body: response.body.value,
|
|
45
|
+
processingTime: response.header.processing_time,
|
|
46
46
|
});
|
|
47
47
|
const hlResponse = new HighLevelResponse({
|
|
48
48
|
...response,
|
|
49
49
|
body: { value: chunkedData.map((chunk) => chunk.body).join('') },
|
|
50
|
-
header: { ...response.header,
|
|
50
|
+
header: { ...response.header, processing_time: chunkedData.reduce((acc, chunk) => acc + chunk.processingTime, 0) },
|
|
51
51
|
});
|
|
52
52
|
resolve({
|
|
53
53
|
response: hlResponse,
|
|
@@ -56,8 +56,8 @@ export const endpointRequest = (config) => {
|
|
|
56
56
|
}
|
|
57
57
|
else {
|
|
58
58
|
chunkedData.push({
|
|
59
|
-
body: response.body
|
|
60
|
-
processingTime: response.header
|
|
59
|
+
body: response.body.value,
|
|
60
|
+
processingTime: response.header.processing_time,
|
|
61
61
|
});
|
|
62
62
|
hookResponse();
|
|
63
63
|
}
|
|
@@ -75,7 +75,7 @@ export const endpointRequest = (config) => {
|
|
|
75
75
|
},
|
|
76
76
|
_instances = new WeakSet(),
|
|
77
77
|
_hasNextChunk = function _hasNextChunk(msg) {
|
|
78
|
-
return (
|
|
78
|
+
return (msg.header.flags & FLAG_HAS_NEXT_CHUNK) === FLAG_HAS_NEXT_CHUNK;
|
|
79
79
|
},
|
|
80
80
|
_a;
|
|
81
81
|
};
|
|
@@ -19,7 +19,7 @@ export const httpProxyRequest = () => {
|
|
|
19
19
|
const promise = new Promise((resolve, reject) => {
|
|
20
20
|
this.hooks.hookOnce(`frontgateConnection:response:${msg.callbackId}`, (response) => {
|
|
21
21
|
try {
|
|
22
|
-
if (
|
|
22
|
+
if (response.Message !== 'Foundation::HTTPProxyResponse') {
|
|
23
23
|
reject(JSON.stringify(response));
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
@@ -5,6 +5,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
5
5
|
};
|
|
6
6
|
import { trace } from '@opentelemetry/api';
|
|
7
7
|
import { createExtendedMixinFactory } from '.';
|
|
8
|
+
import { isPtlMessageWithHeader } from '../message/interfaces';
|
|
8
9
|
export const openTelemetry = () => {
|
|
9
10
|
const mixinOpenTelemetry = (Base) => {
|
|
10
11
|
var _instances, _createSpanHeader, _a;
|
|
@@ -13,7 +14,7 @@ export const openTelemetry = () => {
|
|
|
13
14
|
super(...args);
|
|
14
15
|
_instances.add(this);
|
|
15
16
|
this.hooks.hook('frontgateConnection:beforeSerializeMessage', (msg) => {
|
|
16
|
-
if (msg
|
|
17
|
+
if (isPtlMessageWithHeader(msg)) {
|
|
17
18
|
trace.getTracer('frontgate-js-sdk').startActiveSpan('frontgateConnection:sendMessage', (span) => {
|
|
18
19
|
const spanHeader = __classPrivateFieldGet(this, _instances, "m", _createSpanHeader).call(this, span.spanContext());
|
|
19
20
|
if (spanHeader) {
|
|
@@ -12,8 +12,12 @@ export const pingRequests = () => {
|
|
|
12
12
|
callbackId: 'PingResponse',
|
|
13
13
|
};
|
|
14
14
|
await this.hooks.callHook('frontgateConnection:sendMessage', msg);
|
|
15
|
-
const promise = new Promise((resolve) => {
|
|
15
|
+
const promise = new Promise((resolve, reject) => {
|
|
16
16
|
this.hooks.hookOnce(`frontgateConnection:response:${msg.callbackId}`, (response) => {
|
|
17
|
+
if (response.Message !== 'Foundation::PingResponse') {
|
|
18
|
+
reject(JSON.stringify(response));
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
17
21
|
const pong = new PingResponse(response);
|
|
18
22
|
resolve(pong);
|
|
19
23
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createExtendedMixinFactory } from '.';
|
|
2
|
+
import { UnexpectedResponseError } from '../common/errors';
|
|
2
3
|
import { Mdg2Response } from '../message';
|
|
3
4
|
import { useTimeout } from '../util/functions';
|
|
4
5
|
export const requests = () => {
|
|
@@ -12,8 +13,12 @@ export const requests = () => {
|
|
|
12
13
|
callbackId: '',
|
|
13
14
|
};
|
|
14
15
|
await this.hooks.callHook('frontgateConnection:sendMessage', msg);
|
|
15
|
-
const promise = new Promise((resolve) => {
|
|
16
|
+
const promise = new Promise((resolve, reject) => {
|
|
16
17
|
this.hooks.hookOnce(`frontgateConnection:response:${msg.callbackId}`, (response) => {
|
|
18
|
+
if (response.Message !== 'Foundation::HighLevelResponse' && response.Message !== 'HighLevelResponse') {
|
|
19
|
+
reject(new UnexpectedResponseError(response));
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
17
22
|
const mdg2Response = new Mdg2Response(response);
|
|
18
23
|
resolve(mdg2Response);
|
|
19
24
|
});
|
|
@@ -10,6 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
import { createExtendedMixinFactory } from '../.';
|
|
13
|
+
import { UnexpectedResponseError } from '../../common/errors';
|
|
13
14
|
import { SecretGenerator, AuthenticationRequest, ConfigurationRequest } from '../../compat';
|
|
14
15
|
import { getBytesFromBuffer } from '../../connection';
|
|
15
16
|
import { LogLevel } from '../../logger';
|
|
@@ -59,9 +60,8 @@ export const appAuth = (idApplication, idUser, clientCredentials, deploymentStag
|
|
|
59
60
|
return new AuthenticationRequest(options);
|
|
60
61
|
},
|
|
61
62
|
_createConfigurationRequest = function _createConfigurationRequest(msg, conf) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
throw new Error(`Expected message "${expectedMessage}" but received "${msg.Message}"`);
|
|
63
|
+
if (msg.Message !== 'Foundation::AuthenticationResponse') {
|
|
64
|
+
throw new UnexpectedResponseError(msg);
|
|
65
65
|
}
|
|
66
66
|
const { challenge } = msg.challenge;
|
|
67
67
|
const options = {
|
|
@@ -18,6 +18,7 @@ import { LogLevel } from '../../logger';
|
|
|
18
18
|
import { AuthenticationByTokenRequest, AuthenticationTokenRequest, AuthenticationTokenResponse } from '../../message';
|
|
19
19
|
import { randomBytes } from 'crypto';
|
|
20
20
|
import { useTimeout } from '../../util/functions';
|
|
21
|
+
import { UnexpectedResponseError } from '../../common/errors';
|
|
21
22
|
export const sessionAuth = (config, idApplication, username, password, deploymentStage) => {
|
|
22
23
|
const mixinSessionAuth = (Base) => {
|
|
23
24
|
var _instances, _tokenConnectionAttempt, _logOut, _mdg2wstoken, _sharedSecret, _clientSecret, _requestOtpAuthenticationTokenForSessionHandling, _toUrlBase64, _createAuthenticationRequest, _createConfigurationRequest, _createTransportLayerRequestHeaderConfigurationRequest, _submit, _a;
|
|
@@ -134,7 +135,7 @@ export const sessionAuth = (config, idApplication, username, password, deploymen
|
|
|
134
135
|
await this.hooks.callHook('frontgateConnection:sendMessage', msg);
|
|
135
136
|
const promise = new Promise((resolve, reject) => {
|
|
136
137
|
this.hooks.hookOnce(`frontgateConnection:response:${msg.callbackId}`, (response) => {
|
|
137
|
-
if (
|
|
138
|
+
if (response.Message !== 'Foundation::AuthenticationTokenResponse') {
|
|
138
139
|
reject(JSON.stringify(response));
|
|
139
140
|
return;
|
|
140
141
|
}
|
|
@@ -163,9 +164,8 @@ export const sessionAuth = (config, idApplication, username, password, deploymen
|
|
|
163
164
|
return new AuthenticationRequest(options);
|
|
164
165
|
},
|
|
165
166
|
_createConfigurationRequest = function _createConfigurationRequest(msg, conf) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
throw new Error(`Expected message "${expectedMessage}" but received "${msg.Message}"`);
|
|
167
|
+
if (msg.Message !== 'Foundation::AuthenticationResponse') {
|
|
168
|
+
throw new UnexpectedResponseError(msg);
|
|
169
169
|
}
|
|
170
170
|
if (msg.id_user === ID_USER_AUTHENTICATED) {
|
|
171
171
|
void this.hooks.callHook('frontgateConnection:setIdApp', ID_APP_AUTHENTICATED);
|
|
@@ -15,6 +15,7 @@ import { AuthenticationRequest, ConfigurationRequest, SecretGenerator } from '..
|
|
|
15
15
|
import { ID_APP_AUTHENTICATED, ID_USER_AUTHENTICATED } from '../../authentication';
|
|
16
16
|
import { randomBytes } from 'crypto';
|
|
17
17
|
import { LogLevel } from '../../logger';
|
|
18
|
+
import { UnexpectedResponseError } from '../../common/errors';
|
|
18
19
|
export const userCredentialAuth = (idApplication, username, credentials, deploymentStage) => {
|
|
19
20
|
const mixinUserCredentialAuth = (Base) => {
|
|
20
21
|
var _instances, _sharedSecret, _clientSecret, _createAuthenticationRequest, _createConfigurationRequest, _createTransportLayerRequestHeaderConfigurationRequest, _submit, _a;
|
|
@@ -58,9 +59,8 @@ export const userCredentialAuth = (idApplication, username, credentials, deploym
|
|
|
58
59
|
return new AuthenticationRequest(options);
|
|
59
60
|
},
|
|
60
61
|
_createConfigurationRequest = function _createConfigurationRequest(msg, conf) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
throw new Error(`Expected message "${expectedMessage}" but received "${msg.Message}"`);
|
|
62
|
+
if (msg.Message !== 'Foundation::AuthenticationResponse') {
|
|
63
|
+
throw new UnexpectedResponseError(msg);
|
|
64
64
|
}
|
|
65
65
|
if (msg.id_user === ID_USER_AUTHENTICATED) {
|
|
66
66
|
void this.hooks.callHook('frontgateConnection:setIdApp', ID_APP_AUTHENTICATED);
|
|
@@ -15,6 +15,7 @@ import { ID_APP_AUTHENTICATED, ID_USER_AUTHENTICATED } from '../../authenticatio
|
|
|
15
15
|
import { AuthenticationRequest, ConfigurationRequest, SecretGenerator } from '../../compat';
|
|
16
16
|
import { LogLevel } from '../../logger';
|
|
17
17
|
import { randomBytes } from 'crypto';
|
|
18
|
+
import { UnexpectedResponseError } from '../../common/errors';
|
|
18
19
|
export const userPasswordAuth = (idApplication, username, password, deploymentStage) => {
|
|
19
20
|
const mixinUserPasswordAuth = (Base) => {
|
|
20
21
|
var _instances, _sharedSecret, _clientSecret, _createAuthenticationRequest, _createConfigurationRequest, _createTransportLayerRequestHeaderConfigurationRequest, _submit, _a;
|
|
@@ -53,9 +54,8 @@ export const userPasswordAuth = (idApplication, username, password, deploymentSt
|
|
|
53
54
|
return new AuthenticationRequest(options);
|
|
54
55
|
},
|
|
55
56
|
_createConfigurationRequest = function _createConfigurationRequest(msg, conf) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
throw new Error(`Expected message "${expectedMessage}" but received "${msg.Message}"`);
|
|
57
|
+
if (msg.Message !== 'Foundation::AuthenticationResponse') {
|
|
58
|
+
throw new UnexpectedResponseError(msg);
|
|
59
59
|
}
|
|
60
60
|
if (msg.id_user === ID_USER_AUTHENTICATED) {
|
|
61
61
|
void this.hooks.callHook('frontgateConnection:setIdApp', ID_APP_AUTHENTICATED);
|
|
@@ -12,8 +12,8 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
12
12
|
import { createExtendedMixinFactory, } from '../';
|
|
13
13
|
import WebSocket from 'isomorphic-ws';
|
|
14
14
|
import { LogLevel } from '../../logger';
|
|
15
|
+
import { hasJobIdInRoot, hasJobIdInHeader, isServiceAndNotationBased } from '../../message/interfaces';
|
|
15
16
|
import { ID_APP_AUTHENTICATED, ID_USER_NONE } from '../../authentication';
|
|
16
|
-
import { ErrorResponse } from '../../message';
|
|
17
17
|
import { useTimeout } from '../../util/functions';
|
|
18
18
|
export const wsConnection = (conf) => {
|
|
19
19
|
const mixinConnectableWS = (Base) => {
|
|
@@ -259,19 +259,19 @@ export const wsConnection = (conf) => {
|
|
|
259
259
|
}
|
|
260
260
|
catch (e) {
|
|
261
261
|
const errorResponse = __classPrivateFieldGet(this, _instances, "m", _createErrorMessage).call(this, e, msg);
|
|
262
|
-
__classPrivateFieldGet(this, _instances, "m", _respondToMessage).call(this, errorResponse
|
|
262
|
+
__classPrivateFieldGet(this, _instances, "m", _respondToMessage).call(this, errorResponse);
|
|
263
263
|
}
|
|
264
264
|
},
|
|
265
265
|
_respondToMessage = function _respondToMessage(msgObj) {
|
|
266
|
-
if (
|
|
266
|
+
if (hasJobIdInHeader(msgObj)) {
|
|
267
267
|
void this.hooks.callHook(`frontgateConnection:response:${msgObj.header.id_job}`, msgObj);
|
|
268
268
|
return;
|
|
269
269
|
}
|
|
270
|
-
if (
|
|
270
|
+
if (isServiceAndNotationBased(msgObj)) {
|
|
271
271
|
void this.hooks.callHook(`frontgateConnection:response:${msgObj.header.id_service}-${msgObj.id_notation}`, msgObj);
|
|
272
272
|
return;
|
|
273
273
|
}
|
|
274
|
-
if (
|
|
274
|
+
if (hasJobIdInRoot(msgObj)) {
|
|
275
275
|
void this.hooks.callHook(`frontgateConnection:response:${msgObj.id_job}`, msgObj);
|
|
276
276
|
return;
|
|
277
277
|
}
|
|
@@ -308,13 +308,15 @@ export const wsConnection = (conf) => {
|
|
|
308
308
|
(_c = msg.header.authentication_identifiers).id_user || (_c.id_user = __classPrivateFieldGet(this, _idUser, "f"));
|
|
309
309
|
},
|
|
310
310
|
_createErrorMessage = function _createErrorMessage(error, msg) {
|
|
311
|
-
return
|
|
311
|
+
return {
|
|
312
312
|
Message: 'Foundation::ErrorResponse',
|
|
313
313
|
Version: 1,
|
|
314
|
-
|
|
315
|
-
|
|
314
|
+
header: {},
|
|
315
|
+
id_job: msg.header?.id_job ?? -1,
|
|
316
|
+
processing_time: 0,
|
|
317
|
+
reason: { value: 8 },
|
|
316
318
|
details: error,
|
|
317
|
-
}
|
|
319
|
+
};
|
|
318
320
|
},
|
|
319
321
|
_applyDefaultsToConfig = function _applyDefaultsToConfig(oldConf) {
|
|
320
322
|
const maxIdleIntervalInS = oldConf.maximumIdleIntervalInS ?? 60;
|
|
@@ -10,7 +10,6 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
10
10
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
11
|
};
|
|
12
12
|
var _FrontgateClientDataObserver_data, _FrontgateClientDataObserver_nextFn, _FrontgateClientDataObserver_errorFn;
|
|
13
|
-
import { ErrorResponse } from '../../message/response';
|
|
14
13
|
const getParentAndKey = (obj, path) => {
|
|
15
14
|
const parts = path.split('/').slice(1);
|
|
16
15
|
let parent = obj;
|
|
@@ -110,7 +109,7 @@ export class FrontgateClientEndpointDataObserver extends FrontgateClientDataObse
|
|
|
110
109
|
super.pushData(data);
|
|
111
110
|
}
|
|
112
111
|
catch (e) {
|
|
113
|
-
super.pushError(new
|
|
112
|
+
super.pushError(new Error('Failed to apply patch', { cause: e }));
|
|
114
113
|
}
|
|
115
114
|
}
|
|
116
115
|
}
|