@aws-amplify/api-graphql 0.0.0-unstable-1ca644b-20260128091132
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/README.md +3 -0
- package/dist/cjs/GraphQLAPI.js +66 -0
- package/dist/cjs/GraphQLAPI.js.map +1 -0
- package/dist/cjs/Providers/AWSAppSyncEventsProvider/index.js +117 -0
- package/dist/cjs/Providers/AWSAppSyncEventsProvider/index.js.map +1 -0
- package/dist/cjs/Providers/AWSAppSyncRealTimeProvider/index.js +96 -0
- package/dist/cjs/Providers/AWSAppSyncRealTimeProvider/index.js.map +1 -0
- package/dist/cjs/Providers/AWSWebSocketProvider/appsyncUrl.js +113 -0
- package/dist/cjs/Providers/AWSWebSocketProvider/appsyncUrl.js.map +1 -0
- package/dist/cjs/Providers/AWSWebSocketProvider/authHeaders.js +99 -0
- package/dist/cjs/Providers/AWSWebSocketProvider/authHeaders.js.map +1 -0
- package/dist/cjs/Providers/AWSWebSocketProvider/index.js +693 -0
- package/dist/cjs/Providers/AWSWebSocketProvider/index.js.map +1 -0
- package/dist/cjs/Providers/constants.js +149 -0
- package/dist/cjs/Providers/constants.js.map +1 -0
- package/dist/cjs/index.js +18 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/internals/InternalGraphQLAPI.js +269 -0
- package/dist/cjs/internals/InternalGraphQLAPI.js.map +1 -0
- package/dist/cjs/internals/events/appsyncRequest.js +96 -0
- package/dist/cjs/internals/events/appsyncRequest.js.map +1 -0
- package/dist/cjs/internals/events/index.js +142 -0
- package/dist/cjs/internals/events/index.js.map +1 -0
- package/dist/cjs/internals/events/types.js +6 -0
- package/dist/cjs/internals/events/types.js.map +1 -0
- package/dist/cjs/internals/events/utils.js +57 -0
- package/dist/cjs/internals/events/utils.js.map +1 -0
- package/dist/cjs/internals/generateClient.js +86 -0
- package/dist/cjs/internals/generateClient.js.map +1 -0
- package/dist/cjs/internals/graphqlAuth.js +63 -0
- package/dist/cjs/internals/graphqlAuth.js.map +1 -0
- package/dist/cjs/internals/graphqlRequest.js +19 -0
- package/dist/cjs/internals/graphqlRequest.js.map +1 -0
- package/dist/cjs/internals/index.js +16 -0
- package/dist/cjs/internals/index.js.map +1 -0
- package/dist/cjs/internals/server/generateClientWithAmplifyInstance.js +48 -0
- package/dist/cjs/internals/server/generateClientWithAmplifyInstance.js.map +1 -0
- package/dist/cjs/internals/server/index.js +9 -0
- package/dist/cjs/internals/server/index.js.map +1 -0
- package/dist/cjs/internals/types.js +4 -0
- package/dist/cjs/internals/types.js.map +1 -0
- package/dist/cjs/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.js +10 -0
- package/dist/cjs/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.js.map +1 -0
- package/dist/cjs/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.js +10 -0
- package/dist/cjs/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.js.map +1 -0
- package/dist/cjs/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.js +14 -0
- package/dist/cjs/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.js.map +1 -0
- package/dist/cjs/internals/v6.js +155 -0
- package/dist/cjs/internals/v6.js.map +1 -0
- package/dist/cjs/server/generateClient.js +42 -0
- package/dist/cjs/server/generateClient.js.map +1 -0
- package/dist/cjs/server/index.js +9 -0
- package/dist/cjs/server/index.js.map +1 -0
- package/dist/cjs/types/PubSub.js +49 -0
- package/dist/cjs/types/PubSub.js.map +1 -0
- package/dist/cjs/types/index.js +34 -0
- package/dist/cjs/types/index.js.map +1 -0
- package/dist/cjs/utils/ConnectionStateMonitor.js +134 -0
- package/dist/cjs/utils/ConnectionStateMonitor.js.map +1 -0
- package/dist/cjs/utils/ReachabilityMonitor/index.js +10 -0
- package/dist/cjs/utils/ReachabilityMonitor/index.js.map +1 -0
- package/dist/cjs/utils/ReachabilityMonitor/index.native.js +12 -0
- package/dist/cjs/utils/ReachabilityMonitor/index.native.js.map +1 -0
- package/dist/cjs/utils/ReconnectionMonitor.js +71 -0
- package/dist/cjs/utils/ReconnectionMonitor.js.map +1 -0
- package/dist/cjs/utils/errors/GraphQLApiError.js +21 -0
- package/dist/cjs/utils/errors/GraphQLApiError.js.map +1 -0
- package/dist/cjs/utils/errors/assertValidationError.js +18 -0
- package/dist/cjs/utils/errors/assertValidationError.js.map +1 -0
- package/dist/cjs/utils/errors/constants.js +47 -0
- package/dist/cjs/utils/errors/constants.js.map +1 -0
- package/dist/cjs/utils/errors/createGraphQLResultWithError.js +15 -0
- package/dist/cjs/utils/errors/createGraphQLResultWithError.js.map +1 -0
- package/dist/cjs/utils/errors/index.js +16 -0
- package/dist/cjs/utils/errors/index.js.map +1 -0
- package/dist/cjs/utils/errors/repackageAuthError.js +38 -0
- package/dist/cjs/utils/errors/repackageAuthError.js.map +1 -0
- package/dist/cjs/utils/errors/validation.js +28 -0
- package/dist/cjs/utils/errors/validation.js.map +1 -0
- package/dist/cjs/utils/index.js +11 -0
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/cjs/utils/resolveConfig.js +32 -0
- package/dist/cjs/utils/resolveConfig.js.map +1 -0
- package/dist/cjs/utils/resolveLibraryOptions.js +16 -0
- package/dist/cjs/utils/resolveLibraryOptions.js.map +1 -0
- package/dist/esm/GraphQLAPI.d.ts +37 -0
- package/dist/esm/GraphQLAPI.mjs +63 -0
- package/dist/esm/GraphQLAPI.mjs.map +1 -0
- package/dist/esm/Providers/AWSAppSyncEventsProvider/index.d.ts +49 -0
- package/dist/esm/Providers/AWSAppSyncEventsProvider/index.mjs +115 -0
- package/dist/esm/Providers/AWSAppSyncEventsProvider/index.mjs.map +1 -0
- package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.d.ts +47 -0
- package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs +94 -0
- package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs.map +1 -0
- package/dist/esm/Providers/AWSWebSocketProvider/appsyncUrl.d.ts +21 -0
- package/dist/esm/Providers/AWSWebSocketProvider/appsyncUrl.mjs +107 -0
- package/dist/esm/Providers/AWSWebSocketProvider/appsyncUrl.mjs.map +1 -0
- package/dist/esm/Providers/AWSWebSocketProvider/authHeaders.d.ts +8 -0
- package/dist/esm/Providers/AWSWebSocketProvider/authHeaders.mjs +97 -0
- package/dist/esm/Providers/AWSWebSocketProvider/authHeaders.mjs.map +1 -0
- package/dist/esm/Providers/AWSWebSocketProvider/index.d.ts +99 -0
- package/dist/esm/Providers/AWSWebSocketProvider/index.mjs +691 -0
- package/dist/esm/Providers/AWSWebSocketProvider/index.mjs.map +1 -0
- package/dist/esm/Providers/constants.d.ts +135 -0
- package/dist/esm/Providers/constants.mjs +147 -0
- package/dist/esm/Providers/constants.mjs.map +1 -0
- package/dist/esm/index.d.ts +6 -0
- package/dist/esm/index.mjs +7 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/internals/InternalGraphQLAPI.d.ts +45 -0
- package/dist/esm/internals/InternalGraphQLAPI.mjs +270 -0
- package/dist/esm/internals/InternalGraphQLAPI.mjs.map +1 -0
- package/dist/esm/internals/events/appsyncRequest.d.ts +14 -0
- package/dist/esm/internals/events/appsyncRequest.mjs +96 -0
- package/dist/esm/internals/events/appsyncRequest.mjs.map +1 -0
- package/dist/esm/internals/events/index.d.ts +58 -0
- package/dist/esm/internals/events/index.mjs +139 -0
- package/dist/esm/internals/events/index.mjs.map +1 -0
- package/dist/esm/internals/events/types.d.ts +93 -0
- package/dist/esm/internals/events/types.mjs +2 -0
- package/dist/esm/internals/events/types.mjs.map +1 -0
- package/dist/esm/internals/events/utils.d.ts +16 -0
- package/dist/esm/internals/events/utils.mjs +53 -0
- package/dist/esm/internals/events/utils.mjs.map +1 -0
- package/dist/esm/internals/generateClient.d.ts +12 -0
- package/dist/esm/internals/generateClient.mjs +85 -0
- package/dist/esm/internals/generateClient.mjs.map +1 -0
- package/dist/esm/internals/graphqlAuth.d.ts +3 -0
- package/dist/esm/internals/graphqlAuth.mjs +64 -0
- package/dist/esm/internals/graphqlAuth.mjs.map +1 -0
- package/dist/esm/internals/graphqlRequest.d.ts +3 -0
- package/dist/esm/internals/graphqlRequest.mjs +18 -0
- package/dist/esm/internals/graphqlRequest.mjs.map +1 -0
- package/dist/esm/internals/index.d.ts +4 -0
- package/dist/esm/internals/index.mjs +4 -0
- package/dist/esm/internals/index.mjs.map +1 -0
- package/dist/esm/internals/server/generateClientWithAmplifyInstance.d.ts +13 -0
- package/dist/esm/internals/server/generateClientWithAmplifyInstance.mjs +61 -0
- package/dist/esm/internals/server/generateClientWithAmplifyInstance.mjs.map +1 -0
- package/dist/esm/internals/server/index.d.ts +1 -0
- package/dist/esm/internals/server/index.mjs +2 -0
- package/dist/esm/internals/server/index.mjs.map +1 -0
- package/dist/esm/internals/types.d.ts +34 -0
- package/dist/esm/internals/types.mjs +2 -0
- package/dist/esm/internals/types.mjs.map +1 -0
- package/dist/esm/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.d.ts +2 -0
- package/dist/esm/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.mjs +8 -0
- package/dist/esm/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.mjs.map +1 -0
- package/dist/esm/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.d.ts +8 -0
- package/dist/esm/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.mjs +8 -0
- package/dist/esm/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.mjs.map +1 -0
- package/dist/esm/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.d.ts +2 -0
- package/dist/esm/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.mjs +12 -0
- package/dist/esm/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.mjs.map +1 -0
- package/dist/esm/internals/v6.d.ts +100 -0
- package/dist/esm/internals/v6.mjs +152 -0
- package/dist/esm/internals/v6.mjs.map +1 -0
- package/dist/esm/server/generateClient.d.ts +21 -0
- package/dist/esm/server/generateClient.mjs +41 -0
- package/dist/esm/server/generateClient.mjs.map +1 -0
- package/dist/esm/server/index.d.ts +1 -0
- package/dist/esm/server/index.mjs +2 -0
- package/dist/esm/server/index.mjs.map +1 -0
- package/dist/esm/types/PubSub.d.ts +27 -0
- package/dist/esm/types/PubSub.mjs +47 -0
- package/dist/esm/types/PubSub.mjs.map +1 -0
- package/dist/esm/types/index.d.ts +369 -0
- package/dist/esm/types/index.mjs +30 -0
- package/dist/esm/types/index.mjs.map +1 -0
- package/dist/esm/utils/ConnectionStateMonitor.d.ts +69 -0
- package/dist/esm/utils/ConnectionStateMonitor.mjs +132 -0
- package/dist/esm/utils/ConnectionStateMonitor.mjs.map +1 -0
- package/dist/esm/utils/ReachabilityMonitor/index.d.ts +1 -0
- package/dist/esm/utils/ReachabilityMonitor/index.mjs +8 -0
- package/dist/esm/utils/ReachabilityMonitor/index.mjs.map +1 -0
- package/dist/esm/utils/ReachabilityMonitor/index.native.d.ts +1 -0
- package/dist/esm/utils/ReachabilityMonitor/index.native.mjs +9 -0
- package/dist/esm/utils/ReachabilityMonitor/index.native.mjs.map +1 -0
- package/dist/esm/utils/ReconnectionMonitor.d.ts +29 -0
- package/dist/esm/utils/ReconnectionMonitor.mjs +69 -0
- package/dist/esm/utils/ReconnectionMonitor.mjs.map +1 -0
- package/dist/esm/utils/errors/GraphQLApiError.d.ts +7 -0
- package/dist/esm/utils/errors/GraphQLApiError.mjs +19 -0
- package/dist/esm/utils/errors/GraphQLApiError.mjs.map +1 -0
- package/dist/esm/utils/errors/assertValidationError.d.ts +5 -0
- package/dist/esm/utils/errors/assertValidationError.mjs +17 -0
- package/dist/esm/utils/errors/assertValidationError.mjs.map +1 -0
- package/dist/esm/utils/errors/constants.d.ts +7 -0
- package/dist/esm/utils/errors/constants.mjs +46 -0
- package/dist/esm/utils/errors/constants.mjs.map +1 -0
- package/dist/esm/utils/errors/createGraphQLResultWithError.d.ts +2 -0
- package/dist/esm/utils/errors/createGraphQLResultWithError.mjs +13 -0
- package/dist/esm/utils/errors/createGraphQLResultWithError.mjs.map +1 -0
- package/dist/esm/utils/errors/index.d.ts +4 -0
- package/dist/esm/utils/errors/index.mjs +5 -0
- package/dist/esm/utils/errors/index.mjs.map +1 -0
- package/dist/esm/utils/errors/repackageAuthError.d.ts +7 -0
- package/dist/esm/utils/errors/repackageAuthError.mjs +36 -0
- package/dist/esm/utils/errors/repackageAuthError.mjs.map +1 -0
- package/dist/esm/utils/errors/validation.d.ts +7 -0
- package/dist/esm/utils/errors/validation.mjs +26 -0
- package/dist/esm/utils/errors/validation.mjs.map +1 -0
- package/dist/esm/utils/index.d.ts +2 -0
- package/dist/esm/utils/index.mjs +3 -0
- package/dist/esm/utils/index.mjs.map +1 -0
- package/dist/esm/utils/resolveConfig.d.ts +12 -0
- package/dist/esm/utils/resolveConfig.mjs +33 -0
- package/dist/esm/utils/resolveConfig.mjs.map +1 -0
- package/dist/esm/utils/resolveLibraryOptions.d.ts +11 -0
- package/dist/esm/utils/resolveLibraryOptions.mjs +13 -0
- package/dist/esm/utils/resolveLibraryOptions.mjs.map +1 -0
- package/internals/package.json +8 -0
- package/internals/server/package.json +8 -0
- package/package.json +99 -0
- package/server/package.json +7 -0
- package/src/GraphQLAPI.ts +97 -0
- package/src/Providers/AWSAppSyncEventsProvider/index.ts +218 -0
- package/src/Providers/AWSAppSyncRealTimeProvider/index.ts +185 -0
- package/src/Providers/AWSWebSocketProvider/appsyncUrl.ts +152 -0
- package/src/Providers/AWSWebSocketProvider/authHeaders.ts +146 -0
- package/src/Providers/AWSWebSocketProvider/index.ts +1028 -0
- package/src/Providers/constants.ts +154 -0
- package/src/index.ts +12 -0
- package/src/internals/InternalGraphQLAPI.ts +424 -0
- package/src/internals/events/appsyncRequest.ts +169 -0
- package/src/internals/events/index.ts +199 -0
- package/src/internals/events/types.ts +109 -0
- package/src/internals/events/utils.ts +77 -0
- package/src/internals/generateClient.ts +120 -0
- package/src/internals/graphqlAuth.ts +87 -0
- package/src/internals/graphqlRequest.ts +30 -0
- package/src/internals/index.ts +10 -0
- package/src/internals/server/generateClientWithAmplifyInstance.ts +73 -0
- package/src/internals/server/index.ts +4 -0
- package/src/internals/types.ts +42 -0
- package/src/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.ts +10 -0
- package/src/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.ts +13 -0
- package/src/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.ts +15 -0
- package/src/internals/v6.ts +189 -0
- package/src/server/generateClient.ts +68 -0
- package/src/server/index.ts +4 -0
- package/src/types/PubSub.ts +57 -0
- package/src/types/index.ts +524 -0
- package/src/utils/ConnectionStateMonitor.ts +195 -0
- package/src/utils/ReachabilityMonitor/index.native.ts +7 -0
- package/src/utils/ReachabilityMonitor/index.ts +5 -0
- package/src/utils/ReconnectionMonitor.ts +77 -0
- package/src/utils/errors/GraphQLApiError.ts +21 -0
- package/src/utils/errors/assertValidationError.ts +19 -0
- package/src/utils/errors/constants.ts +56 -0
- package/src/utils/errors/createGraphQLResultWithError.ts +15 -0
- package/src/utils/errors/index.ts +7 -0
- package/src/utils/errors/repackageAuthError.ts +43 -0
- package/src/utils/errors/validation.ts +26 -0
- package/src/utils/index.ts +5 -0
- package/src/utils/resolveConfig.ts +46 -0
- package/src/utils/resolveLibraryOptions.ts +14 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
export { AMPLIFY_SYMBOL } from '@aws-amplify/core/internals/utils';
|
|
4
|
+
|
|
5
|
+
export const MAX_DELAY_MS = 5000;
|
|
6
|
+
|
|
7
|
+
export const NON_RETRYABLE_CODES = [400, 401, 403];
|
|
8
|
+
export const NON_RETRYABLE_ERROR_TYPES = [
|
|
9
|
+
'BadRequestException',
|
|
10
|
+
'UnauthorizedException',
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
export const CONNECTION_STATE_CHANGE = 'ConnectionStateChange';
|
|
14
|
+
|
|
15
|
+
export enum MESSAGE_TYPES {
|
|
16
|
+
/**
|
|
17
|
+
* Client -> Server message.
|
|
18
|
+
* This message type is the first message after handshake and this will initialize AWS AppSync RealTime communication
|
|
19
|
+
*/
|
|
20
|
+
GQL_CONNECTION_INIT = 'connection_init',
|
|
21
|
+
/**
|
|
22
|
+
* Server -> Client message
|
|
23
|
+
* This message type is in case there is an issue with AWS AppSync RealTime when establishing connection
|
|
24
|
+
*/
|
|
25
|
+
GQL_CONNECTION_ERROR = 'connection_error',
|
|
26
|
+
/**
|
|
27
|
+
* Server -> Client message.
|
|
28
|
+
* This message type is for the ack response from AWS AppSync RealTime for GQL_CONNECTION_INIT message
|
|
29
|
+
*/
|
|
30
|
+
GQL_CONNECTION_ACK = 'connection_ack',
|
|
31
|
+
/**
|
|
32
|
+
* Client -> Server message.
|
|
33
|
+
* This message type is for register subscriptions with AWS AppSync RealTime
|
|
34
|
+
*/
|
|
35
|
+
GQL_START = 'start',
|
|
36
|
+
/**
|
|
37
|
+
* Server -> Client message.
|
|
38
|
+
* This message type is for the ack response from AWS AppSync RealTime for GQL_START message
|
|
39
|
+
*/
|
|
40
|
+
GQL_START_ACK = 'start_ack',
|
|
41
|
+
/**
|
|
42
|
+
* Server -> Client message.
|
|
43
|
+
* This message type is for subscription message from AWS AppSync RealTime or Events
|
|
44
|
+
*/
|
|
45
|
+
DATA = 'data',
|
|
46
|
+
/**
|
|
47
|
+
* Server -> Client message.
|
|
48
|
+
* This message type helps the client to know is still receiving messages from AWS AppSync RealTime
|
|
49
|
+
*/
|
|
50
|
+
GQL_CONNECTION_KEEP_ALIVE = 'ka',
|
|
51
|
+
/**
|
|
52
|
+
* Client -> Server message.
|
|
53
|
+
* This message type is for unregister subscriptions with AWS AppSync RealTime
|
|
54
|
+
*/
|
|
55
|
+
GQL_STOP = 'stop',
|
|
56
|
+
/**
|
|
57
|
+
* Server -> Client message.
|
|
58
|
+
* This message type is for the ack response from AWS AppSync RealTime for GQL_STOP message
|
|
59
|
+
*/
|
|
60
|
+
GQL_COMPLETE = 'complete',
|
|
61
|
+
/**
|
|
62
|
+
* Server -> Client message.
|
|
63
|
+
* This message type is for sending error messages from AWS AppSync RealTime to the client
|
|
64
|
+
*/
|
|
65
|
+
GQL_ERROR = 'error', // Server -> Client
|
|
66
|
+
/**
|
|
67
|
+
* Client -> Server message.
|
|
68
|
+
* This message type is for registering subscriptions with Events
|
|
69
|
+
*/
|
|
70
|
+
EVENT_SUBSCRIBE = 'subscribe',
|
|
71
|
+
/**
|
|
72
|
+
* Client -> Server message.
|
|
73
|
+
* This message type is for publishing a message with Events
|
|
74
|
+
*/
|
|
75
|
+
EVENT_PUBLISH = 'publish',
|
|
76
|
+
/**
|
|
77
|
+
* Server -> Client message.
|
|
78
|
+
* Server acknowledges successful subscription
|
|
79
|
+
*/
|
|
80
|
+
EVENT_SUBSCRIBE_ACK = 'subscribe_success',
|
|
81
|
+
/**
|
|
82
|
+
* Server -> Client message.
|
|
83
|
+
* Server acknowledges successful publish
|
|
84
|
+
*/
|
|
85
|
+
EVENT_PUBLISH_ACK = 'publish_success',
|
|
86
|
+
/**
|
|
87
|
+
* Client -> Server message.
|
|
88
|
+
* This message type is for unregister subscriptions with AWS AppSync RealTime
|
|
89
|
+
*/
|
|
90
|
+
EVENT_STOP = 'unsubscribe',
|
|
91
|
+
/**
|
|
92
|
+
* Server -> Client message.
|
|
93
|
+
* This is the ack response from AWS AppSync Events to EVENT_STOP message
|
|
94
|
+
*/
|
|
95
|
+
EVENT_COMPLETE = 'unsubscribe_success',
|
|
96
|
+
/**
|
|
97
|
+
* Server -> Client message.
|
|
98
|
+
* This message type is for sending error messages from AWS AppSync Events to the client
|
|
99
|
+
*/
|
|
100
|
+
EVENT_SUBSCRIBE_ERROR = 'subscribe_error',
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export enum SUBSCRIPTION_STATUS {
|
|
104
|
+
PENDING,
|
|
105
|
+
CONNECTED,
|
|
106
|
+
FAILED,
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export enum SOCKET_STATUS {
|
|
110
|
+
CLOSED,
|
|
111
|
+
READY,
|
|
112
|
+
CONNECTING,
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export const AWS_APPSYNC_REALTIME_HEADERS = {
|
|
116
|
+
accept: 'application/json, text/javascript',
|
|
117
|
+
'content-encoding': 'amz-1.0',
|
|
118
|
+
'content-type': 'application/json; charset=UTF-8',
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Time in milleseconds to wait for GQL_CONNECTION_INIT message
|
|
123
|
+
*/
|
|
124
|
+
export const CONNECTION_INIT_TIMEOUT = 15000;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Time in milleseconds to wait for GQL_START_ACK message
|
|
128
|
+
*/
|
|
129
|
+
export const START_ACK_TIMEOUT = 15000;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Default Time in milleseconds to wait for GQL_CONNECTION_KEEP_ALIVE message
|
|
133
|
+
*/
|
|
134
|
+
export const DEFAULT_KEEP_ALIVE_TIMEOUT = 5 * 60 * 1000;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Default Time in milleseconds between monitoring checks of keep alive status
|
|
138
|
+
*/
|
|
139
|
+
export const DEFAULT_KEEP_ALIVE_HEARTBEAT_TIMEOUT = 5 * 1000;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Default Time in milleseconds to alert for missed GQL_CONNECTION_KEEP_ALIVE message
|
|
143
|
+
*/
|
|
144
|
+
export const DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT = 65 * 1000;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Default delay time in milleseconds between when reconnect is triggered vs when it is attempted
|
|
148
|
+
*/
|
|
149
|
+
export const RECONNECT_DELAY = 5 * 1000;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Default interval time in milleseconds between when reconnect is re-attempted
|
|
153
|
+
*/
|
|
154
|
+
export const RECONNECT_INTERVAL = 60 * 1000;
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import * as events from './internals/events';
|
|
5
|
+
|
|
6
|
+
export { events };
|
|
7
|
+
|
|
8
|
+
export { GraphQLAPI, GraphQLAPIClass, graphqlOperation } from './GraphQLAPI';
|
|
9
|
+
export * from './types';
|
|
10
|
+
|
|
11
|
+
export { CONNECTION_STATE_CHANGE } from './Providers/constants';
|
|
12
|
+
export * from './internals/events/types';
|
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import {
|
|
4
|
+
DocumentNode,
|
|
5
|
+
OperationDefinitionNode,
|
|
6
|
+
OperationTypeNode,
|
|
7
|
+
parse,
|
|
8
|
+
print,
|
|
9
|
+
} from 'graphql';
|
|
10
|
+
import { Observable, catchError } from 'rxjs';
|
|
11
|
+
import { AmplifyClassV6 } from '@aws-amplify/core';
|
|
12
|
+
import {
|
|
13
|
+
AmplifyUrl,
|
|
14
|
+
CustomUserAgentDetails,
|
|
15
|
+
getAmplifyUserAgent,
|
|
16
|
+
} from '@aws-amplify/core/internals/utils';
|
|
17
|
+
import { isCancelError as isCancelErrorREST } from '@aws-amplify/api-rest';
|
|
18
|
+
import {
|
|
19
|
+
cancel as cancelREST,
|
|
20
|
+
post,
|
|
21
|
+
updateRequestToBeCancellable,
|
|
22
|
+
} from '@aws-amplify/api-rest/internals';
|
|
23
|
+
import {
|
|
24
|
+
CustomHeaders,
|
|
25
|
+
RequestOptions,
|
|
26
|
+
} from '@aws-amplify/data-schema/runtime';
|
|
27
|
+
|
|
28
|
+
import { AWSAppSyncRealTimeProvider } from '../Providers/AWSAppSyncRealTimeProvider';
|
|
29
|
+
import { GraphQLOperation, GraphQLOptions, GraphQLResult } from '../types';
|
|
30
|
+
import { resolveConfig, resolveLibraryOptions } from '../utils';
|
|
31
|
+
import { repackageUnauthorizedError } from '../utils/errors/repackageAuthError';
|
|
32
|
+
import { NO_ENDPOINT } from '../utils/errors/constants';
|
|
33
|
+
import { GraphQLApiError, createGraphQLResultWithError } from '../utils/errors';
|
|
34
|
+
|
|
35
|
+
import { isGraphQLResponseWithErrors } from './utils/runtimeTypeGuards/isGraphQLResponseWithErrors';
|
|
36
|
+
import { headerBasedAuth } from './graphqlAuth';
|
|
37
|
+
|
|
38
|
+
const USER_AGENT_HEADER = 'x-amz-user-agent';
|
|
39
|
+
|
|
40
|
+
const isAmplifyInstance = (
|
|
41
|
+
amplify:
|
|
42
|
+
| AmplifyClassV6
|
|
43
|
+
| ((fn: (amplify: any) => Promise<any>) => Promise<AmplifyClassV6>),
|
|
44
|
+
): amplify is AmplifyClassV6 => {
|
|
45
|
+
return typeof amplify !== 'function';
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Export Cloud Logic APIs
|
|
50
|
+
*/
|
|
51
|
+
export class InternalGraphQLAPIClass {
|
|
52
|
+
/**
|
|
53
|
+
* @private
|
|
54
|
+
*/
|
|
55
|
+
private appSyncRealTime = new Map<string, AWSAppSyncRealTimeProvider>();
|
|
56
|
+
|
|
57
|
+
private _api = {
|
|
58
|
+
post,
|
|
59
|
+
cancelREST,
|
|
60
|
+
isCancelErrorREST,
|
|
61
|
+
updateRequestToBeCancellable,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
public getModuleName() {
|
|
65
|
+
return 'InternalGraphQLAPI';
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* to get the operation type
|
|
70
|
+
* @param operation
|
|
71
|
+
*/
|
|
72
|
+
getGraphqlOperationType(operation: GraphQLOperation): OperationTypeNode {
|
|
73
|
+
const doc = parse(operation);
|
|
74
|
+
const definitions = doc.definitions as readonly OperationDefinitionNode[];
|
|
75
|
+
const [{ operation: operationType }] = definitions;
|
|
76
|
+
|
|
77
|
+
return operationType;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Executes a GraphQL operation
|
|
82
|
+
*
|
|
83
|
+
* @param options - GraphQL Options
|
|
84
|
+
* @param [additionalHeaders] - headers to merge in after any `libraryConfigHeaders` set in the config
|
|
85
|
+
* @returns An Observable if the query is a subscription query, else a promise of the graphql result.
|
|
86
|
+
*/
|
|
87
|
+
graphql<T = any>(
|
|
88
|
+
amplify:
|
|
89
|
+
| AmplifyClassV6
|
|
90
|
+
| ((fn: (amplify: any) => Promise<any>) => Promise<AmplifyClassV6>),
|
|
91
|
+
{
|
|
92
|
+
query: paramQuery,
|
|
93
|
+
variables = {},
|
|
94
|
+
authMode,
|
|
95
|
+
authToken,
|
|
96
|
+
endpoint,
|
|
97
|
+
apiKey,
|
|
98
|
+
}: GraphQLOptions,
|
|
99
|
+
additionalHeaders?: CustomHeaders,
|
|
100
|
+
customUserAgentDetails?: CustomUserAgentDetails,
|
|
101
|
+
): Observable<GraphQLResult<T>> | Promise<GraphQLResult<T>> {
|
|
102
|
+
const query =
|
|
103
|
+
typeof paramQuery === 'string'
|
|
104
|
+
? parse(paramQuery)
|
|
105
|
+
: parse(print(paramQuery));
|
|
106
|
+
|
|
107
|
+
const [operationDef = {}] = query.definitions.filter(
|
|
108
|
+
def => def.kind === 'OperationDefinition',
|
|
109
|
+
);
|
|
110
|
+
const { operation: operationType } =
|
|
111
|
+
operationDef as OperationDefinitionNode;
|
|
112
|
+
|
|
113
|
+
const headers = additionalHeaders || {};
|
|
114
|
+
|
|
115
|
+
switch (operationType) {
|
|
116
|
+
case 'query':
|
|
117
|
+
case 'mutation': {
|
|
118
|
+
const abortController = new AbortController();
|
|
119
|
+
|
|
120
|
+
let responsePromise: Promise<GraphQLResult<T>>;
|
|
121
|
+
|
|
122
|
+
if (isAmplifyInstance(amplify)) {
|
|
123
|
+
responsePromise = this._graphql<T>(
|
|
124
|
+
amplify,
|
|
125
|
+
{ query, variables, authMode, apiKey, endpoint },
|
|
126
|
+
headers,
|
|
127
|
+
abortController,
|
|
128
|
+
customUserAgentDetails,
|
|
129
|
+
authToken,
|
|
130
|
+
);
|
|
131
|
+
} else {
|
|
132
|
+
// NOTE: this wrapper function must be await-able so the Amplify server context manager can
|
|
133
|
+
// destroy the context only after it completes
|
|
134
|
+
const wrapper = async (amplifyInstance: AmplifyClassV6) => {
|
|
135
|
+
const result = await this._graphql<T>(
|
|
136
|
+
amplifyInstance,
|
|
137
|
+
{ query, variables, authMode, apiKey, endpoint },
|
|
138
|
+
headers,
|
|
139
|
+
abortController,
|
|
140
|
+
customUserAgentDetails,
|
|
141
|
+
authToken,
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
return result;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
responsePromise = amplify(wrapper) as unknown as Promise<
|
|
148
|
+
GraphQLResult<T>
|
|
149
|
+
>;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
this._api.updateRequestToBeCancellable(
|
|
153
|
+
responsePromise,
|
|
154
|
+
abortController,
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
return responsePromise;
|
|
158
|
+
}
|
|
159
|
+
case 'subscription':
|
|
160
|
+
return this._graphqlSubscribe(
|
|
161
|
+
amplify as AmplifyClassV6,
|
|
162
|
+
{ query, variables, authMode, apiKey, endpoint },
|
|
163
|
+
headers,
|
|
164
|
+
customUserAgentDetails,
|
|
165
|
+
authToken,
|
|
166
|
+
);
|
|
167
|
+
default:
|
|
168
|
+
throw new Error(`invalid operation type: ${operationType}`);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
private async _graphql<T = any>(
|
|
173
|
+
amplify: AmplifyClassV6,
|
|
174
|
+
{
|
|
175
|
+
query,
|
|
176
|
+
variables,
|
|
177
|
+
authMode: authModeOverride,
|
|
178
|
+
endpoint: endpointOverride,
|
|
179
|
+
apiKey: apiKeyOverride,
|
|
180
|
+
}: GraphQLOptions,
|
|
181
|
+
additionalHeaders: CustomHeaders = {},
|
|
182
|
+
abortController: AbortController,
|
|
183
|
+
customUserAgentDetails?: CustomUserAgentDetails,
|
|
184
|
+
authToken?: string,
|
|
185
|
+
): Promise<GraphQLResult<T>> {
|
|
186
|
+
const {
|
|
187
|
+
apiKey,
|
|
188
|
+
region,
|
|
189
|
+
endpoint: appSyncGraphqlEndpoint,
|
|
190
|
+
customEndpoint,
|
|
191
|
+
customEndpointRegion,
|
|
192
|
+
defaultAuthMode,
|
|
193
|
+
} = resolveConfig(amplify);
|
|
194
|
+
|
|
195
|
+
const initialAuthMode = authModeOverride || defaultAuthMode || 'iam';
|
|
196
|
+
// identityPool is an alias for iam. TODO: remove 'iam' in v7
|
|
197
|
+
const authMode =
|
|
198
|
+
initialAuthMode === 'identityPool' ? 'iam' : initialAuthMode;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Retrieve library options from Amplify configuration.
|
|
202
|
+
* `customHeaders` here are from the Amplify configuration options,
|
|
203
|
+
* and are for non-AppSync endpoints only. These are *not* the same as
|
|
204
|
+
* `additionalHeaders`, which are custom headers that are either 1)
|
|
205
|
+
* included when configuring the API client or 2) passed along with
|
|
206
|
+
* individual requests.
|
|
207
|
+
*/
|
|
208
|
+
const { headers: customHeaders, withCredentials } =
|
|
209
|
+
resolveLibraryOptions(amplify);
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Client or request-specific custom headers that may or may not be
|
|
213
|
+
* returned by a function:
|
|
214
|
+
*/
|
|
215
|
+
let additionalCustomHeaders: Record<string, string>;
|
|
216
|
+
|
|
217
|
+
if (typeof additionalHeaders === 'function') {
|
|
218
|
+
const requestOptions: RequestOptions = {
|
|
219
|
+
method: 'POST',
|
|
220
|
+
url: new AmplifyUrl(
|
|
221
|
+
endpointOverride || customEndpoint || appSyncGraphqlEndpoint || '',
|
|
222
|
+
).toString(),
|
|
223
|
+
queryString: print(query as DocumentNode),
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
additionalCustomHeaders = await additionalHeaders(requestOptions);
|
|
227
|
+
} else {
|
|
228
|
+
additionalCustomHeaders = additionalHeaders;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// if an authorization header is set, have the explicit authToken take precedence
|
|
232
|
+
if (authToken) {
|
|
233
|
+
additionalCustomHeaders = {
|
|
234
|
+
...additionalCustomHeaders,
|
|
235
|
+
Authorization: authToken,
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const authHeaders = await headerBasedAuth(
|
|
240
|
+
amplify,
|
|
241
|
+
authMode,
|
|
242
|
+
apiKeyOverride ?? apiKey,
|
|
243
|
+
additionalCustomHeaders,
|
|
244
|
+
);
|
|
245
|
+
|
|
246
|
+
const headers = {
|
|
247
|
+
...(!customEndpoint && authHeaders),
|
|
248
|
+
/**
|
|
249
|
+
* Custom endpoint headers.
|
|
250
|
+
* If there is both a custom endpoint and custom region present, we get the headers.
|
|
251
|
+
* If there is a custom endpoint but no region, we return an empty object.
|
|
252
|
+
* If neither are present, we return an empty object.
|
|
253
|
+
*/
|
|
254
|
+
...((customEndpoint && (customEndpointRegion ? authHeaders : {})) || {}),
|
|
255
|
+
// Custom headers included in Amplify configuration options:
|
|
256
|
+
...(customHeaders &&
|
|
257
|
+
(await customHeaders({
|
|
258
|
+
query: print(query as DocumentNode),
|
|
259
|
+
variables,
|
|
260
|
+
}))),
|
|
261
|
+
// Custom headers from individual requests or API client configuration:
|
|
262
|
+
...additionalCustomHeaders,
|
|
263
|
+
// User agent headers:
|
|
264
|
+
...(!customEndpoint && {
|
|
265
|
+
[USER_AGENT_HEADER]: getAmplifyUserAgent(customUserAgentDetails),
|
|
266
|
+
}),
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
const body = {
|
|
270
|
+
query: print(query as DocumentNode),
|
|
271
|
+
variables: variables || null,
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
let signingServiceInfo;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* We do not send the signing service info to the REST API under the
|
|
278
|
+
* following conditions (i.e. it will not sign the request):
|
|
279
|
+
* - there is a custom endpoint but no region
|
|
280
|
+
* - the auth mode is `none`, or `apiKey`
|
|
281
|
+
* - the auth mode is a type other than the types listed below
|
|
282
|
+
*/
|
|
283
|
+
if (
|
|
284
|
+
(customEndpoint && !customEndpointRegion) ||
|
|
285
|
+
(authMode !== 'oidc' &&
|
|
286
|
+
authMode !== 'userPool' &&
|
|
287
|
+
authMode !== 'iam' &&
|
|
288
|
+
authMode !== 'lambda')
|
|
289
|
+
) {
|
|
290
|
+
signingServiceInfo = undefined;
|
|
291
|
+
} else {
|
|
292
|
+
signingServiceInfo = {
|
|
293
|
+
service: !customEndpointRegion ? 'appsync' : 'execute-api',
|
|
294
|
+
region: !customEndpointRegion ? region : customEndpointRegion,
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
const endpoint =
|
|
299
|
+
endpointOverride || customEndpoint || appSyncGraphqlEndpoint;
|
|
300
|
+
|
|
301
|
+
if (!endpoint) {
|
|
302
|
+
throw createGraphQLResultWithError<T>(new GraphQLApiError(NO_ENDPOINT));
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
let response: any;
|
|
306
|
+
|
|
307
|
+
try {
|
|
308
|
+
// // // See the inline doc of the REST `post()` API for possible errors to be thrown.
|
|
309
|
+
// // // As these errors are catastrophic they should be caught and handled by GraphQL
|
|
310
|
+
// // // API consumers.
|
|
311
|
+
const { body: responseBody } = await this._api.post(amplify, {
|
|
312
|
+
url: new AmplifyUrl(endpoint),
|
|
313
|
+
options: {
|
|
314
|
+
headers,
|
|
315
|
+
body,
|
|
316
|
+
signingServiceInfo,
|
|
317
|
+
withCredentials,
|
|
318
|
+
},
|
|
319
|
+
abortController,
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
response = await responseBody.json();
|
|
323
|
+
} catch (error) {
|
|
324
|
+
if (this.isCancelError(error)) {
|
|
325
|
+
throw error;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
response = createGraphQLResultWithError<T>(error as any);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (isGraphQLResponseWithErrors(response)) {
|
|
332
|
+
throw repackageUnauthorizedError(response);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
return response as unknown as GraphQLResult<T>;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Checks to see if an error thrown is from an api request cancellation
|
|
340
|
+
* @param {any} error - Any error
|
|
341
|
+
* @return {boolean} - A boolean indicating if the error was from an api request cancellation
|
|
342
|
+
*/
|
|
343
|
+
isCancelError(error: any): boolean {
|
|
344
|
+
return this._api.isCancelErrorREST(error);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Cancels an inflight request. Only applicable for graphql queries and mutations
|
|
349
|
+
* @param {any} request - request to cancel
|
|
350
|
+
* @returns - A boolean indicating if the request was cancelled
|
|
351
|
+
*/
|
|
352
|
+
cancel(request: Promise<any>, message?: string): boolean {
|
|
353
|
+
return this._api.cancelREST(request, message);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
private _graphqlSubscribe(
|
|
357
|
+
amplify: AmplifyClassV6,
|
|
358
|
+
{
|
|
359
|
+
query,
|
|
360
|
+
variables,
|
|
361
|
+
authMode: authModeOverride,
|
|
362
|
+
apiKey: apiKeyOverride,
|
|
363
|
+
endpoint,
|
|
364
|
+
}: GraphQLOptions,
|
|
365
|
+
additionalHeaders: CustomHeaders = {},
|
|
366
|
+
customUserAgentDetails?: CustomUserAgentDetails,
|
|
367
|
+
authToken?: string,
|
|
368
|
+
): Observable<any> {
|
|
369
|
+
const config = resolveConfig(amplify);
|
|
370
|
+
|
|
371
|
+
const initialAuthMode =
|
|
372
|
+
authModeOverride || config?.defaultAuthMode || 'iam';
|
|
373
|
+
// identityPool is an alias for iam. TODO: remove 'iam' in v7
|
|
374
|
+
const authMode =
|
|
375
|
+
initialAuthMode === 'identityPool' ? 'iam' : initialAuthMode;
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Retrieve library options from Amplify configuration.
|
|
379
|
+
* `libraryConfigHeaders` are from the Amplify configuration options,
|
|
380
|
+
* and will not be overwritten by other custom headers. These are *not*
|
|
381
|
+
* the same as `additionalHeaders`, which are custom headers that are
|
|
382
|
+
* either 1)included when configuring the API client or 2) passed along
|
|
383
|
+
* with individual requests.
|
|
384
|
+
*/
|
|
385
|
+
const { headers: libraryConfigHeaders } = resolveLibraryOptions(amplify);
|
|
386
|
+
|
|
387
|
+
const appSyncGraphqlEndpoint = endpoint ?? config?.endpoint;
|
|
388
|
+
|
|
389
|
+
// TODO: This could probably be an exception. But, lots of tests rely on
|
|
390
|
+
// attempting to connect to nowhere. So, I'm treating as the opposite of
|
|
391
|
+
// a Chesterton's fence for now. (A fence I shouldn't build, because I don't
|
|
392
|
+
// know why somethings depends on its absence!)
|
|
393
|
+
const memoKey = appSyncGraphqlEndpoint ?? 'none';
|
|
394
|
+
const realtimeProvider =
|
|
395
|
+
this.appSyncRealTime.get(memoKey) ?? new AWSAppSyncRealTimeProvider();
|
|
396
|
+
this.appSyncRealTime.set(memoKey, realtimeProvider);
|
|
397
|
+
|
|
398
|
+
return realtimeProvider
|
|
399
|
+
.subscribe(
|
|
400
|
+
{
|
|
401
|
+
query: print(query as DocumentNode),
|
|
402
|
+
variables,
|
|
403
|
+
appSyncGraphqlEndpoint,
|
|
404
|
+
region: config?.region,
|
|
405
|
+
authenticationType: authMode,
|
|
406
|
+
apiKey: apiKeyOverride ?? config?.apiKey,
|
|
407
|
+
additionalHeaders,
|
|
408
|
+
authToken,
|
|
409
|
+
libraryConfigHeaders,
|
|
410
|
+
},
|
|
411
|
+
customUserAgentDetails,
|
|
412
|
+
)
|
|
413
|
+
.pipe(
|
|
414
|
+
catchError(e => {
|
|
415
|
+
if (e.errors) {
|
|
416
|
+
throw repackageUnauthorizedError(e);
|
|
417
|
+
}
|
|
418
|
+
throw e;
|
|
419
|
+
}),
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
export const InternalGraphQLAPI = new InternalGraphQLAPIClass();
|