Socket
Socket
Sign inDemoInstall

angular-in-memory-web-api

Package Overview
Dependencies
8
Maintainers
3
Versions
53
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.6 to 0.5.0

30

CHANGELOG.md

@@ -11,2 +11,26 @@ # "angular-in-memory-web-api" versions

<a id="0.5.0"></a>
## 0.5.0 (2017-10-05)
**BREAKING CHANGE**: HTTP response data no longer wrapped in object w/ `data` property by default.
In this release, the `dataEncapsulation` configuration default changed from `false` to `true`. The HTTP response body holds the data values directly rather than an object that encapsulates those values, `{data: ...}`. This is a **breaking change that affects almost all existing apps!**
Changing the default to `false` is a **breaking change**. Pre-existing apps that did not set this property explicitly will be broken because they expect encapsulation and are probably mapping
the HTTP response results from the `data` property like this:
```
.map(data => data.data as Hero[])
```
**To migrate, simply remove that line everywhere.**
If you would rather keep the web api's encapsulation, `{data: ...}`, set `dataEncapsulation` to `true` during configuration as in the following example:
```
HttpClientInMemoryWebApiModule.forRoot(HeroInMemDataService, { dataEncapsulation: true })
```
We made this change because
* the [security flaw](http://stackoverflow.com/questions/3503102/what-are-top-level-json-arrays-and-why-are-they-a-security-risk)
that data encapsulation tried to overcome has been fixed in most (if not all) browsers supported by Angular v2+.
* data encapsulation is uncommon in modern web APIs.
* removing the `.map` step simplifies usage of `HttpClient` in most scenarios.
<a id="0.4.6"></a>

@@ -67,2 +91,8 @@ ## 0.4.6 (2017-09-13)

The 0.4.0 release was a major overhaul of this library.
You don't have to change your existing application _code_ if your app uses this library without customizations.
But this release's **breaking changes** affect developers who used the customization features or loaded application files with SystemJS.
**BREAKING CHANGES**: Massive refactoring.

@@ -69,0 +99,0 @@ Many low-level and customization options have changed.

3

interfaces.d.ts

@@ -50,3 +50,4 @@ import { Observable } from 'rxjs/Observable';

/**
* true (default) encapsulate content in a `data` property inside the response body. false: put content directly inside the response body
* false (default) put content directly inside the response body.
* true: encapsulate content in a `data` property inside the response body, `{ data: ... }`.
*/

@@ -53,0 +54,0 @@ dataEncapsulation?: boolean;

@@ -42,3 +42,3 @@ import { Injectable } from '@angular/core';

caseSensitiveSearch: false,
dataEncapsulation: true,
dataEncapsulation: false,
delay: 500,

@@ -45,0 +45,0 @@ delete404: false,

@@ -1,1 +0,1 @@

[{"__symbolic":"module","version":3,"metadata":{"HeadersCore":{"__symbolic":"interface"},"InMemoryDbService":{"__symbolic":"class","members":{"createDb":[{"__symbolic":"method"}]}},"InMemoryBackendConfigArgs":{"__symbolic":"class"},"InMemoryBackendConfig":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"InMemoryBackendConfigArgs"}]}]}},"parseUri":{"__symbolic":"function"},"ParsedRequestUrl":{"__symbolic":"interface"},"PassThruBackend":{"__symbolic":"interface"},"removeTrailingSlash":{"__symbolic":"function","parameters":["path"],"value":{"__symbolic":"error","message":"Expression form not supported","line":180,"character":22}},"RequestCore":{"__symbolic":"interface"},"RequestInfo":{"__symbolic":"interface"},"RequestInfoUtilities":{"__symbolic":"interface"},"ResponseOptions":{"__symbolic":"interface"},"UriInfo":{"__symbolic":"interface"}}},{"__symbolic":"module","version":1,"metadata":{"HeadersCore":{"__symbolic":"interface"},"InMemoryDbService":{"__symbolic":"class","members":{"createDb":[{"__symbolic":"method"}]}},"InMemoryBackendConfigArgs":{"__symbolic":"class"},"InMemoryBackendConfig":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"InMemoryBackendConfigArgs"}]}]}},"parseUri":{"__symbolic":"function"},"ParsedRequestUrl":{"__symbolic":"interface"},"PassThruBackend":{"__symbolic":"interface"},"removeTrailingSlash":{"__symbolic":"function","parameters":["path"],"value":{"__symbolic":"error","message":"Expression form not supported","line":180,"character":22}},"RequestCore":{"__symbolic":"interface"},"RequestInfo":{"__symbolic":"interface"},"RequestInfoUtilities":{"__symbolic":"interface"},"ResponseOptions":{"__symbolic":"interface"},"UriInfo":{"__symbolic":"interface"}}}]
[{"__symbolic":"module","version":3,"metadata":{"HeadersCore":{"__symbolic":"interface"},"InMemoryDbService":{"__symbolic":"class","members":{"createDb":[{"__symbolic":"method"}]}},"InMemoryBackendConfigArgs":{"__symbolic":"class"},"InMemoryBackendConfig":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"InMemoryBackendConfigArgs"}]}]}},"parseUri":{"__symbolic":"function"},"ParsedRequestUrl":{"__symbolic":"interface"},"PassThruBackend":{"__symbolic":"interface"},"removeTrailingSlash":{"__symbolic":"function","parameters":["path"],"value":{"__symbolic":"error","message":"Expression form not supported","line":181,"character":22}},"RequestCore":{"__symbolic":"interface"},"RequestInfo":{"__symbolic":"interface"},"RequestInfoUtilities":{"__symbolic":"interface"},"ResponseOptions":{"__symbolic":"interface"},"UriInfo":{"__symbolic":"interface"}}},{"__symbolic":"module","version":1,"metadata":{"HeadersCore":{"__symbolic":"interface"},"InMemoryDbService":{"__symbolic":"class","members":{"createDb":[{"__symbolic":"method"}]}},"InMemoryBackendConfigArgs":{"__symbolic":"class"},"InMemoryBackendConfig":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"InMemoryBackendConfigArgs"}]}]}},"parseUri":{"__symbolic":"function"},"ParsedRequestUrl":{"__symbolic":"interface"},"PassThruBackend":{"__symbolic":"interface"},"removeTrailingSlash":{"__symbolic":"function","parameters":["path"],"value":{"__symbolic":"error","message":"Expression form not supported","line":181,"character":22}},"RequestCore":{"__symbolic":"interface"},"RequestInfo":{"__symbolic":"interface"},"RequestInfoUtilities":{"__symbolic":"interface"},"ResponseOptions":{"__symbolic":"interface"},"UriInfo":{"__symbolic":"interface"}}}]
{
"name": "angular-in-memory-web-api",
"version": "0.4.6",
"version": "0.5.0",
"description": "An in-memory web api for Angular demos and tests",

@@ -5,0 +5,0 @@ "main": "bundles/in-memory-web-api.umd.js",

@@ -10,15 +10,21 @@ # Angular in-memory-web-api

---
## **v0.4 supports `HttpClient`!**
>Release v0.4.0 (8 Sept 2017) was a major overhaul of this library.
>
>You don't have to change your existing application _code_ if your app uses this library without customizations.
>
>
>The v0.4.0 release introduced **breaking changes** that affect developers who used the customization features or loaded application files with SystemJS.
>
>**Read this README and the [CHANGELOG](https://github.com/angular/in-memory-web-api/blob/master/CHANGELOG.md/#0.4.0)**
to learn what's new and about **breaking changes**
>
>The new **unit tests** are a good way to see the in-memory web api in action.
## Important recent changes
### HTTP response data no longer wrapped in object w/ `data` property
As of v0.5.0 (5 October 2017), the `dataEncapsulation` configuration default changed from `false` to `true`. The HTTP response body holds the data values directly rather than an object that encapsulates those values, `{data: ...}`. This is a **breaking change that affects almost all existing apps!**
See the [CHANGELOG](https://github.com/angular/in-memory-web-api/blob/master/CHANGELOG.md/#0.5.0) for the reason behind this change and how to quickly fix your code or revert to encapsulation.
### v0.4 supports `HttpClient`
Release v0.4.0 (8 Sept 2017) was a major overhaul of this library.
The v0.4.0 release introduced **breaking changes** that affect developers who used the customization features or loaded application files with SystemJS.
**Read this README and the [CHANGELOG](https://github.com/angular/in-memory-web-api/blob/master/CHANGELOG.md/#0.4.0)**
to learn what's new and about other **breaking changes**.
---
## Use cases

@@ -124,3 +130,3 @@

import { HttpClientModule } from '@angular/common/http';
import { HttpClientInMemoryWebApiModule } from 'http-angular-in-memory-web-api';
import { HttpClientInMemoryWebApiModule } from 'angular-in-memory-web-api';

@@ -153,3 +159,3 @@ import { InMemHeroService } from '../app/hero.service';

import { HttpModule } from '@angular/http';
import { HttpInMemoryWebApiModule } from 'http-angular-in-memory-web-api';
import { HttpInMemoryWebApiModule } from 'angular-in-memory-web-api';

@@ -444,3 +450,3 @@ import { InMemHeroService } from '../app/hero.service';

- update `READM.md` if usage or interfaces change.
- update `README.md` if usage or interfaces change.

@@ -447,0 +453,0 @@ - consider updating the dependency versions in `package.json`.

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc