@aws-amplify/api-graphql 3.4.11 → 4.0.1-console-preview.047a1dd.0
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/lib/GraphQLAPI.js +0 -5
- package/lib/Providers/AWSAppSyncRealTimeProvider/index.d.ts +67 -0
- package/lib/Providers/AWSAppSyncRealTimeProvider/index.js +817 -0
- package/lib/Providers/constants.d.ts +95 -0
- package/lib/Providers/constants.js +103 -0
- package/lib/index.d.ts +0 -3
- package/lib/index.js +3 -9
- package/lib/internals/InternalGraphQLAPI.d.ts +4 -40
- package/lib/internals/InternalGraphQLAPI.js +89 -243
- package/lib/internals/index.d.ts +1 -0
- package/lib/internals/index.js +2 -1
- package/lib/internals/v6.d.ts +89 -0
- package/lib/internals/v6.js +99 -0
- package/lib/tsconfig.tsbuildinfo +5790 -0
- package/lib/types/PubSub.d.ts +27 -0
- package/lib/types/PubSub.js +46 -0
- package/lib/types/index.d.ts +184 -4
- package/lib/types/index.js +0 -3
- package/lib/utils/ConnectionStateMonitor.d.ts +41 -0
- package/lib/utils/ConnectionStateMonitor.js +143 -0
- package/lib/utils/ReachabilityMonitor/index.d.ts +3 -0
- package/lib/utils/ReachabilityMonitor/index.js +6 -0
- package/lib/utils/ReachabilityMonitor/index.native.d.ts +3 -0
- package/lib/utils/ReachabilityMonitor/index.native.js +10 -0
- package/lib/utils/ReconnectionMonitor.d.ts +29 -0
- package/lib/utils/ReconnectionMonitor.js +72 -0
- package/lib/utils/errors/APIError.d.ts +7 -0
- package/lib/utils/errors/APIError.js +22 -0
- package/lib/utils/errors/assertValidationError.d.ts +5 -0
- package/lib/utils/errors/assertValidationError.js +16 -0
- package/lib/utils/errors/index.d.ts +3 -0
- package/lib/utils/errors/index.js +11 -0
- package/lib/utils/errors/validation.d.ts +8 -0
- package/lib/utils/errors/validation.js +26 -0
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +8 -0
- package/lib/utils/resolveConfig.d.ts +8 -0
- package/lib/utils/resolveConfig.js +17 -0
- package/lib/utils/resolveCredentials.d.ts +12 -0
- package/lib/utils/resolveCredentials.js +22 -0
- package/lib-esm/GraphQLAPI.js +0 -5
- package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.d.ts +67 -0
- package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js +815 -0
- package/lib-esm/Providers/constants.d.ts +95 -0
- package/lib-esm/Providers/constants.js +100 -0
- package/lib-esm/index.d.ts +0 -3
- package/lib-esm/index.js +0 -4
- package/lib-esm/internals/InternalGraphQLAPI.d.ts +4 -40
- package/lib-esm/internals/InternalGraphQLAPI.js +90 -244
- package/lib-esm/internals/index.d.ts +1 -0
- package/lib-esm/internals/index.js +1 -1
- package/lib-esm/internals/v6.d.ts +89 -0
- package/lib-esm/internals/v6.js +96 -0
- package/lib-esm/tsconfig.tsbuildinfo +5790 -0
- package/lib-esm/types/PubSub.d.ts +27 -0
- package/lib-esm/types/PubSub.js +44 -0
- package/lib-esm/types/index.d.ts +184 -4
- package/lib-esm/types/index.js +0 -3
- package/lib-esm/utils/ConnectionStateMonitor.d.ts +41 -0
- package/lib-esm/utils/ConnectionStateMonitor.js +141 -0
- package/lib-esm/utils/ReachabilityMonitor/index.d.ts +3 -0
- package/lib-esm/utils/ReachabilityMonitor/index.js +4 -0
- package/lib-esm/utils/ReachabilityMonitor/index.native.d.ts +3 -0
- package/lib-esm/utils/ReachabilityMonitor/index.native.js +7 -0
- package/lib-esm/utils/ReconnectionMonitor.d.ts +29 -0
- package/lib-esm/utils/ReconnectionMonitor.js +70 -0
- package/lib-esm/utils/errors/APIError.d.ts +7 -0
- package/lib-esm/utils/errors/APIError.js +20 -0
- package/lib-esm/utils/errors/assertValidationError.d.ts +5 -0
- package/lib-esm/utils/errors/assertValidationError.js +13 -0
- package/lib-esm/utils/errors/index.d.ts +3 -0
- package/lib-esm/utils/errors/index.js +5 -0
- package/lib-esm/utils/errors/validation.d.ts +8 -0
- package/lib-esm/utils/errors/validation.js +24 -0
- package/lib-esm/utils/index.d.ts +2 -0
- package/lib-esm/utils/index.js +4 -0
- package/lib-esm/utils/resolveConfig.d.ts +8 -0
- package/lib-esm/utils/resolveConfig.js +15 -0
- package/lib-esm/utils/resolveCredentials.d.ts +12 -0
- package/lib-esm/utils/resolveCredentials.js +20 -0
- package/package.json +114 -114
- package/src/GraphQLAPI.ts +0 -2
- package/src/Providers/AWSAppSyncRealTimeProvider/index.ts +1003 -0
- package/src/Providers/constants.ts +110 -0
- package/src/index.ts +0 -3
- package/src/internals/InternalGraphQLAPI.ts +62 -221
- package/src/internals/index.ts +2 -0
- package/src/internals/v6.ts +106 -0
- package/src/types/PubSub.ts +58 -0
- package/src/types/index.ts +234 -7
- package/src/utils/ConnectionStateMonitor.ts +195 -0
- package/src/utils/ReachabilityMonitor/index.native.ts +7 -0
- package/src/utils/ReachabilityMonitor/index.ts +4 -0
- package/src/utils/ReconnectionMonitor.ts +76 -0
- package/src/utils/errors/APIError.ts +18 -0
- package/src/utils/errors/assertValidationError.ts +19 -0
- package/src/utils/errors/index.ts +6 -0
- package/src/utils/errors/validation.ts +26 -0
- package/src/utils/index.ts +5 -0
- package/src/utils/resolveConfig.ts +20 -0
- package/src/utils/resolveCredentials.ts +14 -0
- package/lib/.tsbuildinfo +0 -3
- package/lib/GraphQLAPI.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/internals/InternalGraphQLAPI.js.map +0 -1
- package/lib/internals/index.js.map +0 -1
- package/lib/types/index.js.map +0 -1
- package/lib-esm/.tsbuildinfo +0 -3
- package/lib-esm/GraphQLAPI.js.map +0 -1
- package/lib-esm/index.js.map +0 -1
- package/lib-esm/internals/InternalGraphQLAPI.js.map +0 -1
- package/lib-esm/internals/index.js.map +0 -1
- package/lib-esm/types/index.js.map +0 -1
package/README.md
ADDED
package/lib/GraphQLAPI.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
-
var core_1 = require("@aws-amplify/core");
|
|
7
4
|
var internals_1 = require("./internals");
|
|
8
5
|
exports.graphqlOperation = function (query, variables, authToken) {
|
|
9
6
|
if (variables === void 0) { variables = {}; }
|
|
@@ -38,5 +35,3 @@ var GraphQLAPIClass = /** @class */ (function (_super) {
|
|
|
38
35
|
}(internals_1.InternalGraphQLAPIClass));
|
|
39
36
|
exports.GraphQLAPIClass = GraphQLAPIClass;
|
|
40
37
|
exports.GraphQLAPI = new GraphQLAPIClass(null);
|
|
41
|
-
core_1.Amplify.register(exports.GraphQLAPI);
|
|
42
|
-
//# sourceMappingURL=GraphQLAPI.js.map
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import Observable from 'zen-observable-ts';
|
|
2
|
+
import { PubSubContentObserver } from '../../types/PubSub';
|
|
3
|
+
import { SUBSCRIPTION_STATUS } from '../constants';
|
|
4
|
+
import { GraphQLAuthMode } from '@aws-amplify/core/lib-esm/singleton/API/types';
|
|
5
|
+
import { CustomUserAgentDetails } from '@aws-amplify/core/internals/utils';
|
|
6
|
+
import { DocumentType } from '@aws-amplify/api-rest';
|
|
7
|
+
export declare type ObserverQuery = {
|
|
8
|
+
observer: PubSubContentObserver;
|
|
9
|
+
query: string;
|
|
10
|
+
variables: Record<string, DocumentType>;
|
|
11
|
+
subscriptionState: SUBSCRIPTION_STATUS;
|
|
12
|
+
subscriptionReadyCallback?: Function;
|
|
13
|
+
subscriptionFailedCallback?: Function;
|
|
14
|
+
startAckTimeoutId?: ReturnType<typeof setTimeout>;
|
|
15
|
+
};
|
|
16
|
+
export interface AWSAppSyncRealTimeProviderOptions {
|
|
17
|
+
appSyncGraphqlEndpoint?: string;
|
|
18
|
+
authenticationType?: GraphQLAuthMode;
|
|
19
|
+
query?: string;
|
|
20
|
+
variables?: Record<string, DocumentType>;
|
|
21
|
+
apiKey?: string;
|
|
22
|
+
region?: string;
|
|
23
|
+
graphql_headers?: () => {} | (() => Promise<{}>);
|
|
24
|
+
additionalHeaders?: {
|
|
25
|
+
[key: string]: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export declare class AWSAppSyncRealTimeProvider {
|
|
29
|
+
private awsRealTimeSocket?;
|
|
30
|
+
private socketStatus;
|
|
31
|
+
private keepAliveTimeoutId?;
|
|
32
|
+
private keepAliveTimeout;
|
|
33
|
+
private keepAliveAlertTimeoutId?;
|
|
34
|
+
private subscriptionObserverMap;
|
|
35
|
+
private promiseArray;
|
|
36
|
+
private connectionState;
|
|
37
|
+
private readonly connectionStateMonitor;
|
|
38
|
+
private readonly reconnectionMonitor;
|
|
39
|
+
private connectionStateMonitorSubscription;
|
|
40
|
+
constructor(options?: AWSAppSyncRealTimeProviderOptions);
|
|
41
|
+
/**
|
|
42
|
+
* Mark the socket closed and release all active listeners
|
|
43
|
+
*/
|
|
44
|
+
close(): void;
|
|
45
|
+
getNewWebSocket(url: string, protocol: string): WebSocket;
|
|
46
|
+
getProviderName(): string;
|
|
47
|
+
private isCustomDomain;
|
|
48
|
+
subscribe(options?: AWSAppSyncRealTimeProviderOptions, customUserAgentDetails?: CustomUserAgentDetails): Observable<Record<string, unknown>>;
|
|
49
|
+
private _startSubscriptionWithAWSAppSyncRealTime;
|
|
50
|
+
private _logStartSubscriptionError;
|
|
51
|
+
private _waitForSubscriptionToBeConnected;
|
|
52
|
+
private _sendUnsubscriptionMessage;
|
|
53
|
+
private _removeSubscriptionObserver;
|
|
54
|
+
private _closeSocketIfRequired;
|
|
55
|
+
private _handleIncomingSubscriptionMessage;
|
|
56
|
+
private _errorDisconnect;
|
|
57
|
+
private _timeoutStartSubscriptionAck;
|
|
58
|
+
private _initializeWebSocketConnection;
|
|
59
|
+
private _initializeRetryableHandshake;
|
|
60
|
+
private _initializeHandshake;
|
|
61
|
+
private _awsRealTimeHeaderBasedAuth;
|
|
62
|
+
private _awsRealTimeCUPHeader;
|
|
63
|
+
private _awsRealTimeOPENIDHeader;
|
|
64
|
+
private _awsRealTimeApiKeyHeader;
|
|
65
|
+
private _awsRealTimeIAMHeader;
|
|
66
|
+
private _customAuthHeader;
|
|
67
|
+
}
|