1.0.0 • Published 2 years ago

asure.integrations.smb.internal-api v1.0.0

Weekly downloads
-
License
ISC
Repository
bitbucket
Last release
2 years ago

Integration Internal API Monorepo

Project Intent

This repository holds the Internal API which is a collection of endpoints designed to act as a private API that implements a consistent interface for the retrieval and manipulation of payroll and HR data across multiple underlying systems. It is currently consumed by multiple public "translator" APIs that interact with 3rd parties.

Project Structure

This project is designed as a monorepo. For us, that means package management and deployment are hoisted to the project root. This repo has a single package.lock in the root and a pair of generic Jenkinsfiles, these provide dependencies and script the deployment pipelines for every endpoint. Any endpoint specific infrastructure or configuration is managed in its serverless.yml file. The endpoints that comprise the API are designed to be stateless and scalable.

Due to the limitations of VS Code configuration the file tsconfig.json is only used to get Intellisense to correctly predict what files will be included in compliation. It is very unlikely that changes will be necessary to tsconfig.json. The actual tsconfig that is/should be used to build the project is build.tsconfig.json and that is where any TypeScript config changes should happen.

Project Setup For Development

This project requires NodeJS version 14, and npm version 8+.

Local debugging requires VS Code, bash, and nvm.

Notes For Windows Users

Depending on your specific system configuration, it is possible there will be issues installing the latest version of npm. If, upon attempting to install latest npm using either method, you encounter an EEXIST error declaring that npm is Refusing to delete ~/.nvm/versions/node/v14.x.x/bin/npm.cmd you will need to take some extra steps. There is an open nvm-windows github issue discussing a variety of workarounds, but the simplest one is found in this comment. If you are using gitbash you may need to rename the npm file and delete npm.cmd rather than what's suggested in the comment, the idea remains the same however:

  • Rename the npm executable you're going to use to update
  • Delete all the other conflicting files
  • Use the renamed executable to install -g npm@latest.

Installing Node 14

We recommend using nvm to manage Node versions (and you'll need it if you want to debug). Instructions for installing nvm can be found here. After installing nvm, Node 14 and the latest version of npm can be installed together by running nvm install --latest-npm 14. If you do this you can skip the section "Installing Latest npm". If you wish to install Node 14 separately from npm you can use the command nvm install 14 instead. To set Node 14 as your active Node version you can usenvm use 14

Installing Latest npm

To get the latest version of npm, you can either:

  • Install it during your nvm install of node 14 by using nvm install --latest-npm 14
  • After installing Node 14 and setting it as your active Node version with nvm use 14 you can use the command npm install -g npm@latest to install the latest version.

Installing Project Dependencies

Once Node 14 is in use and the latest npm installed you can simply run npm install in the project root. This should install all dependencies.

VS Code Settings for Debug

To provide a consistent debugging environment "typescript.tsdk": "./node_modules/typescript/lib" should be included in the settings.json. If you do not yet have a settings.json, simply create one in the .vscode folder and put { "typescript.tsdk": "./node_modules/typescript/lib" } in it. This file is excluded from the repository because it is primarily intended for management of local VS Code configuration, so including it could be disruptive to developer workflows.

The launch.json file provides launch configurations for debugging including specifying a runtimeVersion of Node.JS. Use of this property requires nvm. If, for some reason, VS Code is unable to detect your installation of nvm, or the availability of the appropriate Node version there are two potential workarounds. For Windows users it may be resolved by installing nvm-windows. Alternatively, running the command nvm alias default 14 will make your latest installed version of Node 14 the default version for VS Code. The the runtimeVersion property can be temporarily removed from launch.json to allow local debugging.