ObjRefMap
Home > @gooddata/sdk-ui-dashboard > ObjRefMap
ObjRefMap class
This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Utility class that assists with type-agnostic mapping of metadata objects by ObjRef.
Problem =======
The challenges with ObjRef's start in context of backend that supports both uri and id ref (e.g. bear) and the client.
Backend according to contract creates one type of ref - uri ref - so that is fine. However when instances of ref
are created by the client code and are passed in through the public API (as is the case with the dashboard component) - problems start.
For clients it is often more convenient to use ID refs.. because they are transferable across workspaces and because they appear in the catalog export.
Doing strict ref-to-ref matching between user input and the data stored in state will result in no matches because the types of ref's do not match.
---
This class addresses the problem by having the get
method check the type of ObjRef first and then perform lookups into either id to item or uri to item mapping.
Signature:
export declare class ObjRefMap<T>
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)(config) | (ALPHA) Constructs a new instance of the ObjRefMap class |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
[Symbol.toStringTag] | readonly | string | (ALPHA) |
fromItems | (items: ReadonlyArray<T>) => ObjRefMap<T> | (ALPHA) | |
size | number | (ALPHA) |