@aws-amplify/datastore
Version:
AppSyncLocal support for aws-amplify
1 lines • 37.1 kB
Source Map (JSON)
{"version":3,"file":"mutation.mjs","sources":["../../../../src/sync/processors/mutation.ts"],"sourcesContent":["import { InternalAPI } from '@aws-amplify/api/internals';\nimport { BackgroundProcessManager, Category, DataStoreAction, NonRetryableError, jitteredBackoff, retry, } from '@aws-amplify/core/internals/utils';\nimport { Observable } from 'rxjs';\nimport { ConsoleLogger } from '@aws-amplify/core';\nimport { DISCARD, OpType, ProcessName, isModelFieldType, isTargetNameAssociation, } from '../../types';\nimport { ID, USER, extractTargetNamesFromSrc } from '../../util';\nimport { TransformerMutationType, buildGraphQLOperation, createMutationInstanceFromModelOperation, getModelAuthModes, getTokenForCustomAuth, } from '../utils';\nimport { getMutationErrorType } from './errorMaps';\nconst MAX_ATTEMPTS = 10;\nconst logger = new 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 BackgroundProcessManager();\n this.amplifyContext.InternalAPI =\n this.amplifyContext.InternalAPI || 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] = buildGraphQLOperation(namespace, model, 'CREATE');\n const [updateMutation] = buildGraphQLOperation(namespace, model, 'UPDATE');\n const [deleteMutation] = 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 BackgroundProcessManager();\n const observable = new 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 = 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 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: getMutationErrorType(error),\n process: 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 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 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: Category.DataStore,\n action: 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 NonRetryableError('Unauthorized');\n }\n if (error.message === 'Network Error' ||\n code === 'ERR_NETWORK' // refers to axios timeout error caused by device's bad network condition\n ) {\n if (!this.processing) {\n throw new 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 = 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 === DISCARD) {\n // Query latest from server and notify merger\n const [[, builtOpName, builtQuery]] = buildGraphQLOperation(this.schema.namespaces[namespaceName], modelDefinition, 'GET');\n const newAuthToken = await 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 = createMutationInstanceFromModelOperation(namespace.relationships, modelDefinition, opType, retriedModelConstructor, retryWith, graphQLCondition, retiredMutationEventCtor, this.modelInstanceCreator, retiredMutationEvent.id);\n await this.storage.save(updatedMutation);\n throw new 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: getMutationErrorType(error),\n errorInfo: error.errorInfo,\n process: 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 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 ], 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[ID] = parsedData.id;\n }\n let mutationInput;\n if (operation === 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 (isModelFieldType(type)) {\n // except for belongs to relations - we need to replace them with the correct foreign key(s)\n if (isTargetNameAssociation(association) &&\n association.connectionType === 'BELONGS_TO') {\n const targetNames = 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 === 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 === 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 TransformerMutationType.CREATE:\n return OpType.INSERT;\n case TransformerMutationType.DELETE:\n return OpType.DELETE;\n case TransformerMutationType.UPDATE:\n return OpType.UPDATE;\n case 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}\nconst MAX_RETRY_DELAY_MS = 5 * 60 * 1000;\nconst originalJitteredBackoff = 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 */\nexport const 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};\nexport { MutationProcessor };\n"],"names":[],"mappings":";;;;;;;;;AAQA,MAAM,YAAY,GAAG,EAAE;AACvB,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,WAAW,CAAC;AAC7C,MAAM,iBAAiB,CAAC;AACxB,IAAI,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,oBAAoB,EAAE,cAAc,EAAE,aAAa,GAAG,EAAE,EAAE,gBAAgB,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE;AACjL,QAAQ,IAAI,CAAC,MAAM,GAAG,MAAM;AAC5B,QAAQ,IAAI,CAAC,OAAO,GAAG,OAAO;AAC9B,QAAQ,IAAI,CAAC,WAAW,GAAG,WAAW;AACtC,QAAQ,IAAI,CAAC,MAAM,GAAG,MAAM;AAC5B,QAAQ,IAAI,CAAC,oBAAoB,GAAG,oBAAoB;AACxD,QAAQ,IAAI,CAAC,cAAc,GAAG,cAAc;AAC5C,QAAQ,IAAI,CAAC,aAAa,GAAG,aAAa;AAC1C,QAAQ,IAAI,CAAC,gBAAgB,GAAG,gBAAgB;AAChD,QAAQ,IAAI,CAAC,YAAY,GAA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