Skip to content

Migration: v3

Jake edited this page Jul 20, 2018 · 1 revision

πŸŽ‰ Welcome to Leverage v3.0.0! πŸŽ‰

This version contains breaking API changes as well as a few other improvements. Here is a comprehensive guide on what to change in order to upgrade. If anything is missing, please file an issue.

Interface Simplification

The TypeScript interface definitions for units have been renamed and simplified, here is a mapping from the old names to the new ones:

  • LeverageUnit -> Unit
  • LeverageConfig -> Config
  • LeverageInstance -> Instance
  • LeverageConfigInstanceWithDependencies -> ConfigInstance
  • PluginInstanceWithDependencies -> PluginInstance
  • ServiceInstanceWithDependencies -> ServiceInstance
  • ComponentInstanceWithDependencies -> ComponentInstance
  • MiddlewareInstanceWithDependencies -> MiddlewareInstance
  • PluginConfigWithDependencies -> PluginConfigInstance
  • ServiceConfigWithDependencies -> ServiceConfigInstance
  • ComponentConfigWithDependencies -> ComponentConfigInstance
  • MiddlewareConfigWithDependencies -> MiddlewareConfigInstance

Unit Configs Are Optional!

Finally! You no longer have to supply a config property on your units!

Example

v2

{
  config: {
    type: '...'
  }
}

v3

{
  type: '...'
}

Component Type

The component type has been moved from component.config.type to component.type.

Example

v2

{
  config: {
    type: '...'
  }
}

v3

{
  type: '...'
}

Plugin Type

The plugin type has been moved from plugin.config.type to plugin.type.

Example

v2

{
  config: {
    type: '...'
  }
}

v3

{
  type: '...'
}

Middleware Type

The middleware type has been moved from middleware.config.type to middleware.type.

Example

v2

{
  config: {
    type: '...'
  }
}

v3

{
  type: '...'
}

Service Name

The service name has been moved from service.config.name to service.name.

Example

v2

{
  config: {
    name: '...'
  }
}

v3

{
  name: '...'
}

Decorators

The decorator pattern has been removed and replaced with a class that can be instantiated or extended for each unit.

Example (this is the same for all units)

v2

import { Component } from '@leverage/core';

@Component
class C {}

v3

import { Component } from '@leverage/core';

class C extends Component {}
Clone this wiki locally