@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/types/index.js
CHANGED
|
@@ -10,4 +10,4 @@ var GraphQLAuthError;
|
|
|
10
10
|
GraphQLAuthError["NO_CREDENTIALS"] = "No credentials";
|
|
11
11
|
GraphQLAuthError["NO_FEDERATED_JWT"] = "No federated jwt";
|
|
12
12
|
GraphQLAuthError["NO_AUTH_TOKEN"] = "No auth token specified";
|
|
13
|
-
})(GraphQLAuthError
|
|
13
|
+
})(GraphQLAuthError || (exports.GraphQLAuthError = GraphQLAuthError = {}));
|
package/lib-esm/index.js
CHANGED
|
@@ -5,3 +5,4 @@ export { GraphQLAuthError, GRAPHQL_AUTH_MODE } from './types';
|
|
|
5
5
|
export { GraphQLAPI, GraphQLAPIClass, graphqlOperation } from './GraphQLAPI';
|
|
6
6
|
export * from './types';
|
|
7
7
|
export default GraphQLAPI;
|
|
8
|
+
// chore: trigger v5-stable LTS release to complete partial publish (uuid-v11 RN fix, datastore). No functional change.
|
|
@@ -77,10 +77,10 @@ var InternalGraphQLAPIClass = /** @class */ (function () {
|
|
|
77
77
|
return Promise.reject('API not configured');
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
|
-
InternalGraphQLAPIClass.prototype._headerBasedAuth = function (
|
|
81
|
-
|
|
82
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
80
|
+
InternalGraphQLAPIClass.prototype._headerBasedAuth = function (defaultAuthenticationType_1) {
|
|
81
|
+
return __awaiter(this, arguments, void 0, function (defaultAuthenticationType, additionalHeaders) {
|
|
83
82
|
var _a, aws_appsync_authenticationType, apiKey, authenticationType, headers, _b, credentialsOK, token, federatedInfo, currentUser, e_1, session, e_2;
|
|
83
|
+
if (additionalHeaders === void 0) { additionalHeaders = {}; }
|
|
84
84
|
return __generator(this, function (_c) {
|
|
85
85
|
switch (_c.label) {
|
|
86
86
|
case 0:
|
|
@@ -218,47 +218,47 @@ var InternalGraphQLAPIClass = /** @class */ (function () {
|
|
|
218
218
|
throw new Error("invalid operation type: ".concat(operationType));
|
|
219
219
|
}
|
|
220
220
|
};
|
|
221
|
-
InternalGraphQLAPIClass.prototype._graphql = function (_a
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
return __generator(this, function (
|
|
229
|
-
switch (
|
|
221
|
+
InternalGraphQLAPIClass.prototype._graphql = function (_a) {
|
|
222
|
+
return __awaiter(this, arguments, void 0, function (_b, additionalHeaders, initParams, customUserAgentDetails) {
|
|
223
|
+
var _c, region, appSyncGraphqlEndpoint, _d, graphql_headers, customGraphqlEndpoint, customEndpointRegion, headers, _e, _f, _g, _h, _j, _k, body, init, endpoint, error, response, err_1, errors;
|
|
224
|
+
var _l;
|
|
225
|
+
var query = _b.query, variables = _b.variables, authMode = _b.authMode;
|
|
226
|
+
if (additionalHeaders === void 0) { additionalHeaders = {}; }
|
|
227
|
+
if (initParams === void 0) { initParams = {}; }
|
|
228
|
+
return __generator(this, function (_m) {
|
|
229
|
+
switch (_m.label) {
|
|
230
230
|
case 0:
|
|
231
231
|
this.createInstanceIfNotCreated();
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
if (!
|
|
232
|
+
_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;
|
|
233
|
+
_e = [{}];
|
|
234
|
+
_f = !customGraphqlEndpoint;
|
|
235
|
+
if (!_f) return [3 /*break*/, 2];
|
|
236
236
|
return [4 /*yield*/, this._headerBasedAuth(authMode, additionalHeaders)];
|
|
237
237
|
case 1:
|
|
238
|
-
|
|
239
|
-
|
|
238
|
+
_f = (_m.sent());
|
|
239
|
+
_m.label = 2;
|
|
240
240
|
case 2:
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
if (!
|
|
241
|
+
_g = [__assign.apply(void 0, _e.concat([(_f)]))];
|
|
242
|
+
_h = customGraphqlEndpoint;
|
|
243
|
+
if (!_h) return [3 /*break*/, 6];
|
|
244
244
|
if (!customEndpointRegion) return [3 /*break*/, 4];
|
|
245
245
|
return [4 /*yield*/, this._headerBasedAuth(authMode, additionalHeaders)];
|
|
246
246
|
case 3:
|
|
247
|
-
|
|
247
|
+
_j = _m.sent();
|
|
248
248
|
return [3 /*break*/, 5];
|
|
249
249
|
case 4:
|
|
250
|
-
|
|
251
|
-
|
|
250
|
+
_j = { Authorization: null };
|
|
251
|
+
_m.label = 5;
|
|
252
252
|
case 5:
|
|
253
|
-
|
|
254
|
-
|
|
253
|
+
_h = (_j);
|
|
254
|
+
_m.label = 6;
|
|
255
255
|
case 6:
|
|
256
|
-
|
|
256
|
+
_k = [__assign.apply(void 0, _g.concat([(_h)]))];
|
|
257
257
|
return [4 /*yield*/, graphql_headers({ query: query, variables: variables })];
|
|
258
258
|
case 7:
|
|
259
|
-
headers = __assign.apply(void 0, [__assign.apply(void 0, [__assign.apply(void 0,
|
|
260
|
-
|
|
261
|
-
|
|
259
|
+
headers = __assign.apply(void 0, [__assign.apply(void 0, [__assign.apply(void 0, _k.concat([(_m.sent())])), additionalHeaders]), (!customGraphqlEndpoint && (_l = {},
|
|
260
|
+
_l[USER_AGENT_HEADER] = getAmplifyUserAgent(customUserAgentDetails),
|
|
261
|
+
_l))]);
|
|
262
262
|
body = {
|
|
263
263
|
query: print(query),
|
|
264
264
|
variables: variables,
|
|
@@ -279,15 +279,15 @@ var InternalGraphQLAPIClass = /** @class */ (function () {
|
|
|
279
279
|
errors: [error],
|
|
280
280
|
};
|
|
281
281
|
}
|
|
282
|
-
|
|
282
|
+
_m.label = 8;
|
|
283
283
|
case 8:
|
|
284
|
-
|
|
284
|
+
_m.trys.push([8, 10, , 11]);
|
|
285
285
|
return [4 /*yield*/, this._api.post(endpoint, init)];
|
|
286
286
|
case 9:
|
|
287
|
-
response =
|
|
287
|
+
response = _m.sent();
|
|
288
288
|
return [3 /*break*/, 11];
|
|
289
289
|
case 10:
|
|
290
|
-
err_1 =
|
|
290
|
+
err_1 = _m.sent();
|
|
291
291
|
// If the exception is because user intentionally
|
|
292
292
|
// cancelled the request, do not modify the exception
|
|
293
293
|
// so that clients can identify the exception correctly.
|