Gradiant XAPI constans for xAPI

dsl, elearning, gradiant, npm, typescript, xapi, xapi-dsl, xapi-statement
npm install @gradiant/xapi-dsl@1.10.0


npm version code style: prettier Conventional Commits

Gradiant xAPI DSL

Set of types for easily building xAPI statements.


This package contains a set of typescript definitions types to work with xAPI statements.

  • Actor
  • Attachment
  • Context
  • Object
  • Result
  • Statement
  • Verb

It also includes some external xAPI vocabulary terms (e.g. verbs, activities and extension identifiers) to be used in a centralized way. Some of the xAPI vocabularies considered here are:


You can consult the entire DSL at the dsl-definition.json

Getting started

The module exports in the index all the types needed by the xapi as well as the dsl as a nested object

// xapi interfaces...
import { Statement } from '@gradiant/xapi-dsl';

// dsl nested object
import { dsl } from '@gradiant/xapi-dsl';

const statement: Statement = jsonStatement as Statement;

if ( === {
  // essay activity type URI
  console.log('Smart essay activity');

Also, DSL constants can be imported individually from the dsl folder

import { activityTypes, verbs, contextExtensions /* ... */ } from '@gradiant/xapi-dsl/dsl';


npm run build

Build the TypeScript files under de src folder into the root folder. It will generate the dsl folder and the types folder. These two folder are auto generated and therefore should not be edited directly.

npm run clean

Remove the following generated directories/files

  • dsl
  • types
  • index.js
  • index.d.ts

npm run lint

Run tslint and prettier applying the available fixes