{"version":3,"file":"sync.mjs","sources":["../../../../src/sync/processors/sync.ts"],"sourcesContent":["import { InternalAPI } from '@aws-amplify/api/internals';\nimport { Observable } from 'rxjs';\nimport { BackgroundProcessManager, Category, DataStoreAction, NonRetryableError, jitteredExponentialRetry, } from '@aws-amplify/core/internals/utils';\nimport { ConsoleLogger, Hub } from '@aws-amplify/core';\nimport { ProcessName, } from '../../types';\nimport { buildGraphQLOperation, getClientSideAuthError, getForbiddenError, getModelAuthModes, getTokenForCustomAuth, predicateToGraphQLFilter, } from '../utils';\nimport { ModelPredicateCreator } from '../../predicates';\nimport { getSyncErrorType } from './errorMaps';\nconst opResultDefaults = {\n    items: [],\n    nextToken: null,\n    startedAt: null,\n};\nconst logger = new ConsoleLogger('DataStore');\nclass SyncProcessor {\n    constructor(schema, syncPredicates, amplifyConfig = {}, authModeStrategy, errorHandler, amplifyContext) {\n        this.schema = schema;\n        this.syncPredicates = syncPredicates;\n        this.amplifyConfig = amplifyConfig;\n        this.authModeStrategy = authModeStrategy;\n        this.errorHandler = errorHandler;\n        this.amplifyContext = amplifyContext;\n        this.typeQuery = new WeakMap();\n        this.runningProcesses = new BackgroundProcessManager();\n        amplifyContext.InternalAPI = 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 [[, ...opNameQuery]] = buildGraphQLOperation(namespace, model, 'LIST');\n                this.typeQuery.set(model, opNameQuery);\n            });\n        });\n    }\n    graphqlFilterFromPredicate(model) {\n        if (!this.syncPredicates) {\n            return null;\n        }\n        const predicatesGroup = ModelPredicateCreator.getPredicates(this.syncPredicates.get(model), false);\n        if (!predicatesGroup) {\n            return null;\n        }\n        return predicateToGraphQLFilter(predicatesGroup);\n    }\n    async retrievePage(modelDefinition, lastSync, nextToken, limit = null, filter, onTerminate) {\n        const [opName, query] = this.typeQuery.get(modelDefinition);\n        const variables = {\n            limit,\n            nextToken,\n            lastSync,\n            filter,\n        };\n        const modelAuthModes = await getModelAuthModes({\n            authModeStrategy: this.authModeStrategy,\n            defaultAuthMode: this.amplifyConfig.aws_appsync_authenticationType,\n            modelName: modelDefinition.name,\n            schema: this.schema,\n        });\n        // sync only needs the READ auth mode(s)\n        const readAuthModes = modelAuthModes.READ;\n        let authModeAttempts = 0;\n        const authModeRetry = async () => {\n            if (!this.runningProcesses.isOpen) {\n                throw new Error('sync.retreievePage termination was requested. Exiting.');\n            }\n            try {\n                logger.debug(`Attempting sync with authMode: ${readAuthModes[authModeAttempts]}`);\n                const response = await this.jitteredRetry({\n                    query,\n                    variables,\n                    opName,\n                    modelDefinition,\n                    authMode: readAuthModes[authModeAttempts],\n                    onTerminate,\n                });\n                logger.debug(`Sync successful with authMode: ${readAuthModes[authModeAttempts]}`);\n                return response;\n            }\n            catch (error) {\n                authModeAttempts++;\n                if (authModeAttempts >= readAuthModes.length) {\n                    const authMode = readAuthModes[authModeAttempts - 1];\n                    logger.debug(`Sync failed with authMode: ${authMode}`, error);\n                    if (getClientSideAuthError(error) || getForbiddenError(error)) {\n                        // return empty list of data so DataStore will continue to sync other models\n                        logger.warn(`User is unauthorized to query ${opName} with auth mode ${authMode}. No data could be returned.`);\n                        return {\n                            data: {\n                                [opName]: opResultDefaults,\n                            },\n                        };\n                    }\n                    throw error;\n                }\n                logger.debug(`Sync failed with authMode: ${readAuthModes[authModeAttempts - 1]}. Retrying with authMode: ${readAuthModes[authModeAttempts]}`);\n                return authModeRetry();\n            }\n        };\n        const { data } = await authModeRetry();\n        const { [opName]: opResult } = data;\n        const { items, nextToken: newNextToken, startedAt } = opResult;\n        return {\n            nextToken: newNextToken,\n            startedAt,\n            items,\n        };\n    }\n    async jitteredRetry({ query, variables, opName, modelDefinition, authMode, onTerminate, }) {\n        return jitteredExponentialRetry(async (retriedQuery, retriedVariables) => {\n            try {\n                const authToken = await getTokenForCustomAuth(authMode, this.amplifyConfig);\n                const customUserAgentDetails = {\n                    category: Category.DataStore,\n                    action: DataStoreAction.GraphQl,\n                };\n                return await this.amplifyContext.InternalAPI.graphql({\n                    query: retriedQuery,\n                    variables: retriedVariables,\n                    authMode,\n                    authToken,\n                }, undefined, customUserAgentDetails);\n                // TODO: onTerminate.then(() => API.cancel(...))\n            }\n            catch (error) {\n                // Catch client-side (GraphQLAuthError) & 401/403 errors here so that we don't continue to retry\n                const clientOrForbiddenErrorMessage = getClientSideAuthError(error) || getForbiddenError(error);\n                if (clientOrForbiddenErrorMessage) {\n                    logger.error('Sync processor retry error:', error);\n                    throw new NonRetryableError(clientOrForbiddenErrorMessage);\n                }\n                const hasItems = Boolean(error?.data?.[opName]?.items);\n                const unauthorized = error?.errors &&\n                    error.errors.some(err => err.errorType === 'Unauthorized');\n                const otherErrors = error?.errors &&\n                    error.errors.filter(err => err.errorType !== 'Unauthorized');\n                const result = error;\n                if (hasItems) {\n                    result.data[opName].items = result.data[opName].items.filter(item => item !== null);\n                }\n                if (hasItems && otherErrors?.length) {\n                    await Promise.all(otherErrors.map(async (err) => {\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: err.message,\n                                model: modelDefinition.name,\n                                operation: opName,\n                                errorType: getSyncErrorType(err),\n                                process: ProcessName.sync,\n                                remoteModel: null,\n                                cause: err,\n                            });\n                        }\n                        catch (e) {\n                            logger.error('Sync error handler failed with:', e);\n                        }\n                    }));\n                    Hub.dispatch('datastore', {\n                        event: 'nonApplicableDataReceived',\n                        data: {\n                            errors: otherErrors,\n                            modelName: modelDefinition.name,\n                        },\n                    });\n                }\n                /**\n                 * Handle $util.unauthorized() in resolver request mapper, which responses with something\n                 * like this:\n                 *\n                 * ```\n                 * {\n                 * \tdata: { syncYourModel: null },\n                 * \terrors: [\n                 * \t\t{\n                 * \t\t\tpath: ['syncLegacyJSONComments'],\n                 * \t\t\tdata: null,\n                 * \t\t\terrorType: 'Unauthorized',\n                 * \t\t\terrorInfo: null,\n                 * \t\t\tlocations: [{ line: 2, column: 3, sourceName: null }],\n                 * \t\t\tmessage:\n                 * \t\t\t\t'Not Authorized to access syncYourModel on type Query',\n                 * \t\t\t},\n                 * \t\t],\n                 * \t}\n                 * ```\n                 *\n                 * The correct handling for this is to signal that we've encountered a non-retryable error,\n                 * since the server has responded with an auth error and *NO DATA* at this point.\n                 */\n                if (unauthorized) {\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: null,\n                        message: error.message,\n                        model: modelDefinition.name,\n                        operation: opName,\n                        errorType: getSyncErrorType(error.errors[0]),\n                        process: ProcessName.sync,\n                        remoteModel: null,\n                        cause: error,\n                    });\n                    throw new NonRetryableError(error);\n                }\n                if (result.data?.[opName]?.items?.length) {\n                    return result;\n                }\n                throw error;\n            }\n        }, [query, variables], undefined, onTerminate);\n    }\n    start(typesLastSync) {\n        const { maxRecordsToSync, syncPageSize } = this.amplifyConfig;\n        const parentPromises = new Map();\n        const observable = new Observable(observer => {\n            const sortedTypesLastSyncs = Object.values(this.schema.namespaces).reduce((map, namespace) => {\n                for (const modelName of Array.from(namespace.modelTopologicalOrdering.keys())) {\n                    const typeLastSync = typesLastSync.get(namespace.models[modelName]);\n                    map.set(namespace.models[modelName], typeLastSync);\n                }\n                return map;\n            }, new Map());\n            const allModelsReady = Array.from(sortedTypesLastSyncs.entries())\n                .filter(([{ syncable }]) => syncable)\n                .map(([modelDefinition, [namespace, lastSync]]) => this.runningProcesses.isOpen &&\n                this.runningProcesses.add(async (onTerminate) => {\n                    let done = false;\n                    let nextToken = null;\n                    let startedAt = null;\n                    let items = null;\n                    let recordsReceived = 0;\n                    const filter = this.graphqlFilterFromPredicate(modelDefinition);\n                    const parents = this.schema.namespaces[namespace].modelTopologicalOrdering.get(modelDefinition.name);\n                    const promises = parents.map(parent => parentPromises.get(`${namespace}_${parent}`));\n                    // eslint-disable-next-line no-async-promise-executor\n                    const promise = new Promise(async (resolve) => {\n                        await Promise.all(promises);\n                        do {\n                            /**\n                             * If `runningProcesses` is not open, it means that the sync processor has been\n                             * stopped (for example by calling `DataStore.clear()` upstream) and has not yet\n                             * finished terminating and/or waiting for its background processes to complete.\n                             */\n                            if (!this.runningProcesses.isOpen) {\n                                logger.debug(`Sync processor has been stopped, terminating sync for ${modelDefinition.name}`);\n                                resolve();\n                                return;\n                            }\n                            const limit = Math.min(maxRecordsToSync - recordsReceived, syncPageSize);\n                            /**\n                             * It's possible that `retrievePage` will fail.\n                             * If it does fail, continue merging the rest of the data,\n                             * and invoke the error handler for non-applicable data.\n                             */\n                            try {\n                                ({ items, nextToken, startedAt } = await this.retrievePage(modelDefinition, lastSync, nextToken, limit, filter, onTerminate));\n                            }\n                            catch (error) {\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: modelDefinition.name,\n                                        operation: null,\n                                        errorType: getSyncErrorType(error),\n                                        process: ProcessName.sync,\n                                        remoteModel: null,\n                                        cause: error,\n                                    });\n                                }\n                                catch (e) {\n                                    logger.error('Sync error handler failed with:', e);\n                                }\n                                /**\n                                 * If there's an error, this model fails, but the rest of the sync should\n                                 * continue. To facilitate this, we explicitly mark this model as `done`\n                                 * with no items and allow the loop to continue organically. This ensures\n                                 * all callbacks (subscription messages) happen as normal, so anything\n                                 * waiting on them knows the model is as done as it can be.\n                                 */\n                                done = true;\n                                items = [];\n                            }\n                            recordsReceived += items.length;\n                            done =\n                                nextToken === null || recordsReceived >= maxRecordsToSync;\n                            observer.next({\n                                namespace,\n                                modelDefinition,\n                                items,\n                                done,\n                                startedAt,\n                                isFullSync: !lastSync,\n                            });\n                        } while (!done);\n                        resolve();\n                    });\n                    parentPromises.set(`${namespace}_${modelDefinition.name}`, promise);\n                    await promise;\n                }, `adding model ${modelDefinition.name}`));\n            Promise.all(allModelsReady).then(() => {\n                observer.complete();\n            });\n        });\n        return observable;\n    }\n    async stop() {\n        logger.debug('stopping sync processor');\n        await this.runningProcesses.close();\n        await this.runningProcesses.open();\n        logger.debug('sync processor stopped');\n    }\n}\nexport { SyncProcessor };\n"],"names":[],"mappings":";;;;;;;;;AAQA,MAAM,gBAAgB,GAAG;AACzB,IAAI,KAAK,EAAE,EAAE;AACb,IAAI,SAAS,EAAE,IAAI;AACnB,IAAI,SAAS,EAAE,IAAI;AACnB,CAAC;AACD,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,WAAW,CAAC;AAC7C,MAAM,aAAa,CAAC;AACpB,IAAI,WAAW,CAAC,MAAM,EAAE,cAAc,EAAE,aAAa,GAAG,EAAE,EAAE,gBAAgB,EAAE,YAAY,EAAE,cAAc,EAAE;AAC5G,QAAQ,IAAI,CAAC,MAAM,GAAG,MAAM;AAC5B,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,GAAG,YAAY;AACxC,QAAQ,IAAI,CAAC,cAAc,GAAG,cAAc;AAC5C,QAAQ,IAAI,CAAC,SAAS,GAAG,IAAI,OAAO,EAAE;AACtC,QAAQ,IAAI,CAAC,gBAAgB,GAAG,IAAI,wBAAwB,EAAE;AAC9D,QAAQ,cAAc,CAAC,WAAW,GAAG,cAAc,CAAC,WAAW,IAAI,WAAW;AAC9E,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