Factory
Last updated
Was this helpful?
Last updated
Was this helpful?
Factories are tasked with creating instances of their corresponding Entity and managing the internal cache for that Entity type. So, for example, the Security Token Factory is tasked with fetching necessary data to instance a Security Token, as well as fetching/refreshing the internal Security Token cache
▪ EntityType: ‹T›
▪ T: any
▪ U: any
Factory
↳
↳
↳
↳
↳
↳
↳
Create a factory that can generate an entity
Parameters:
Name
Type
eClass
context
entity class that this Factory is in charge of generating and caching
• cache: object
[ key: string]: EntityType | undefined
▸ create(uid
: string, params
: T): EntityType
Get an entity from the cache. Creates it if it isn't cached, updates it if it is
Parameters:
Name
Type
Description
uid
string
unique identifier for the entity
params
T
constructor data for the entity
Returns: EntityType
▸ fetch(uid
: string): Promise‹EntityType›
Get an entity from the cache. Fetches the necessary data to create it if it isn't cached, refreshes it if it is
Parameters:
Name
Type
Description
uid
string
unique identifier for the entity
Returns: Promise‹EntityType›
▸ refresh(uid
: string): Promise‹void›
Fetch the data for an entity and updates its properties
Parameters:
Name
Type
Description
uid
string
unique identifier for the entity
Returns: Promise‹void›
▸ update(uid
: string, params
: Partial‹T›): Promise‹void›
Update an entity's properties in place
Parameters:
Name
Type
Description
uid
string
unique identifier for the entity
params
Partial‹T›
properties that should be updated
Returns: Promise‹void›
+ new Factory(eClass
: ‹T, U›, context
: ):
Defined in
‹T, U›
Returns:
• Entity: ‹T, U›
Defined in
Defined in
• context:
Defined in
Defined in
Defined in
Defined in
Defined in