npm update && npm run build
npm i Mavennet/neoflow-dto --save
npm i Mavennet/neoflow-dto#branch-name
- Node.js 16+
- Npm 6+
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'
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_
Some common issues faced are:
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
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'
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
master - branch that is published as a package version (changes to this will initiate a package version bump)
others - feature branch
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
- Many DTOs are being imported from Traceability because they are either:
- Duplicates --> Example: DeleteContractsDTO
- Duplicates with some modifications --> Example: AnalyticsDTO