Implementation of a TypeScript Low-Code Solution

At this point it is assumed that the initial setup and the mandatory commands of the Solution CLI have been performed and executed as described.

Prerequisites

Be sure you have set up and installed all prerequisites

Create a new Solution Workspace

After you have created a solution in Solution Designer and modeled it according to Domain Driven Design specifications, create a folder for your workspace.

Open a terminal and navigate to your development workspace folder

Example:

cd /my/workspace/

Clone Solution to Local Workspace

Inside Solution Designer, open the solution and click on Solution CLI in the task bar located at the bottom of the page.

There you will find instructions on how to setup the CLI and connect it with your k5-project. The section "Implementation" provides the necessary information for the fss clone command to clone the solution to your local workspace.

Note: You will be prompted for your username and password for this k5-project.

A folder in your workspace will be created for the cloned solution, where the folder name will be the solution acronym.

Example:

/my/workspace/SOL

Open Project

Open your solution project folder in your IDE and open a new terminal from within.

Project Structure

The project is structured into 3 sub-folders inside the src-impl folder:

api, domain and integration

These folders correspond to the namespace types that are described in Modeling Low-Code Solutions

Sub-Folder: api

src-impl/api

This folder will contain sub-folders. Each sub-folder represents a modeled API namespace where the folder name is the API namespace acronym.

Each API namespace folder src-impl/api/api_ns_accr will contain a sub-folder named operations that will contain implementation stubs and test stubs for each modeled operation of this API namespace.

Sub-Folder: domain

src-impl/domain

This folder will contain sub-folders. Each sub-folder represents a modeled domain namespace, where the folder name is the domain namespace acronym.

Each domain namespace folder src-impl/domain/dom_ns_accr will contain the sub-folders listed below:

  • src-impl/domain/dom_ns_accr /agents

    This folder will hold implementation stubs & test stubs files for all agents under this domain namespace.

  • src-impl/domain/dom_ns_accr /aggregates.

    This folder will contain sub-folders, each one represents a root entity under this domain namespace.

    Each entity folder src-impl/domain/dom_ns_accr /aggregates/entityA will contain two sub-folders factory and instance where:

    • factory folder will hold all factory commands, implementation stubs and test stubs for this entity
    • instance folder will hold all instance commands, implementation stubs and test stubs for this entity

  • src-impl/domain/dom_ns_accr /externals

    This folder will hold implementation stubs and test stubs files for all external entities under this domain namespace

  • src-impl/domain/dom_ns_accr /services

    This folder will hold implementation stubs & test stubs files for all services under this domain namespace

Sub-Folder: integration

src-impl/integration

This folder will contain sub-folders. Each sub-folder represents a modeled integration namespace, where the folder name is the integration namespace acronym.

Each integration namespace folder src-impl/integration/int_ns_accr will contain a sub-folder named services that will contain implementation stubs & test stubs for each modeled service in this integration namespace.

Attention: It is the solution engineer’s responsibility to implement the logic for these operations stub files.
More specifically:
> src-impl
   > api
     > api_ns_accr1
       > operations
       > middleware       
     > api_ns_accr2
       > operations
       > middleware
   > domain
      > dom_ns_accr1
        > agents
        > aggregates
           > RootEntity1
             > factory
             > instance
        > externals
        > services
      > dom_ns_accr2
        > agents
        > aggregates
          > RootEntity1
            > factory
            > instance
          > RootEntity2
            > factory
Attention: It is possible to create additional stubs (.ts files) anywhere within the src-impl folder and implement reusable methods by using the syntax:
export function doSomething() {
    // write reusable code
}
In order to call this function from commands and services, start typing the name of the function and it will automatically recognise it.