0.5.0 • Published 1 year ago

@lautmaler/jovo-plugin-turninfo v0.5.0

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

TurnInfoLogPlugin

The TurnInfoLogPlugin is a Jovo plugin that performs data aggregation of request and state data, e.g. requestId, sessionData and much more.

Installation

Install the plugin in your Jovo project using npm:

$ npm install @lautmaler/jovo-plugin-turninfo

After successfully installing the plugin, you can add it to your app configuration:

const app = new App({
  // ...
  plugins: [
    // ...
    new TurnInfoLogPlugin({
      // ...
    }),
  ],
});

The plugin accepts the following configuration:

new TurnInfoLogPlugin({
  enabled: true,
  override(jovo: Jovo) {
    return {
      // ...
    };
  },
  skipTests: true,
});
  • enabled: Whether to enable the plugin in the current context or not
  • override: Function used to override properties or add new ones, e.g. platform-specific fields, see overriding properties
  • skipTests: Whether to enable/disable this plugin when running unit tests

Overriding properties

It is common to log platform-specific properties when working with the TurnInfoLogPlugin, since it only logs standard, globally accessible properties by default. To work around this, you can use the override() function in the configuration to override and add properties to your log. Simply return an object of key-value pairs, that will later on be merged with the default logging object.

new TurnInfoLogPlugin({
  override(jovo: Jovo) {
    return {
      requestId: jovo.$request.id,
      intent: jovo.$input.nlu.intent,
      // ...
    }
  }
})

You can even type the parameter to match your platform, e.g. using CorePlatform:

new TurnInfoLogPlugin({
  override(core: Core) {
    return {
      timeZone: core.$request.timeZone,
      // ...
    }
  }
})

Just keep in mind that if you're using multiple platforms, you'll have to disambiguate what platform you're using in your override() function.

0.5.0

1 year ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.3

2 years ago

0.1.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago