Function addFailedSyncOperation

  • Adds a failed sync operation with typed data.

    Parameters

    Returns FailedOperation

    The created failed operation.

    export function addFailedSyncOperation(
    data: FailedSyncOperationData,
    ): FailedOperation {
    const {
    mediaId,
    title,
    status,
    progress,
    score,
    private: isPrivate,
    coverImage,
    error,
    errorCode,
    previousValues,
    syncMetadata,
    } = data;
    return addFailedOperation({
    type: FailedOperationType.SYNC_UPDATE,
    error,
    errorCode,
    payload: {
    mediaId,
    title,
    status,
    progress,
    score,
    private: isPrivate ?? false,
    coverImage,
    previousValues: previousValues ?? null,
    syncMetadata: syncMetadata ?? null,
    },
    context: {
    failedAt: new Date().toISOString(),
    },
    });
    }