Options
All
  • Public
  • Public/Protected
  • All
Menu

Package muster-server

Muster-Server

Installation

npm install --save @dws/muster-server

Index

Type aliases

NodeTypesArray

NodeTypesArray: Array<NodeType>

Variables

Const DEFAULT_WHITELISTED_NODE_TYPES

DEFAULT_WHITELISTED_NODE_TYPES: NodeTypesArray = [...ArithmeticNodeTypes,...KeysNodeTypes,...TransformsNodeTypes,...LogicNodeTypes,...StringNodeTypes,FirstItemNodeType,CallNodeType,CombineLatestNodeType,ContextNodeType,FieldsNodeType,FnNodeType,GetNodeType,HeadNodeType,KeyNodeType,EntriesNodeType,LegacyQueryNodeType,QueryNodeType,QuerySetCallOperationNodeType,QuerySetGetChildOperationNodeType,QuerySetGetItemsOperationNodeType,QuerySetNodeType,QuerySetOperationNodeType,QuerySetResultNodeType,QuerySetSetOperationNodeType,ParallelNodeType,RootNodeType,SeriesNodeType,SetNodeType,ValueNodeType,WithTransformsNodeType,]

Const HEADERS_PARAM_NAME

HEADERS_PARAM_NAME: "$$headers" = "$$headers"

Const HeaderNodeType

HeaderNodeType: StatelessNodeType<"http-header", HeaderNodeProperties> = createNodeType<'http-header', HeaderNodeProperties>('http-header', {shape: {name: types.string,},operations: {evaluate: {run(node: HeaderNode): NodeDefinition {if (!(HEADERS_PARAM_NAME in node.context.values)) {throw new Error('No headers middleware detected.');}const headers: GraphNode = node.context.values[HEADERS_PARAM_NAME];if (!ValueNodeType.is(headers)) {throw incorrectNodeType(ValueNodeType, headers);}const name = node.definition.properties.name;if (!(name in headers.definition.properties.value)) {console.warn(`Header '${name}' not found in the request headers`);}return value(headers.definition.properties.value[name]);},},},})

Const SESSION_PARAM_NAME

SESSION_PARAM_NAME: "$$session" = "$$session"

Const SessionNodeType

SessionNodeType: StatelessNodeType<"session", SessionNodeProperties> = createNodeType<'session',SessionNodeProperties>('session', {shape: {},operations: {evaluate: {run(node: SessionNode): GraphNode {if (!(SESSION_PARAM_NAME in node.context.values)) {throw new Error('No session middleware detected');}return node.context.values[SESSION_PARAM_NAME];},},},})

Let age

age: number = 1

Const bodyParser

bodyParser: any = require('body-parser')

Const clientApp

clientApp: Muster = muster({server: remote(`http://localhost:${port}/`, { useSockets: true }),})

Const graph

graph: Muster = muster({name: 'Test name',ageStream: fromStream(subject),})

migrationsInOrder

migrationsInOrder: any

Let nextRequestNumber

nextRequestNumber: number = 1

Const port

port: string = process.env.PORT || '8999'

Const server

server: Server = http.createServer()

Const subject

subject: BehaviorSubject<ValueNodeDefinition<string>> = new BehaviorSubject(value(`Geoff is ${age}`))

Const wss

wss: Server = new WebSocket.Server({ server })

Functions

header

headerMiddleware

  • headerMiddleware(): RequestHandler

isHeaderNodeDefinition

  • isHeaderNodeDefinition(value: NodeDefinition): boolean

isSessionNodeDefinition

  • isSessionNodeDefinition(value: NodeDefinition): boolean

musterExpress

session

sessionMiddleware

  • sessionMiddleware(): RequestHandler

socketConnect

Object literals

Const defaultConfig

defaultConfig: object

enableRequestLogging

enableRequestLogging: false = false

whitelistedNodeTypes

whitelistedNodeTypes: (StaticNodeType<string, object, object> | StatelessNodeType<string, object, object, string, GraphOperation<string, object, object, OperationType<string, object, object>>> | StatefulNodeType<string, object, any, object, object, string, GraphOperation<string, object, object, OperationType<string, object, object>>>)[] = DEFAULT_WHITELISTED_NODE_TYPES

Const defaultConfig

defaultConfig: object

enableRequestLogging

enableRequestLogging: false = false

whitelistedNodeTypes

whitelistedNodeTypes: (StaticNodeType<string, object, object> | StatelessNodeType<string, object, object, string, GraphOperation<string, object, object, OperationType<string, object, object>>> | StatefulNodeType<string, object, any, object, object, string, GraphOperation<string, object, object, OperationType<string, object, object>>>)[] = DEFAULT_WHITELISTED_NODE_TYPES