interface DataProviderService {
    DataProviderEngine: typeof "shared/models/data-provider-engine.model".DataProviderEngine;
    decorators: {
        doNotNotify: {
            (method: Function & {
                doNotNotify?: boolean;
            }): void;
            (target: object, member: string): void;
        };
        ignore: {
            (method: Function & {
                isIgnored?: boolean;
            }): void;
            (target: object, member: string): void;
        };
    };
    get: (<DataProviderName>(providerName: DataProviderName) => Promise<DataProviders[DataProviderName] | undefined>);
    hasKnown: ((providerName: string) => boolean);
    registerEngine: (<DataProviderName>(providerName: DataProviderName, dataProviderEngine: "shared/models/data-provider-engine.model".default<DataProviderTypes[DataProviderName]>, dataProviderType?: string, dataProviderAttributes?: {
        [property: string]: unknown;
    }) => Promise<DisposableDataProviders[DataProviderName]>);
}

Properties

Abstract class that provides a placeholder notifyUpdate for data provider engine classes. If a data provider engine class extends this class, it doesn't have to specify its own notifyUpdate function in order to use notifyUpdate.

IDataProviderEngine for more information on extending this class.

decorators: {
    doNotNotify: {
        (method: Function & {
            doNotNotify?: boolean;
        }): void;
        (target: object, member: string): void;
    };
    ignore: {
        (method: Function & {
            isIgnored?: boolean;
        }): void;
        (target: object, member: string): void;
    };
}

A collection of decorators to be used with the data provider service

Type declaration

  • doNotNotify: {
        (method: Function & {
            doNotNotify?: boolean;
        }): void;
        (target: object, member: string): void;
    }

    Decorator function that marks a data provider engine set<data_type> method not to automatically emit an update and notify subscribers of a change to the data. papi will still consider the set<data_type> method to be a data type method, but it will not layer over it to emit updates.

    class MyDataProviderEngine {
    papi.dataProviders.decorators.doNotNotify
    async setVerse() {}
    }

    WARNING: Do not copy and paste this example. The @ symbol does not render correctly in JSDoc code blocks, so a different unicode character was used. Please use a normal @ when using a decorator.

    OR

    const myDataProviderEngine = {
    async setVerse() {},
    };
    papi.dataProviders.decorators.ignore(dataProviderEngine.setVerse);

    The method not to layer over to send an automatic update

      • (method): void
      • Decorator function that marks a data provider engine set<data_type> method not to automatically emit an update and notify subscribers of a change to the data. papi will still consider the set<data_type> method to be a data type method, but it will not layer over it to emit updates.

        Parameters

        • method: Function & {
              doNotNotify?: boolean;
          }

          The method not to layer over to send an automatic update

        Returns void

        class MyDataProviderEngine {
        papi.dataProviders.decorators.doNotNotify
        async setVerse() {}
        }

        WARNING: Do not copy and paste this example. The @ symbol does not render correctly in JSDoc code blocks, so a different unicode character was used. Please use a normal @ when using a decorator.

        OR

        const myDataProviderEngine = {
        async setVerse() {},
        };
        papi.dataProviders.decorators.ignore(dataProviderEngine.setVerse);
      • (target, member): void
      • Decorator function that marks a data provider engine set<data_type> method not to automatically emit an update and notify subscribers of a change to the data. papi will still consider the set<data_type> method to be a data type method, but it will not layer over it to emit updates.

        Parameters

        • target: object

          The class that has the method not to layer over to send an automatic update

        • member: string

          The name of the method not to layer over to send an automatic update

          Note: this is the signature that provides the actual decorator functionality. However, since users will not be using this signature, the example usage is provided in the signature above.

        Returns void

  • ignore: {
        (method: Function & {
            isIgnored?: boolean;
        }): void;
        (target: object, member: string): void;
    }

    Decorator function that marks a data provider engine set___ or get___ method to be ignored. papi will not layer over these methods or consider them to be data type methods

    class MyDataProviderEngine {
    papi.dataProviders.decorators.ignore
    async getInternal() {}
    }

    WARNING: Do not copy and paste this example. The @ symbol does not render correctly in JSDoc code blocks, so a different unicode character was used. Please use a normal @ when using a decorator.

    OR

    const myDataProviderEngine = {
    async getInternal() {},
    };
    papi.dataProviders.decorators.ignore(dataProviderEngine.getInternal);

    The method to ignore

      • (method): void
      • Decorator function that marks a data provider engine set___ or get___ method to be ignored. papi will not layer over these methods or consider them to be data type methods

        Parameters

        • method: Function & {
              isIgnored?: boolean;
          }

          The method to ignore

        Returns void

        class MyDataProviderEngine {
        papi.dataProviders.decorators.ignore
        async getInternal() {}
        }

        WARNING: Do not copy and paste this example. The @ symbol does not render correctly in JSDoc code blocks, so a different unicode character was used. Please use a normal @ when using a decorator.

        OR

        const myDataProviderEngine = {
        async getInternal() {},
        };
        papi.dataProviders.decorators.ignore(dataProviderEngine.getInternal);
      • (target, member): void
      • Decorator function that marks a data provider engine set___ or get___ method to be ignored. papi will not layer over these methods or consider them to be data type methods

        Parameters

        • target: object

          The class that has the method to ignore

        • member: string

          The name of the method to ignore

          Note: this is the signature that provides the actual decorator functionality. However, since users will not be using this signature, the example usage is provided in the signature above.

        Returns void

