Git Product home page Git Product logo

jovo-plugin-class-handler's People

Contributors

m-ripper avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

victorstein

jovo-plugin-class-handler's Issues

Support for class instance instead of constructor

Currently, the plugin works well when I send a class to the JovoClassHandler.

JovoClassHandler: {
  handlers: [
    rootHandler
  ]
}

However, there's no support for class instances meaning that sending:

JovoClassHandler: {
  handlers: [
    new rootHandler(dependency1, dependency2)
  ]
}

As I would get the error [JovoClassHandler] reference of type object is not supported.. The code above is especially useful if I'm following the dependency injection pattern for any other dependency of my class (e.g. Loggers, Repositories, etc.).

My current implementation includes a DIContainer that takes care of resolving the dependencies for me and spits out the instance of the class with all its' dependencies resolved.

import { AppContainer } from './app.container'
import { IRoot } from './types/intents.types'
import { Types } from './types/types'

const appContainer = new AppContainer()
const rootHandler: IRoot = appContainer.get(Types.RootHandler)

const config = {
  logging: true,
  intentMap: {
    'AMAZON.StopIntent': 'END'
  },
  db: {
    FileDb: {
      pathToFile: './../../db/db.json'
    }
  },
  plugin: {
    JovoClassHandler: {
      handlers: [
        rootHandler
      ]
    }
  }
}

export = config

This should work if there's a way to send implementations of the current class and not just the class constructor. I was wondering if there are any plans to support this or if support for this is already in the lib and I'm just not setting things up correctly.

I appreciate any guidance that you can provide.

Issues using this

Hi!

I tried using this package but I couldn't get it to work.

My project uses the following Jovo versions:

Jovo CLI Version: 2.2.7

Jovo packages of current project:
  jovo-cms-i18next: 2.2.9
  jovo-core: 2.2.8
  jovo-db-filedb: 2.2.8
  jovo-framework: 2.2.11
  jovo-platform-alexa: 2.2.13
  jovo-platform-dialogflow: 2.2.9
  jovo-platform-googleassistant: 2.2.11
  jovo-plugin-class-handler: 1.2.0
  jovo-plugin-debugger: 2.2.9

I followed the README but when executing tsc the following two errors are triggered:

node_modules/jovo-platform-googleassistant/dist/src/index.d.ts:43:15 - error TS2430: Interface 'GoogleAction' incorrectly extends interface 'Jovo'.
  Types of property 'ask' are incompatible.

and

node_modules/jovo-platform-googleassistant/dist/src/core/GoogleAction.d.ts:13:5 - error TS2416: Property 'ask' in type 'GoogleAction' is not assignable to the same property in base type 'Jovo'.

Do you know whats going on?

Cheers, Michael

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.