Amplify JS API Documentation
    Preparing search index...
    Index

    Constructors

    Properties

    configure: (config?: DataStoreConfig) => void
    delete: {
        <T extends Readonly<Record<string, any>>>(
            modelConstructor: PersistentModelConstructor<T>,
            identifier: IdentifierFieldOrIdentifierObject<
                T,
                PersistentModelMetaData<T>,
            >,
        ): Promise<T[]>;
        <T extends Readonly<Record<string, any>>>(
            modelConstructor: PersistentModelConstructor<T>,
            condition: typeof PredicateAll | ModelPredicateExtender<T>,
        ): Promise<T[]>;
        <T extends Readonly<Record<string, any>>>(
            model: T,
            condition?: ModelPredicateExtender<T>,
        ): Promise<T>;
    }
    observe: {
        (): Observable<SubscriptionMessage<Readonly<Record<string, any>>>>;
        <T extends Readonly<Record<string, any>>>(
            modelConstructor: PersistentModelConstructor<T>,
            identifier: string,
        ): Observable<SubscriptionMessage<T>>;
        <T extends Readonly<Record<string, any>>>(
            modelConstructor: PersistentModelConstructor<T>,
            criteria?: typeof PredicateAll | RecursiveModelPredicateExtender<T>,
        ): Observable<SubscriptionMessage<T>>;
        <T extends Readonly<Record<string, any>>>(
            model: T,
        ): Observable<SubscriptionMessage<T>>;
    }
    observeQuery: <T extends Readonly<Record<string, any>>>(
        modelConstructor: PersistentModelConstructor<T>,
        criteria?: typeof PredicateAll | RecursiveModelPredicateExtender<T>,
        paginationProducer?: ObserveQueryOptions<T>,
    ) => Observable<DataStoreSnapshot<T>>
    query: {
        <T extends Readonly<Record<string, any>>>(
            modelConstructor: PersistentModelConstructor<T>,
            identifier: IdentifierFieldOrIdentifierObject<
                T,
                PersistentModelMetaData<T>,
            >,
        ): Promise<T | undefined>;
        <T extends Readonly<Record<string, any>>>(
            modelConstructor: PersistentModelConstructor<T>,
            criteria?: RecursiveModelPredicateExtender<T> | typeof PredicateAll | null,
            paginationProducer?: ProducerPaginationInput<T>,
        ): Promise<T[]>;
    }
    save: <T extends Readonly<Record<string, any>>>(
        model: T,
        condition?: ModelPredicateExtender<T>,
    ) => Promise<T>
    setConflictHandler: (config: DataStoreConfig) => ConflictHandler
    setErrorHandler: (config: DataStoreConfig) => ErrorHandler
    start: () => Promise<void>

    If not already done:

    1. Attaches and initializes storage.
    2. Loads the schema and records metadata.
    3. If this.amplifyConfig.aws_appsync_graphqlEndpoint contains a URL, attaches a sync engine, starts it, and subscribes.

    Methods

    • Clears all data from storage and removes all data, schema info, other initialization details, and then stops DataStore.

      That said, reinitialization is required after clearing. This can be done by explicitiliy calling start() or any method that implicitly starts DataStore, such as query(), save(), or delete().

      Returns Promise<void>

    • Returns string

    • Builds a function to capture BackgroundManagerNotOpenError's to produce friendlier, more instructive errors for customers.

      Parameters

      • operation: string

        The name of the operation (usually a Datastore method) the customer tried to call.

      Returns (err: Error) => never

    • Stops all DataStore sync activities.

      TODO: "Waits for graceful termination of running queries and terminates subscriptions."

      Parameters

      Returns Promise<void>