Skip to main content
Version: 0.5.0

Working with the Standard Library

Jayvee ships with its own standard library on board, including the most often used value types, transformations, and so on. The standard library itself is written in .jv files here.

Standard Library Contents

The following elements are part of the standard library:

Builtin Contents

The implementations of built-in contents are not expressed in Jayvee itself but on the TypeScript layer. Examples:

  • Builtin value types: These value types are the base for defining user-defined value types in Jayvee, e.g., text, integer, decimal, boolean.
  • Builtin io types: These io types are used to describe in inputs and outputs of block types, e.g., Sheet, File.
  • Builtin block types: These block types are the very basic building blocks in Jayvee, e.g., HttpExtractor, SqliteLoader.
  • Builtin constraint types: These constraint types are constraints with custom logic, e.g., LengthConstraint, RegexConstraint.

Builtin definitions are usually generated and added to the standard library from the internal representations of the concepts.

User-defined Contents

The implementations of user-defined contents are expressed in Jayvee itself. Examples:

  • User-defined value types: These value types are based on built-in or other user-defined value types. Their definition is expressed natively in Jayvee, e.g., Percent.
  • User-defined block types: These block types are based on built-in or other user-defined block types. Their definition is expressed natively in Jayvee.

We use jv files to add user-defined value types to the standard library (see below).

Extending the Standard Library

Just add jv files to the directory here. It is crawled hierarchically, meaning that you can also organize files in folders.

Implementation

1. Code generation

We use code generation to transform these .jv files into TypeScript files that the language server can used. The generation script is run via npm run generate next to the AST generation.

2. Builtin libraries

The solution we chose to implement the standard library mechanism is close to the built-in library tutorial by Langium. The following components are of interest: