@ember-data/model 4.1.0-alpha.1 → 4.1.0-alpha.13
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/attr.js
CHANGED
|
@@ -130,7 +130,7 @@ function attr(type, options) {
|
|
|
130
130
|
return computed({
|
|
131
131
|
get(key) {
|
|
132
132
|
if (DEBUG) {
|
|
133
|
-
if (['_internalModel', '
|
|
133
|
+
if (['_internalModel', 'currentState'].indexOf(key) !== -1) {
|
|
134
134
|
throw new Error(
|
|
135
135
|
`'${key}' is a reserved property name on instances of classes extending Model. Please choose a different property name for your attr on ${this.constructor.toString()}`
|
|
136
136
|
);
|
|
@@ -145,7 +145,7 @@ function attr(type, options) {
|
|
|
145
145
|
},
|
|
146
146
|
set(key, value) {
|
|
147
147
|
if (DEBUG) {
|
|
148
|
-
if (['_internalModel', '
|
|
148
|
+
if (['_internalModel', 'currentState'].indexOf(key) !== -1) {
|
|
149
149
|
throw new Error(
|
|
150
150
|
`'${key}' is a reserved property name on instances of classes extending Model. Please choose a different property name for your attr on ${this.constructor.toString()}`
|
|
151
151
|
);
|
|
@@ -143,7 +143,7 @@ function belongsTo(modelName, options) {
|
|
|
143
143
|
return computed({
|
|
144
144
|
get(key) {
|
|
145
145
|
if (DEBUG) {
|
|
146
|
-
if (['_internalModel', '
|
|
146
|
+
if (['_internalModel', 'recordData', 'currentState'].indexOf(key) !== -1) {
|
|
147
147
|
throw new Error(
|
|
148
148
|
`'${key}' is a reserved property name on instances of classes extending Model. Please choose a different property name for your belongsTo on ${this.constructor.toString()}`
|
|
149
149
|
);
|
|
@@ -173,7 +173,7 @@ function belongsTo(modelName, options) {
|
|
|
173
173
|
},
|
|
174
174
|
set(key, value) {
|
|
175
175
|
if (DEBUG) {
|
|
176
|
-
if (['_internalModel', '
|
|
176
|
+
if (['_internalModel', 'recordData', 'currentState'].indexOf(key) !== -1) {
|
|
177
177
|
throw new Error(
|
|
178
178
|
`'${key}' is a reserved property name on instances of classes extending Model. Please choose a different property name for your belongsTo on ${this.constructor.toString()}`
|
|
179
179
|
);
|
|
@@ -183,7 +183,7 @@ function hasMany(type, options) {
|
|
|
183
183
|
return computed({
|
|
184
184
|
get(key) {
|
|
185
185
|
if (DEBUG) {
|
|
186
|
-
if (['_internalModel', '
|
|
186
|
+
if (['_internalModel', 'recordData', 'currentState'].indexOf(key) !== -1) {
|
|
187
187
|
throw new Error(
|
|
188
188
|
`'${key}' is a reserved property name on instances of classes extending Model. Please choose a different property name for your hasMany on ${this.constructor.toString()}`
|
|
189
189
|
);
|
|
@@ -193,7 +193,7 @@ function hasMany(type, options) {
|
|
|
193
193
|
},
|
|
194
194
|
set(key, records) {
|
|
195
195
|
if (DEBUG) {
|
|
196
|
-
if (['_internalModel', '
|
|
196
|
+
if (['_internalModel', 'recordData', 'currentState'].indexOf(key) !== -1) {
|
|
197
197
|
throw new Error(
|
|
198
198
|
`'${key}' is a reserved property name on instances of classes extending Model. Please choose a different property name for your hasMany on ${this.constructor.toString()}`
|
|
199
199
|
);
|
package/addon/-private/model.js
CHANGED
|
@@ -16,7 +16,6 @@ import { CUSTOM_MODEL_CLASS, RECORD_DATA_ERRORS, REQUEST_SERVICE } from '@ember-
|
|
|
16
16
|
import { HAS_DEBUG_PACKAGE } from '@ember-data/private-build-infra';
|
|
17
17
|
import {
|
|
18
18
|
DEPRECATE_EVENTED_API_USAGE,
|
|
19
|
-
DEPRECATE_MODEL_TOJSON,
|
|
20
19
|
DEPRECATE_RECORD_LIFECYCLE_EVENT_METHODS,
|
|
21
20
|
} from '@ember-data/private-build-infra/deprecations';
|
|
22
21
|
import {
|
|
@@ -78,7 +77,7 @@ function findPossibleInverses(type, inverseType, name, relationshipsSoFar) {
|
|
|
78
77
|
|
|
79
78
|
/*
|
|
80
79
|
* This decorator allows us to lazily compute
|
|
81
|
-
* an expensive getter on first-access and
|
|
80
|
+
* an expensive getter on first-access and thereafter
|
|
82
81
|
* never recompute it.
|
|
83
82
|
*/
|
|
84
83
|
function computeOnce(target, key, desc) {
|
|
@@ -1867,7 +1866,7 @@ class Model extends EmberObject {
|
|
|
1867
1866
|
|
|
1868
1867
|
```javascript
|
|
1869
1868
|
import { get } from '@ember/object';
|
|
1870
|
-
import
|
|
1869
|
+
import Person from 'app/models/person'
|
|
1871
1870
|
|
|
1872
1871
|
let attributes = Person.attributes
|
|
1873
1872
|
|
|
@@ -2173,47 +2172,6 @@ if (DEPRECATE_EVENTED_API_USAGE) {
|
|
|
2173
2172
|
});
|
|
2174
2173
|
}
|
|
2175
2174
|
|
|
2176
|
-
if (DEPRECATE_MODEL_TOJSON) {
|
|
2177
|
-
/**
|
|
2178
|
-
Use [JSONSerializer](JSONSerializer.html) to
|
|
2179
|
-
get the JSON representation of a record.
|
|
2180
|
-
|
|
2181
|
-
`toJSON` takes an optional hash as a parameter, currently
|
|
2182
|
-
supported options are:
|
|
2183
|
-
|
|
2184
|
-
- `includeId`: `true` if the record's ID should be included in the
|
|
2185
|
-
JSON representation.
|
|
2186
|
-
|
|
2187
|
-
@method toJSON
|
|
2188
|
-
@public
|
|
2189
|
-
@param {Object} options
|
|
2190
|
-
@return {Object} A JSON representation of the object.
|
|
2191
|
-
*/
|
|
2192
|
-
Model.reopen({
|
|
2193
|
-
toJSON(options) {
|
|
2194
|
-
// container is for lazy transform lookups
|
|
2195
|
-
deprecate(
|
|
2196
|
-
`Called the built-in \`toJSON\` on the record "${this.constructor.modelName}:${this.id}". The built-in \`toJSON\` method on instances of classes extending \`Model\` is deprecated. For more information see the link below.`,
|
|
2197
|
-
false,
|
|
2198
|
-
{
|
|
2199
|
-
id: 'ember-data:model.toJSON',
|
|
2200
|
-
until: '4.0',
|
|
2201
|
-
url: 'https://deprecations.emberjs.com/ember-data/v3.x#toc_record-toJSON',
|
|
2202
|
-
for: '@ember-data/model',
|
|
2203
|
-
since: {
|
|
2204
|
-
available: '3.15',
|
|
2205
|
-
enabled: '3.15',
|
|
2206
|
-
},
|
|
2207
|
-
}
|
|
2208
|
-
);
|
|
2209
|
-
let serializer = this._internalModel.store.serializerFor('-default');
|
|
2210
|
-
let snapshot = this._internalModel.createSnapshot();
|
|
2211
|
-
|
|
2212
|
-
return serializer.serialize(snapshot, options);
|
|
2213
|
-
},
|
|
2214
|
-
});
|
|
2215
|
-
}
|
|
2216
|
-
|
|
2217
2175
|
if (DEBUG) {
|
|
2218
2176
|
let lookupDescriptor = function lookupDescriptor(obj, keyName) {
|
|
2219
2177
|
let current = obj;
|
|
@@ -2279,12 +2237,6 @@ if (DEBUG) {
|
|
|
2279
2237
|
);
|
|
2280
2238
|
}
|
|
2281
2239
|
|
|
2282
|
-
if (!isDefaultEmptyDescriptor(this, 'content') || this.content !== undefined) {
|
|
2283
|
-
throw new Error(
|
|
2284
|
-
`'content' is a reserved property name on instances of classes extending Model. Please choose a different property name for ${this.constructor.toString()}`
|
|
2285
|
-
);
|
|
2286
|
-
}
|
|
2287
|
-
|
|
2288
2240
|
let ourDescriptor = lookupDescriptor(Model.prototype, 'currentState');
|
|
2289
2241
|
let theirDescriptor = lookupDescriptor(this, 'currentState');
|
|
2290
2242
|
let realState = this.___recordState || this._internalModel.currentState;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-data/model",
|
|
3
|
-
"version": "4.1.0-alpha.
|
|
3
|
+
"version": "4.1.0-alpha.13",
|
|
4
4
|
"description": "The default blueprint for ember-cli addons.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"test:node": "mocha"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@ember-data/canary-features": "4.1.0-alpha.
|
|
22
|
-
"@ember-data/private-build-infra": "4.1.0-alpha.
|
|
23
|
-
"@ember-data/store": "4.1.0-alpha.
|
|
21
|
+
"@ember-data/canary-features": "4.1.0-alpha.13",
|
|
22
|
+
"@ember-data/private-build-infra": "4.1.0-alpha.13",
|
|
23
|
+
"@ember-data/store": "4.1.0-alpha.13",
|
|
24
24
|
"@ember/edition-utils": "^1.2.0",
|
|
25
|
-
"@ember/string": "^
|
|
25
|
+
"@ember/string": "^3.0.0",
|
|
26
26
|
"ember-cached-decorator-polyfill": "^0.1.4",
|
|
27
27
|
"ember-cli-babel": "^7.26.6",
|
|
28
28
|
"ember-cli-string-utils": "^1.1.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"inflection": "~1.13.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@ember-data/unpublished-test-infra": "4.1.0-alpha.
|
|
35
|
+
"@ember-data/unpublished-test-infra": "4.1.0-alpha.13",
|
|
36
36
|
"@ember/optional-features": "^2.0.0",
|
|
37
37
|
"@ember/test-helpers": "^2.2.5",
|
|
38
38
|
"broccoli-asset-rev": "^3.0.0",
|