@ember-data/model 3.28.7 → 3.28.10

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.
@@ -24,17 +24,17 @@ import { computedMacroWithOptionalParams } from './util';
24
24
 
25
25
  ```app/models/post.js
26
26
  import Model, { hasMany } from '@ember-data/model';
27
-
27
+
28
28
  export default class PostModel extends Model {
29
- @hasMany('comment') comments;
29
+ @hasMany('comment') comments;
30
30
  }
31
31
  ```
32
32
 
33
33
  ```app/models/comment.js
34
34
  import Model, { belongsTo } from '@ember-data/model';
35
-
35
+
36
36
  export default class CommentModel extends Model {
37
- @belongsTo('post') post;
37
+ @belongsTo('post') post;
38
38
  }
39
39
  ```
40
40
 
@@ -54,7 +54,7 @@ import { computedMacroWithOptionalParams } from './util';
54
54
  import Model, { hasMany } from '@ember-data/model';
55
55
 
56
56
  export default class TagModel extends Model {
57
- @hasMany('post') posts;
57
+ @hasMany('post') posts;
58
58
  }
59
59
  ```
60
60
 
@@ -119,8 +119,10 @@ function computeOnce(target, key, desc) {
119
119
  @uses EmberData.DeprecatedEvented
120
120
  */
121
121
  class Model extends EmberObject {
122
- init(...args) {
123
- super.init(...args);
122
+ init(options = {}) {
123
+ const createProps = options._createProps;
124
+ delete options._createProps;
125
+ super.init(options);
124
126
 
125
127
  if (DEBUG) {
126
128
  if (!this._internalModel) {
@@ -133,6 +135,7 @@ class Model extends EmberObject {
133
135
  if (CUSTOM_MODEL_CLASS) {
134
136
  this.___recordState = new RecordState(this);
135
137
  }
138
+ this.setProperties(createProps);
136
139
  }
137
140
 
138
141
  /**
@@ -2076,6 +2079,7 @@ class Model extends EmberObject {
2076
2079
  // the values initialized during create to `setUnknownProperty`
2077
2080
  Model.prototype._internalModel = null;
2078
2081
  Model.prototype.store = null;
2082
+ Model.prototype._createProps = null;
2079
2083
 
2080
2084
  if (HAS_DEBUG_PACKAGE) {
2081
2085
  /**
@@ -1,3 +1,4 @@
1
+ import ArrayMixin from '@ember/array';
1
2
  import { assert } from '@ember/debug';
2
3
  import { dependentKeyCompat } from '@ember/object/compat';
3
4
  import { tracked } from '@glimmer/tracking';
@@ -16,7 +17,7 @@ import { DEPRECATE_EVENTED_API_USAGE } from '@ember-data/private-build-infra/dep
16
17
 
17
18
  A PromiseManyArray is an array-like proxy that also proxies certain method calls
18
19
  to the underlying ManyArray in addition to being "promisified".
19
-
20
+
20
21
  Right now we proxy:
21
22
 
22
23
  * `reload()`
@@ -41,6 +42,14 @@ export default class PromiseManyArray {
41
42
  this._update(promise, content);
42
43
  this.isDestroyed = false;
43
44
  this.isDestroying = false;
45
+
46
+ const meta = Ember.meta(this);
47
+ meta.hasMixin = (mixin: Object) => {
48
+ if (mixin === ArrayMixin) {
49
+ return true;
50
+ }
51
+ return false;
52
+ };
44
53
  }
45
54
 
46
55
  //---- Methods/Properties on ArrayProxy that we will keep as our API
@@ -54,6 +63,9 @@ export default class PromiseManyArray {
54
63
  */
55
64
  @dependentKeyCompat
56
65
  get length(): number {
66
+ // shouldn't be needed, but ends up being needed
67
+ // for computed chains even in 4.x
68
+ this['[]'];
57
69
  return this.content ? this.content.length : 0;
58
70
  }
59
71
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ember-data/model",
3
- "version": "3.28.7",
3
+ "version": "3.28.10",
4
4
  "description": "The default blueprint for ember-cli addons.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -18,9 +18,9 @@
18
18
  "test:node": "mocha"
19
19
  },
20
20
  "dependencies": {
21
- "@ember-data/canary-features": "3.28.7",
22
- "@ember-data/private-build-infra": "3.28.7",
23
- "@ember-data/store": "3.28.7",
21
+ "@ember-data/canary-features": "3.28.10",
22
+ "@ember-data/private-build-infra": "3.28.10",
23
+ "@ember-data/store": "3.28.10",
24
24
  "@ember/edition-utils": "^1.2.0",
25
25
  "@ember/string": "^3.0.0",
26
26
  "ember-cached-decorator-polyfill": "^0.1.4",
@@ -32,7 +32,7 @@
32
32
  "inflection": "~1.13.1"
33
33
  },
34
34
  "devDependencies": {
35
- "@ember-data/unpublished-test-infra": "3.28.7",
35
+ "@ember-data/unpublished-test-infra": "3.28.10",
36
36
  "@ember/optional-features": "^2.0.0",
37
37
  "@ember/test-helpers": "^2.2.5",
38
38
  "broccoli-asset-rev": "^3.0.0",