# ember-data-json-api-bulk-ext

> The default blueprint for ember-cli addons.

Latest version **2.0.0** (published 2021-06-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install ember-data-json-api-bulk-ext
pnpm add ember-data-json-api-bulk-ext
yarn add ember-data-json-api-bulk-ext
bun add ember-data-json-api-bulk-ext
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2021-06-17 |
| First published | 2020-03-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 510.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | alexlafroscia |
| Keywords | ember-addon |

## Links

- npm: https://www.npmjs.com/package/ember-data-json-api-bulk-ext
- npm.io page: https://npm.io/package/ember-data-json-api-bulk-ext

## Dependencies (1)

- [ember-cli-babel](https://npm.io/package/ember-cli-babel.md) ^7.18.0

## Recent versions

- 2.0.0 (latest) — 2021-06-17
- 1.1.0 — 2020-03-20
- 1.0.0 — 2020-03-19

## README

# ember-data-json-api-bulk-ext

![.github/workflows/verify.yml](https://github.com/movableink/ember-data-json-api-bulk-ext/workflows/.github/workflows/verify.yml/badge.svg)

Decorator to add support to Ember Data for the [JSON:API Bulk Extension](https://github.com/json-api/json-api/blob/9c7a03dbc37f80f6ca81b16d444c960e96dd7a57/extensions/bulk/index.md).

## Compatibility

- Ember.js v3.24 or above
- Ember CLI v2.13 or above
- Node.js v12 or above

## Installation

```
ember install ember-data-json-api-bulk-ext
```

If you have not yet created a subclass of the Ember Data Store, do so now. You will want to import and apply the decorator to this class.

```javascript
// app/services/store.js
import Store from '@ember-data/store';
import { withBulkActions } from 'ember-data-json-api-bulk-ext';

@withBulkActions()
class CustomStore extends Store {}

export default CustomStore;
```

## Usage

With the decorator applied to your Store subclass, you'll have new methods on the store available to you for dealing with bulk API actions.

```javascript
const first = this.store.createRecord('post', { title: 'First Post' });
const second = this.store.createRecord('post', { title: 'Second Post' });

await this.store.bulkCreate([first, second]);

assert.ok(first.id, 'First record was given an ID');
assert.ok(second.id, 'First record was given an ID');
```

Note the following limitations:

- The models being operated on _must_ use the `JSONAPIAdapter` and `JSONAPISerializer`
- All records must be of the same type (for now)
- Records can only be created in bulk (for now)

### Using the extension MIME type

The bulk extension for JSON:API describes a custom MIME type for your requests. To override the default JSON:API MIME type and use the one from the extension, pass the following option to the `withBulkActions` decorator:

```javascript
@withBulkActions({ useExtensionMimeType: true })
class CustomStore extends Store {
```

## Contributing

See the [Contributing](CONTRIBUTING.md) guide for details.

## License

This project is licensed under the [MIT License](LICENSE.md).

---
_Source: https://npm.io/package/ember-data-json-api-bulk-ext · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
