@aws-amplify/api-graphql 4.0.1-console-preview.d745d43.0 → 4.0.1-ssr-api.df60e41.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/lib/GraphQLAPI.d.ts +1 -1
- package/lib/GraphQLAPI.js +23 -30
- package/lib/Providers/AWSAppSyncRealTimeProvider/index.js +467 -582
- package/lib/index.js +1 -1
- package/lib/internals/InternalGraphQLAPI.d.ts +1 -1
- package/lib/internals/InternalGraphQLAPI.js +204 -246
- package/lib/internals/v6.js +3 -3
- package/lib/tsconfig.tsbuildinfo +180 -20
- package/lib/types/index.d.ts +17 -3
- package/lib/utils/ConnectionStateMonitor.js +51 -64
- package/lib/utils/ReachabilityMonitor/index.js +2 -2
- package/lib/utils/ReachabilityMonitor/index.native.js +4 -6
- package/lib/utils/ReconnectionMonitor.js +20 -24
- package/lib/utils/errors/APIError.js +7 -11
- package/lib/utils/errors/assertValidationError.js +4 -4
- package/lib/utils/errors/validation.js +5 -6
- package/lib/utils/resolveConfig.js +9 -10
- package/lib/utils/resolveLibraryOptions.js +4 -5
- package/lib-esm/GraphQLAPI.d.ts +1 -1
- package/lib-esm/GraphQLAPI.js +22 -30
- package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js +458 -574
- package/lib-esm/Providers/constants.js +10 -10
- package/lib-esm/internals/InternalGraphQLAPI.d.ts +1 -1
- package/lib-esm/internals/InternalGraphQLAPI.js +201 -244
- package/lib-esm/internals/v6.js +1 -1
- package/lib-esm/tsconfig.tsbuildinfo +180 -20
- package/lib-esm/types/index.d.ts +17 -3
- package/lib-esm/types/index.js +1 -1
- package/lib-esm/utils/ConnectionStateMonitor.js +49 -63
- package/lib-esm/utils/ReachabilityMonitor/index.js +1 -1
- package/lib-esm/utils/ReachabilityMonitor/index.native.js +1 -3
- package/lib-esm/utils/ReconnectionMonitor.js +19 -24
- package/lib-esm/utils/errors/APIError.js +6 -11
- package/lib-esm/utils/errors/assertValidationError.js +2 -2
- package/lib-esm/utils/errors/validation.js +5 -6
- package/lib-esm/utils/resolveConfig.js +8 -9
- package/lib-esm/utils/resolveLibraryOptions.js +4 -5
- package/package.json +6 -6
- package/src/GraphQLAPI.ts +3 -2
- package/src/internals/InternalGraphQLAPI.ts +35 -10
- package/src/types/index.ts +38 -8
package/lib/GraphQLAPI.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare class GraphQLAPIClass extends InternalGraphQLAPIClass {
|
|
|
19
19
|
* @param [additionalHeaders] - headers to merge in after any `graphql_headers` set in the config
|
|
20
20
|
* @returns An Observable if the query is a subscription query, else a promise of the graphql result.
|
|
21
21
|
*/
|
|
22
|
-
graphql<T = any>(amplify: AmplifyClassV6, options: GraphQLOptions, additionalHeaders?: {
|
|
22
|
+
graphql<T = any>(amplify: AmplifyClassV6 | (() => Promise<AmplifyClassV6>), options: GraphQLOptions, additionalHeaders?: {
|
|
23
23
|
[key: string]: string;
|
|
24
24
|
}): Observable<GraphQLResult<T>> | Promise<GraphQLResult<T>>;
|
|
25
25
|
/**
|
package/lib/GraphQLAPI.js
CHANGED
|
@@ -1,27 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
variables: variables,
|
|
11
|
-
authToken: authToken,
|
|
12
|
-
});
|
|
13
|
-
};
|
|
3
|
+
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
4
|
+
const internals_1 = require("./internals");
|
|
5
|
+
exports.graphqlOperation = (query, variables = {}, authToken) => ({
|
|
6
|
+
query,
|
|
7
|
+
variables,
|
|
8
|
+
authToken,
|
|
9
|
+
});
|
|
14
10
|
/**
|
|
15
11
|
* Export Cloud Logic APIs
|
|
16
12
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
function GraphQLAPIClass() {
|
|
20
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
21
|
-
}
|
|
22
|
-
GraphQLAPIClass.prototype.getModuleName = function () {
|
|
13
|
+
class GraphQLAPIClass extends internals_1.InternalGraphQLAPIClass {
|
|
14
|
+
getModuleName() {
|
|
23
15
|
return 'GraphQLAPI';
|
|
24
|
-
}
|
|
16
|
+
}
|
|
25
17
|
/**
|
|
26
18
|
* Executes a GraphQL operation
|
|
27
19
|
*
|
|
@@ -29,29 +21,30 @@ var GraphQLAPIClass = /** @class */ (function (_super) {
|
|
|
29
21
|
* @param [additionalHeaders] - headers to merge in after any `graphql_headers` set in the config
|
|
30
22
|
* @returns An Observable if the query is a subscription query, else a promise of the graphql result.
|
|
31
23
|
*/
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
graphql(amplify,
|
|
25
|
+
// amplify: AmplifyClassV6 | (() => Promise<AmplifyClassV6>),
|
|
26
|
+
options, additionalHeaders) {
|
|
27
|
+
return super.graphql(amplify, options, additionalHeaders, {
|
|
34
28
|
category: utils_1.Category.API,
|
|
35
|
-
action: utils_1.ApiAction.GraphQl
|
|
29
|
+
action: utils_1.ApiAction.GraphQl,
|
|
36
30
|
});
|
|
37
|
-
}
|
|
31
|
+
}
|
|
38
32
|
/**
|
|
39
33
|
* Checks to see if an error thrown is from an api request cancellation
|
|
40
34
|
* @param error - Any error
|
|
41
35
|
* @returns A boolean indicating if the error was from an api request cancellation
|
|
42
36
|
*/
|
|
43
|
-
|
|
44
|
-
return
|
|
45
|
-
}
|
|
37
|
+
isCancelError(error) {
|
|
38
|
+
return super.isCancelError(error);
|
|
39
|
+
}
|
|
46
40
|
/**
|
|
47
41
|
* Cancels an inflight request. Only applicable for graphql queries and mutations
|
|
48
42
|
* @param {any} request - request to cancel
|
|
49
43
|
* @returns A boolean indicating if the request was cancelled
|
|
50
44
|
*/
|
|
51
|
-
|
|
52
|
-
return
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
}(internals_1.InternalGraphQLAPIClass));
|
|
45
|
+
cancel(request, message) {
|
|
46
|
+
return super.cancel(request, message);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
56
49
|
exports.GraphQLAPIClass = GraphQLAPIClass;
|
|
57
50
|
exports.GraphQLAPI = new GraphQLAPIClass(null);
|