# ms-rest

> Client Runtime for Node.js client libraries generated using AutoRest

Latest version **2.5.6** (published 2022-05-02) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install ms-rest
pnpm add ms-rest
yarn add ms-rest
bun add ms-rest
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.5.6 |
| Published | 2022-05-02 |
| First published | 2015-04-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 183.5 KB |
| Known vulnerabilities | 0 (+3 in 3 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1174 |
| Author | Microsoft Corporation |
| Maintainers | windowsazure, azure-sdk |
| Keywords | node, microsoft, autorest, clientruntime |

## Links

- npm: https://www.npmjs.com/package/ms-rest
- Repository: git@github.com:Azure/azure-sdk-for-node
- Homepage: https://github.com/Azure/azure-sdk-for-node/runtime/ms-rest
- Issues: http://github.com/Azure/azure-sdk-for-node/issues
- npm.io page: https://npm.io/package/ms-rest

## Dependencies (10)

- [ajv](https://npm.io/package/ajv.md) 6.12.3
- [uuid](https://npm.io/package/uuid.md) ^3.2.1
- [moment](https://npm.io/package/moment.md) ^2.21.0
- [tunnel](https://npm.io/package/tunnel.md) 0.0.5
- [request](https://npm.io/package/request.md) ^2.88.2
- [through](https://npm.io/package/through.md) ^2.3.8
- [duplexer](https://npm.io/package/duplexer.md) ^0.1.1
- [is-buffer](https://npm.io/package/is-buffer.md) ^1.1.6
- [is-stream](https://npm.io/package/is-stream.md) ^1.1.0
- [http-signature](https://npm.io/package/http-signature.md) 1.3.6

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 2.5.6 (latest) — 2022-05-02
- 2.5.5 — 2022-03-03
- 2.5.4 — 2020-03-30
- 2.5.3 — 2019-07-10
- 2.5.2 — 2019-07-09
- 2.5.1 — 2019-06-25
- 2.5.0 — 2019-02-07
- 2.4.1 — 2019-02-06
- 2.4.0 — 2019-02-04
- 2.3.8 — 2018-11-20
- 2.3.7 — 2018-09-26
- 2.3.6 — 2018-06-24
- 2.3.5 — 2018-06-21
- 2.3.4 — 2018-06-11
- 2.3.3 — 2018-04-05
- … 45 more at https://npm.io/package/ms-rest/versions

## README

# MS-Rest

Infrastructure for serialization/deserialization, error handling, tracing, and http client pipeline configuration. Required by nodeJS client libraries generated using AutoRest.

- **Node.js version: 4.x.x or higher**


## How to Install

```bash
npm install ms-rest
```

## Usage
```javascript
var msrest = require('ms-rest');
```
## Serialization/Deserialization
Features
- Type checking
  - (String, Number, Boolean, ByteArray, Base64Url, Date, DateTime, Enum, TimeSpan, DateTimeRfc1123, UnixTime, Object, Stream, Sequence, Dictionary, Composite, Uuid(as a string))
- Validation of specified constraints
  - ExclusiveMaximum, ExclusiveMinimum, InclusiveMaximum, InclusiveMinimum, MaxItems, MaxLength, MinItems, MinLength, MultipleOf, Pattern, UniqueItems
- Flattening/Unflattening properties
- Default Values
- Model Properties marked as constant are set during serialization, irrespective of they being provided or not
- Required check (If a model or property is marked required and is not provided in the object then an error is thrown)
- Readonly check (If a model or property is marked readonly then it is not sent on the wire during, serialization)
- Serializing Constant values

- serialize an array of dictionary of primitive values
```javascript
var mapper = {
  type : {
    name: 'Sequence', 
    element: {
      type : {
        name: 'Dictionary',
        value: {
          type: {
            name: 'Boolean'
          }
        }
      }
    }
  }
};
var array = [{ 1: true }, { 2: false }, { 1: true, 2: false, 3: true }];
var serializedArray = msRest.serialize(mapper, array, 'arrayObj');
assert.deepEqual(array, serializedArray);
var serializedProduct = msrest.serialize(mapper, productObj, 'productObject');
var deserializedArray = msRest.deserialize(mapper, serializedArray, 'serializedArrayObj');
```
For more examples on serialization/deserialization with complex types please take a look over [here](https://github.com/Azure/autorest/blob/master/ClientRuntimes/NodeJS/ms-rest/test/serializationTests.js#L116).

## Related Projects

- [AutoRest](https://github.com/Azure/AutoRest)

![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-node%2Fruntime%2Fms-rest%2FREADME.png)

---
_Source: https://npm.io/package/ms-rest · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
