This repository has been archived by the owner on Mar 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 867
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a213bbc
commit c2ab080
Showing
4 changed files
with
132 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Close Pull Request | ||
|
||
on: | ||
pull_request_target: | ||
types: [opened] | ||
|
||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: superbrothers/close-pull-request@v3 | ||
with: | ||
comment: 'Normalizr is no longer maintained and does not accept pull requests. Please maintain your own fork of this repository.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,119 +1,19 @@ | ||
# normalizr [![build status](https://img.shields.io/travis/paularmstrong/normalizr/master.svg?style=flat-square)](https://travis-ci.org/paularmstrong/normalizr) [![Coverage Status](https://img.shields.io/coveralls/paularmstrong/normalizr/master.svg?style=flat-square)](https://coveralls.io/github/paularmstrong/normalizr?branch=master) [![npm version](https://img.shields.io/npm/v/normalizr.svg?style=flat-square)](https://www.npmjs.com/package/normalizr) [![npm downloads](https://img.shields.io/npm/dm/normalizr.svg?style=flat-square)](https://www.npmjs.com/package/normalizr) | ||
|
||
# [📣 🤝 Maintainer help wanted ](https://github.com/paularmstrong/normalizr/discussions/493) | ||
# 📣 Normalizr is no longer maintained | ||
|
||
## Install | ||
Due to lack of ability to find an invested maintainer and inability to find time to do routine maintenance and community building, this package is no longer maintained. Please see the discussion [🤝 Maintainer help wanted](https://github.com/paularmstrong/normalizr/discussions/493) for more information. | ||
|
||
Install from the NPM repository using yarn or npm: | ||
## FAQs | ||
|
||
```shell | ||
yarn add normalizr | ||
``` | ||
### Should I still use Normalizr? | ||
|
||
```shell | ||
npm install normalizr | ||
``` | ||
If you need it, yes. Normalizr is and has been at a stable release for a very long time, used by thousands of others without issue. | ||
|
||
## Motivation | ||
### What should I do if I want other features or found a bug? | ||
|
||
Many APIs, public or not, return JSON data that has deeply nested objects. Using data in this kind of structure is often very difficult for JavaScript applications, especially those using [Flux](http://facebook.github.io/flux/) or [Redux](http://redux.js.org/). | ||
Fork [Normalizr on Github](https://github.com/paularmstrong/normalizr) and maintain a version yourself. | ||
|
||
## Solution | ||
### Can I contribute back to Normalizr? | ||
|
||
Normalizr is a small, but powerful utility for taking JSON with a schema definition and returning nested entities with their IDs, gathered in dictionaries. | ||
|
||
## Documentation | ||
|
||
* [Introduction](/docs/introduction.md) | ||
* [Build Files](/docs/introduction.md#build-files) | ||
* [Quick Start](/docs/quickstart.md) | ||
* [API](/docs/api.md) | ||
* [normalize](/docs/api.md#normalizedata-schema) | ||
* [denormalize](/docs/api.md#denormalizeinput-schema-entities) | ||
* [schema](/docs/api.md#schema) | ||
* [Using with JSONAPI](/docs/jsonapi.md) | ||
|
||
## Examples | ||
|
||
* [Normalizing GitHub Issues](/examples/github) | ||
* [Relational Data](/examples/relationships) | ||
* [Interactive Redux](/examples/redux) | ||
|
||
## Quick Start | ||
|
||
Consider a typical blog post. The API response for a single post might look something like this: | ||
|
||
```json | ||
{ | ||
"id": "123", | ||
"author": { | ||
"id": "1", | ||
"name": "Paul" | ||
}, | ||
"title": "My awesome blog post", | ||
"comments": [ | ||
{ | ||
"id": "324", | ||
"commenter": { | ||
"id": "2", | ||
"name": "Nicole" | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
|
||
We have two nested entity types within our `article`: `users` and `comments`. Using various `schema`, we can normalize all three entity types down: | ||
|
||
```js | ||
import { normalize, schema } from 'normalizr'; | ||
|
||
// Define a users schema | ||
const user = new schema.Entity('users'); | ||
|
||
// Define your comments schema | ||
const comment = new schema.Entity('comments', { | ||
commenter: user | ||
}); | ||
|
||
// Define your article | ||
const article = new schema.Entity('articles', { | ||
author: user, | ||
comments: [comment] | ||
}); | ||
|
||
const normalizedData = normalize(originalData, article); | ||
``` | ||
|
||
Now, `normalizedData` will be: | ||
|
||
```js | ||
{ | ||
result: "123", | ||
entities: { | ||
"articles": { | ||
"123": { | ||
id: "123", | ||
author: "1", | ||
title: "My awesome blog post", | ||
comments: [ "324" ] | ||
} | ||
}, | ||
"users": { | ||
"1": { "id": "1", "name": "Paul" }, | ||
"2": { "id": "2", "name": "Nicole" } | ||
}, | ||
"comments": { | ||
"324": { id: "324", "commenter": "2" } | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Dependencies | ||
|
||
None. | ||
|
||
## Credits | ||
|
||
Normalizr was originally created by [Dan Abramov](http://github.com/gaearon) and inspired by a conversation with [Jing Chen](https://twitter.com/jingc). Since v3, it was completely rewritten and maintained by [Paul Armstrong](https://twitter.com/paularmstrong). It has also received much help, enthusiasm, and contributions from [community members](https://github.com/paularmstrong/normalizr/graphs/contributors). | ||
There are no current plans to resurrect this origin of Normalizr. If a forked version becomes sufficiently maintained and popular, please reach out about merging the fork and changing maintainers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,117 @@ | ||
# Table of Contents | ||
# normalizr [![build status](https://img.shields.io/travis/paularmstrong/normalizr/master.svg?style=flat-square)](https://travis-ci.org/paularmstrong/normalizr) [![Coverage Status](https://img.shields.io/coveralls/paularmstrong/normalizr/master.svg?style=flat-square)](https://coveralls.io/github/paularmstrong/normalizr?branch=master) [![npm version](https://img.shields.io/npm/v/normalizr.svg?style=flat-square)](https://www.npmjs.com/package/normalizr) [![npm downloads](https://img.shields.io/npm/dm/normalizr.svg?style=flat-square)](https://www.npmjs.com/package/normalizr) | ||
|
||
## Install | ||
|
||
Install from the NPM repository using yarn or npm: | ||
|
||
```shell | ||
yarn add normalizr | ||
``` | ||
|
||
```shell | ||
npm install normalizr | ||
``` | ||
|
||
## Motivation | ||
|
||
Many APIs, public or not, return JSON data that has deeply nested objects. Using data in this kind of structure is often very difficult for JavaScript applications, especially those using [Flux](http://facebook.github.io/flux/) or [Redux](http://redux.js.org/). | ||
|
||
## Solution | ||
|
||
Normalizr is a small, but powerful utility for taking JSON with a schema definition and returning nested entities with their IDs, gathered in dictionaries. | ||
|
||
## Documentation | ||
|
||
- [Read Me](/README.md) | ||
- [Introduction](/docs/introduction.md) | ||
- [Build Files](/docs/introduction.md#build-files) | ||
- [Quick Start](/docs/quickstart.md) | ||
- [API](/docs/api.md) | ||
- [normalize](/docs/api.md#normalizedata-schema) | ||
- [denormalize](/docs/api.md#denormalizeinput-schema-entities) | ||
- [schema](/docs/api.md#schema) | ||
- [Frequently Asked Questions](/docs/faqs.md) | ||
- [Using with JSONAPI](/docs/jsonapi.md) | ||
|
||
## Examples | ||
|
||
- [Normalizing GitHub Issues](/examples/github) | ||
- [Relational Data](/examples/relationships) | ||
- [Interactive Redux](/examples/redux) | ||
|
||
## Quick Start | ||
|
||
Consider a typical blog post. The API response for a single post might look something like this: | ||
|
||
```json | ||
{ | ||
"id": "123", | ||
"author": { | ||
"id": "1", | ||
"name": "Paul" | ||
}, | ||
"title": "My awesome blog post", | ||
"comments": [ | ||
{ | ||
"id": "324", | ||
"commenter": { | ||
"id": "2", | ||
"name": "Nicole" | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
|
||
We have two nested entity types within our `article`: `users` and `comments`. Using various `schema`, we can normalize all three entity types down: | ||
|
||
```js | ||
import { normalize, schema } from 'normalizr'; | ||
|
||
// Define a users schema | ||
const user = new schema.Entity('users'); | ||
|
||
// Define your comments schema | ||
const comment = new schema.Entity('comments', { | ||
commenter: user, | ||
}); | ||
|
||
// Define your article | ||
const article = new schema.Entity('articles', { | ||
author: user, | ||
comments: [comment], | ||
}); | ||
|
||
const normalizedData = normalize(originalData, article); | ||
``` | ||
|
||
Now, `normalizedData` will be: | ||
|
||
```js | ||
{ | ||
result: "123", | ||
entities: { | ||
"articles": { | ||
"123": { | ||
id: "123", | ||
author: "1", | ||
title: "My awesome blog post", | ||
comments: [ "324" ] | ||
} | ||
}, | ||
"users": { | ||
"1": { "id": "1", "name": "Paul" }, | ||
"2": { "id": "2", "name": "Nicole" } | ||
}, | ||
"comments": { | ||
"324": { id: "324", "commenter": "2" } | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Dependencies | ||
|
||
None. | ||
|
||
## Credits | ||
|
||
Normalizr was originally created by [Dan Abramov](http://github.com/gaearon) and inspired by a conversation with [Jing Chen](https://twitter.com/jingc). Since v3, it was completely rewritten and maintained by [Paul Armstrong](https://twitter.com/paularmstrong). It has also received much help, enthusiasm, and contributions from [community members](https://github.com/paularmstrong/normalizr/graphs/contributors). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters