Class: serviceproxymetadata = new ServiceProxyMetadata()

Metadata for a service proxy

Properties
Name Type Default Value Flags Description
dataSource juggler.DataSource exported optional

Metadata for a service proxy

dataSourceName undefined | string exported optional

Metadata for a service proxy

decorator string "@serviceProxy" exported

Metadata for a service proxy

constructor(dataSource: string | DataSource) : ServiceProxyMetadata

Parameters
Name Type Default Value Flags Description
dataSource string | DataSource

Metadata for a service proxy

const SERVICE_PROXY_KEY = MetadataAccessor.create< string, ServiceProxyDecorator >('service.proxy')

Function: serviceProxy

serviceProxy(dataSource: string | DataSource) : (Anonymous function)

Parameters
Name Type Default Value Flags Description
dataSource string | DataSource

Namespace: juggler

Interface: GenericService

A generic service interface with any number of methods that return a promise

Function: getService

getService(ds: DataSource) : Promise<T>

Get a service proxy from a LoopBack 3.x data source backed by service-oriented connectors such as rest, soap, and grpc.

Parameters
Name Type Default Value Flags Description
ds DataSource

A legacy data source

Class: servicemixindoc = new ServiceMixinDoc()

A dummy class created to generate the tsdoc for the members in service mixin. Please don't use it.

The members are implemented in function ServiceMixin

constructor(args: any[]) : ServiceMixinDoc

Parameters
Name Type Default Value Flags Description
args any[] rest

A dummy class created to generate the tsdoc for the members in service mixin. Please don't use it.

The members are implemented in function ServiceMixin

component(component: Class<__type>) : void

Add a component to this application. Also mounts all the components services.

Parameters
Name Type Default Value Flags Description
component Class<__type>

The component to add.


export class ProductComponent {
  controllers = [ProductController];
  repositories = [ProductRepo, UserRepo];
  providers = {
    [AUTHENTICATION_STRATEGY]: AuthStrategy,
    [AUTHORIZATION_ROLE]: Role,
  };
};

app.component(ProductComponent);

mountComponentServices(component: Class<__type>) : void

Get an instance of a component and mount all it's services. This function is intended to be used internally by component()

Parameters
Name Type Default Value Flags Description
component Class<__type>

The component to mount services of

serviceProvider(provider: Class<Provider<S>>) : void

Add a service to this application.

Parameters
Name Type Default Value Flags Description
provider Class<Provider<S>>

The service provider to register.

export interface GeocoderService {
  geocode(address: string): Promise<GeoPoint[]>;
}

export class GeocoderServiceProvider implements Provider<GeocoderService> { constructor( @inject('datasources.geocoder') protected dataSource: juggler.DataSource = new GeocoderDataSource(), ) {}

value(): Promise<GeocoderService> { return getService(this.dataSource); } }

app.serviceProvider(GeocoderServiceProvider);

Interface: ApplicationWithServices

Interface for an Application mixed in with ServiceMixin

Properties
Name Type Default Value Flags Description
options ApplicationConfig exported public

Interface for an Application mixed in with ServiceMixin

component(component: Class<__type>) : void

Parameters
Name Type Default Value Flags Description
component Class<__type>

Interface for an Application mixed in with ServiceMixin

mountComponentServices(component: Class<__type>) : void

Parameters
Name Type Default Value Flags Description
component Class<__type>

Interface for an Application mixed in with ServiceMixin

serviceProvider(provider: Class<Provider<S>>) : void

Parameters
Name Type Default Value Flags Description
provider Class<Provider<S>>

Interface for an Application mixed in with ServiceMixin

Interface: Class

Interface for classes with new operator.

constructor(args: any[]) : T

Parameters
Name Type Default Value Flags Description
args any[] rest

Interface for classes with new operator.

Function: ServiceMixin

ServiceMixin(superClass: T) :

A mixin class for Application that creates a .serviceProvider() function to register a service automatically. Also overrides component function to allow it to register repositories automatically.

class MyApplication extends ServiceMixin(Application) {}

Please note: the members in the mixin function are documented in a dummy class called ServiceMixinDoc

Parameters
Name Type Default Value Flags Description
superClass T