TypeScript Solution Framework (SDK)

Introduction

The Solution Framework provides numerous components for the implementation of a Domain Service Projects (TypeScript) based on the project's design model. That means, whatever you modelled in the design phase will be reflected by pre-generated code.

Tip:

The generated solution framework is dependent on the extensions that are currently enabled in the project. Please check the related pages for NodeJS TypeScript Implementation in the chapter Extensions to find out more about the generated SDK and how it can be used.

SDK components

These SDK components can be used in multiple implementation files depending on the type of namespace they belong to.

Solution

It is possible to access the project details for logging purposes by using the this.solution component.

const acrnm = this.solution.acronym;
const name = this.solution.name;
const category = this.solution.category;

The values in the this.solution are read-only.

Logging

This provides utility logging functions info, warn, error and debug.

// the log.error() can take an array of argumnets
this.util.log.error('Error Message', errorObject);

// the log.debug() can take an array of argumnets
this.util.log.debug('Debug Message', errorObject);

// the log.info() can take an array of argumnets
this.util.log.info('Info Message', object);

// the log.warn() can take an array of argumnets
this.util.log.warn('Warning Message', object);

Audit logging

The Audit Logging services offers the transaction and performance logging functionality.

// the revlog.publish() can take an array of argumnets
this.util.revlog.publish('Audit Message', Object);

Global Kafka consumers can be implemented to consume the audit log messages and persist them in a secure data store.

HTTP requests

To make an HTTP request against external APIs.

The this.util.request provides functions for the GET, POST, PUT, PATCH, DEL HTTP operations.

const response = await this.util.request.get(url: string, queryParams?: HTTPQueryParams, headers?: HTTPHeaders, sslConfig?: SSLConfig);
OR
const response = await this.util.request.del(url: string, queryParams?: HTTPQueryParams, headers?: HTTPHeaders, sslConfig?: SSLConfig);
OR
const response = await this.util.request.patch(url: string, queryParams?: HTTPQueryParams, body?: any, headers?: HTTPHeaders, sslConfig?: SSLConfig);
OR
const response = await this.util.request.post(url: string, queryParams?: HTTPQueryParams, body?: any, headers?: HTTPHeaders, sslConfig?: SSLConfig);
OR
const response = await this.util.request.put(url: string, queryParams?: HTTPQueryParams, body?: any, headers?: HTTPHeaders, sslConfig?: SSLConfig);

Request context

This provides information regarding the current request context the command is executed with.

// get request context via this._context
const requestContext = this._context.requestContext;

Scope overview

Below is an illustrative table for the different scopes inside each implementation element.

ServiceCommandAgentOperationExternal Entity constructExternal Entity loadExternal Entity validate
this.inputooo o
this.outputooo ooo
this.instance o ooo
this.factory.entityoooo oo
this.factory.errorooo
this.factory.referenceooo
this.factory.eventooo
this.repooooo o
this.serviceso oo oo
this.util.logooooooo
this.util.revlogooooooo
this.response.statusCode o
this.response.body o
this.requestContextoooo