@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.
Files changed (114) hide show
  1. package/README.md +3 -0
  2. package/lib/GraphQLAPI.js +0 -5
  3. package/lib/Providers/AWSAppSyncRealTimeProvider/index.d.ts +67 -0
  4. package/lib/Providers/AWSAppSyncRealTimeProvider/index.js +817 -0
  5. package/lib/Providers/constants.d.ts +95 -0
  6. package/lib/Providers/constants.js +103 -0
  7. package/lib/index.d.ts +0 -3
  8. package/lib/index.js +3 -9
  9. package/lib/internals/InternalGraphQLAPI.d.ts +4 -40
  10. package/lib/internals/InternalGraphQLAPI.js +89 -243
  11. package/lib/internals/index.d.ts +1 -0
  12. package/lib/internals/index.js +2 -1
  13. package/lib/internals/v6.d.ts +89 -0
  14. package/lib/internals/v6.js +99 -0
  15. package/lib/tsconfig.tsbuildinfo +5790 -0
  16. package/lib/types/PubSub.d.ts +27 -0
  17. package/lib/types/PubSub.js +46 -0
  18. package/lib/types/index.d.ts +184 -4
  19. package/lib/types/index.js +0 -3
  20. package/lib/utils/ConnectionStateMonitor.d.ts +41 -0
  21. package/lib/utils/ConnectionStateMonitor.js +143 -0
  22. package/lib/utils/ReachabilityMonitor/index.d.ts +3 -0
  23. package/lib/utils/ReachabilityMonitor/index.js +6 -0
  24. package/lib/utils/ReachabilityMonitor/index.native.d.ts +3 -0
  25. package/lib/utils/ReachabilityMonitor/index.native.js +10 -0
  26. package/lib/utils/ReconnectionMonitor.d.ts +29 -0
  27. package/lib/utils/ReconnectionMonitor.js +72 -0
  28. package/lib/utils/errors/APIError.d.ts +7 -0
  29. package/lib/utils/errors/APIError.js +22 -0
  30. package/lib/utils/errors/assertValidationError.d.ts +5 -0
  31. package/lib/utils/errors/assertValidationError.js +16 -0
  32. package/lib/utils/errors/index.d.ts +3 -0
  33. package/lib/utils/errors/index.js +11 -0
  34. package/lib/utils/errors/validation.d.ts +8 -0
  35. package/lib/utils/errors/validation.js +26 -0
  36. package/lib/utils/index.d.ts +2 -0
  37. package/lib/utils/index.js +8 -0
  38. package/lib/utils/resolveConfig.d.ts +8 -0
  39. package/lib/utils/resolveConfig.js +17 -0
  40. package/lib/utils/resolveCredentials.d.ts +12 -0
  41. package/lib/utils/resolveCredentials.js +22 -0
  42. package/lib-esm/GraphQLAPI.js +0 -5
  43. package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.d.ts +67 -0
  44. package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js +815 -0
  45. package/lib-esm/Providers/constants.d.ts +95 -0
  46. package/lib-esm/Providers/constants.js +100 -0
  47. package/lib-esm/index.d.ts +0 -3
  48. package/lib-esm/index.js +0 -4
  49. package/lib-esm/internals/InternalGraphQLAPI.d.ts +4 -40
  50. package/lib-esm/internals/InternalGraphQLAPI.js +90 -244
  51. package/lib-esm/internals/index.d.ts +1 -0
  52. package/lib-esm/internals/index.js +1 -1
  53. package/lib-esm/internals/v6.d.ts +89 -0
  54. package/lib-esm/internals/v6.js +96 -0
  55. package/lib-esm/tsconfig.tsbuildinfo +5790 -0
  56. package/lib-esm/types/PubSub.d.ts +27 -0
  57. package/lib-esm/types/PubSub.js +44 -0
  58. package/lib-esm/types/index.d.ts +184 -4
  59. package/lib-esm/types/index.js +0 -3
  60. package/lib-esm/utils/ConnectionStateMonitor.d.ts +41 -0
  61. package/lib-esm/utils/ConnectionStateMonitor.js +141 -0
  62. package/lib-esm/utils/ReachabilityMonitor/index.d.ts +3 -0
  63. package/lib-esm/utils/ReachabilityMonitor/index.js +4 -0
  64. package/lib-esm/utils/ReachabilityMonitor/index.native.d.ts +3 -0
  65. package/lib-esm/utils/ReachabilityMonitor/index.native.js +7 -0
  66. package/lib-esm/utils/ReconnectionMonitor.d.ts +29 -0
  67. package/lib-esm/utils/ReconnectionMonitor.js +70 -0
  68. package/lib-esm/utils/errors/APIError.d.ts +7 -0
  69. package/lib-esm/utils/errors/APIError.js +20 -0
  70. package/lib-esm/utils/errors/assertValidationError.d.ts +5 -0
  71. package/lib-esm/utils/errors/assertValidationError.js +13 -0
  72. package/lib-esm/utils/errors/index.d.ts +3 -0
  73. package/lib-esm/utils/errors/index.js +5 -0
  74. package/lib-esm/utils/errors/validation.d.ts +8 -0
  75. package/lib-esm/utils/errors/validation.js +24 -0
  76. package/lib-esm/utils/index.d.ts +2 -0
  77. package/lib-esm/utils/index.js +4 -0
  78. package/lib-esm/utils/resolveConfig.d.ts +8 -0
  79. package/lib-esm/utils/resolveConfig.js +15 -0
  80. package/lib-esm/utils/resolveCredentials.d.ts +12 -0
  81. package/lib-esm/utils/resolveCredentials.js +20 -0
  82. package/package.json +114 -114
  83. package/src/GraphQLAPI.ts +0 -2
  84. package/src/Providers/AWSAppSyncRealTimeProvider/index.ts +1003 -0
  85. package/src/Providers/constants.ts +110 -0
  86. package/src/index.ts +0 -3
  87. package/src/internals/InternalGraphQLAPI.ts +62 -221
  88. package/src/internals/index.ts +2 -0
  89. package/src/internals/v6.ts +106 -0
  90. package/src/types/PubSub.ts +58 -0
  91. package/src/types/index.ts +234 -7
  92. package/src/utils/ConnectionStateMonitor.ts +195 -0
  93. package/src/utils/ReachabilityMonitor/index.native.ts +7 -0
  94. package/src/utils/ReachabilityMonitor/index.ts +4 -0
  95. package/src/utils/ReconnectionMonitor.ts +76 -0
  96. package/src/utils/errors/APIError.ts +18 -0
  97. package/src/utils/errors/assertValidationError.ts +19 -0
  98. package/src/utils/errors/index.ts +6 -0
  99. package/src/utils/errors/validation.ts +26 -0
  100. package/src/utils/index.ts +5 -0
  101. package/src/utils/resolveConfig.ts +20 -0
  102. package/src/utils/resolveCredentials.ts +14 -0
  103. package/lib/.tsbuildinfo +0 -3
  104. package/lib/GraphQLAPI.js.map +0 -1
  105. package/lib/index.js.map +0 -1
  106. package/lib/internals/InternalGraphQLAPI.js.map +0 -1
  107. package/lib/internals/index.js.map +0 -1
  108. package/lib/types/index.js.map +0 -1
  109. package/lib-esm/.tsbuildinfo +0 -3
  110. package/lib-esm/GraphQLAPI.js.map +0 -1
  111. package/lib-esm/index.js.map +0 -1
  112. package/lib-esm/internals/InternalGraphQLAPI.js.map +0 -1
  113. package/lib-esm/internals/index.js.map +0 -1
  114. package/lib-esm/types/index.js.map +0 -1
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ > INTERNAL USE ONLY
2
+
3
+ This package contains the AWS Amplify API GraphQL category and is intended for internal use only. To integrate Amplify into your app, please use [aws-amplify](https://www.npmjs.com/package/aws-amplify).
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
+ }