@aws-amplify/datastore 5.0.1-console-preview.8d88eef.0 → 5.0.1-console-preview.be08038.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.
@@ -172,7 +172,7 @@ var multiAuthStrategy = function (amplifyContext) {
172
172
  return function (_a) {
173
173
  var schema = _a.schema, modelName = _a.modelName;
174
174
  return __awaiter(void 0, void 0, void 0, function () {
175
- var currentUser, e_1, attributes, authAttribute, sortedRules;
175
+ var currentUser, authSession, e_1, attributes, authAttribute, sortedRules;
176
176
  var _b;
177
177
  return __generator(this, function (_c) {
178
178
  switch (_c.label) {
@@ -180,7 +180,11 @@ var multiAuthStrategy = function (amplifyContext) {
180
180
  _c.trys.push([0, 2, , 3]);
181
181
  return [4 /*yield*/, (0, core_1.fetchAuthSession)()];
182
182
  case 1:
183
- currentUser = _c.sent();
183
+ authSession = _c.sent();
184
+ if (authSession.tokens.accessToken) {
185
+ // the user is authenticated
186
+ currentUser = authSession;
187
+ }
184
188
  return [3 /*break*/, 3];
185
189
  case 2:
186
190
  e_1 = _c.sent();
@@ -83,9 +83,8 @@ exports.syncErrorMap = {
83
83
  * @param observableError an error from ZenObservable subscribe error callback
84
84
  */
85
85
  function unwrapObservableError(observableError) {
86
- var _a = observableError.error, _b = _a === void 0 ? {
87
- errors: [],
88
- } : _a, _c = __read(_b.errors, 1), error = _c[0];
86
+ var _a;
87
+ var _b = __read((_a = __read(observableError.errors, 0), observableError).errors, 1), error = _b[0];
89
88
  return error;
90
89
  }
91
90
  function getMutationErrorType(error) {
@@ -328,13 +328,12 @@ var SubscriptionProcessor = /** @class */ (function () {
328
328
  _this.drainBuffer();
329
329
  },
330
330
  error: function (subscriptionError) { return __awaiter(_this, void 0, void 0, function () {
331
- var _a, _b, _c, _d, _e, _f, message, isRTFError, e_1;
332
- return __generator(this, function (_g) {
333
- switch (_g.label) {
331
+ var _a, _b, _c, _d, message, isRTFError, e_1;
332
+ var _e;
333
+ return __generator(this, function (_f) {
334
+ switch (_f.label) {
334
335
  case 0:
335
- _a = subscriptionError.error, _b = _a === void 0 ? {
336
- errors: [],
337
- } : _a, _c = __read(_b.errors, 1), _d = _c[0], _e = _d === void 0 ? {} : _d, _f = _e.message, message = _f === void 0 ? '' : _f;
336
+ _a = __read((_e = __read(subscriptionError.errors, 0), subscriptionError).errors, 1), _b = _a[0], _c = _b === void 0 ? {} : _b, _d = _c.message, message = _d === void 0 ? '' : _d;
338
337
  isRTFError =
339
338
  // only attempt catch if a filter variable was added to the subscription query
340
339
  addFilter &&
@@ -372,9 +371,9 @@ var SubscriptionProcessor = /** @class */ (function () {
372
371
  }
373
372
  }
374
373
  logger.warn('subscriptionError', message);
375
- _g.label = 1;
374
+ _f.label = 1;
376
375
  case 1:
377
- _g.trys.push([1, 3, , 4]);
376
+ _f.trys.push([1, 3, , 4]);
378
377
  return [4 /*yield*/, this.errorHandler({
379
378
  recoverySuggestion: 'Ensure app code is up to date, auth directives exist and are correct on each model, and that server-side data has not been invalidated by a schema change. If the problem persists, search for or create an issue: https://github.com/aws-amplify/amplify-js/issues',
380
379
  localModel: null,
@@ -387,10 +386,10 @@ var SubscriptionProcessor = /** @class */ (function () {
387
386
  cause: subscriptionError,
388
387
  })];
389
388
  case 2:
390
- _g.sent();
389
+ _f.sent();
391
390
  return [3 /*break*/, 4];
392
391
  case 3:
393
- e_1 = _g.sent();
392
+ e_1 = _f.sent();
394
393
  logger.error('Subscription error handler failed with:', e_1);
395
394
  return [3 /*break*/, 4];
396
395
  case 4: