Skip to content

Mavennet/neoflow-dto

Repository files navigation

Neoflow-DTO

Mavennet

Build Status

CI/CD

Table of Contents

Build 🛠️

To build library

npm update && npm run build

Installation ⬇️

To install library

npm i Mavennet/neoflow-dto --save

To install a branch of library

npm i Mavennet/neoflow-dto#branch-name

Usage ⚙️

Prerequisites

  • Node.js 16+
  • Npm 6+

Repos that should use this library

Importing

After using npm to install the package, import the DTO at the top of the file that is to use it.

import { RandomDTO } from '@mavennet/neoflow-dto'

Naming Convention

When creating or importing Org. Agent or Core specific DTOs, this is the naming convention that is followed:

All Org. Agent specific DTOs have a prefix: AGENT_

All Core Service specific DTOs have a prefix: CORE_

Troubleshooting 🔍

Some common issues faced are:

1. Did not build

There are two parts to the package: src and lib.

src

Is what is being editing. When making changes, creating new DTOs, adding constants, etc., all this must be done here.

lib Is where the DTOs are being exported from when when any file imports them. Editing the files here is pointless as when the package is built, it gets over written.

The problem arises when changes are made to src but package is not built. Although the src contains updates files, the files are going to be imported form lib, which still has the outdates version. Make sure to build the package before pushing the changes to any branch:

npm run build

2. Did not export

Each folder and sub-folder contains a file called index.ts. This is the file where DTOs and folders are being exported from. Without a file being exported, it will not be accesible in another program and will likley result in the "does not exist" error in the import statement. To solve this, add an export statement into the index file contained within the folder where the DTO file is located.

export * from './random.dto'

3. Cannot make an instance of an abstract class.

Some DTOs are abstract classes, and probably for good reason. But if there is ever the need to create an instance of one, just create another class which extends the abstract one and export that.

Reference: The abstract class and the resolved implementation

More About the Repository 🤔

Branches

master - branch that is published as a package version (changes to this will initiate a package version bump)

others - feature branch

Navigation

Below is a brief overview of the current code base structure.

src
├── analytics
│   ├── consts
│   └── dto
├── auth
│   ├── consts
│   └── dto
├── autoShareSettings
│   ├── consts
│   └── dto
├── contracts
│   ├── consts
│   └── dto
├── credentials
│   ├── consts
│   └── dto
├── documents
│   ├── consts
│   └── dto
├── events
│   ├── consts
│   └── dto
│       ├── certify
│       ├── createPoduct
│       ├── inspect
│       ├── storage
│       ├── transfer
│       ├── transform
│       └── transport
│           ├── billOfLading
│           └── EntryNumber
├── general
│   ├── consts
│   └── dto
├── notifications
│   ├── consts
│   └── dto
├── organizations
│   ├── consts
│   └── dto
├── presentations
│   ├── consts
│   └── dto
├── products
│   ├── consts
│   └── dto
│       └── sharing
├── users
│   ├── consts
│   └── dto
├── index.ts
└── json-Id.context.ts

Notes