@ember-data/model 5.3.0-alpha.2 → 5.3.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/addon/-private.js CHANGED
@@ -1,5 +1,5 @@
1
- import { M as Model } from "./index-8a7de041";
2
- export { E as Errors, L as LEGACY_SUPPORT, R as ManyArray, P as PromiseBelongsTo, c as PromiseManyArray, a as attr, b as belongsTo, h as hasMany } from "./index-8a7de041";
1
+ import { M as Model } from "./has-many-2baf73c0";
2
+ export { E as Errors, L as LEGACY_SUPPORT, R as ManyArray, P as PromiseBelongsTo, c as PromiseManyArray, a as attr, b as belongsTo, h as hasMany } from "./has-many-2baf73c0";
3
3
  import { getOwner } from '@ember/application';
4
4
 
5
5
  /*
@@ -4,18 +4,18 @@ import EmberObject, { computed, get } from '@ember/object';
4
4
  import { recordIdentifierFor, storeFor as storeFor$1 } from '@ember-data/store';
5
5
  import { peekCache, RecordArray, MUTATE, SOURCE, recordIdentifierFor as recordIdentifierFor$1, IDENTIFIER_ARRAY_TAG, notifyArray, isStableIdentifier, storeFor, fastPush, coerceId } from '@ember-data/store/-private';
6
6
  import { dasherize } from '@ember/string';
7
+ import { A } from '@ember/array';
8
+ import { singularize } from 'ember-inflector';
7
9
  import { dependentKeyCompat } from '@ember/object/compat';
8
10
  import { run } from '@ember/runloop';
9
11
  import { cached, tracked } from '@glimmer/tracking';
10
12
  import Ember from 'ember';
11
- import { A } from '@ember/array';
12
13
  import ArrayProxy from '@ember/array/proxy';
13
14
  import { mapBy, not } from '@ember/object/computed';
14
15
  import PromiseProxyMixin from '@ember/object/promise-proxy-mixin';
15
16
  import ObjectProxy from '@ember/object/proxy';
16
17
  import { cacheFor } from '@ember/object/internals';
17
18
  import { addToTransaction, subscribe } from '@ember-data/tracking/-private';
18
- import { singularize } from 'ember-inflector';
19
19
  function isElementDescriptor(args) {
20
20
  let [maybeTarget, maybeKey, maybeDesc] = args;
21
21
  return (
@@ -1224,10 +1224,9 @@ function isResourceIdentiferWithRelatedLinks$1(value) {
1224
1224
  @public
1225
1225
  */
1226
1226
  let BelongsToReference = (_class$3 = class BelongsToReference {
1227
- // unsubscribe tokens given to us by the notification manager
1228
-
1229
1227
  constructor(store, graph, parentIdentifier, belongsToRelationship, key) {
1230
1228
  this.___identifier = void 0;
1229
+ // unsubscribe tokens given to us by the notification manager
1231
1230
  this.___token = void 0;
1232
1231
  this.___relatedToken = null;
1233
1232
  _initializerDefineProperty(this, "_ref", _descriptor$3, this);
@@ -1704,9 +1703,8 @@ function isResourceIdentiferWithRelatedLinks(value) {
1704
1703
  @extends Reference
1705
1704
  */
1706
1705
  let HasManyReference = (_class$2 = class HasManyReference {
1707
- // unsubscribe tokens given to us by the notification manager
1708
-
1709
1706
  constructor(store, graph, parentIdentifier, hasManyRelationship, key) {
1707
+ // unsubscribe tokens given to us by the notification manager
1710
1708
  this.___token = void 0;
1711
1709
  this.___identifier = void 0;
1712
1710
  this.___relatedTokenMap = void 0;
@@ -2803,6 +2801,11 @@ function isInvalidError(error) {
2803
2801
  let Tag = (_class$1 = class Tag {
2804
2802
  constructor() {
2805
2803
  _initializerDefineProperty(this, "ref", _descriptor$1, this);
2804
+ if (macroCondition(getOwnConfig().env.DEBUG)) {
2805
+ const [base, prop] = arguments;
2806
+ this._debug_base = base;
2807
+ this._debug_prop = prop;
2808
+ }
2806
2809
  this.rev = 1;
2807
2810
  this.isDirty = true;
2808
2811
  this.value = undefined;
@@ -2835,7 +2838,8 @@ function getTag(record, key) {
2835
2838
  tags = Object.create(null);
2836
2839
  Tags.set(record, tags);
2837
2840
  }
2838
- return tags[key] = tags[key] || new Tag();
2841
+ // @ts-expect-error
2842
+ return tags[key] = tags[key] || (macroCondition(getOwnConfig().env.DEBUG) ? new Tag(record.constructor.modelName, key) : new Tag());
2839
2843
  }
2840
2844
  function peekTag(record, key) {
2841
2845
  let tags = Tags.get(record);
@@ -4167,41 +4171,6 @@ let Model = (_class = (_class2 = class Model extends EmberObject {
4167
4171
  eachAttribute(callback, binding) {
4168
4172
  this.constructor.eachAttribute(callback, binding);
4169
4173
  }
4170
-
4171
- /**
4172
- Create should only ever be called by the store. To create an instance of a
4173
- `Model` in a dirty state use `store.createRecord`.
4174
- To create instances of `Model` in a clean state, use `store.push`
4175
- @method create
4176
- @private
4177
- @static
4178
- */
4179
- /**
4180
- Represents the model's class name as a string. This can be used to look up the model's class name through
4181
- `Store`'s modelFor method.
4182
- `modelName` is generated for you by Ember Data. It will be a lowercased, dasherized string.
4183
- For example:
4184
- ```javascript
4185
- store.modelFor('post').modelName; // 'post'
4186
- store.modelFor('blog-post').modelName; // 'blog-post'
4187
- ```
4188
- The most common place you'll want to access `modelName` is in your serializer's `payloadKeyFromModelName` method. For example, to change payload
4189
- keys to underscore (instead of dasherized), you might use the following code:
4190
- ```javascript
4191
- import RESTSerializer from '@ember-data/serializer/rest';
4192
- import { underscore } from '<app-name>/utils/string-utils';
4193
- export default const PostSerializer = RESTSerializer.extend({
4194
- payloadKeyFromModelName(modelName) {
4195
- return underscore(modelName);
4196
- }
4197
- });
4198
- ```
4199
- @property modelName
4200
- @public
4201
- @type String
4202
- @readonly
4203
- @static
4204
- */
4205
4174
  /*
4206
4175
  These class methods below provide relationship
4207
4176
  introspection abilities about relationships.