@gradiant/xapi-dsl
TypeScript icon, indicating that this package has built-in type declarations

1.18.1 • Public • Published

npm version code style: prettier Conventional Commits

Gradiant xAPI DSL

Set of types for easily building xAPI statements.

Overview

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:

DSL

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 (statement.verb.id === dsl.activityTypes.smart.essay) {
  // 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';

Scripts

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
  • index.d.ts.map

npm run lint

Run tslint and prettier applying the available fixes

npm run dsl:print

It generates a new version of dsl-definition.json file. This file must be updated to release a new version.

Readme

Keywords

none

Package Sidebar

Install

npm i @gradiant/xapi-dsl

Weekly Downloads

5

Version

1.18.1

License

Mozilla Public License Version 2.0

Unpacked Size

301 kB

Total Files

524

Last publish

Collaborators

  • grdadmin