Skip to content

Commit

Permalink
interface update
Browse files Browse the repository at this point in the history
  • Loading branch information
igorT committed May 22, 2019
1 parent 976f9f2 commit ff0cf35
Showing 1 changed file with 2 additions and 36 deletions.
38 changes: 2 additions & 36 deletions text/0000-record-data-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ interface RecordData {

isDeletionCommitted(identifier: RecordIdentifier): boolean

setIsDeleted(identifier: RecordIdentifier, boolean isDeleted): void
setIsDeleted(identifier: RecordIdentifier, boolean: isDeleted): void
}
```

Expand All @@ -40,41 +40,7 @@ interface RecordData {

`isDeletionPersisted` should return true if and only if the record had been marked for deletion and that deletion has been successfully persisted, otherwise false.

The entire RecordData interface would then become:

```ts
interface RecordData {

// To be added in this RFC
isNew(identifier: RecordIdentifier): boolean

isDeleted(identifier: RecordIdentifier): boolean

isDeletionCommited(identifier: RecordIdentifier): boolean

setIsDeleted(identifier: RecordIdentifier, boolean isDeleted): void

//existing methods as of RFC #461

pushData(data: JsonApiResource, calculateChange?: boolean)

clientDidCreate(identifier: RecordIdentifier);
willCommit(identifier: RecordIdentifier);
commitWasRejected(identifier: RecordIdentifier, errors?: JsonApiError[]);
didCommit(data: JsonApiResource | null): void

unloadRecord(identifier: RecordIdentifier);

rollbackAttributes(identifier: RecordIdentifier);
changedAttributes(identifier: RecordIdentifier): ChangedAttributesHash;
hasChangedAttributes(identifier: RecordIdentifier): boolean;

getAttr(identifier: RecordIdentifier, key: string): any;
getRelationship(identifier: RecordIdentifier): JsonApiRelationship;

performMutation(operation: Operation): void
}
```
The TS interface for the all of Record Data with the new methods can be be found [here](https://github.com/emberjs/data/blob/igor/record-data-state-interface/packages/store/addon/-private/ts-interfaces/record-data.ts#L13)

In order to notify changes to the state flags we would also add a notification method to the store wrapper which is passed to RecordData:

Expand Down

0 comments on commit ff0cf35

Please sign in to comment.