Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
runspired committed Sep 2, 2022
1 parent e1e3462 commit 7aad0c0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/-ember-data/node-tests/fixtures/expected.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ module.exports = {
'(public) @ember-data/store RecordArray#save',
'(public) @ember-data/store RecordArray#type',
'(public) @ember-data/store RecordArray#update',
"(public) @ember-data/store RecordDataManager#sync",
"(public) @ember-data/store RecordDataManager#addToHasMany",
"(public) @ember-data/store RecordDataManager#changedAttributes",
"(public) @ember-data/store RecordDataManager#changedAttrs",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Store, { recordIdentifierFor } from '@ember-data/store';
import { DSModel } from '@ember-data/types/q/ds-model';
import { CollectionResourceRelationship, SingleResourceRelationship } from '@ember-data/types/q/ember-data-json-api';
import type { NewRecordIdentifier, RecordIdentifier, StableRecordIdentifier } from '@ember-data/types/q/identifier';
import type { ChangedAttributesHash, RecordData, RecordDataV1 } from '@ember-data/types/q/record-data';
import type { ChangedAttributesHash, MergeOperation, RecordData, RecordDataV1 } from '@ember-data/types/q/record-data';
import type { JsonApiResource, JsonApiValidationError } from '@ember-data/types/q/record-data-json-api';
import type { RecordDataStoreWrapper } from '@ember-data/types/q/record-data-store-wrapper';
import { Dict } from '@ember-data/types/q/utils';
Expand All @@ -26,6 +26,9 @@ if (!DEPRECATE_V1_RECORD_DATA) {
}

class TestRecordData implements RecordData {
sync(op: MergeOperation): void {
throw new Error('Method not implemented.');
}
update(operation: LocalRelationshipOperation): void {
throw new Error('Method not implemented.');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import JSONAPISerializer from '@ember-data/serializer/json-api';
import Store, { recordIdentifierFor } from '@ember-data/store';
import { CollectionResourceRelationship, SingleResourceRelationship } from '@ember-data/types/q/ember-data-json-api';
import type { NewRecordIdentifier, RecordIdentifier, StableRecordIdentifier } from '@ember-data/types/q/identifier';
import type { ChangedAttributesHash, RecordData, RecordDataV1 } from '@ember-data/types/q/record-data';
import type { ChangedAttributesHash, MergeOperation, RecordData, RecordDataV1 } from '@ember-data/types/q/record-data';
import type { JsonApiResource, JsonApiValidationError } from '@ember-data/types/q/record-data-json-api';
import { RecordDataStoreWrapper } from '@ember-data/types/q/record-data-store-wrapper';
import { Dict } from '@ember-data/types/q/utils';
Expand Down Expand Up @@ -115,6 +115,9 @@ class V1TestRecordData implements RecordDataV1 {
}
}
class V2TestRecordData implements RecordData {
sync(op: MergeOperation): void {
throw new Error('Method not implemented.');
}
update(operation: LocalRelationshipOperation): void {
throw new Error('Method not implemented.');
}
Expand Down
11 changes: 11 additions & 0 deletions packages/store/addon/-private/managers/record-data-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,17 @@ export class NonSingletonRecordDataManager implements RecordData {
return recordData.pushData(identifier, data, hasRecord);
}

/**
* Perform an operation on the cache to update the remote state.
*
* Note: currently the only valid operation is a MergeOperation
* which occurs when a collision of identifiers is detected.
*
* @method sync
* @public
* @param op the operation to perform
* @returns {void}
*/
sync(op: MergeOperation): void {
const recordData = this.#recordData;
if (this.#isDeprecated(recordData)) {
Expand Down

0 comments on commit 7aad0c0

Please sign in to comment.