Overview
===========
The Moovweb SDK is a Node JS project to develop, test and deploy Moovweb Adapt and Moovweb PWA projects. Refer to [Moov SDK Documentation for details](https://pwa.moovweb.com/).

### Pre-requisites
  * [Node 8.11.2 or greater](https://nodejs.org/en/)
  * [Yarn package manager](https://yarnpkg.com/en/)

### Installation
Refer to the ["Getting Started"](https://pwa.moovweb.com/guides/getting_started) section of the Moovweb documentation for installation instructions

## Release Notes

### 7.4.7 - January 14, 2020
  * Bug fix global installs of MoovSDK not working

### 7.4.6 - January 13, 2020
  * Bug fix included file missing from v7.4.5

### 7.4.5 - January 11, 2020
  * Bug fix NodeJS version check to make v8.15 the minimum version but also less than v9.0

### 7.4.4 - January 07, 2020
  * Update NodeJS version check to make v8.15 the minimum version

### 7.4.3 - January 07, 2020
  * Fixed obscure "Empty reply from server" when request headers are too large. Increased CLI max header size to 16kb which is what we support in Moovweb cloud.

### 7.4.2 - December 27, 2019
  * Enhanced logging to aid debugging site performance impacted by upstream requests. Look for the following entries in the logging output by the sdk
    * `info: MUR start`
    * `info: MUR ended`
    * `info: req ended`

### 7.4.1 - December 13, 2019
  * Fix bug where `--user-password` option fails with `moovsdk cacheclear`

### 7.4.0 - October 24, 2019
  * Add round robin of upstream IPs for MUR requests.
  * Add `x-moov-status` response header.
  * Update `via` header in MUR requests.

### 7.3.3 - September 13, 2019
  * Fixed version check for NodeJS to correctly identify NodeJS v8.x.x as the correct version for the moovsdk.

### 7.3.2 - September 12, 2019
  * Added `--host-var` command line option to specify the value for `$` in host mapping. (default "mlocal")

### 7.3.1 - August 22, 2019
  * Removed requirements on edge transformation flags in `moov_config.json`.

### 7.3.0 - August 1, 2019
  * Added ability to clear project cache using `--surrogate-key` and `--path`.

### 7.2.0 - July 18, 2019
  * Disabled `record-upstream-requests` by default.

### 7.1.9 - June 7, 2019
  * Polls Moovweb servers less often on "moovsdk deploy" to reduce network pressure.

### 7.1.8 - Apr 24, 2019
  * Fixed exceptions on empty upstream responses.

### 7.1.7 - Apr 24, 2019
  * Promoted 7.1.7-alpha.1 to 7.1.7.
  
### 7.1.7-alpha.1 - Apr 5, 2019
  * Fixed crash on badly encoded data received from upstream.
  * Fixed crash on badly encoded headers sent to upstream.

### 7.1.7-alpha.0 - Mar 7, 2019
  * Fixed issue where CSS relative paths were not being resolved correctly by CLI.

### 7.1.6 - Feb 4, 2019
  * Added ability to clear a project's cache via `moovsdk cacheclear` in addition to https://console.moovweb.com "Flush" button.

### 7.1.5 - Jan 9, 2019
  * Fixed issue where --mode=some_mode_name was not being parsed correctly when the --create or --blob flag was specified.

### 7.1.4 - Dec 24, 2018
  * Fixed issue where 'moovsdk cert fetch' was not writing cert to disk
  * Added exit codes to 'moovsdk cert fetch' - 0 = cert ok, 90 = cert expired, 91 = cert will expire in under 31 days, 92 = no cert found.
  * Fixed issue where 'moovsdk cert' was not reporting errors properly.
  * Updated 'moovsdk cert' inline help text.
  * Fixed issue where 'moovsdk start' failed when running as Windows admin user.
  * Enhanced performance of 'moovsdk start' runtime.

### 7.1.3 - Dec 13, 2018
  * Added ability to manage certificates via moovsdk in addition to normal https://console.moovweb.com

### 7.1.2 - Dec 6, 2018
  * Fix issue where upstream requests fail with certificate CName mismatch.
  * Added ability to create mode via --create command line option.
  * Added ability to associate a blob to a mode via --blob command line option.
  * Changed deployment to ignore the .moov directory, but include the tasks directory.

### 7.1.2-alpha.0 - Nov 21, 2018
  * Added a flag to create a mode if the desired mode does not exist.
  * Added a flag to associate a blob with the deployed endpoint.

### 7.1.1 - Nov 16, 2018
  * Improve output readability on deploy.

### 7.1.0 - Nov 15, 2018
  * Various bug fixes and robustification for host hacking.
  * Added request record/replay feature.
  * Fix decoding of upstream responses that are not utf-8 and don’t send `charset` in `content-type`.
  * Fix https redirects rewritten to http when host hacking is in effect.
  * Fix local assets served only over http when host hacking is in effect.
  * Added `x-moov-t` response header with request performance metrics.
  
### 7.0.23 - Nov 6, 2018
  * Fix issue where CLI command line arguments were not correctly validated.
  * Report affected domains upon successful deploy.

### 7.1.0-alpha.6 - Oct 29, 2018
  * Fixed bug on upstream MUR requests.

### 7.1.0-alpha.5 - Oct 25, 2018
  * Fix bug on cert reading.
  * Fix upstream host selection.

### 7.1.0-alpha.4 - Oct 25, 2018
  * Improved error handling for record/replay.

### 7.0.22 - Oct 24, 2018
  * Fix a bug where background tasks were not properly killed on CLI exit.

### 7.1.0-alpha.3 - Oct 19, 2018
  * Made trace logging more explicit.

### 7.1.0-alpha.2 - Oct 16, 2018
  * Drastically increased performance of record/replay feature.

### 7.0.21 - Oct 10, 2018
  * Add host hacking for non-Windows platforms. Add the `--host-hack` flag and run with `sudo` to use.

### 7.1.0-alpha.1 - Oct 4, 2018
  * Addressed issue with protocol selection of upstream requests.

### 7.1.0-alpha.0 - Sep 14, 2018
  * Add experimental record/replay feature for upstream requests.

### 7.0.20 - Sep 5, 2018
  * Fix an issue where `location` response header points to `https://localhost:8080` instead of using `http`.
  * Fix an issue where links would be rewritten to `https://localhost:8080` instead of using `http`.
  * Fix an issue where links would be rewritten to `127.0.0.1` rather than to the original host (e.g. `localhost`)
  * Fix a CORS issue where source map is served on a different host than the request being debugged.

### 7.0.19 - Sep 5, 2018
  * Fix issues with missing `write` and other methods on sandbox HTTP request and response objects.

### 7.0.18 - Aug 29, 2018
  * Fix an issue with unhandled promise rejections in user code terminating SDK.
  * Fix an issue with too long output from build tasks ("stdout maxBuffer exceeded" or "stderr maxBuffer exceeded" errors).

### 7.0.17 - Aug 28, 2018
  * Fix `EADDRNOTAVAIL` error on Windows.

### 7.0.16 - Aug 23, 2018
  * Asynchronous functions (`setTimeout`, `setImmediate` and `setInterval` and their clear counterparts) are now always declared in user sandbox but throw exceptions on use everywhere except in response rewriter (which is the only asynchronous part of user code)

### 7.0.15 - Aug 23, 2018
  * The CLI will now check if another instance of the CLI is running on the same base port on start and shut it down if one is found.

### 7.0.14 - Aug 18, 2018
  * Enabled support for Chrome debugger.
  * Enabled support for source maps to show the original file name and line number when exceptions occur.

### 7.0.13 - Aug 17, 2018
  * Fix an issue with sending `secure` cookies to browser even though SDK runs on `http://localhost`.

### 7.0.12 - Aug 16, 2018
  * Fix an issue with sending URI encoded cookies to upstream. Now all cookies are sent as they were received.

### 7.0.11 - Aug 14, 2018
  * Correctly write request body to upstream request.
  * Fix an issue where line numbers in debugger do not align with line number in source code.

### 7.0.10 - Aug 13, 2018
  * Fix an issue with `set-cookie` headers values being concatenated into a single value.

### 7.0.9 - Aug 13, 2018
  * Add support for .moovignore which allows the developer to exclude files from the deployment upload to improve deployment speed.
  * Fix a bug where a failing deploy script logs 'Uncaught exception [object Object]'.
  * Fix compressed response bodies not decompressed.
  * Fix issues with CORS and local static assets.
  * Fix downstream to upstream mapping for single domain projects.
  * Fix sandbox exports (`global.env`) interpretation.

### 7.0.8 - Aug 9, 2018
  * Fix request body not accessible to user code.
  * Fix minor typos in logging output.
  * Fix logging on slug compilation failed.
  * Improve info output during SDK start.
  * Add method to request logging.
  * Add version to `MoovJS SDK is starting` log message.

### 7.0.7 - Aug 8, 2018
  * Fixed bug where deploy fails and requests password when it cannot write auth token to disk.

### 7.0.6 - Aug 7, 2018
  * Fix bug where ```moovsdk --version``` was returning the wrong value.

### 7.0.5 - Aug 7, 2018
  * Fix bad downstream to upstream host mapping affecting serving of upstream requests.
  * Fix error handling in edge workers.
  * Add logging on request received and served.

### 7.0.4 - Aug 6, 2018
  * Replace back `--host-mapping` with `--upstream` as downstream part of the mapping is always `locahost:${port}` in SDK.
  * Inject `process.NODE_ENV` with `development` (in SDK) and `production` (in the cloud) values.
  * Fix serving of static assets.
  * Fix incomplete edge and backend sandbox environment.
  * Fix perfect proxying on errors in edge response transformer (in SDK we should never perfect proxy)

### 7.0.3 - Aug 6, 2018
  * Fixed Continuous Integration / Continuous Deployment scripts for moovsdk.

### 7.0.2 - Aug 3, 2018
  * Fix `asset_host` environment variable to be prefixed with `//` as it is in production cloud.

### 7.0.1 - Aug 2, 2018
  * Replace `--upstream` option in `start` command with `--host-mapping`. Optionally using `--host-mapping` allows developers to change downstream to upstream host mapping rather than using the first mapping from `moov_config.json` file.
  * Use --port as base port, don't allow individual ports. Removed individual port switches.- Fix injected value for `host` header to be downstream host, not upstream host.
  * Pause after build before unpausing the builds.
  * Add handling of incorrect asynchronous callback handling in user code. When SDK notices that user has not added correct `on('error')` handler for asynchronous HTTP requests, and an error is issued, SDK will finish the transformation for user.
  * Add handling of unhandled rejections in user code.
  * Extend `--no-pause` warning to 60 seconds due to slow Webpack starts.
  * Output stats and arguments on SDK start for easier troubleshooting.
  * Fix `cheerio` not defined issue.
  * Fix `cheerio` not present in backend request rewriter.
  * Fix backend transformer not using timeouts in SDK.
  * Fix edge proxy upstream host and URL.
  * Fix asset host value for edge and backend workers.

### 7.0.0 - Aug 1, 2018
  * First release of Moov SDK v7.
