@aws-amplify/api-graphql 3.4.27 → 3.4.31
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/index.js +1 -0
- package/lib/internals/InternalGraphQLAPI.js +34 -34
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/index.js +1 -1
- package/lib-esm/index.js +1 -0
- package/lib-esm/internals/InternalGraphQLAPI.js +34 -34
- package/lib-esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +24 -17
- package/src/index.ts +2 -0
package/lib/index.js
CHANGED
|
@@ -14,3 +14,4 @@ Object.defineProperty(exports, "GraphQLAPIClass", { enumerable: true, get: funct
|
|
|
14
14
|
Object.defineProperty(exports, "graphqlOperation", { enumerable: true, get: function () { return GraphQLAPI_2.graphqlOperation; } });
|
|
15
15
|
tslib_1.__exportStar(require("./types"), exports);
|
|
16
16
|
exports.default = GraphQLAPI_1.GraphQLAPI;
|
|
17
|
+
// chore: trigger v5-stable LTS release to complete partial publish (uuid-v11 RN fix, datastore). No functional change.
|
|
@@ -81,10 +81,10 @@ var InternalGraphQLAPIClass = /** @class */ (function () {
|
|
|
81
81
|
return Promise.reject('API not configured');
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
|
-
InternalGraphQLAPIClass.prototype._headerBasedAuth = function (
|
|
85
|
-
|
|
86
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
84
|
+
InternalGraphQLAPIClass.prototype._headerBasedAuth = function (defaultAuthenticationType_1) {
|
|
85
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (defaultAuthenticationType, additionalHeaders) {
|
|
87
86
|
var _a, aws_appsync_authenticationType, apiKey, authenticationType, headers, _b, credentialsOK, token, federatedInfo, currentUser, e_1, session, e_2;
|
|
87
|
+
if (additionalHeaders === void 0) { additionalHeaders = {}; }
|
|
88
88
|
return tslib_1.__generator(this, function (_c) {
|
|
89
89
|
switch (_c.label) {
|
|
90
90
|
case 0:
|
|
@@ -222,47 +222,47 @@ var InternalGraphQLAPIClass = /** @class */ (function () {
|
|
|
222
222
|
throw new Error("invalid operation type: ".concat(operationType));
|
|
223
223
|
}
|
|
224
224
|
};
|
|
225
|
-
InternalGraphQLAPIClass.prototype._graphql = function (_a
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
return tslib_1.__generator(this, function (
|
|
233
|
-
switch (
|
|
225
|
+
InternalGraphQLAPIClass.prototype._graphql = function (_a) {
|
|
226
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (_b, additionalHeaders, initParams, customUserAgentDetails) {
|
|
227
|
+
var _c, region, appSyncGraphqlEndpoint, _d, graphql_headers, customGraphqlEndpoint, customEndpointRegion, headers, _e, _f, _g, _h, _j, _k, body, init, endpoint, error, response, err_1, errors;
|
|
228
|
+
var _l;
|
|
229
|
+
var query = _b.query, variables = _b.variables, authMode = _b.authMode;
|
|
230
|
+
if (additionalHeaders === void 0) { additionalHeaders = {}; }
|
|
231
|
+
if (initParams === void 0) { initParams = {}; }
|
|
232
|
+
return tslib_1.__generator(this, function (_m) {
|
|
233
|
+
switch (_m.label) {
|
|
234
234
|
case 0:
|
|
235
235
|
this.createInstanceIfNotCreated();
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
if (!
|
|
236
|
+
_c = this._options, region = _c.aws_appsync_region, appSyncGraphqlEndpoint = _c.aws_appsync_graphqlEndpoint, _d = _c.graphql_headers, graphql_headers = _d === void 0 ? function () { return ({}); } : _d, customGraphqlEndpoint = _c.graphql_endpoint, customEndpointRegion = _c.graphql_endpoint_iam_region;
|
|
237
|
+
_e = [{}];
|
|
238
|
+
_f = !customGraphqlEndpoint;
|
|
239
|
+
if (!_f) return [3 /*break*/, 2];
|
|
240
240
|
return [4 /*yield*/, this._headerBasedAuth(authMode, additionalHeaders)];
|
|
241
241
|
case 1:
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
_f = (_m.sent());
|
|
243
|
+
_m.label = 2;
|
|
244
244
|
case 2:
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
if (!
|
|
245
|
+
_g = [tslib_1.__assign.apply(void 0, _e.concat([(_f)]))];
|
|
246
|
+
_h = customGraphqlEndpoint;
|
|
247
|
+
if (!_h) return [3 /*break*/, 6];
|
|
248
248
|
if (!customEndpointRegion) return [3 /*break*/, 4];
|
|
249
249
|
return [4 /*yield*/, this._headerBasedAuth(authMode, additionalHeaders)];
|
|
250
250
|
case 3:
|
|
251
|
-
|
|
251
|
+
_j = _m.sent();
|
|
252
252
|
return [3 /*break*/, 5];
|
|
253
253
|
case 4:
|
|
254
|
-
|
|
255
|
-
|
|
254
|
+
_j = { Authorization: null };
|
|
255
|
+
_m.label = 5;
|
|
256
256
|
case 5:
|
|
257
|
-
|
|
258
|
-
|
|
257
|
+
_h = (_j);
|
|
258
|
+
_m.label = 6;
|
|
259
259
|
case 6:
|
|
260
|
-
|
|
260
|
+
_k = [tslib_1.__assign.apply(void 0, _g.concat([(_h)]))];
|
|
261
261
|
return [4 /*yield*/, graphql_headers({ query: query, variables: variables })];
|
|
262
262
|
case 7:
|
|
263
|
-
headers = tslib_1.__assign.apply(void 0, [tslib_1.__assign.apply(void 0, [tslib_1.__assign.apply(void 0,
|
|
264
|
-
|
|
265
|
-
|
|
263
|
+
headers = tslib_1.__assign.apply(void 0, [tslib_1.__assign.apply(void 0, [tslib_1.__assign.apply(void 0, _k.concat([(_m.sent())])), additionalHeaders]), (!customGraphqlEndpoint && (_l = {},
|
|
264
|
+
_l[USER_AGENT_HEADER] = (0, core_1.getAmplifyUserAgent)(customUserAgentDetails),
|
|
265
|
+
_l))]);
|
|
266
266
|
body = {
|
|
267
267
|
query: (0, graphql_1.print)(query),
|
|
268
268
|
variables: variables,
|
|
@@ -283,15 +283,15 @@ var InternalGraphQLAPIClass = /** @class */ (function () {
|
|
|
283
283
|
errors: [error],
|
|
284
284
|
};
|
|
285
285
|
}
|
|
286
|
-
|
|
286
|
+
_m.label = 8;
|
|
287
287
|
case 8:
|
|
288
|
-
|
|
288
|
+
_m.trys.push([8, 10, , 11]);
|
|
289
289
|
return [4 /*yield*/, this._api.post(endpoint, init)];
|
|
290
290
|
case 9:
|
|
291
|
-
response =
|
|
291
|
+
response = _m.sent();
|
|
292
292
|
return [3 /*break*/, 11];
|
|
293
293
|
case 10:
|
|
294
|
-
err_1 =
|
|
294
|
+
err_1 = _m.sent();
|
|
295
295
|
// If the exception is because user intentionally
|
|
296
296
|
// cancelled the request, do not modify the exception
|
|
297
297
|
// so that clients can identify the exception correctly.
|