@ns8/switchboard-interfaces
Contains all switchboard interfaces
TypeScript Interfaces
There are multiple interfaces exposed that support the SwitchBoard project object.
- Primary Schemas
- SwitchActionSchema
- SwitchEventSchema
- SwitchScoreSchema
- ScriptEventSchema
- UIObject
- Context Schemas
- ExecutionContext interfaces of a SwitchBoard action context object
- EventContext interfaces of a SwitchBoard event context object
- ScoringContext interfaces of a SwitchBoard scoring context object
- Supporting Schemas
- EndpointSchema
- SwitchTypeSchema
- ProjectTypeSchema
- SettingsImplementationType
all of which can be imported be imported by:
import { SwitchBoard, ExecutionContext, EventContext, ScoringContext } from "@ns8/switchboard-interfaces"
Schemas
All NS8 Official schemas are published to https://schemas.ns8.com/ if any changes or additions need to be made they should be made at github @ns8inc/ns8-schemas
Schemas are used by during the handoff between Fastify, Kafka and Zeebe to validate context objects before they are handed off to the switches. The interfaces are used by switch designers to ensure that their methods have the correct signatures.
- switchboard.json exposes a local copy of the switchboard schema file it can be found here
- executionContext.json exposes a local copy of the executionContext schema file it can be found here
- eventContext.json exposes a local copy of the eventContext schema file it can be found here
- scoringContext.json exposes a local copy of the scoringContext schema file it can be found here
Schema Loading
const exeContextSchema = require("@ns8/switchboard-interfaces/executionContext.json");
Install
Create a linked working build
Running yarn build:dev
will automatically build and link a local working copy of the interfaces. You can
then use them in another project by running yarn link @ns8/switchboard-interfaces
from the root of the other project.