Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# ember-data-types

Project to get uptodate types in DefinitelyTyped for ember-data 5.x.

How to use:

1. Remove all `@types/ember-data` from your `package.json`
2. Add this repo to your `package.json`:
```json
{
"devDependencies": {
"@types/ember-data": "github:feederco/ember-data-types#master"
}
}
```
3. Run `npm install`
4. Add to your tsconfig.json
```ts
"paths": {
// ... your paths
"ember-data": [
"node_modules/@types/ember-data/index"
],
"@ember-data/*": [
"node_modules/@types/ember-data/*"
]
}
``
3 changes: 0 additions & 3 deletions adapter.d.ts

This file was deleted.

80 changes: 80 additions & 0 deletions adapter/error.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import { JSONAPIError } from "./json-api";

/**
* A `AdapterError` is used by an adapter to signal that an error occurred
* during a request to an external API. It indicates a generic error, and
* subclasses are used to indicate specific error states. The following
* subclasses are provided:
*/
export default class AdapterError extends Error {
isAdapterError: boolean;

static code: string;

constructor(errors?: JSONAPIError[], message?: string);
}
/**
* A `InvalidError` is used by an adapter to signal the external API
* was unable to process a request because the content was not
* semantically correct or meaningful per the API. Usually this means a
* record failed some form of server side validation. When a promise
* from an adapter is rejected with a `InvalidError` the record will
* transition to the `invalid` state and the errors will be set to the
* `errors` property on the record.
*/
export class InvalidError extends AdapterError {
constructor(errors: JSONAPIError[]);
}
/**
* A `TimeoutError` is used by an adapter to signal that a request
* to the external API has timed out. I.e. no response was received from
* the external API within an allowed time period.
*/
export class TimeoutError extends AdapterError {}
/**
* A `AbortError` is used by an adapter to signal that a request to
* the external API was aborted. For example, this can occur if the user
* navigates away from the current page after a request to the external API
* has been initiated but before a response has been received.
*/
export class AbortError extends AdapterError {}
/**
* A `UnauthorizedError` equates to a HTTP `401 Unauthorized` response
* status. It is used by an adapter to signal that a request to the external
* API was rejected because authorization is required and has failed or has not
* yet been provided.
*/
export class UnauthorizedError extends AdapterError {}
/**
* A `ForbiddenError` equates to a HTTP `403 Forbidden` response status.
* It is used by an adapter to signal that a request to the external API was
* valid but the server is refusing to respond to it. If authorization was
* provided and is valid, then the authenticated user does not have the
* necessary permissions for the request.
*/
export class ForbiddenError extends AdapterError {}
/**
* A `NotFoundError` equates to a HTTP `404 Not Found` response status.
* It is used by an adapter to signal that a request to the external API
* was rejected because the resource could not be found on the API.
*/
export class NotFoundError extends AdapterError {}
/**
* A `ConflictError` equates to a HTTP `409 Conflict` response status.
* It is used by an adapter to indicate that the request could not be processed
* because of a conflict in the request. An example scenario would be when
* creating a record with a client generated id but that id is already known
* to the external API.
*/
export class ConflictError extends AdapterError {}
/**
* A `ServerError` equates to a HTTP `500 Internal Server Error` response
* status. It is used by the adapter to indicate that a request has failed
* because of an error in the external API.
*/
export class ServerError extends AdapterError {}
/**
* Holds validation errors for a given record, organized by attribute names.
*/


Loading