m-ripper / jovo-plugin-class-handler Goto Github PK
View Code? Open in Web Editor NEWA Jovo plugin to use classes as handlers for the Jovo Framework
A Jovo plugin to use classes as handlers for the Jovo Framework
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
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.