Interface IProjectDataProviderEngineFactory<SupportedProjectInterfaces>

A factory object registered with the papi that creates a Project Data Provider Engine for each project with the factory's specified projectInterfaces when the papi requests. Used by the papi to create IProjectDataProviderEngines for a specific project and projectInterface when someone gets a project data provider with papi.projectDataProviders.get. When this factory object is registered with papi.projectDataProviders.registerProjectDataProviderEngineFactory, the papi creates a ProjectDataProviderFactory that layers over this engine to create IProjectDataProviders.

Project Data Provider Engine Factories create Project Data Provider Engines for specific projectInterfaces. For each project id available on a Project Data Provider Factory, the factory that supports that project with some set of projectInterfaces creates a new instance of a PDP with the supported projectInterfaces.

A PDP Factory can provide its own unique project ids (Base PDP Factory) or layer over other PDPFs and provide additional projectInterfaces on those projects (Layering PDP Factory). Base PDP Factories must create PDPs that support the platform.base projectInterface. See IBaseProjectDataProvider and ProjectDataProviderInterfaces for more information.

WARNING: For Layering PDPFs, getAvailableProjects has very specific requirements that absolutely must be met. Please see IProjectDataProviderEngineFactory.getAvailableProjects for more information on the requirements.

To make creating a Layering PDPF easier, you can extend LayeringProjectDataProviderEngineFactory, which automatically fulfills the special requirements for Layering PDPFs. We highly recommend using it.

interface IProjectDataProviderEngineFactory<
    SupportedProjectInterfaces extends ProjectInterfaces[],
> {
    createProjectDataProviderEngine(
        projectId: string,
    ): Promise<IProjectDataProviderEngine<SupportedProjectInterfaces>>;
    getAvailableProjects(
        layeringFilters?: ProjectMetadataFilterOptions,
    ): Promise<ProjectMetadataWithoutFactoryInfo[]>;
}

Type Parameters

Methods

  • Get metadata about all projects that can be served by PDPs created by this PDP factory.

    If this is a Base PDP Factory, this method should return this PDP Factory's own unique project IDs.

    If this is a Layering PDP Factory, this method should call papi.projectLookup.getMetadataForAllProjects with some set of metadata filters in order to determine which projects it can layer over. The set of metadata filters relevant to this PDP Factory absolutely must be merged with the layeringFilters provided using papi.projectLookup.mergeMetadataFilters, or it will get into an infinite loop of calling other layering PDPs.

    WARNING: If this is a Layering PDP Factory, it absolutely must merge its metadata filters with layeringFilters provided using papi.projectLookup.mergeMetadataFilters! Otherwise you will cause an infinite loop that will break things.

    Parameters

    • OptionallayeringFilters: ProjectMetadataFilterOptions

      If applicable, filters used to prevent this Layering PDP Factory from entering an infinite loop with another Layering PDP Factory. You absolutely must merge these filters with your own filters using papi.projectLookup.mergeMetadataFilters when calling papi.projectLookup.getMetadataForAllProjects inside this method. If you are not calling getMetadataForAllProjects inside this method (likely if this is a Base PDPF), you can safely ignore this parameter.

    Returns Promise<ProjectMetadataWithoutFactoryInfo[]>