Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function implicitRelationshipsFor(instance: any): ConfidentDict {
let recordData = (recordDataFor(instance) || instance) as RelationshipRecordData;
return recordData._implicitRelationships;
}
isDeletedCP = computed('currentState', function() {
let rd = recordDataFor(this);
if (rd.isDeleted) {
return rd.isDeleted();
} else {
return get(this._internalModel.currentState, 'isDeleted');
}
}).readOnly();
} else {
isNewCP = computed('currentState', function() {
let rd = recordDataFor(this);
if (rd.isNew) {
return rd.isNew();
} else {
return get(this._internalModel.currentState, 'isNew');
}
}).readOnly();
} else {
errors: computed(function() {
let errors = Errors.create();
errors._registerHandlers(
() => {
this.send('becameInvalid');
},
() => {
this.send('becameValid');
}
);
if (RECORD_DATA_ERRORS) {
let recordData = recordDataFor(this);
let jsonApiErrors;
if (recordData.getErrors) {
jsonApiErrors = recordData.getErrors();
if (jsonApiErrors) {
let errorsHash = errorsArrayToHash(jsonApiErrors);
let errorKeys = Object.keys(errorsHash);
for (let i = 0; i < errorKeys.length; i++) {
errors._add(errorKeys[i], errorsHash[errorKeys[i]]);
}
}
}
}
return errors;
}).readOnly(),
function hasValue(internalModel, key) {
return recordDataFor(internalModel).hasAttr(key);
}
internalModels.map(im => recordDataFor(im))
);
export function relationshipsFor(instance: any): Relationships {
let recordData = (recordDataFor(instance) || instance) as RelationshipRecordData;
return recordData._relationships;
}
get() {
deprecate(
`Model.data was private and it's use has been deprecated. For public access, use the RecordData API or iterate attributes`,
false,
{
id: 'ember-data:Model.data',
until: '3.9',
}
);
return recordDataFor(this)._data;
},
});