@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.
- package/lib/authModeStrategies/multiAuthStrategy.js +6 -2
- package/lib/sync/processors/errorMaps.js +2 -3
- package/lib/sync/processors/subscription.js +9 -10
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib-esm/authModeStrategies/multiAuthStrategy.js +6 -2
- package/lib-esm/sync/processors/errorMaps.js +2 -3
- package/lib-esm/sync/processors/subscription.js +10 -11
- package/lib-esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/authModeStrategies/multiAuthStrategy.ts +5 -1
- package/src/sync/processors/errorMaps.ts +4 -4
- package/src/sync/processors/subscription.ts +10 -5
|
@@ -169,7 +169,7 @@ export var multiAuthStrategy = function (amplifyContext) {
|
|
|
169
169
|
return function (_a) {
|
|
170
170
|
var schema = _a.schema, modelName = _a.modelName;
|
|
171
171
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
172
|
-
var currentUser, e_1, attributes, authAttribute, sortedRules;
|
|
172
|
+
var currentUser, authSession, e_1, attributes, authAttribute, sortedRules;
|
|
173
173
|
var _b;
|
|
174
174
|
return __generator(this, function (_c) {
|
|
175
175
|
switch (_c.label) {
|
|
@@ -177,7 +177,11 @@ export var multiAuthStrategy = function (amplifyContext) {
|
|
|
177
177
|
_c.trys.push([0, 2, , 3]);
|
|
178
178
|
return [4 /*yield*/, fetchAuthSession()];
|
|
179
179
|
case 1:
|
|
180
|
-
|
|
180
|
+
authSession = _c.sent();
|
|
181
|
+
if (authSession.tokens.accessToken) {
|
|
182
|
+
// the user is authenticated
|
|
183
|
+
currentUser = authSession;
|
|
184
|
+
}
|
|
181
185
|
return [3 /*break*/, 3];
|
|
182
186
|
case 2:
|
|
183
187
|
e_1 = _c.sent();
|
|
@@ -80,9 +80,8 @@ export var syncErrorMap = {
|
|
|
80
80
|
* @param observableError an error from ZenObservable subscribe error callback
|
|
81
81
|
*/
|
|
82
82
|
function unwrapObservableError(observableError) {
|
|
83
|
-
var _a
|
|
84
|
-
|
|
85
|
-
} : _a, _c = __read(_b.errors, 1), error = _c[0];
|
|
83
|
+
var _a;
|
|
84
|
+
var _b = __read((_a = __read(observableError.errors, 0), observableError).errors, 1), error = _b[0];
|
|
86
85
|
return error;
|
|
87
86
|
}
|
|
88
87
|
export function getMutationErrorType(error) {
|
|
@@ -71,7 +71,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
71
71
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
72
72
|
};
|
|
73
73
|
import { InternalAPI } from '@aws-amplify/api/internals';
|
|
74
|
-
import { Hub, fetchAuthSession, ConsoleLogger } from '@aws-amplify/core';
|
|
74
|
+
import { Hub, fetchAuthSession, ConsoleLogger, } from '@aws-amplify/core';
|
|
75
75
|
import { Category, DataStoreAction, BackgroundProcessManager, } from '@aws-amplify/core/internals/utils';
|
|
76
76
|
import { Observable } from 'rxjs';
|
|
77
77
|
import { ProcessName, } from '../../types';
|
|
@@ -325,13 +325,12 @@ var SubscriptionProcessor = /** @class */ (function () {
|
|
|
325
325
|
_this.drainBuffer();
|
|
326
326
|
},
|
|
327
327
|
error: function (subscriptionError) { return __awaiter(_this, void 0, void 0, function () {
|
|
328
|
-
var _a, _b, _c, _d,
|
|
329
|
-
|
|
330
|
-
|
|
328
|
+
var _a, _b, _c, _d, message, isRTFError, e_1;
|
|
329
|
+
var _e;
|
|
330
|
+
return __generator(this, function (_f) {
|
|
331
|
+
switch (_f.label) {
|
|
331
332
|
case 0:
|
|
332
|
-
_a = subscriptionError.
|
|
333
|
-
errors: [],
|
|
334
|
-
} : _a, _c = __read(_b.errors, 1), _d = _c[0], _e = _d === void 0 ? {} : _d, _f = _e.message, message = _f === void 0 ? '' : _f;
|
|
333
|
+
_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;
|
|
335
334
|
isRTFError =
|
|
336
335
|
// only attempt catch if a filter variable was added to the subscription query
|
|
337
336
|
addFilter &&
|
|
@@ -369,9 +368,9 @@ var SubscriptionProcessor = /** @class */ (function () {
|
|
|
369
368
|
}
|
|
370
369
|
}
|
|
371
370
|
logger.warn('subscriptionError', message);
|
|
372
|
-
|
|
371
|
+
_f.label = 1;
|
|
373
372
|
case 1:
|
|
374
|
-
|
|
373
|
+
_f.trys.push([1, 3, , 4]);
|
|
375
374
|
return [4 /*yield*/, this.errorHandler({
|
|
376
375
|
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',
|
|
377
376
|
localModel: null,
|
|
@@ -384,10 +383,10 @@ var SubscriptionProcessor = /** @class */ (function () {
|
|
|
384
383
|
cause: subscriptionError,
|
|
385
384
|
})];
|
|
386
385
|
case 2:
|
|
387
|
-
|
|
386
|
+
_f.sent();
|
|
388
387
|
return [3 /*break*/, 4];
|
|
389
388
|
case 3:
|
|
390
|
-
e_1 =
|
|
389
|
+
e_1 = _f.sent();
|
|
391
390
|
logger.error('Subscription error handler failed with:', e_1);
|
|
392
391
|
return [3 /*break*/, 4];
|
|
393
392
|
case 4:
|