@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 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 (defaultAuthenticationType, additionalHeaders) {
85
- if (additionalHeaders === void 0) { additionalHeaders = {}; }
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, additionalHeaders, initParams, customUserAgentDetails) {
226
- var query = _a.query, variables = _a.variables, authMode = _a.authMode;
227
- if (additionalHeaders === void 0) { additionalHeaders = {}; }
228
- if (initParams === void 0) { initParams = {}; }
229
- return tslib_1.__awaiter(this, void 0, void 0, function () {
230
- var _b, region, appSyncGraphqlEndpoint, _c, graphql_headers, customGraphqlEndpoint, customEndpointRegion, headers, _d, _e, _f, _g, _h, _j, body, init, endpoint, error, response, err_1, errors;
231
- var _k;
232
- return tslib_1.__generator(this, function (_l) {
233
- switch (_l.label) {
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
- _b = this._options, region = _b.aws_appsync_region, appSyncGraphqlEndpoint = _b.aws_appsync_graphqlEndpoint, _c = _b.graphql_headers, graphql_headers = _c === void 0 ? function () { return ({}); } : _c, customGraphqlEndpoint = _b.graphql_endpoint, customEndpointRegion = _b.graphql_endpoint_iam_region;
237
- _d = [{}];
238
- _e = !customGraphqlEndpoint;
239
- if (!_e) return [3 /*break*/, 2];
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
- _e = (_l.sent());
243
- _l.label = 2;
242
+ _f = (_m.sent());
243
+ _m.label = 2;
244
244
  case 2:
245
- _f = [tslib_1.__assign.apply(void 0, _d.concat([(_e)]))];
246
- _g = customGraphqlEndpoint;
247
- if (!_g) return [3 /*break*/, 6];
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
- _h = _l.sent();
251
+ _j = _m.sent();
252
252
  return [3 /*break*/, 5];
253
253
  case 4:
254
- _h = { Authorization: null };
255
- _l.label = 5;
254
+ _j = { Authorization: null };
255
+ _m.label = 5;
256
256
  case 5:
257
- _g = (_h);
258
- _l.label = 6;
257
+ _h = (_j);
258
+ _m.label = 6;
259
259
  case 6:
260
- _j = [tslib_1.__assign.apply(void 0, _f.concat([(_g)]))];
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, _j.concat([(_l.sent())])), additionalHeaders]), (!customGraphqlEndpoint && (_k = {},
264
- _k[USER_AGENT_HEADER] = (0, core_1.getAmplifyUserAgent)(customUserAgentDetails),
265
- _k))]);
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
- _l.label = 8;
286
+ _m.label = 8;
287
287
  case 8:
288
- _l.trys.push([8, 10, , 11]);
288
+ _m.trys.push([8, 10, , 11]);
289
289
  return [4 /*yield*/, this._api.post(endpoint, init)];
290
290
  case 9:
291
- response = _l.sent();
291
+ response = _m.sent();
292
292
  return [3 /*break*/, 11];
293
293
  case 10:
294
- err_1 = _l.sent();
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.