Factory
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
Type parameters
▪ EntityType: Entity‹T›
â–ª T: any
â–ª U: any
Hierarchy
Index
Constructors
Properties
Methods
Constructors
constructor
+ new Factory(eClass
: EntityClass‹T, U›, context
: Context): Factory
Defined in src/entities/factories/Factory.ts:42
Create a factory that can generate an entity
Parameters:
Returns: Factory
Properties
Entity
• Entity: EntityClass‹T, U›
Defined in src/entities/factories/Factory.ts:37
entity class that this Factory is in charge of generating and caching
cache
• cache: object
Defined in src/entities/factories/Factory.ts:28
Type declaration:
[ key: string]: EntityType | undefined
context
• context: Context
Defined in src/entities/factories/Factory.ts:32
Methods
create
â–¸ create(uid
: string, params
: T): EntityType
Defined in src/entities/factories/Factory.ts:87
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
â–¸ fetch(uid
: string): Promise‹EntityType›
Defined in src/entities/factories/Factory.ts:57
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
â–¸ refresh(uid
: string): Promise‹void›
Defined in src/entities/factories/Factory.ts:108
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
â–¸ update(uid
: string, params
: Partial‹T›): Promise‹void›
Defined in src/entities/factories/Factory.ts:126
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›
Last updated
Was this helpful?