Skip to content

Create @talxis/metadata NPM package #23

@hajekj

Description

@hajekj

The package should provide basic metadata operations with views, forms, appmodules, optionsets and entity metadata. The package should expose an IMetadataProvider interface to provide metadata based on its host (portal or Power Apps). In Portal, metadata calls need to be exposed under window.TALXIS.Portal.Metadata.* (should be 1:1, also replacing TALXIS.Portal.Utility.Metadata), where as the Power Apps will require Xrm.WebApi implementation for retrieval and caching (this is done on portal side).

Entity Metadata has some specifics and should return extended and mapped interface of getEntityMetadata, in order to extend it with custom attributes (for example MaxSizeInKB with file field).

The export interface should follow this interface:

interface IMetadataProvider
{
    entity: {
        get(entityName: string): Promise<IEntityMetadata>;
        getEntities(): Promise<ISimpleEntityDefinition[]>;
    },
    view: {
        get(id: string): Promise<IViewMetadata>;
        getQuickFindViewAsync(entityName: string): Promise<IViewMetadata>;
        getLookupViewAsync(entityName: string): Promise<IViewMetadata>;
        // This is to be discussed due to use of `talxis_userquery` entity and its caching etc.
        getViewNamesAndIds(entityName: string, options?: {
            viewIds?: string[],
            includeUserQueries?: boolean
        }): Promise<IViewIdName[]>;
    },
    form: {
        // TBD
    }
}

The implementation will be TalxisPortalMetadataProvider and PowerAppsMetadataProvider (eventually PowerPagesMetadataProvider and more) for clients to consume.

Also create TalxisDynamicMetadataProvider for dynamic attributes (for entity metadata only at the moment, the rest will throw exceptions).

The replacement for getEntityMetadata should map the attributes into a normal array instead of the Xrm one, so that we can use find and other methods regularly.

The PowerAppsMetadataProvider should use a cache stored in the most upper accessible window (eg. window.top) so that the cache is shared accross all consumers within the window.

Development: https://github.com/TALXIS/client-metadata

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions