FlyzeApiStoreFacade Documentation
@flyze/lib-data-store 3.0.0-alpha.55· latestThis document provides an overview of the FlyzeApiStoreFacade class, which serves as the main entry point for interacting with the Flyze API Store using the facade pattern. The facade simplifies access to various store instances and their associated facades.
Overview
Section titled “Overview”The Function can be spllit into three main functionalities:
- Managing Multiple Store Instances: The facade allows for the management of multiple store instances, each identified by a unique instance ID.
- Accessing Application Facades: It provides methods to access application facades for different instances, enabling interaction with the store’s data and operations.
- Managing Individual Instance Facades: The facade also supports the management of individual instance facades, allowing for the addition and retrieval of specific facades associated with each instance.
Managing Multiple Store Instances
Section titled “Managing Multiple Store Instances” const facade: FlyzeApiStoreFacade = ...;
// add a new instance facade.addApplicationInstance({ instanceId: 'instance1', config: {...} });
// remove an instance facade.removeApplicationInstance('instance1');
// list available instances const instances = facade.getAvailableInstances();Accessing Application Facades
Section titled “Accessing Application Facades” const facade: FlyzeApiStoreFacade = ...;
// get application facade for a specific instance const appFacade = facade.getApplicationFacade('instance1');
// select application facade as observable const appFacade$ = facade.selectApplicationFacade$('instance1');
// set the current application instance ID facade.setApplicationInstanceId('instance1');
// access the current application instance ID const currentInstanceId = facade.getApplicationInstanceId(); // currentInstanceId === 'instance1'
// access the current application facade const currentAppFacade = facade.getApplicationFacade();
// access the current application facade as observable const currentAppFacade$ = facade.selectApplicationFacade$();Managing Individual Instance Facades
Section titled “Managing Individual Instance Facades” const facade: FlyzeApiStoreFacade = ...;
// create a custom instance facade for specific tags const customFacade = facade.createInstanceFacade('instance1', {tagId: '000-000'});
// add an instance facade facade.addInstanceFacade({ instanceId: 'instance1', facadeKey: 'userFacade', facade: customFacade });
// get an instance facade const userFacade = facade.getInstanceFacade('instance1', 'userFacade');
// remove an instance facade facade.removeInstanceFacade('instance1', 'userFacade');
// create an async instance facade for multiple custom tags const customFacadeByTagCustomIds = await facade.createInstanceFacadeAsync('instance1', {tagCustomId: ['my-tag-01' , 'my-tag-02'], selectedTagExclusive: true});