@aws-amplify/api 4.0.56-unstable.11 → 4.0.56-unstable.14
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/dist/aws-amplify-api.js
CHANGED
|
@@ -9868,6 +9868,7 @@ var GraphQLAPIClass = /** @class */function () {
|
|
|
9868
9868
|
switch (operationType) {
|
|
9869
9869
|
case 'query':
|
|
9870
9870
|
case 'mutation':
|
|
9871
|
+
this.createInstanceIfNotCreated();
|
|
9871
9872
|
var cancellableToken = this._api.getCancellableToken();
|
|
9872
9873
|
var initParams = {
|
|
9873
9874
|
cancellableToken: cancellableToken
|
|
@@ -9907,46 +9908,41 @@ var GraphQLAPIClass = /** @class */function () {
|
|
|
9907
9908
|
return __generator(this, function (_l) {
|
|
9908
9909
|
switch (_l.label) {
|
|
9909
9910
|
case 0:
|
|
9910
|
-
|
|
9911
|
-
return [4 /*yield*/, this.createInstance()];
|
|
9912
|
-
case 1:
|
|
9913
|
-
_l.sent();
|
|
9914
|
-
_l.label = 2;
|
|
9915
|
-
case 2:
|
|
9911
|
+
this.createInstanceIfNotCreated();
|
|
9916
9912
|
_b = this._options, region = _b.aws_appsync_region, appSyncGraphqlEndpoint = _b.aws_appsync_graphqlEndpoint, _c = _b.graphql_headers, graphql_headers = _c === void 0 ? function () {
|
|
9917
9913
|
return {};
|
|
9918
9914
|
} : _c, customGraphqlEndpoint = _b.graphql_endpoint, customEndpointRegion = _b.graphql_endpoint_iam_region;
|
|
9919
9915
|
_d = [{}];
|
|
9920
9916
|
_e = !customGraphqlEndpoint;
|
|
9921
|
-
if (!_e) return [3 /*break*/,
|
|
9917
|
+
if (!_e) return [3 /*break*/, 2];
|
|
9922
9918
|
return [4 /*yield*/, this._headerBasedAuth(authMode, additionalHeaders)];
|
|
9923
|
-
case
|
|
9919
|
+
case 1:
|
|
9924
9920
|
_e = _l.sent();
|
|
9925
|
-
_l.label =
|
|
9926
|
-
case
|
|
9921
|
+
_l.label = 2;
|
|
9922
|
+
case 2:
|
|
9927
9923
|
_f = [__assign.apply(void 0, _d.concat([_e]))];
|
|
9928
9924
|
_g = customGraphqlEndpoint;
|
|
9929
|
-
if (!_g) return [3 /*break*/,
|
|
9930
|
-
if (!customEndpointRegion) return [3 /*break*/,
|
|
9925
|
+
if (!_g) return [3 /*break*/, 6];
|
|
9926
|
+
if (!customEndpointRegion) return [3 /*break*/, 4];
|
|
9931
9927
|
return [4 /*yield*/, this._headerBasedAuth(authMode, additionalHeaders)];
|
|
9932
|
-
case
|
|
9928
|
+
case 3:
|
|
9933
9929
|
_h = _l.sent();
|
|
9934
|
-
return [3 /*break*/,
|
|
9935
|
-
case
|
|
9930
|
+
return [3 /*break*/, 5];
|
|
9931
|
+
case 4:
|
|
9936
9932
|
_h = {
|
|
9937
9933
|
Authorization: null
|
|
9938
9934
|
};
|
|
9939
|
-
_l.label =
|
|
9940
|
-
case
|
|
9935
|
+
_l.label = 5;
|
|
9936
|
+
case 5:
|
|
9941
9937
|
_g = _h;
|
|
9942
|
-
_l.label =
|
|
9943
|
-
case
|
|
9938
|
+
_l.label = 6;
|
|
9939
|
+
case 6:
|
|
9944
9940
|
_j = [__assign.apply(void 0, _f.concat([_g]))];
|
|
9945
9941
|
return [4 /*yield*/, graphql_headers({
|
|
9946
9942
|
query: query,
|
|
9947
9943
|
variables: variables
|
|
9948
9944
|
})];
|
|
9949
|
-
case
|
|
9945
|
+
case 7:
|
|
9950
9946
|
headers = __assign.apply(void 0, [__assign.apply(void 0, [__assign.apply(void 0, _j.concat([_l.sent()])), additionalHeaders]), !customGraphqlEndpoint && (_k = {}, _k[USER_AGENT_HEADER] = Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["getAmplifyUserAgent"])(userAgentSuffix), _k)]);
|
|
9951
9947
|
body = {
|
|
9952
9948
|
query: Object(graphql__WEBPACK_IMPORTED_MODULE_0__["print"])(query),
|
|
@@ -9968,14 +9964,14 @@ var GraphQLAPIClass = /** @class */function () {
|
|
|
9968
9964
|
errors: [error]
|
|
9969
9965
|
};
|
|
9970
9966
|
}
|
|
9971
|
-
_l.label =
|
|
9972
|
-
case
|
|
9973
|
-
_l.trys.push([
|
|
9967
|
+
_l.label = 8;
|
|
9968
|
+
case 8:
|
|
9969
|
+
_l.trys.push([8, 10,, 11]);
|
|
9974
9970
|
return [4 /*yield*/, this._api.post(endpoint, init)];
|
|
9975
|
-
case
|
|
9971
|
+
case 9:
|
|
9976
9972
|
response = _l.sent();
|
|
9977
|
-
return [3 /*break*/,
|
|
9978
|
-
case
|
|
9973
|
+
return [3 /*break*/, 11];
|
|
9974
|
+
case 10:
|
|
9979
9975
|
err_1 = _l.sent();
|
|
9980
9976
|
// If the exception is because user intentionally
|
|
9981
9977
|
// cancelled the request, do not modify the exception
|
|
@@ -9987,8 +9983,8 @@ var GraphQLAPIClass = /** @class */function () {
|
|
|
9987
9983
|
data: {},
|
|
9988
9984
|
errors: [new graphql__WEBPACK_IMPORTED_MODULE_0__["GraphQLError"](err_1.message, null, null, null, null, err_1)]
|
|
9989
9985
|
};
|
|
9990
|
-
return [3 /*break*/,
|
|
9991
|
-
case
|
|
9986
|
+
return [3 /*break*/, 11];
|
|
9987
|
+
case 11:
|
|
9992
9988
|
errors = response.errors;
|
|
9993
9989
|
if (errors && errors.length) {
|
|
9994
9990
|
throw response;
|
|
@@ -9998,6 +9994,22 @@ var GraphQLAPIClass = /** @class */function () {
|
|
|
9998
9994
|
});
|
|
9999
9995
|
});
|
|
10000
9996
|
};
|
|
9997
|
+
GraphQLAPIClass.prototype.createInstanceIfNotCreated = function () {
|
|
9998
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
9999
|
+
return __generator(this, function (_a) {
|
|
10000
|
+
switch (_a.label) {
|
|
10001
|
+
case 0:
|
|
10002
|
+
if (!!this._api) return [3 /*break*/, 2];
|
|
10003
|
+
return [4 /*yield*/, this.createInstance()];
|
|
10004
|
+
case 1:
|
|
10005
|
+
_a.sent();
|
|
10006
|
+
_a.label = 2;
|
|
10007
|
+
case 2:
|
|
10008
|
+
return [2 /*return*/];
|
|
10009
|
+
}
|
|
10010
|
+
});
|
|
10011
|
+
});
|
|
10012
|
+
};
|
|
10001
10013
|
/**
|
|
10002
10014
|
* Checks to see if an error thrown is from an api request cancellation
|
|
10003
10015
|
* @param {any} error - Any error
|