@aws-amplify/datastore 5.0.32 → 5.0.33-s-auth.30d0cd2.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/dist/cjs/authModeStrategies/multiAuthStrategy.js +1 -1
- package/dist/cjs/authModeStrategies/multiAuthStrategy.js.map +1 -1
- package/dist/cjs/datastore/datastore.js +46 -41
- package/dist/cjs/datastore/datastore.js.map +1 -1
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/predicates/index.js +1 -0
- package/dist/cjs/predicates/index.js.map +1 -1
- package/dist/cjs/predicates/next.js +13 -12
- package/dist/cjs/predicates/next.js.map +1 -1
- package/dist/cjs/predicates/sort.js +2 -2
- package/dist/cjs/predicates/sort.js.map +1 -1
- package/dist/cjs/storage/adapter/AsyncStorageAdapter.js +21 -18
- package/dist/cjs/storage/adapter/AsyncStorageAdapter.js.map +1 -1
- package/dist/cjs/storage/adapter/AsyncStorageDatabase.js +10 -9
- package/dist/cjs/storage/adapter/AsyncStorageDatabase.js.map +1 -1
- package/dist/cjs/storage/adapter/InMemoryStore.js +4 -1
- package/dist/cjs/storage/adapter/InMemoryStore.js.map +1 -1
- package/dist/cjs/storage/adapter/IndexedDBAdapter.js +21 -23
- package/dist/cjs/storage/adapter/IndexedDBAdapter.js.map +1 -1
- package/dist/cjs/storage/adapter/StorageAdapterBase.js +7 -7
- package/dist/cjs/storage/adapter/StorageAdapterBase.js.map +1 -1
- package/dist/cjs/storage/adapter/getDefaultAdapter/index.js +4 -1
- package/dist/cjs/storage/adapter/getDefaultAdapter/index.js.map +1 -1
- package/dist/cjs/storage/adapter/getDefaultAdapter/index.native.js +1 -0
- package/dist/cjs/storage/adapter/getDefaultAdapter/index.native.js.map +1 -1
- package/dist/cjs/storage/relationship.js +1 -0
- package/dist/cjs/storage/relationship.js.map +1 -1
- package/dist/cjs/storage/storage.js +14 -14
- package/dist/cjs/storage/storage.js.map +1 -1
- package/dist/cjs/sync/datastoreConnectivity.js +0 -3
- package/dist/cjs/sync/datastoreConnectivity.js.map +1 -1
- package/dist/cjs/sync/index.js +47 -43
- package/dist/cjs/sync/index.js.map +1 -1
- package/dist/cjs/sync/merger.js +1 -1
- package/dist/cjs/sync/merger.js.map +1 -1
- package/dist/cjs/sync/outbox.js +19 -17
- package/dist/cjs/sync/outbox.js.map +1 -1
- package/dist/cjs/sync/processors/errorMaps.js.map +1 -1
- package/dist/cjs/sync/processors/mutation.js +31 -28
- package/dist/cjs/sync/processors/mutation.js.map +1 -1
- package/dist/cjs/sync/processors/subscription.js +21 -12
- package/dist/cjs/sync/processors/subscription.js.map +1 -1
- package/dist/cjs/sync/processors/sync.js +25 -21
- package/dist/cjs/sync/processors/sync.js.map +1 -1
- package/dist/cjs/sync/utils.js +20 -21
- package/dist/cjs/sync/utils.js.map +1 -1
- package/dist/cjs/types.js +1 -0
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/util.js +46 -25
- package/dist/cjs/util.js.map +1 -1
- package/dist/esm/authModeStrategies/multiAuthStrategy.d.ts +1 -1
- package/dist/esm/authModeStrategies/multiAuthStrategy.mjs +1 -1
- package/dist/esm/authModeStrategies/multiAuthStrategy.mjs.map +1 -1
- package/dist/esm/datastore/datastore.d.ts +4 -6
- package/dist/esm/datastore/datastore.mjs +42 -34
- package/dist/esm/datastore/datastore.mjs.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/predicates/index.mjs +1 -0
- package/dist/esm/predicates/index.mjs.map +1 -1
- package/dist/esm/predicates/next.d.ts +7 -7
- package/dist/esm/predicates/next.mjs +13 -12
- package/dist/esm/predicates/next.mjs.map +1 -1
- package/dist/esm/predicates/sort.d.ts +1 -1
- package/dist/esm/predicates/sort.mjs +2 -2
- package/dist/esm/predicates/sort.mjs.map +1 -1
- package/dist/esm/storage/adapter/AsyncStorageAdapter.d.ts +1 -1
- package/dist/esm/storage/adapter/AsyncStorageAdapter.mjs +21 -18
- package/dist/esm/storage/adapter/AsyncStorageAdapter.mjs.map +1 -1
- package/dist/esm/storage/adapter/AsyncStorageDatabase.mjs +10 -9
- package/dist/esm/storage/adapter/AsyncStorageDatabase.mjs.map +1 -1
- package/dist/esm/storage/adapter/InMemoryStore.mjs +4 -1
- package/dist/esm/storage/adapter/InMemoryStore.mjs.map +1 -1
- package/dist/esm/storage/adapter/IndexedDBAdapter.mjs +21 -23
- package/dist/esm/storage/adapter/IndexedDBAdapter.mjs.map +1 -1
- package/dist/esm/storage/adapter/StorageAdapterBase.d.ts +2 -2
- package/dist/esm/storage/adapter/StorageAdapterBase.mjs +7 -7
- package/dist/esm/storage/adapter/StorageAdapterBase.mjs.map +1 -1
- package/dist/esm/storage/adapter/getDefaultAdapter/index.mjs +3 -1
- package/dist/esm/storage/adapter/getDefaultAdapter/index.mjs.map +1 -1
- package/dist/esm/storage/adapter/getDefaultAdapter/index.native.mjs +1 -0
- package/dist/esm/storage/adapter/getDefaultAdapter/index.native.mjs.map +1 -1
- package/dist/esm/storage/adapter/index.d.ts +1 -1
- package/dist/esm/storage/relationship.mjs +1 -0
- package/dist/esm/storage/relationship.mjs.map +1 -1
- package/dist/esm/storage/storage.d.ts +11 -11
- package/dist/esm/storage/storage.mjs +10 -10
- package/dist/esm/storage/storage.mjs.map +1 -1
- package/dist/esm/sync/datastoreConnectivity.d.ts +2 -2
- package/dist/esm/sync/datastoreConnectivity.mjs +0 -3
- package/dist/esm/sync/datastoreConnectivity.mjs.map +1 -1
- package/dist/esm/sync/index.d.ts +3 -3
- package/dist/esm/sync/index.mjs +47 -43
- package/dist/esm/sync/index.mjs.map +1 -1
- package/dist/esm/sync/merger.d.ts +1 -1
- package/dist/esm/sync/merger.mjs +1 -1
- package/dist/esm/sync/merger.mjs.map +1 -1
- package/dist/esm/sync/outbox.d.ts +4 -4
- package/dist/esm/sync/outbox.mjs +19 -17
- package/dist/esm/sync/outbox.mjs.map +1 -1
- package/dist/esm/sync/processors/errorMaps.mjs.map +1 -1
- package/dist/esm/sync/processors/mutation.d.ts +5 -5
- package/dist/esm/sync/processors/mutation.mjs +31 -28
- package/dist/esm/sync/processors/mutation.mjs.map +1 -1
- package/dist/esm/sync/processors/subscription.d.ts +1 -1
- package/dist/esm/sync/processors/subscription.mjs +21 -12
- package/dist/esm/sync/processors/subscription.mjs.map +1 -1
- package/dist/esm/sync/processors/sync.d.ts +3 -3
- package/dist/esm/sync/processors/sync.mjs +13 -9
- package/dist/esm/sync/processors/sync.mjs.map +1 -1
- package/dist/esm/sync/utils.d.ts +11 -13
- package/dist/esm/sync/utils.mjs +20 -21
- package/dist/esm/sync/utils.mjs.map +1 -1
- package/dist/esm/types.d.ts +121 -131
- package/dist/esm/types.mjs +3 -2
- package/dist/esm/types.mjs.map +1 -1
- package/dist/esm/util.d.ts +5 -5
- package/dist/esm/util.mjs +46 -25
- package/dist/esm/util.mjs.map +1 -1
- package/package.json +74 -73
- package/src/authModeStrategies/multiAuthStrategy.ts +8 -4
- package/src/datastore/datastore.ts +145 -123
- package/src/index.ts +10 -8
- package/src/predicates/index.ts +10 -2
- package/src/predicates/next.ts +39 -28
- package/src/predicates/sort.ts +23 -26
- package/src/storage/adapter/AsyncStorageAdapter.ts +43 -25
- package/src/storage/adapter/AsyncStorageDatabase.ts +18 -10
- package/src/storage/adapter/InMemoryStore.ts +5 -1
- package/src/storage/adapter/IndexedDBAdapter.ts +50 -37
- package/src/storage/adapter/StorageAdapterBase.ts +24 -18
- package/src/storage/adapter/getDefaultAdapter/index.native.ts +1 -0
- package/src/storage/adapter/getDefaultAdapter/index.ts +4 -1
- package/src/storage/adapter/index.ts +2 -2
- package/src/storage/relationship.ts +5 -1
- package/src/storage/storage.ts +38 -30
- package/src/sync/datastoreConnectivity.ts +4 -6
- package/src/sync/index.ts +228 -230
- package/src/sync/merger.ts +4 -3
- package/src/sync/outbox.ts +26 -24
- package/src/sync/processors/errorMaps.ts +5 -0
- package/src/sync/processors/mutation.ts +80 -72
- package/src/sync/processors/subscription.ts +69 -53
- package/src/sync/processors/sync.ts +49 -37
- package/src/sync/utils.ts +60 -41
- package/src/types.ts +165 -165
- package/src/util.ts +89 -53
|
@@ -5,21 +5,21 @@ exports.MutationProcessor = exports.safeJitteredBackoff = void 0;
|
|
|
5
5
|
const internals_1 = require("@aws-amplify/api/internals");
|
|
6
6
|
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
7
7
|
const rxjs_1 = require("rxjs");
|
|
8
|
+
const core_1 = require("@aws-amplify/core");
|
|
8
9
|
const types_1 = require("../../types");
|
|
9
10
|
const util_1 = require("../../util");
|
|
10
11
|
const utils_2 = require("../utils");
|
|
11
12
|
const errorMaps_1 = require("./errorMaps");
|
|
12
|
-
const core_1 = require("@aws-amplify/core");
|
|
13
13
|
const MAX_ATTEMPTS = 10;
|
|
14
14
|
const logger = new core_1.ConsoleLogger('DataStore');
|
|
15
15
|
class MutationProcessor {
|
|
16
|
-
constructor(schema, storage, userClasses, outbox, modelInstanceCreator,
|
|
16
|
+
constructor(schema, storage, userClasses, outbox, modelInstanceCreator, _MutationEvent, amplifyConfig = {}, authModeStrategy, errorHandler, conflictHandler, amplifyContext) {
|
|
17
17
|
this.schema = schema;
|
|
18
18
|
this.storage = storage;
|
|
19
19
|
this.userClasses = userClasses;
|
|
20
20
|
this.outbox = outbox;
|
|
21
21
|
this.modelInstanceCreator = modelInstanceCreator;
|
|
22
|
-
this.
|
|
22
|
+
this._MutationEvent = _MutationEvent;
|
|
23
23
|
this.amplifyConfig = amplifyConfig;
|
|
24
24
|
this.authModeStrategy = authModeStrategy;
|
|
25
25
|
this.errorHandler = errorHandler;
|
|
@@ -111,7 +111,7 @@ class MutationProcessor {
|
|
|
111
111
|
const authModeRetry = async () => {
|
|
112
112
|
try {
|
|
113
113
|
logger.debug(`Attempting mutation with authMode: ${operationAuthModes[authModeAttempts]}`);
|
|
114
|
-
const response = await this.jitteredRetry(namespaceName, model, operation, data, condition, modelConstructor, this.
|
|
114
|
+
const response = await this.jitteredRetry(namespaceName, model, operation, data, condition, modelConstructor, this._MutationEvent, head, operationAuthModes[authModeAttempts], onTerminate);
|
|
115
115
|
logger.debug(`Mutation sent successfully with authMode: ${operationAuthModes[authModeAttempts]}`);
|
|
116
116
|
return response;
|
|
117
117
|
}
|
|
@@ -120,6 +120,7 @@ class MutationProcessor {
|
|
|
120
120
|
if (authModeAttempts >= operationAuthModes.length) {
|
|
121
121
|
logger.debug(`Mutation failed with authMode: ${operationAuthModes[authModeAttempts - 1]}`);
|
|
122
122
|
try {
|
|
123
|
+
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
|
|
123
124
|
await this.errorHandler({
|
|
124
125
|
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',
|
|
125
126
|
localModel: null,
|
|
@@ -138,7 +139,7 @@ class MutationProcessor {
|
|
|
138
139
|
throw error;
|
|
139
140
|
}
|
|
140
141
|
logger.debug(`Mutation failed with authMode: ${operationAuthModes[authModeAttempts - 1]}. Retrying with authMode: ${operationAuthModes[authModeAttempts]}`);
|
|
141
|
-
return
|
|
142
|
+
return authModeRetry();
|
|
142
143
|
}
|
|
143
144
|
};
|
|
144
145
|
[result, opName, modelDefinition] = await authModeRetry();
|
|
@@ -176,9 +177,9 @@ class MutationProcessor {
|
|
|
176
177
|
}, 'mutation resume loop');
|
|
177
178
|
}
|
|
178
179
|
}
|
|
179
|
-
async jitteredRetry(namespaceName, model, operation, data, condition, modelConstructor,
|
|
180
|
-
return
|
|
181
|
-
const [query, variables, graphQLCondition, opName, modelDefinition] = this.createQueryVariables(namespaceName,
|
|
180
|
+
async jitteredRetry(namespaceName, model, operation, data, condition, modelConstructor, MutationEventCtor, mutationEvent, authMode, onTerminate) {
|
|
181
|
+
return (0, utils_1.retry)(async (retriedModel, retriedOperation, retriedData, retriedCondition, retriedModelConstructor, retiredMutationEventCtor, retiredMutationEvent) => {
|
|
182
|
+
const [query, variables, graphQLCondition, opName, modelDefinition] = this.createQueryVariables(namespaceName, retriedModel, retriedOperation, retriedData, retriedCondition);
|
|
182
183
|
const authToken = await (0, utils_2.getTokenForCustomAuth)(authMode, this.amplifyConfig);
|
|
183
184
|
const tryWith = {
|
|
184
185
|
query,
|
|
@@ -187,7 +188,7 @@ class MutationProcessor {
|
|
|
187
188
|
authToken,
|
|
188
189
|
};
|
|
189
190
|
let attempt = 0;
|
|
190
|
-
const opType = this.opTypeFromTransformerOperation(
|
|
191
|
+
const opType = this.opTypeFromTransformerOperation(retriedOperation);
|
|
191
192
|
const customUserAgentDetails = {
|
|
192
193
|
category: utils_1.Category.DataStore,
|
|
193
194
|
action: utils_1.DataStoreAction.GraphQl,
|
|
@@ -225,34 +226,34 @@ class MutationProcessor {
|
|
|
225
226
|
else {
|
|
226
227
|
try {
|
|
227
228
|
retryWith = await this.conflictHandler({
|
|
228
|
-
modelConstructor,
|
|
229
|
-
localModel: this.modelInstanceCreator(
|
|
230
|
-
remoteModel: this.modelInstanceCreator(
|
|
229
|
+
modelConstructor: retriedModelConstructor,
|
|
230
|
+
localModel: this.modelInstanceCreator(retriedModelConstructor, variables.input),
|
|
231
|
+
remoteModel: this.modelInstanceCreator(retriedModelConstructor, error.data),
|
|
231
232
|
operation: opType,
|
|
232
233
|
attempts: attempt,
|
|
233
234
|
});
|
|
234
235
|
}
|
|
235
|
-
catch (
|
|
236
|
-
logger.warn('conflict trycatch',
|
|
236
|
+
catch (caughtErr) {
|
|
237
|
+
logger.warn('conflict trycatch', caughtErr);
|
|
237
238
|
continue;
|
|
238
239
|
}
|
|
239
240
|
}
|
|
240
241
|
if (retryWith === types_1.DISCARD) {
|
|
241
242
|
// Query latest from server and notify merger
|
|
242
|
-
const [[,
|
|
243
|
-
const
|
|
244
|
-
const serverData = await this.amplifyContext.InternalAPI.graphql({
|
|
245
|
-
query,
|
|
243
|
+
const [[, builtOpName, builtQuery]] = (0, utils_2.buildGraphQLOperation)(this.schema.namespaces[namespaceName], modelDefinition, 'GET');
|
|
244
|
+
const newAuthToken = await (0, utils_2.getTokenForCustomAuth)(authMode, this.amplifyConfig);
|
|
245
|
+
const serverData = (await this.amplifyContext.InternalAPI.graphql({
|
|
246
|
+
query: builtQuery,
|
|
246
247
|
variables: { id: variables.input.id },
|
|
247
248
|
authMode,
|
|
248
|
-
authToken,
|
|
249
|
-
}, undefined, customUserAgentDetails);
|
|
249
|
+
authToken: newAuthToken,
|
|
250
|
+
}, undefined, customUserAgentDetails));
|
|
250
251
|
// onTerminate cancel graphql()
|
|
251
|
-
return [serverData,
|
|
252
|
+
return [serverData, builtOpName, modelDefinition];
|
|
252
253
|
}
|
|
253
254
|
const namespace = this.schema.namespaces[namespaceName];
|
|
254
255
|
// convert retry with to tryWith
|
|
255
|
-
const updatedMutation = (0, utils_2.createMutationInstanceFromModelOperation)(namespace.relationships, modelDefinition, opType,
|
|
256
|
+
const updatedMutation = (0, utils_2.createMutationInstanceFromModelOperation)(namespace.relationships, modelDefinition, opType, retriedModelConstructor, retryWith, graphQLCondition, retiredMutationEventCtor, this.modelInstanceCreator, retiredMutationEvent.id);
|
|
256
257
|
await this.storage.save(updatedMutation);
|
|
257
258
|
throw new utils_1.NonRetryableError('RetryMutation');
|
|
258
259
|
}
|
|
@@ -262,21 +263,22 @@ class MutationProcessor {
|
|
|
262
263
|
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',
|
|
263
264
|
localModel: variables.input,
|
|
264
265
|
message: error.message,
|
|
265
|
-
operation,
|
|
266
|
+
operation: retriedOperation,
|
|
266
267
|
errorType: (0, errorMaps_1.getMutationErrorType)(error),
|
|
267
268
|
errorInfo: error.errorInfo,
|
|
268
269
|
process: types_1.ProcessName.mutate,
|
|
269
270
|
cause: error,
|
|
270
271
|
remoteModel: error.data
|
|
271
|
-
? this.modelInstanceCreator(
|
|
272
|
+
? this.modelInstanceCreator(retriedModelConstructor, error.data)
|
|
272
273
|
: null,
|
|
273
274
|
});
|
|
274
275
|
}
|
|
275
|
-
catch (
|
|
276
|
-
logger.warn('Mutation error handler failed with:',
|
|
276
|
+
catch (caughtErr) {
|
|
277
|
+
logger.warn('Mutation error handler failed with:', caughtErr);
|
|
277
278
|
}
|
|
278
279
|
finally {
|
|
279
280
|
// Return empty tuple, dequeues the mutation
|
|
281
|
+
// eslint-disable-next-line no-unsafe-finally
|
|
280
282
|
return error.data
|
|
281
283
|
? [
|
|
282
284
|
{ data: { [opName]: error.data } },
|
|
@@ -293,6 +295,7 @@ class MutationProcessor {
|
|
|
293
295
|
throw new utils_1.NonRetryableError(err);
|
|
294
296
|
}
|
|
295
297
|
}
|
|
298
|
+
// eslint-disable-next-line no-unmodified-loop-condition
|
|
296
299
|
} while (tryWith);
|
|
297
300
|
}, [
|
|
298
301
|
model,
|
|
@@ -300,7 +303,7 @@ class MutationProcessor {
|
|
|
300
303
|
data,
|
|
301
304
|
condition,
|
|
302
305
|
modelConstructor,
|
|
303
|
-
|
|
306
|
+
MutationEventCtor,
|
|
304
307
|
mutationEvent,
|
|
305
308
|
], exports.safeJitteredBackoff, onTerminate);
|
|
306
309
|
}
|
|
@@ -359,7 +362,7 @@ class MutationProcessor {
|
|
|
359
362
|
}
|
|
360
363
|
// scalar fields / non-model types
|
|
361
364
|
if (operation === utils_2.TransformerMutationType.UPDATE) {
|
|
362
|
-
if (!
|
|
365
|
+
if (!Object.prototype.hasOwnProperty.call(parsedData, name)) {
|
|
363
366
|
// for update mutations - strip out a field if it's unchanged
|
|
364
367
|
continue;
|
|
365
368
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutation.js","sources":["../../../../src/sync/processors/mutation.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MutationProcessor = exports.safeJitteredBackoff = void 0;\nconst internals_1 = require(\"@aws-amplify/api/internals\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst rxjs_1 = require(\"rxjs\");\nconst types_1 = require(\"../../types\");\nconst util_1 = require(\"../../util\");\nconst utils_2 = require(\"../utils\");\nconst errorMaps_1 = require(\"./errorMaps\");\nconst core_1 = require(\"@aws-amplify/core\");\nconst MAX_ATTEMPTS = 10;\nconst logger = new core_1.ConsoleLogger('DataStore');\nclass MutationProcessor {\n constructor(schema, storage, userClasses, outbox, modelInstanceCreator, MutationEvent, amplifyConfig = {}, authModeStrategy, errorHandler, conflictHandler, amplifyContext) {\n this.schema = schema;\n this.storage = storage;\n this.userClasses = userClasses;\n this.outbox = outbox;\n this.modelInstanceCreator = modelInstanceCreator;\n this.MutationEvent = MutationEvent;\n this.amplifyConfig = amplifyConfig;\n this.authModeStrategy = authModeStrategy;\n this.errorHandler = errorHandler;\n this.conflictHandler = conflictHandler;\n this.amplifyContext = amplifyContext;\n this.typeQuery = new WeakMap();\n this.processing = false;\n this.runningProcesses = new utils_1.BackgroundProcessManager();\n this.amplifyContext.InternalAPI =\n this.amplifyContext.InternalAPI || internals_1.InternalAPI;\n this.generateQueries();\n }\n generateQueries() {\n Object.values(this.schema.namespaces).forEach(namespace => {\n Object.values(namespace.models)\n .filter(({ syncable }) => syncable)\n .forEach(model => {\n const [createMutation] = (0, utils_2.buildGraphQLOperation)(namespace, model, 'CREATE');\n const [updateMutation] = (0, utils_2.buildGraphQLOperation)(namespace, model, 'UPDATE');\n const [deleteMutation] = (0, utils_2.buildGraphQLOperation)(namespace, model, 'DELETE');\n this.typeQuery.set(model, [\n createMutation,\n updateMutation,\n deleteMutation,\n ]);\n });\n });\n }\n isReady() {\n return this.observer !== undefined;\n }\n start() {\n this.runningProcesses = new utils_1.BackgroundProcessManager();\n const observable = new rxjs_1.Observable(observer => {\n this.observer = observer;\n try {\n this.resume();\n }\n catch (error) {\n logger.error('mutations processor start error', error);\n throw error;\n }\n return this.runningProcesses.addCleaner(async () => {\n // The observer has unsubscribed and/or `stop()` has been called.\n this.removeObserver();\n this.pause();\n });\n });\n return observable;\n }\n async stop() {\n this.removeObserver();\n await this.runningProcesses.close();\n await this.runningProcesses.open();\n }\n removeObserver() {\n this.observer?.complete?.();\n this.observer = undefined;\n }\n async resume() {\n if (this.runningProcesses.isOpen) {\n await this.runningProcesses.add(async (onTerminate) => {\n if (this.processing ||\n !this.isReady() ||\n !this.runningProcesses.isOpen) {\n return;\n }\n this.processing = true;\n let head;\n const namespaceName = util_1.USER;\n // start to drain outbox\n while (this.processing &&\n this.runningProcesses.isOpen &&\n (head = await this.outbox.peek(this.storage)) !== undefined) {\n const { model, operation, data, condition } = head;\n const modelConstructor = this.userClasses[model];\n let result = undefined;\n let opName = undefined;\n let modelDefinition = undefined;\n try {\n const modelAuthModes = await (0, utils_2.getModelAuthModes)({\n authModeStrategy: this.authModeStrategy,\n defaultAuthMode: this.amplifyConfig.aws_appsync_authenticationType,\n modelName: model,\n schema: this.schema,\n });\n const operationAuthModes = modelAuthModes[operation.toUpperCase()];\n let authModeAttempts = 0;\n const authModeRetry = async () => {\n try {\n logger.debug(`Attempting mutation with authMode: ${operationAuthModes[authModeAttempts]}`);\n const response = await this.jitteredRetry(namespaceName, model, operation, data, condition, modelConstructor, this.MutationEvent, head, operationAuthModes[authModeAttempts], onTerminate);\n logger.debug(`Mutation sent successfully with authMode: ${operationAuthModes[authModeAttempts]}`);\n return response;\n }\n catch (error) {\n authModeAttempts++;\n if (authModeAttempts >= operationAuthModes.length) {\n logger.debug(`Mutation failed with authMode: ${operationAuthModes[authModeAttempts - 1]}`);\n try {\n await this.errorHandler({\n 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',\n localModel: null,\n message: error.message,\n model: modelConstructor.name,\n operation: opName,\n errorType: (0, errorMaps_1.getMutationErrorType)(error),\n process: types_1.ProcessName.sync,\n remoteModel: null,\n cause: error,\n });\n }\n catch (e) {\n logger.error('Mutation error handler failed with:', e);\n }\n throw error;\n }\n logger.debug(`Mutation failed with authMode: ${operationAuthModes[authModeAttempts - 1]}. Retrying with authMode: ${operationAuthModes[authModeAttempts]}`);\n return await authModeRetry();\n }\n };\n [result, opName, modelDefinition] = await authModeRetry();\n }\n catch (error) {\n if (error.message === 'Offline' ||\n error.message === 'RetryMutation') {\n continue;\n }\n }\n if (result === undefined) {\n logger.debug('done retrying');\n await this.storage.runExclusive(async (storage) => {\n await this.outbox.dequeue(storage);\n });\n continue;\n }\n const record = result.data[opName];\n let hasMore = false;\n await this.storage.runExclusive(async (storage) => {\n // using runExclusive to prevent possible race condition\n // when another record gets enqueued between dequeue and peek\n await this.outbox.dequeue(storage, record, operation);\n hasMore = (await this.outbox.peek(storage)) !== undefined;\n });\n this.observer?.next?.({\n operation,\n modelDefinition,\n model: record,\n hasMore,\n });\n }\n // pauses itself\n this.pause();\n }, 'mutation resume loop');\n }\n }\n async jitteredRetry(namespaceName, model, operation, data, condition, modelConstructor, MutationEvent, mutationEvent, authMode, onTerminate) {\n return await (0, utils_1.retry)(async (model, operation, data, condition, modelConstructor, MutationEvent, mutationEvent) => {\n const [query, variables, graphQLCondition, opName, modelDefinition] = this.createQueryVariables(namespaceName, model, operation, data, condition);\n const authToken = await (0, utils_2.getTokenForCustomAuth)(authMode, this.amplifyConfig);\n const tryWith = {\n query,\n variables,\n authMode,\n authToken,\n };\n let attempt = 0;\n const opType = this.opTypeFromTransformerOperation(operation);\n const customUserAgentDetails = {\n category: utils_1.Category.DataStore,\n action: utils_1.DataStoreAction.GraphQl,\n };\n do {\n try {\n const result = (await this.amplifyContext.InternalAPI.graphql(tryWith, undefined, customUserAgentDetails));\n // Use `as any` because TypeScript doesn't seem to like passing tuples\n // through generic params.\n return [result, opName, modelDefinition];\n }\n catch (err) {\n if (err.errors && err.errors.length > 0) {\n const [error] = err.errors;\n const { originalError: { code = null } = {} } = error;\n if (error.errorType === 'Unauthorized') {\n throw new utils_1.NonRetryableError('Unauthorized');\n }\n if (error.message === 'Network Error' ||\n code === 'ECONNABORTED' // refers to axios timeout error caused by device's bad network condition\n ) {\n if (!this.processing) {\n throw new utils_1.NonRetryableError('Offline');\n }\n // TODO: Check errors on different env (react-native or other browsers)\n throw new Error('Network Error');\n }\n if (error.errorType === 'ConflictUnhandled') {\n // TODO: add on ConflictConditionalCheck error query last from server\n attempt++;\n let retryWith;\n if (attempt > MAX_ATTEMPTS) {\n retryWith = types_1.DISCARD;\n }\n else {\n try {\n retryWith = await this.conflictHandler({\n modelConstructor,\n localModel: this.modelInstanceCreator(modelConstructor, variables.input),\n remoteModel: this.modelInstanceCreator(modelConstructor, error.data),\n operation: opType,\n attempts: attempt,\n });\n }\n catch (err) {\n logger.warn('conflict trycatch', err);\n continue;\n }\n }\n if (retryWith === types_1.DISCARD) {\n // Query latest from server and notify merger\n const [[, opName, query]] = (0, utils_2.buildGraphQLOperation)(this.schema.namespaces[namespaceName], modelDefinition, 'GET');\n const authToken = await (0, utils_2.getTokenForCustomAuth)(authMode, this.amplifyConfig);\n const serverData = await this.amplifyContext.InternalAPI.graphql({\n query,\n variables: { id: variables.input.id },\n authMode,\n authToken,\n }, undefined, customUserAgentDetails);\n // onTerminate cancel graphql()\n return [serverData, opName, modelDefinition];\n }\n const namespace = this.schema.namespaces[namespaceName];\n // convert retry with to tryWith\n const updatedMutation = (0, utils_2.createMutationInstanceFromModelOperation)(namespace.relationships, modelDefinition, opType, modelConstructor, retryWith, graphQLCondition, MutationEvent, this.modelInstanceCreator, mutationEvent.id);\n await this.storage.save(updatedMutation);\n throw new utils_1.NonRetryableError('RetryMutation');\n }\n else {\n try {\n this.errorHandler({\n 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',\n localModel: variables.input,\n message: error.message,\n operation,\n errorType: (0, errorMaps_1.getMutationErrorType)(error),\n errorInfo: error.errorInfo,\n process: types_1.ProcessName.mutate,\n cause: error,\n remoteModel: error.data\n ? this.modelInstanceCreator(modelConstructor, error.data)\n : null,\n });\n }\n catch (err) {\n logger.warn('Mutation error handler failed with:', err);\n }\n finally {\n // Return empty tuple, dequeues the mutation\n return error.data\n ? [\n { data: { [opName]: error.data } },\n opName,\n modelDefinition,\n ]\n : [];\n }\n }\n }\n else {\n // Catch-all for client-side errors that don't come back in the `GraphQLError` format.\n // These errors should not be retried.\n throw new utils_1.NonRetryableError(err);\n }\n }\n } while (tryWith);\n }, [\n model,\n operation,\n data,\n condition,\n modelConstructor,\n MutationEvent,\n mutationEvent,\n ], exports.safeJitteredBackoff, onTerminate);\n }\n createQueryVariables(namespaceName, model, operation, data, condition) {\n const modelDefinition = this.schema.namespaces[namespaceName].models[model];\n const { primaryKey } = this.schema.namespaces[namespaceName].keys[model];\n const auth = modelDefinition.attributes?.find(a => a.type === 'auth');\n const ownerFields = auth?.properties?.rules\n .map(rule => rule.ownerField)\n .filter(f => f) || ['owner'];\n const queriesTuples = this.typeQuery.get(modelDefinition);\n const [, opName, query] = queriesTuples.find(([transformerMutationType]) => transformerMutationType === operation);\n const { _version, ...parsedData } = JSON.parse(data);\n // include all the fields that comprise a custom PK if one is specified\n const deleteInput = {};\n if (primaryKey && primaryKey.length) {\n for (const pkField of primaryKey) {\n deleteInput[pkField] = parsedData[pkField];\n }\n }\n else {\n deleteInput[util_1.ID] = parsedData.id;\n }\n let mutationInput;\n if (operation === utils_2.TransformerMutationType.DELETE) {\n // For DELETE mutations, only the key(s) are included in the input\n mutationInput = deleteInput;\n }\n else {\n // Otherwise, we construct the mutation input with the following logic\n mutationInput = {};\n const modelFields = Object.values(modelDefinition.fields);\n for (const { name, type, association, isReadOnly } of modelFields) {\n // omit readonly fields. cloud storage doesn't need them and won't take them!\n if (isReadOnly) {\n continue;\n }\n // omit owner fields if it's `null`. cloud storage doesn't allow it.\n if (ownerFields.includes(name) && parsedData[name] === null) {\n continue;\n }\n // model fields should be stripped out from the input\n if ((0, types_1.isModelFieldType)(type)) {\n // except for belongs to relations - we need to replace them with the correct foreign key(s)\n if ((0, types_1.isTargetNameAssociation)(association) &&\n association.connectionType === 'BELONGS_TO') {\n const targetNames = (0, util_1.extractTargetNamesFromSrc)(association);\n if (targetNames) {\n // instead of including the connected model itself, we add its key(s) to the mutation input\n for (const targetName of targetNames) {\n mutationInput[targetName] = parsedData[targetName];\n }\n }\n }\n continue;\n }\n // scalar fields / non-model types\n if (operation === utils_2.TransformerMutationType.UPDATE) {\n if (!parsedData.hasOwnProperty(name)) {\n // for update mutations - strip out a field if it's unchanged\n continue;\n }\n }\n // all other fields are added to the input object\n mutationInput[name] = parsedData[name];\n }\n }\n // Build mutation variables input object\n const input = {\n ...mutationInput,\n _version,\n };\n const graphQLCondition = JSON.parse(condition);\n const variables = {\n input,\n ...(operation === utils_2.TransformerMutationType.CREATE\n ? {}\n : {\n condition: Object.keys(graphQLCondition).length > 0\n ? graphQLCondition\n : null,\n }),\n };\n return [query, variables, graphQLCondition, opName, modelDefinition];\n }\n opTypeFromTransformerOperation(operation) {\n switch (operation) {\n case utils_2.TransformerMutationType.CREATE:\n return types_1.OpType.INSERT;\n case utils_2.TransformerMutationType.DELETE:\n return types_1.OpType.DELETE;\n case utils_2.TransformerMutationType.UPDATE:\n return types_1.OpType.UPDATE;\n case utils_2.TransformerMutationType.GET: // Intentionally blank\n break;\n default:\n throw new Error(`Invalid operation ${operation}`);\n }\n // because it makes TS happy ...\n return undefined;\n }\n pause() {\n this.processing = false;\n }\n}\nexports.MutationProcessor = MutationProcessor;\nconst MAX_RETRY_DELAY_MS = 5 * 60 * 1000;\nconst originalJitteredBackoff = (0, utils_1.jitteredBackoff)(MAX_RETRY_DELAY_MS);\n/**\n * @private\n * Internal use of Amplify only.\n *\n * Wraps the jittered backoff calculation to retry Network Errors indefinitely.\n * Backs off according to original jittered retry logic until the original retry\n * logic hits its max. After this occurs, if the error is a Network Error, we\n * ignore the attempt count and return MAX_RETRY_DELAY_MS to retry forever (until\n * the request succeeds).\n *\n * @param attempt ignored\n * @param _args ignored\n * @param error tested to see if `.message` is 'Network Error'\n * @returns number | false :\n */\nconst safeJitteredBackoff = (attempt, _args, error) => {\n const attemptResult = originalJitteredBackoff(attempt);\n // If this is the last attempt and it is a network error, we retry indefinitively every 5 minutes\n if (attemptResult === false &&\n (error || {}).message === 'Network Error') {\n return MAX_RETRY_DELAY_MS;\n }\n return attemptResult;\n};\nexports.safeJitteredBackoff = safeJitteredBackoff;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,GAAG,KAAK,CAAC,CAAC;AACjE,MAAM,WAAW,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AAC1D,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC/B,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACvC,MAAM,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AACrC,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACpC,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAC3C,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC5C,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;AACrD,MAAM,iBAAiB,CAAC;AACxB,IAAI,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,oBAAoB,EA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MAAM,uBAAuB,GAAG,IAAI,OAAO,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAAC;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,KAAK;AACvD,IAAI,MAAM,aAAa,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAC;AAC3D;AACA,IAAI,IAAI,aAAa,KAAK,KAAK;AAC/B,QAAQ,CAAC,KAAK,IAAI,EAAE,EAAE,OAAO,KAAK,eAAe,EAAE;AACnD,QAAQ,OAAO,kBAAkB,CAAC;AAClC,KAAK;AACL,IAAI,OAAO,aAAa,CAAC;AACzB,CAAC,CAAC;AACF,OAAO,CAAC,mBAAmB,GAAG,mBAAmB;;"}
|
|
1
|
+
{"version":3,"file":"mutation.js","sources":["../../../../src/sync/processors/mutation.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MutationProcessor = exports.safeJitteredBackoff = void 0;\nconst internals_1 = require(\"@aws-amplify/api/internals\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst rxjs_1 = require(\"rxjs\");\nconst core_1 = require(\"@aws-amplify/core\");\nconst types_1 = require(\"../../types\");\nconst util_1 = require(\"../../util\");\nconst utils_2 = require(\"../utils\");\nconst errorMaps_1 = require(\"./errorMaps\");\nconst MAX_ATTEMPTS = 10;\nconst logger = new core_1.ConsoleLogger('DataStore');\nclass MutationProcessor {\n constructor(schema, storage, userClasses, outbox, modelInstanceCreator, _MutationEvent, amplifyConfig = {}, authModeStrategy, errorHandler, conflictHandler, amplifyContext) {\n this.schema = schema;\n this.storage = storage;\n this.userClasses = userClasses;\n this.outbox = outbox;\n this.modelInstanceCreator = modelInstanceCreator;\n this._MutationEvent = _MutationEvent;\n this.amplifyConfig = amplifyConfig;\n this.authModeStrategy = authModeStrategy;\n this.errorHandler = errorHandler;\n this.conflictHandler = conflictHandler;\n this.amplifyContext = amplifyContext;\n this.typeQuery = new WeakMap();\n this.processing = false;\n this.runningProcesses = new utils_1.BackgroundProcessManager();\n this.amplifyContext.InternalAPI =\n this.amplifyContext.InternalAPI || internals_1.InternalAPI;\n this.generateQueries();\n }\n generateQueries() {\n Object.values(this.schema.namespaces).forEach(namespace => {\n Object.values(namespace.models)\n .filter(({ syncable }) => syncable)\n .forEach(model => {\n const [createMutation] = (0, utils_2.buildGraphQLOperation)(namespace, model, 'CREATE');\n const [updateMutation] = (0, utils_2.buildGraphQLOperation)(namespace, model, 'UPDATE');\n const [deleteMutation] = (0, utils_2.buildGraphQLOperation)(namespace, model, 'DELETE');\n this.typeQuery.set(model, [\n createMutation,\n updateMutation,\n deleteMutation,\n ]);\n });\n });\n }\n isReady() {\n return this.observer !== undefined;\n }\n start() {\n this.runningProcesses = new utils_1.BackgroundProcessManager();\n const observable = new rxjs_1.Observable(observer => {\n this.observer = observer;\n try {\n this.resume();\n }\n catch (error) {\n logger.error('mutations processor start error', error);\n throw error;\n }\n return this.runningProcesses.addCleaner(async () => {\n // The observer has unsubscribed and/or `stop()` has been called.\n this.removeObserver();\n this.pause();\n });\n });\n return observable;\n }\n async stop() {\n this.removeObserver();\n await this.runningProcesses.close();\n await this.runningProcesses.open();\n }\n removeObserver() {\n this.observer?.complete?.();\n this.observer = undefined;\n }\n async resume() {\n if (this.runningProcesses.isOpen) {\n await this.runningProcesses.add(async (onTerminate) => {\n if (this.processing ||\n !this.isReady() ||\n !this.runningProcesses.isOpen) {\n return;\n }\n this.processing = true;\n let head;\n const namespaceName = util_1.USER;\n // start to drain outbox\n while (this.processing &&\n this.runningProcesses.isOpen &&\n (head = await this.outbox.peek(this.storage)) !== undefined) {\n const { model, operation, data, condition } = head;\n const modelConstructor = this.userClasses[model];\n let result = undefined;\n let opName = undefined;\n let modelDefinition = undefined;\n try {\n const modelAuthModes = await (0, utils_2.getModelAuthModes)({\n authModeStrategy: this.authModeStrategy,\n defaultAuthMode: this.amplifyConfig.aws_appsync_authenticationType,\n modelName: model,\n schema: this.schema,\n });\n const operationAuthModes = modelAuthModes[operation.toUpperCase()];\n let authModeAttempts = 0;\n const authModeRetry = async () => {\n try {\n logger.debug(`Attempting mutation with authMode: ${operationAuthModes[authModeAttempts]}`);\n const response = await this.jitteredRetry(namespaceName, model, operation, data, condition, modelConstructor, this._MutationEvent, head, operationAuthModes[authModeAttempts], onTerminate);\n logger.debug(`Mutation sent successfully with authMode: ${operationAuthModes[authModeAttempts]}`);\n return response;\n }\n catch (error) {\n authModeAttempts++;\n if (authModeAttempts >= operationAuthModes.length) {\n logger.debug(`Mutation failed with authMode: ${operationAuthModes[authModeAttempts - 1]}`);\n try {\n // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression\n await this.errorHandler({\n 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',\n localModel: null,\n message: error.message,\n model: modelConstructor.name,\n operation: opName,\n errorType: (0, errorMaps_1.getMutationErrorType)(error),\n process: types_1.ProcessName.sync,\n remoteModel: null,\n cause: error,\n });\n }\n catch (e) {\n logger.error('Mutation error handler failed with:', e);\n }\n throw error;\n }\n logger.debug(`Mutation failed with authMode: ${operationAuthModes[authModeAttempts - 1]}. Retrying with authMode: ${operationAuthModes[authModeAttempts]}`);\n return authModeRetry();\n }\n };\n [result, opName, modelDefinition] = await authModeRetry();\n }\n catch (error) {\n if (error.message === 'Offline' ||\n error.message === 'RetryMutation') {\n continue;\n }\n }\n if (result === undefined) {\n logger.debug('done retrying');\n await this.storage.runExclusive(async (storage) => {\n await this.outbox.dequeue(storage);\n });\n continue;\n }\n const record = result.data[opName];\n let hasMore = false;\n await this.storage.runExclusive(async (storage) => {\n // using runExclusive to prevent possible race condition\n // when another record gets enqueued between dequeue and peek\n await this.outbox.dequeue(storage, record, operation);\n hasMore = (await this.outbox.peek(storage)) !== undefined;\n });\n this.observer?.next?.({\n operation,\n modelDefinition,\n model: record,\n hasMore,\n });\n }\n // pauses itself\n this.pause();\n }, 'mutation resume loop');\n }\n }\n async jitteredRetry(namespaceName, model, operation, data, condition, modelConstructor, MutationEventCtor, mutationEvent, authMode, onTerminate) {\n return (0, utils_1.retry)(async (retriedModel, retriedOperation, retriedData, retriedCondition, retriedModelConstructor, retiredMutationEventCtor, retiredMutationEvent) => {\n const [query, variables, graphQLCondition, opName, modelDefinition] = this.createQueryVariables(namespaceName, retriedModel, retriedOperation, retriedData, retriedCondition);\n const authToken = await (0, utils_2.getTokenForCustomAuth)(authMode, this.amplifyConfig);\n const tryWith = {\n query,\n variables,\n authMode,\n authToken,\n };\n let attempt = 0;\n const opType = this.opTypeFromTransformerOperation(retriedOperation);\n const customUserAgentDetails = {\n category: utils_1.Category.DataStore,\n action: utils_1.DataStoreAction.GraphQl,\n };\n do {\n try {\n const result = (await this.amplifyContext.InternalAPI.graphql(tryWith, undefined, customUserAgentDetails));\n // Use `as any` because TypeScript doesn't seem to like passing tuples\n // through generic params.\n return [result, opName, modelDefinition];\n }\n catch (err) {\n if (err.errors && err.errors.length > 0) {\n const [error] = err.errors;\n const { originalError: { code = null } = {} } = error;\n if (error.errorType === 'Unauthorized') {\n throw new utils_1.NonRetryableError('Unauthorized');\n }\n if (error.message === 'Network Error' ||\n code === 'ECONNABORTED' // refers to axios timeout error caused by device's bad network condition\n ) {\n if (!this.processing) {\n throw new utils_1.NonRetryableError('Offline');\n }\n // TODO: Check errors on different env (react-native or other browsers)\n throw new Error('Network Error');\n }\n if (error.errorType === 'ConflictUnhandled') {\n // TODO: add on ConflictConditionalCheck error query last from server\n attempt++;\n let retryWith;\n if (attempt > MAX_ATTEMPTS) {\n retryWith = types_1.DISCARD;\n }\n else {\n try {\n retryWith = await this.conflictHandler({\n modelConstructor: retriedModelConstructor,\n localModel: this.modelInstanceCreator(retriedModelConstructor, variables.input),\n remoteModel: this.modelInstanceCreator(retriedModelConstructor, error.data),\n operation: opType,\n attempts: attempt,\n });\n }\n catch (caughtErr) {\n logger.warn('conflict trycatch', caughtErr);\n continue;\n }\n }\n if (retryWith === types_1.DISCARD) {\n // Query latest from server and notify merger\n const [[, builtOpName, builtQuery]] = (0, utils_2.buildGraphQLOperation)(this.schema.namespaces[namespaceName], modelDefinition, 'GET');\n const newAuthToken = await (0, utils_2.getTokenForCustomAuth)(authMode, this.amplifyConfig);\n const serverData = (await this.amplifyContext.InternalAPI.graphql({\n query: builtQuery,\n variables: { id: variables.input.id },\n authMode,\n authToken: newAuthToken,\n }, undefined, customUserAgentDetails));\n // onTerminate cancel graphql()\n return [serverData, builtOpName, modelDefinition];\n }\n const namespace = this.schema.namespaces[namespaceName];\n // convert retry with to tryWith\n const updatedMutation = (0, utils_2.createMutationInstanceFromModelOperation)(namespace.relationships, modelDefinition, opType, retriedModelConstructor, retryWith, graphQLCondition, retiredMutationEventCtor, this.modelInstanceCreator, retiredMutationEvent.id);\n await this.storage.save(updatedMutation);\n throw new utils_1.NonRetryableError('RetryMutation');\n }\n else {\n try {\n this.errorHandler({\n 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',\n localModel: variables.input,\n message: error.message,\n operation: retriedOperation,\n errorType: (0, errorMaps_1.getMutationErrorType)(error),\n errorInfo: error.errorInfo,\n process: types_1.ProcessName.mutate,\n cause: error,\n remoteModel: error.data\n ? this.modelInstanceCreator(retriedModelConstructor, error.data)\n : null,\n });\n }\n catch (caughtErr) {\n logger.warn('Mutation error handler failed with:', caughtErr);\n }\n finally {\n // Return empty tuple, dequeues the mutation\n // eslint-disable-next-line no-unsafe-finally\n return error.data\n ? [\n { data: { [opName]: error.data } },\n opName,\n modelDefinition,\n ]\n : [];\n }\n }\n }\n else {\n // Catch-all for client-side errors that don't come back in the `GraphQLError` format.\n // These errors should not be retried.\n throw new utils_1.NonRetryableError(err);\n }\n }\n // eslint-disable-next-line no-unmodified-loop-condition\n } while (tryWith);\n }, [\n model,\n operation,\n data,\n condition,\n modelConstructor,\n MutationEventCtor,\n mutationEvent,\n ], exports.safeJitteredBackoff, onTerminate);\n }\n createQueryVariables(namespaceName, model, operation, data, condition) {\n const modelDefinition = this.schema.namespaces[namespaceName].models[model];\n const { primaryKey } = this.schema.namespaces[namespaceName].keys[model];\n const auth = modelDefinition.attributes?.find(a => a.type === 'auth');\n const ownerFields = auth?.properties?.rules\n .map(rule => rule.ownerField)\n .filter(f => f) || ['owner'];\n const queriesTuples = this.typeQuery.get(modelDefinition);\n const [, opName, query] = queriesTuples.find(([transformerMutationType]) => transformerMutationType === operation);\n const { _version, ...parsedData } = JSON.parse(data);\n // include all the fields that comprise a custom PK if one is specified\n const deleteInput = {};\n if (primaryKey && primaryKey.length) {\n for (const pkField of primaryKey) {\n deleteInput[pkField] = parsedData[pkField];\n }\n }\n else {\n deleteInput[util_1.ID] = parsedData.id;\n }\n let mutationInput;\n if (operation === utils_2.TransformerMutationType.DELETE) {\n // For DELETE mutations, only the key(s) are included in the input\n mutationInput = deleteInput;\n }\n else {\n // Otherwise, we construct the mutation input with the following logic\n mutationInput = {};\n const modelFields = Object.values(modelDefinition.fields);\n for (const { name, type, association, isReadOnly } of modelFields) {\n // omit readonly fields. cloud storage doesn't need them and won't take them!\n if (isReadOnly) {\n continue;\n }\n // omit owner fields if it's `null`. cloud storage doesn't allow it.\n if (ownerFields.includes(name) && parsedData[name] === null) {\n continue;\n }\n // model fields should be stripped out from the input\n if ((0, types_1.isModelFieldType)(type)) {\n // except for belongs to relations - we need to replace them with the correct foreign key(s)\n if ((0, types_1.isTargetNameAssociation)(association) &&\n association.connectionType === 'BELONGS_TO') {\n const targetNames = (0, util_1.extractTargetNamesFromSrc)(association);\n if (targetNames) {\n // instead of including the connected model itself, we add its key(s) to the mutation input\n for (const targetName of targetNames) {\n mutationInput[targetName] = parsedData[targetName];\n }\n }\n }\n continue;\n }\n // scalar fields / non-model types\n if (operation === utils_2.TransformerMutationType.UPDATE) {\n if (!Object.prototype.hasOwnProperty.call(parsedData, name)) {\n // for update mutations - strip out a field if it's unchanged\n continue;\n }\n }\n // all other fields are added to the input object\n mutationInput[name] = parsedData[name];\n }\n }\n // Build mutation variables input object\n const input = {\n ...mutationInput,\n _version,\n };\n const graphQLCondition = JSON.parse(condition);\n const variables = {\n input,\n ...(operation === utils_2.TransformerMutationType.CREATE\n ? {}\n : {\n condition: Object.keys(graphQLCondition).length > 0\n ? graphQLCondition\n : null,\n }),\n };\n return [query, variables, graphQLCondition, opName, modelDefinition];\n }\n opTypeFromTransformerOperation(operation) {\n switch (operation) {\n case utils_2.TransformerMutationType.CREATE:\n return types_1.OpType.INSERT;\n case utils_2.TransformerMutationType.DELETE:\n return types_1.OpType.DELETE;\n case utils_2.TransformerMutationType.UPDATE:\n return types_1.OpType.UPDATE;\n case utils_2.TransformerMutationType.GET: // Intentionally blank\n break;\n default:\n throw new Error(`Invalid operation ${operation}`);\n }\n // because it makes TS happy ...\n return undefined;\n }\n pause() {\n this.processing = false;\n }\n}\nexports.MutationProcessor = MutationProcessor;\nconst MAX_RETRY_DELAY_MS = 5 * 60 * 1000;\nconst originalJitteredBackoff = (0, utils_1.jitteredBackoff)(MAX_RETRY_DELAY_MS);\n/**\n * @private\n * Internal use of Amplify only.\n *\n * Wraps the jittered backoff calculation to retry Network Errors indefinitely.\n * Backs off according to original jittered retry logic until the original retry\n * logic hits its max. After this occurs, if the error is a Network Error, we\n * ignore the attempt count and return MAX_RETRY_DELAY_MS to retry forever (until\n * the request succeeds).\n *\n * @param attempt ignored\n * @param _args ignored\n * @param error tested to see if `.message` is 'Network Error'\n * @returns number | false :\n */\nconst safeJitteredBackoff = (attempt, _args, error) => {\n const attemptResult = originalJitteredBackoff(attempt);\n // If this is the last attempt and it is a network error, we retry indefinitively every 5 minutes\n if (attemptResult === false &&\n (error || {}).message === 'Network Error') {\n return MAX_RETRY_DELAY_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K,KAAK;AACvD,IAAI,MAAM,aAAa,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAC;AAC3D;AACA,IAAI,IAAI,aAAa,KAAK,KAAK;AAC/B,QAAQ,CAAC,KAAK,IAAI,EAAE,EAAE,OAAO,KAAK,eAAe,EAAE;AACnD,QAAQ,OAAO,kBAAkB,CAAC;AAClC,KAAK;AACL,IAAI,OAAO,aAAa,CAAC;AACzB,CAAC,CAAC;AACF,OAAO,CAAC,mBAAmB,GAAG,mBAAmB;;"}
|
|
@@ -6,12 +6,12 @@ const internals_1 = require("@aws-amplify/api/internals");
|
|
|
6
6
|
const core_1 = require("@aws-amplify/core");
|
|
7
7
|
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
8
8
|
const rxjs_1 = require("rxjs");
|
|
9
|
+
const api_graphql_1 = require("@aws-amplify/api-graphql");
|
|
9
10
|
const types_1 = require("../../types");
|
|
10
11
|
const utils_2 = require("../utils");
|
|
11
12
|
const predicates_1 = require("../../predicates");
|
|
12
13
|
const util_1 = require("../../util");
|
|
13
14
|
const errorMaps_1 = require("./errorMaps");
|
|
14
|
-
const api_graphql_1 = require("@aws-amplify/api-graphql");
|
|
15
15
|
const logger = new core_1.ConsoleLogger('DataStore');
|
|
16
16
|
var CONTROL_MSG;
|
|
17
17
|
(function (CONTROL_MSG) {
|
|
@@ -58,6 +58,7 @@ class SubscriptionProcessor {
|
|
|
58
58
|
const groupAuthRules = rules.filter(rule => rule.authStrategy === 'groups' &&
|
|
59
59
|
['userPools', 'oidc'].includes(rule.provider));
|
|
60
60
|
const validGroup = (authMode === 'oidc' || authMode === 'userPool') &&
|
|
61
|
+
// eslint-disable-next-line array-callback-return
|
|
61
62
|
groupAuthRules.find(groupAuthRule => {
|
|
62
63
|
// validate token against groupClaim
|
|
63
64
|
if (oidcTokenPayload) {
|
|
@@ -186,7 +187,7 @@ class SubscriptionProcessor {
|
|
|
186
187
|
action: utils_1.DataStoreAction.Subscribe,
|
|
187
188
|
};
|
|
188
189
|
if (addFilter && predicatesGroup) {
|
|
189
|
-
variables
|
|
190
|
+
variables.filter =
|
|
190
191
|
(0, utils_2.predicateToGraphQLFilter)(predicatesGroup);
|
|
191
192
|
}
|
|
192
193
|
if (isOwner) {
|
|
@@ -214,14 +215,13 @@ class SubscriptionProcessor {
|
|
|
214
215
|
this.drainBuffer();
|
|
215
216
|
return;
|
|
216
217
|
}
|
|
217
|
-
const
|
|
218
|
-
// @ts-ignore
|
|
218
|
+
const resolvedPredicatesGroup = predicates_1.ModelPredicateCreator.getPredicates(this.syncPredicates.get(modelDefinition), false);
|
|
219
219
|
const { [opName]: record } = data;
|
|
220
220
|
// checking incoming subscription against syncPredicate.
|
|
221
221
|
// once AppSync implements filters on subscriptions, we'll be
|
|
222
222
|
// able to set these when establishing the subscription instead.
|
|
223
223
|
// Until then, we'll need to filter inbound
|
|
224
|
-
if (this.passesPredicateValidation(record,
|
|
224
|
+
if (this.passesPredicateValidation(record, resolvedPredicatesGroup)) {
|
|
225
225
|
this.pushToBuffer(transformerMutationType, modelDefinition, record);
|
|
226
226
|
}
|
|
227
227
|
this.drainBuffer();
|
|
@@ -262,6 +262,7 @@ class SubscriptionProcessor {
|
|
|
262
262
|
}
|
|
263
263
|
logger.warn('subscriptionError', message);
|
|
264
264
|
try {
|
|
265
|
+
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
|
|
265
266
|
await this.errorHandler({
|
|
266
267
|
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',
|
|
267
268
|
localModel: null,
|
|
@@ -290,9 +291,9 @@ class SubscriptionProcessor {
|
|
|
290
291
|
promises.push((async () => {
|
|
291
292
|
let boundFunction;
|
|
292
293
|
let removeBoundFunctionListener;
|
|
293
|
-
await new Promise(
|
|
294
|
-
subscriptionReadyCallback =
|
|
295
|
-
boundFunction = this.hubQueryCompletionListener.bind(this,
|
|
294
|
+
await new Promise(resolve => {
|
|
295
|
+
subscriptionReadyCallback = resolve;
|
|
296
|
+
boundFunction = this.hubQueryCompletionListener.bind(this, resolve);
|
|
296
297
|
removeBoundFunctionListener = core_1.Hub.listen('api', boundFunction);
|
|
297
298
|
});
|
|
298
299
|
removeBoundFunctionListener();
|
|
@@ -308,9 +309,15 @@ class SubscriptionProcessor {
|
|
|
308
309
|
}, 'subscription processor new subscriber');
|
|
309
310
|
return this.runningProcesses.addCleaner(async () => {
|
|
310
311
|
Object.keys(subscriptions).forEach(modelName => {
|
|
311
|
-
subscriptions[modelName][utils_2.TransformerMutationType.CREATE].forEach(subscription =>
|
|
312
|
-
|
|
313
|
-
|
|
312
|
+
subscriptions[modelName][utils_2.TransformerMutationType.CREATE].forEach(subscription => {
|
|
313
|
+
subscription.unsubscribe();
|
|
314
|
+
});
|
|
315
|
+
subscriptions[modelName][utils_2.TransformerMutationType.UPDATE].forEach(subscription => {
|
|
316
|
+
subscription.unsubscribe();
|
|
317
|
+
});
|
|
318
|
+
subscriptions[modelName][utils_2.TransformerMutationType.DELETE].forEach(subscription => {
|
|
319
|
+
subscription.unsubscribe();
|
|
320
|
+
});
|
|
314
321
|
});
|
|
315
322
|
});
|
|
316
323
|
});
|
|
@@ -339,7 +346,9 @@ class SubscriptionProcessor {
|
|
|
339
346
|
}
|
|
340
347
|
drainBuffer() {
|
|
341
348
|
if (this.dataObserver) {
|
|
342
|
-
this.buffer.forEach(data =>
|
|
349
|
+
this.buffer.forEach(data => {
|
|
350
|
+
this.dataObserver.next(data);
|
|
351
|
+
});
|
|
343
352
|
this.buffer = [];
|
|
344
353
|
}
|
|
345
354
|
}
|