Skip to content

Commit

Permalink
svelte
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaurav0 committed Dec 12, 2019
1 parent 1b47019 commit 1840ad4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
1 change: 1 addition & 0 deletions packages/private-build-infra/addon/current-deprecations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ export default {
DEPRECATE_MISMATCHED_INVERSE_RELATIONSHIP_DATA: '3.12',
DEPRECATE_SERIALIZER_QUERY_RECORD_ARRAY_RESPONSE: '3.4',
DEPRECATE_BELONGS_TO_REFERENCE_PUSH: '3.16',
DEPRECATE_REFERENCE_INTERNAL_MODEL: '3.16',
};
2 changes: 2 additions & 0 deletions packages/private-build-infra/addon/deprecations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ export const DEPRECATE_SERIALIZER_QUERY_RECORD_ARRAY_RESPONSE = deprecationState
export const DEPRECATE_MISMATCHED_INVERSE_RELATIONSHIP_DATA = deprecationState(
'DEPRECATE_MISMATCHED_INVERSE_RELATIONSHIP_DATA'
);
export const DEPRECATE_BELONGS_TO_REFERENCE_PUSH = deprecationState('DEPRECATE_BELONGS_TO_REFERENCE_PUSH');
export const DEPRECATE_REFERENCE_INTERNAL_MODEL = deprecationState('DEPRECATE_REFERENCE_INTERNAL_MODEL');
23 changes: 14 additions & 9 deletions packages/store/addon/-private/system/references/reference.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import recordDataFor from '../record-data-for';
import { FULL_LINKS_ON_RELATIONSHIPS } from '@ember-data/canary-features';
import { deprecate } from '@ember/debug';
import { DEPRECATE_REFERENCE_INTERNAL_MODEL } from '@ember-data/private-build-infra/deprecations';
type Dict<T> = import('../../ts-interfaces/utils').Dict<T>;
type JsonApiRelationship = import('../../ts-interfaces/record-data-json-api').JsonApiRelationship;
type PaginationLinks = import('../../ts-interfaces/ember-data-json-api').PaginationLinks;
Expand Down Expand Up @@ -48,15 +49,6 @@ abstract class Reference {

public _resource(): ResourceIdentifier | JsonApiRelationship | void {}

get internalModel() {
deprecate('Accessing the internalModel property of Reference is deprecated', false, {
id: 'ember-data:reference-internal-model',
until: '3.17',
});

return INTERNAL_MODELS.get(this.recordData);
}

/**
This returns a string that represents how the reference will be
looked up when it is loaded. If the relationship has a link it will
Expand Down Expand Up @@ -213,4 +205,17 @@ if (FULL_LINKS_ON_RELATIONSHIPS) {
};
}

if (DEPRECATE_REFERENCE_INTERNAL_MODEL) {
Object.defineProperty(Reference.prototype, 'internalModel', {
get() {
deprecate('Accessing the internalModel property of Reference is deprecated', false, {
id: 'ember-data:reference-internal-model',
until: '3.17',
});

return INTERNAL_MODELS.get(this.recordData);
},
});
}

export default Reference;

0 comments on commit 1840ad4

Please sign in to comment.