The type of stores created by the AGSStoreFactory.

interface AGSStore {
    get(
        id: AllowedIdTypes,
        options?: GetOptions,
    ): Promise<undefined | Readonly<Record<string, any>>>;
    getIdentity(
        item: Partial<Readonly<Record<string, any>>>,
    ): undefined | AllowedIdTypes;
    getMetadata(): Promise<Metadata>;
    id: undefined | string;
    idProperty?: string;
    layer: any;
    load(): Promise<void>;
    on<Name extends "changed">(
        eventName: Name,
        callback: EventCallback<StoreEvents[Name]>,
    ): EventHandle;
    on(eventName: "*", callback: EventCallback<StoreChangedEvent>): EventHandle;
    on(
        eventName: string | string[],
        callback: EventCallback<unknown>,
    ): EventHandle;
    query(
        query?: ComplexQueryExpression,
        options?: QueryOptions,
    ): AsyncQueryResult<Readonly<Record<string, any>>>;
    target: undefined | string;
    url: undefined | string;
}

Hierarchy (View Summary)

Properties

id: undefined | string

ID of the store.

idProperty?: string

Name of the property used as ID. If not provided, the 'getIdentity' method must be declared.

layer: any

The layer used by this store.

target: undefined | string

Use url instead.

url: undefined | string

The URL of the layer queried by this store. Undefined if this store works on a client side layer.

Methods

  • Retrieves an item by its identifier.

    Parameters

    Returns Promise<undefined | Readonly<Record<string, any>>>

  • Returns an items‘s identity. This must always execute synchronously.

    Parameters

    • item: Partial<Readonly<Record<string, any>>>

      the item.

    Returns undefined | AllowedIdTypes

    the ID

  • Returns any available metadata about the store. This may include attribution, available fields, cache directives, history or version information.

    Returns Promise<Metadata>

  • Manually loads required metadata from backend services if needed.

    Some methods (such as query) may not be available before metadata have been loaded.

    Note: Metadata can also be loaded by calling AsyncStore.getMetadata.

    Returns Promise<void>

  • Register event listener for specific events.

    Type Parameters

    • Name extends "changed"

    Parameters

    Returns EventHandle

    a handle to unregister from the event

  • Register event listener for any event.

    Parameters

    • eventName: "*"

      must be "*" for this overload

    • callback: EventCallback<StoreChangedEvent>

      the event handler callback will be invoked when any event has been emitted

    Returns EventHandle

    a handle to unregister from the events

  • Register event listener for the events listed in eventName. Comma separated event names are possible, for example "eventA,eventB".

    Parameters

    • eventName: string | string[]

      the event name or list of names

    • callback: EventCallback<unknown>

      the event handler callback

    Returns EventHandle

    a handle to unregister from the event(s)