Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

How-to: Make a StreamPipes model available in TypeScript

Automatic Generation

  • Run the script create-client-model.sh. It will automatically create and copy the new model files.
  • The new files can be found in:
    • ui/projects/streampipes/platform-services/src/lib/model/gen/
      • streampipes-model.ts
      • streampipes-mode-client.ts

Manuel Steps

  • Core models that are made available in the UI are either declared in the package streampipes-model or streampipes-model-client
  • If any core model class is changed or a new model class has been created, the following steps should be done to generate the corresponding typescript model:

    1. Go to the corresponding module (e.g., streampipes-model)
    2. Annotate new models with @TsModel so that it will be considered by the typescript generator. For more complex models (e.g., using inheritance), have a look at some existing examples (e.g., StaticProperty), where some additional Jackson annotations might be required.
    3. Execute mvn typescript-generator:generate
    4. This creates a new single class containing all models from the module. Copy that file to the UI folder (ui/projects/streampipes/platform-services/src/applib/core-model/gen). There should be two files present (for streampipes-model and streampipes-model-client), overwrite the existing file. 
    5. Paste the Apache Header to into the generated file.
    6. That's it! Your model should now be available to the UI.

...

Code Block
languagejs
titleCreating a new object in the UI
let freeTextStaticProperty: FreeTextStaticProperty = new FreeTextStaticProperty();
freeTextStaticProperty[@class] = "org.apache.streampipes.model.staticproperty.FreeTextStaticProperty";

...