Closed fsmanuel closed 10 months ago
Similar to https://github.com/adopted-ember-addons/ember-cp-validations/issues/739 we use ember-data internals to detect if ember-data is installed and if it's a DS.Model, DS.ManyArray, or DS.PromiseManyArray .
DS.Model
DS.ManyArray
DS.PromiseManyArray
function requireModule(module, exportName = 'default') { if (require.has(module)) { return require(module)[exportName]; } } const DS = requireModule('ember-data'); export function isDsModel(o) { return !!(DS && o && o instanceof DS.Model); } export function isDSManyArray(o) { return !!( DS && o && isArray(o) && (o instanceof DS.PromiseManyArray || o instanceof DS.ManyArray) ); }
I wonder how long the ember-data import will be arround and if @ember-data/model/-private could be an embroider safe alternative.
ember-data
@ember-data/model/-private
const Model = requireModule('@ember-data/model'); const { ManyArray, PromiseManyArray } = requireModule('@ember-data/model/-private');
//cc @runspired @ef4 @gilest
isDSManyArray should just go away.
isDSManyArray
Similar to https://github.com/adopted-ember-addons/ember-cp-validations/issues/739 we use ember-data internals to detect if ember-data is installed and if it's a
DS.Model
,DS.ManyArray
, orDS.PromiseManyArray
.I wonder how long the
ember-data
import will be arround and if@ember-data/model/-private
could be an embroider safe alternative.//cc @runspired @ef4 @gilest