How to use the @ember-data/store/-private.recordDataFor function in @ember-data/store

To help you get started, we’ve selected a few @ember-data/store examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github emberjs / data / packages / record-data / addon / -private / record-data-for.ts View on Github external
export function implicitRelationshipsFor(instance: any): ConfidentDict {
  let recordData = (recordDataFor(instance) || instance) as RelationshipRecordData;

  return recordData._implicitRelationships;
}
github emberjs / data / packages / model / addon / -private / model.js View on Github external
isDeletedCP = computed('currentState', function() {
    let rd = recordDataFor(this);
    if (rd.isDeleted) {
      return rd.isDeleted();
    } else {
      return get(this._internalModel.currentState, 'isDeleted');
    }
  }).readOnly();
} else {
github emberjs / data / packages / model / addon / -private / model.js View on Github external
isNewCP = computed('currentState', function() {
    let rd = recordDataFor(this);
    if (rd.isNew) {
      return rd.isNew();
    } else {
      return get(this._internalModel.currentState, 'isNew');
    }
  }).readOnly();
} else {
github emberjs / data / packages / model / addon / -private / model.js View on Github external
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(),
github emberjs / data / packages / model / addon / -private / attr.js View on Github external
function hasValue(internalModel, key) {
  return recordDataFor(internalModel).hasAttr(key);
}
github emberjs / data / packages / record-data / addon / -private / record-data-for.ts View on Github external
export function relationshipsFor(instance: any): Relationships {
  let recordData = (recordDataFor(instance) || instance) as RelationshipRecordData;

  return recordData._relationships;
}
github emberjs / data / packages / model / addon / -private / model.js View on Github external
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;
    },
  });