class MyDataProviderEngine {
papi.dataProviders.decorators.ignore
async getInternal() {}
}

WARNING: Do not copy and paste this example. The @ symbol does not render correctly in JSDoc code blocks, so a different unicode character was used. Please use a normal @ when using a decorator.

get: (<DataProviderName>(providerName: DataProviderName) => Promise<DataProviders[DataProviderName] | undefined>)

Get a data provider that has previously been set up

Type declaration

    • <DataProviderName>(providerName): Promise<DataProviders[DataProviderName] | undefined>
    • Get a data provider that has previously been set up

      Type Parameters

      • DataProviderName extends keyof DataProviders

      Parameters

      Returns Promise<DataProviders[DataProviderName] | undefined>

      The data provider with the given name if one exists, undefined otherwise

Name of the desired data provider

The data provider with the given name if one exists, undefined otherwise

hasKnown: ((providerName: string) => boolean)

Indicate if we are aware of an existing data provider with the given name. If a data provider with the given name is somewhere else on the network, this function won't tell you about it unless something else in the existing process is subscribed to it.

Type declaration

    • (providerName): boolean
    • Indicate if we are aware of an existing data provider with the given name. If a data provider with the given name is somewhere else on the network, this function won't tell you about it unless something else in the existing process is subscribed to it.

      Parameters

      • providerName: string

      Returns boolean

registerEngine: (<DataProviderName>(providerName: DataProviderName, dataProviderEngine: "shared/models/data-provider-engine.model".default<DataProviderTypes[DataProviderName]>, dataProviderType?: string, dataProviderAttributes?: {
    [property: string]: unknown;
}) => Promise<DisposableDataProviders[DataProviderName]>)

Creates a data provider to be shared on the network layering over the provided data provider engine.

Type declaration

    • <DataProviderName>(providerName, dataProviderEngine, dataProviderType?, dataProviderAttributes?): Promise<DisposableDataProviders[DataProviderName]>
    • Creates a data provider to be shared on the network layering over the provided data provider engine.

      Type Parameters

      • DataProviderName extends keyof DataProviders

      Parameters

      • providerName: DataProviderName

        Name this data provider should be called on the network

      • dataProviderEngine: "shared/models/data-provider-engine.model".default<DataProviderTypes[DataProviderName]>

        The object to layer over with a new data provider object

      • OptionaldataProviderType: string

        String to send in a network event to clarify what type of data provider is represented by this engine. For generic data providers, the default value of dataProvider can be used. For data provider types that have multiple instances (e.g., project data providers), a unique type name should be used to distinguish from generic data providers.

      • OptionaldataProviderAttributes: {
            [property: string]: unknown;
        }

        Optional object that will be sent in a network event to provide additional metadata about the data provider represented by this engine.

        WARNING: registering a dataProviderEngine mutates the provided object. Its notifyUpdate and set methods are layered over to facilitate data provider subscriptions.

        • [property: string]: unknown

      Returns Promise<DisposableDataProviders[DataProviderName]>

      The data provider including control over disposing of it. Note that this data provider is a new object distinct from the data provider engine passed in.

Name this data provider should be called on the network

The object to layer over with a new data provider object

String to send in a network event to clarify what type of data provider is represented by this engine. For generic data providers, the default value of dataProvider can be used. For data provider types that have multiple instances (e.g., project data providers), a unique type name should be used to distinguish from generic data providers.

Optional object that will be sent in a network event to provide additional metadata about the data provider represented by this engine.

WARNING: registering a dataProviderEngine mutates the provided object. Its notifyUpdate and set methods are layered over to facilitate data provider subscriptions.

The data provider including control over disposing of it. Note that this data provider is a new object distinct from the data provider engine passed in.