Wizzi Plugins

Wizzi is a generation framework implemented by plugins.

Kernel modules themself have a pluggable architecture. The wizzi-mtree package is a plugin that implements an api for building

ERROR to-docs unknown tree structures

from

ERROR to-docs unknown ITTF documents

. The wizzi-repo package is a plugin that implements an api for locating and retrieving ITTF documents.

A Wizzi Plugin exposes to the Wizzi factory the methods for retrieving its:

  • Wizzi Schema definitions
  • Wizzi Models and their factories
  • Wizzi Model transformers
  • Artifact generators

A plugin package must export the createFactoryPlugin method in its index.js file. The FactoryPlugin class instance returned to the caller must implement the wizzi-plugin.factoryPlugin API (see below).

ITTF pseudo-code implementation of the createFactoryPlugin method

                                
1 set module.exports
2 {
3 ...
4 @ createFactoryPlugin
5 function
6 { wizziPackage
7 { options
8 [ items
9 string pluginNameOrFile
10 string pluginsBaseFolder
11 default process.cwd()
12 callback
13 ...
14 return
15 _ callback
16 @ null
17 { factoryPlugin
18 api-ref wizzi-plugin.factoryPlugin

A Wizzi Plugin should have a standard folder structure so that modules can be located given the short public name of the required item.

Wizzi Plugin standard folder structure

                                
1 ...
2 {package-name}
3 package.json
4 ...
5 lib
6 artifacts
7 {schema-name}
8 {artifact-name}
9 gen
10 main.js
11 ...
12 {transformer-name}
13 trans
14 main.js
15 ...
16 ...
17 utils
18 ...
19 wizzi
20 models
21 {schema-name}-model.g.js
22 {schema-name}-factory.g.js
23 {schema-name}-schema.g.json
24 ...
25 index.js