API
#
1. Annotation/Decorator/** * Decorate cell with meta data. */@Cell(cellMeta: CellMeta)
(For detail information about Cell decorator, you can read here).
/** * Mark class as service handler. */@Service(serviceMeta: ServiceMeta);
(For detail information about Service decorator, you can read here).
#
2. Virtual network-related APIscreateNetWork(networkConfig: NetworkConfig): Promise<void>;
getResolvedCell(cellName: string): ResolvedCell | undefined;
#
3. Service-related APIs/** * @see https://cellularjs.com/docs/foundation/net/service/#41-service-proxy */addServiceProxies(service, proxies: ClassType<ServiceHandler>[]): void;
/** * @see https://cellularjs.com/docs/foundation/net/service#42-service-providers */addServiceProviders(service, providers: GenericProvider[]): void;
#
4. Transporter-related APIs/** * Send Internal Request and get Internal Response. */send(irq: IRQ, requestOpts?: RequestOptions): Promise<IRS>;
/** * This variable allow you to tweak request data through request life cycle * @see https://cellularjs.com/docs/foundation/net/transporter/#4-request-lifecyle */const transportListener: TransportListener;
#
5. Types#
5.1. NetworkConfigNetworkConfig = CellConfig[];
#
5.2. CellConfigName | Type | Required | Default | Description |
---|---|---|---|---|
name | string | True | Cell name or cell type, it must be unique. | |
space | string | False | Space is where your service placed, read more.... | |
driver | { new() }; { [driverName: string]: { new() } } | True | Driver is a thing that handle request, read more.... | |
customData | { [key: string]: any } | False | In additional to reserved property defined by CellConfig , you can add more custom data with this property. You can get this data via getResolvedCell . |
#
5.3. CellMetaName | Type | Required | Default | Description |
---|---|---|---|---|
providers | (GenericProvider, string)[] | False | Declare providers for resolving dependency later. For more information, have a look at DI API. | |
imports | ImportableCnf[] | False | Import module into current cell. | |
listen | string, { [key: string]: ServiceHandler } | True | Register services into cell, read more.... |
#
5.4. ServiceMetaName | Type | Required | Default | Description |
---|---|---|---|---|
scope | 'publish', 'space', 'private' | False | 'space' | Service handler access scope: - 'publish': accessible from anywhere. - 'space': limit access to the cell with the same space only. - 'private': limit access to the cell only. |
#
5.5. RequestOptionsName | Type | Required | Default | Description |
---|---|---|---|---|
driver | string | False | 'local' | Driver to handle this request, read more.... |
throwOriginalError | boolean | False | undefined ~ false | By default, all exception will be converted into IRS(error response). You can use this option for quick debugging, read more.... |