@bpinternal/verel
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

VeReL

VeReL exposes the Rust library VRL to JavaScript with WebAssembly.

Installation

npm install @bpinternal/verel # for npm
yarn add @bpinternal/verel # for yarn
pnpm add @bpinternal/verel # for pnpm

Usage

import * as vrl from '@bpinternal/verel'

const program = `
# Remove some fields
del(.foo)

# Add a timestamp
.timestamp = now()

# Parse HTTP status code into local variable
http_status_code = parse_int!(.http_status)
del(.http_status)

# Add status
if http_status_code >= 200 && http_status_code <= 299 {
    .status = "success"
} else {
    .status = "error"
}
`

const inputEvent = {
  message: 'Hello VRL',
  foo: 'delete me',
  http_status: '200'
}

const { errors } = vrl.check(program)
if (errors.length) {
  console.error(vrl.formatDiagnostic(errors[0]))
  process.exit(1)
}

const { event: outputEvent } = vrl.execute(program, inputEvent)
console.log(outputEvent)

Disclaimer ⚠️

This package is published under the @bpinternal organization. All packages of this organization are meant to be used by the Botpress team internally and are not meant for our community. However, these packages were still left intentionally public for an important reason : We Love Open-Source. Therefore, if you wish to install this package feel absolutly free to do it. We strongly recomand that you tag your versions properly.

The Botpress Engineering team.

Readme

Keywords

none

Package Sidebar

Install

npm i @bpinternal/verel

Weekly Downloads

564

Version

0.1.1

License

ISC

Unpacked Size

23.9 MB

Total Files

6

Last publish

Collaborators

  • davidvitora
  • slvnperron
  • botpress-cloud-ops
  • spgingras
  • chsir17
  • allardy
  • eff
  • franklevasseur
  • michael.masson