@ember-data/model 4.8.0-alpha.0 → 4.8.0-alpha.3
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 +13 -2
- package/addon/-private/belongs-to.js +9 -3
- package/addon/-private/errors.ts +6 -6
- package/addon/-private/has-many.js +7 -3
- package/addon/-private/legacy-data-fetch.js +9 -7
- package/addon/-private/legacy-data-utils.ts +1 -1
- package/addon/-private/legacy-relationships-support.ts +33 -42
- package/addon/-private/many-array.ts +13 -7
- package/addon/-private/model-for-mixin.ts +2 -4
- package/addon/-private/model.js +425 -108
- package/addon/-private/notify-changes.ts +1 -1
- package/addon/-private/promise-many-array.ts +170 -112
- package/addon/-private/record-state.ts +61 -38
- package/addon/-private/references/belongs-to.ts +5 -5
- package/addon/-private/references/has-many.ts +6 -8
- package/addon/-private/relationship-meta.ts +2 -2
- package/index.js +1 -0
- package/package.json +6 -7
package/addon/-private/model.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
@module @ember-data/model
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { assert, warn } from '@ember/debug';
|
|
5
|
+
import { assert, deprecate, warn } from '@ember/debug';
|
|
6
6
|
import EmberError from '@ember/error';
|
|
7
|
-
import EmberObject
|
|
7
|
+
import EmberObject from '@ember/object';
|
|
8
8
|
import { dependentKeyCompat } from '@ember/object/compat';
|
|
9
9
|
import { run } from '@ember/runloop';
|
|
10
10
|
import { inject as service } from '@ember/service';
|
|
@@ -16,16 +16,13 @@ import Ember from 'ember';
|
|
|
16
16
|
import { resolve } from 'rsvp';
|
|
17
17
|
|
|
18
18
|
import { HAS_DEBUG_PACKAGE } from '@ember-data/private-build-infra';
|
|
19
|
-
import { DEPRECATE_SAVE_PROMISE_ACCESS } from '@ember-data/private-build-infra/deprecations';
|
|
20
|
-
import { recordIdentifierFor, storeFor } from '@ember-data/store';
|
|
21
19
|
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} from '@ember-data/store/-private';
|
|
20
|
+
DEPRECATE_EARLY_STATIC,
|
|
21
|
+
DEPRECATE_MODEL_REOPEN,
|
|
22
|
+
DEPRECATE_SAVE_PROMISE_ACCESS,
|
|
23
|
+
} from '@ember-data/private-build-infra/deprecations';
|
|
24
|
+
import { recordIdentifierFor, storeFor } from '@ember-data/store';
|
|
25
|
+
import { coerceId, deprecatedPromiseObject, recordDataFor, WeakCache } from '@ember-data/store/-private';
|
|
29
26
|
|
|
30
27
|
import Errors from './errors';
|
|
31
28
|
import { LegacySupport } from './legacy-relationships-support';
|
|
@@ -122,9 +119,10 @@ function computeOnce(target, key, desc) {
|
|
|
122
119
|
*/
|
|
123
120
|
class Model extends EmberObject {
|
|
124
121
|
@service store;
|
|
122
|
+
#notifications;
|
|
125
123
|
|
|
126
124
|
init(options = {}) {
|
|
127
|
-
if (DEBUG && !options._secretInit && !options.
|
|
125
|
+
if (DEBUG && !options._secretInit && !options._createProps) {
|
|
128
126
|
throw new EmberError(
|
|
129
127
|
'You should not call `create` on a model. Instead, call `store.createRecord` with the attributes you would like to set.'
|
|
130
128
|
);
|
|
@@ -140,19 +138,29 @@ class Model extends EmberObject {
|
|
|
140
138
|
|
|
141
139
|
this.setProperties(createProps);
|
|
142
140
|
|
|
143
|
-
// TODO pass something in such that we don't need internalModel
|
|
144
|
-
// to get this info
|
|
145
141
|
let store = storeFor(this);
|
|
146
142
|
let notifications = store._notificationManager;
|
|
147
143
|
let identity = recordIdentifierFor(this);
|
|
148
144
|
|
|
149
|
-
notifications.subscribe(identity, (identifier, type, key) => {
|
|
145
|
+
this.#notifications = notifications.subscribe(identity, (identifier, type, key) => {
|
|
150
146
|
notifyChanges(identifier, type, key, this, store);
|
|
151
147
|
});
|
|
152
148
|
}
|
|
153
149
|
|
|
154
|
-
|
|
150
|
+
destroy() {
|
|
155
151
|
LEGACY_SUPPORT.get(this)?.destroy();
|
|
152
|
+
this.___recordState?.destroy();
|
|
153
|
+
const store = storeFor(this);
|
|
154
|
+
const identifier = recordIdentifierFor(this);
|
|
155
|
+
store._notificationManager.unsubscribe(this.#notifications);
|
|
156
|
+
// Legacy behavior is to notify the relationships on destroy
|
|
157
|
+
// such that they "clear". It's uncertain this behavior would
|
|
158
|
+
// be good for a new model paradigm, likely cheaper and safer
|
|
159
|
+
// to simply not notify, for this reason the store does not itself
|
|
160
|
+
// notify individual changes once the delete has been signaled,
|
|
161
|
+
// this decision is left to model instances.
|
|
162
|
+
notifyChanges(identifier, 'relationships', undefined, this, store);
|
|
163
|
+
super.destroy();
|
|
156
164
|
}
|
|
157
165
|
|
|
158
166
|
/**
|
|
@@ -200,10 +208,10 @@ class Model extends EmberObject {
|
|
|
200
208
|
|
|
201
209
|
```javascript
|
|
202
210
|
let record = store.createRecord('model');
|
|
203
|
-
record.
|
|
211
|
+
record.isLoaded; // true
|
|
204
212
|
|
|
205
213
|
store.findRecord('model', 1).then(function(model) {
|
|
206
|
-
model.
|
|
214
|
+
model.isLoaded; // true
|
|
207
215
|
});
|
|
208
216
|
```
|
|
209
217
|
|
|
@@ -227,12 +235,12 @@ class Model extends EmberObject {
|
|
|
227
235
|
|
|
228
236
|
```javascript
|
|
229
237
|
let record = store.createRecord('model');
|
|
230
|
-
record.
|
|
238
|
+
record.hasDirtyAttributes; // true
|
|
231
239
|
|
|
232
240
|
store.findRecord('model', 1).then(function(model) {
|
|
233
|
-
model.
|
|
241
|
+
model.hasDirtyAttributes; // false
|
|
234
242
|
model.set('foo', 'some value');
|
|
235
|
-
model.
|
|
243
|
+
model.hasDirtyAttributes; // true
|
|
236
244
|
});
|
|
237
245
|
```
|
|
238
246
|
|
|
@@ -257,11 +265,11 @@ class Model extends EmberObject {
|
|
|
257
265
|
|
|
258
266
|
```javascript
|
|
259
267
|
let record = store.createRecord('model');
|
|
260
|
-
record.
|
|
268
|
+
record.isSaving; // false
|
|
261
269
|
let promise = record.save();
|
|
262
|
-
record.
|
|
270
|
+
record.isSaving; // true
|
|
263
271
|
promise.then(function() {
|
|
264
|
-
record.
|
|
272
|
+
record.isSaving; // false
|
|
265
273
|
});
|
|
266
274
|
```
|
|
267
275
|
|
|
@@ -287,24 +295,24 @@ class Model extends EmberObject {
|
|
|
287
295
|
|
|
288
296
|
```javascript
|
|
289
297
|
let record = store.createRecord('model');
|
|
290
|
-
record.
|
|
298
|
+
record.isDeleted; // false
|
|
291
299
|
record.deleteRecord();
|
|
292
300
|
|
|
293
301
|
// Locally deleted
|
|
294
|
-
record.
|
|
295
|
-
record.
|
|
296
|
-
record.
|
|
302
|
+
record.isDeleted; // true
|
|
303
|
+
record.hasDirtyAttributes; // true
|
|
304
|
+
record.isSaving; // false
|
|
297
305
|
|
|
298
306
|
// Persisting the deletion
|
|
299
307
|
let promise = record.save();
|
|
300
|
-
record.
|
|
301
|
-
record.
|
|
308
|
+
record.isDeleted; // true
|
|
309
|
+
record.isSaving; // true
|
|
302
310
|
|
|
303
311
|
// Deletion Persisted
|
|
304
312
|
promise.then(function() {
|
|
305
|
-
record.
|
|
306
|
-
record.
|
|
307
|
-
record.
|
|
313
|
+
record.isDeleted; // true
|
|
314
|
+
record.isSaving; // false
|
|
315
|
+
record.hasDirtyAttributes; // false
|
|
308
316
|
});
|
|
309
317
|
```
|
|
310
318
|
|
|
@@ -328,10 +336,10 @@ class Model extends EmberObject {
|
|
|
328
336
|
|
|
329
337
|
```javascript
|
|
330
338
|
let record = store.createRecord('model');
|
|
331
|
-
record.
|
|
339
|
+
record.isNew; // true
|
|
332
340
|
|
|
333
341
|
record.save().then(function(model) {
|
|
334
|
-
model.
|
|
342
|
+
model.isNew; // false
|
|
335
343
|
});
|
|
336
344
|
```
|
|
337
345
|
|
|
@@ -374,7 +382,7 @@ class Model extends EmberObject {
|
|
|
374
382
|
|
|
375
383
|
```javascript
|
|
376
384
|
let record = store.createRecord('model');
|
|
377
|
-
record.
|
|
385
|
+
record.dirtyType; // 'created'
|
|
378
386
|
```
|
|
379
387
|
|
|
380
388
|
@property dirtyType
|
|
@@ -395,10 +403,10 @@ class Model extends EmberObject {
|
|
|
395
403
|
Example
|
|
396
404
|
|
|
397
405
|
```javascript
|
|
398
|
-
record.
|
|
406
|
+
record.isError; // false
|
|
399
407
|
record.set('foo', 'valid value');
|
|
400
408
|
record.save().then(null, function() {
|
|
401
|
-
record.
|
|
409
|
+
record.isError; // true
|
|
402
410
|
});
|
|
403
411
|
```
|
|
404
412
|
|
|
@@ -444,10 +452,10 @@ class Model extends EmberObject {
|
|
|
444
452
|
|
|
445
453
|
```javascript
|
|
446
454
|
let record = store.createRecord('model');
|
|
447
|
-
record.
|
|
455
|
+
record.id; // null
|
|
448
456
|
|
|
449
457
|
store.findRecord('model', 1).then(function(model) {
|
|
450
|
-
model.
|
|
458
|
+
model.id; // '1'
|
|
451
459
|
});
|
|
452
460
|
```
|
|
453
461
|
|
|
@@ -457,24 +465,38 @@ class Model extends EmberObject {
|
|
|
457
465
|
*/
|
|
458
466
|
@tagged
|
|
459
467
|
get id() {
|
|
460
|
-
//
|
|
468
|
+
// this guard exists, because some dev-only deprecation code
|
|
461
469
|
// (addListener via validatePropertyInjections) invokes toString before the
|
|
462
470
|
// object is real.
|
|
463
471
|
if (DEBUG) {
|
|
464
|
-
|
|
472
|
+
try {
|
|
473
|
+
return recordIdentifierFor(this).id;
|
|
474
|
+
} catch {
|
|
465
475
|
return void 0;
|
|
466
476
|
}
|
|
467
477
|
}
|
|
468
|
-
return this.
|
|
478
|
+
return recordIdentifierFor(this).id;
|
|
469
479
|
}
|
|
470
480
|
set id(id) {
|
|
471
481
|
const normalizedId = coerceId(id);
|
|
482
|
+
const identifier = recordIdentifierFor(this);
|
|
483
|
+
let didChange = normalizedId !== identifier.id;
|
|
484
|
+
assert(
|
|
485
|
+
`Cannot set ${identifier.type} record's id to ${id}, because id is already ${identifier.id}`,
|
|
486
|
+
!didChange || identifier.id === null
|
|
487
|
+
);
|
|
472
488
|
|
|
473
|
-
if (normalizedId !== null) {
|
|
474
|
-
this.
|
|
489
|
+
if (normalizedId !== null && didChange) {
|
|
490
|
+
this.store._instanceCache.setRecordId(identifier.type, normalizedId, identifier.lid);
|
|
491
|
+
this.store._notificationManager.notify(identifier, 'identity');
|
|
475
492
|
}
|
|
476
493
|
}
|
|
477
494
|
|
|
495
|
+
// TODO just write a nice toString
|
|
496
|
+
toStringExtension() {
|
|
497
|
+
return this.id;
|
|
498
|
+
}
|
|
499
|
+
|
|
478
500
|
/**
|
|
479
501
|
@property currentState
|
|
480
502
|
@private
|
|
@@ -497,12 +519,6 @@ class Model extends EmberObject {
|
|
|
497
519
|
throw new Error('cannot set currentState');
|
|
498
520
|
}
|
|
499
521
|
|
|
500
|
-
/**
|
|
501
|
-
@property _internalModel
|
|
502
|
-
@private
|
|
503
|
-
@type {Object}
|
|
504
|
-
*/
|
|
505
|
-
|
|
506
522
|
/**
|
|
507
523
|
The store service instance which created this record instance
|
|
508
524
|
|
|
@@ -520,10 +536,10 @@ class Model extends EmberObject {
|
|
|
520
536
|
- `attribute` The name of the property associated with this error message
|
|
521
537
|
|
|
522
538
|
```javascript
|
|
523
|
-
record.
|
|
539
|
+
record.errors.length; // 0
|
|
524
540
|
record.set('foo', 'invalid value');
|
|
525
541
|
record.save().catch(function() {
|
|
526
|
-
record.
|
|
542
|
+
record.errors.foo;
|
|
527
543
|
// [{message: 'foo should be a number.', attribute: 'foo'}]
|
|
528
544
|
});
|
|
529
545
|
```
|
|
@@ -565,22 +581,7 @@ class Model extends EmberObject {
|
|
|
565
581
|
@computeOnce
|
|
566
582
|
get errors() {
|
|
567
583
|
let errors = Errors.create({ __record: this });
|
|
568
|
-
|
|
569
|
-
// with the code managing the update. Probably a
|
|
570
|
-
// lazy flush similar to retrieveLatest in ManyArray
|
|
571
|
-
let recordData = recordDataFor(this);
|
|
572
|
-
let jsonApiErrors;
|
|
573
|
-
if (recordData.getErrors) {
|
|
574
|
-
jsonApiErrors = recordData.getErrors();
|
|
575
|
-
if (jsonApiErrors) {
|
|
576
|
-
let errorsHash = errorsArrayToHash(jsonApiErrors);
|
|
577
|
-
let errorKeys = Object.keys(errorsHash);
|
|
578
|
-
|
|
579
|
-
for (let i = 0; i < errorKeys.length; i++) {
|
|
580
|
-
errors.add(errorKeys[i], errorsHash[errorKeys[i]]);
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
+
this.currentState.updateInvalidErrors(errors);
|
|
584
585
|
return errors;
|
|
585
586
|
}
|
|
586
587
|
|
|
@@ -812,7 +813,7 @@ class Model extends EmberObject {
|
|
|
812
813
|
and value is an [oldProp, newProp] array.
|
|
813
814
|
*/
|
|
814
815
|
changedAttributes() {
|
|
815
|
-
return this.
|
|
816
|
+
return recordDataFor(this).changedAttributes();
|
|
816
817
|
}
|
|
817
818
|
|
|
818
819
|
/**
|
|
@@ -822,11 +823,11 @@ class Model extends EmberObject {
|
|
|
822
823
|
Example
|
|
823
824
|
|
|
824
825
|
```javascript
|
|
825
|
-
record.
|
|
826
|
+
record.name; // 'Untitled Document'
|
|
826
827
|
record.set('name', 'Doc 1');
|
|
827
|
-
record.
|
|
828
|
+
record.name; // 'Doc 1'
|
|
828
829
|
record.rollbackAttributes();
|
|
829
|
-
record.
|
|
830
|
+
record.name; // 'Untitled Document'
|
|
830
831
|
```
|
|
831
832
|
|
|
832
833
|
@since 1.13.0
|
|
@@ -835,8 +836,13 @@ class Model extends EmberObject {
|
|
|
835
836
|
*/
|
|
836
837
|
rollbackAttributes() {
|
|
837
838
|
const { currentState } = this;
|
|
838
|
-
|
|
839
|
+
const { isNew } = currentState;
|
|
840
|
+
recordDataFor(this).rollbackAttributes();
|
|
841
|
+
this.errors.clear();
|
|
839
842
|
currentState.cleanErrorRequests();
|
|
843
|
+
if (isNew) {
|
|
844
|
+
this.unloadRecord();
|
|
845
|
+
}
|
|
840
846
|
}
|
|
841
847
|
|
|
842
848
|
/**
|
|
@@ -848,13 +854,6 @@ class Model extends EmberObject {
|
|
|
848
854
|
return storeFor(this)._instanceCache.createSnapshot(recordIdentifierFor(this));
|
|
849
855
|
}
|
|
850
856
|
|
|
851
|
-
toStringExtension() {
|
|
852
|
-
// the _internalModel guard exists, because some dev-only deprecation code
|
|
853
|
-
// (addListener via validatePropertyInjections) invokes toString before the
|
|
854
|
-
// object is real.
|
|
855
|
-
return this._internalModel && this._internalModel.id;
|
|
856
|
-
}
|
|
857
|
-
|
|
858
857
|
/**
|
|
859
858
|
Save the record and persist any changes to the record to an
|
|
860
859
|
external source via the adapter.
|
|
@@ -1258,12 +1257,46 @@ class Model extends EmberObject {
|
|
|
1258
1257
|
@return {Model} the type of the relationship, or undefined
|
|
1259
1258
|
*/
|
|
1260
1259
|
static typeForRelationship(name, store) {
|
|
1260
|
+
if (DEPRECATE_EARLY_STATIC) {
|
|
1261
|
+
deprecate(
|
|
1262
|
+
`Accessing schema information on Models without looking up the model via the store is deprecated. Use store.modelFor (or better Snapshots or the store.getSchemaDefinitionService() apis) instead.`,
|
|
1263
|
+
this.modelName,
|
|
1264
|
+
{
|
|
1265
|
+
id: 'ember-data:deprecate-early-static',
|
|
1266
|
+
for: 'ember-data',
|
|
1267
|
+
until: '5.0',
|
|
1268
|
+
since: { available: '4.8', enabled: '4.8' },
|
|
1269
|
+
}
|
|
1270
|
+
);
|
|
1271
|
+
} else {
|
|
1272
|
+
assert(
|
|
1273
|
+
`Accessing schema information on Models without looking up the model via the store is disallowed.`,
|
|
1274
|
+
this.modelName
|
|
1275
|
+
);
|
|
1276
|
+
}
|
|
1261
1277
|
let relationship = this.relationshipsByName.get(name);
|
|
1262
1278
|
return relationship && store.modelFor(relationship.type);
|
|
1263
1279
|
}
|
|
1264
1280
|
|
|
1265
1281
|
@computeOnce
|
|
1266
1282
|
static get inverseMap() {
|
|
1283
|
+
if (DEPRECATE_EARLY_STATIC) {
|
|
1284
|
+
deprecate(
|
|
1285
|
+
`Accessing schema information on Models without looking up the model via the store is deprecated. Use store.modelFor (or better Snapshots or the store.getSchemaDefinitionService() apis) instead.`,
|
|
1286
|
+
this.modelName,
|
|
1287
|
+
{
|
|
1288
|
+
id: 'ember-data:deprecate-early-static',
|
|
1289
|
+
for: 'ember-data',
|
|
1290
|
+
until: '5.0',
|
|
1291
|
+
since: { available: '4.8', enabled: '4.8' },
|
|
1292
|
+
}
|
|
1293
|
+
);
|
|
1294
|
+
} else {
|
|
1295
|
+
assert(
|
|
1296
|
+
`Accessing schema information on Models without looking up the model via the store is disallowed.`,
|
|
1297
|
+
this.modelName
|
|
1298
|
+
);
|
|
1299
|
+
}
|
|
1267
1300
|
return Object.create(null);
|
|
1268
1301
|
}
|
|
1269
1302
|
|
|
@@ -1301,6 +1334,23 @@ class Model extends EmberObject {
|
|
|
1301
1334
|
@return {Object} the inverse relationship, or null
|
|
1302
1335
|
*/
|
|
1303
1336
|
static inverseFor(name, store) {
|
|
1337
|
+
if (DEPRECATE_EARLY_STATIC) {
|
|
1338
|
+
deprecate(
|
|
1339
|
+
`Accessing schema information on Models without looking up the model via the store is deprecated. Use store.modelFor (or better Snapshots or the store.getSchemaDefinitionService() apis) instead.`,
|
|
1340
|
+
this.modelName,
|
|
1341
|
+
{
|
|
1342
|
+
id: 'ember-data:deprecate-early-static',
|
|
1343
|
+
for: 'ember-data',
|
|
1344
|
+
until: '5.0',
|
|
1345
|
+
since: { available: '4.8', enabled: '4.8' },
|
|
1346
|
+
}
|
|
1347
|
+
);
|
|
1348
|
+
} else {
|
|
1349
|
+
assert(
|
|
1350
|
+
`Accessing schema information on Models without looking up the model via the store is disallowed.`,
|
|
1351
|
+
this.modelName
|
|
1352
|
+
);
|
|
1353
|
+
}
|
|
1304
1354
|
let inverseMap = this.inverseMap;
|
|
1305
1355
|
if (inverseMap[name]) {
|
|
1306
1356
|
return inverseMap[name];
|
|
@@ -1313,6 +1363,23 @@ class Model extends EmberObject {
|
|
|
1313
1363
|
|
|
1314
1364
|
//Calculate the inverse, ignoring the cache
|
|
1315
1365
|
static _findInverseFor(name, store) {
|
|
1366
|
+
if (DEPRECATE_EARLY_STATIC) {
|
|
1367
|
+
deprecate(
|
|
1368
|
+
`Accessing schema information on Models without looking up the model via the store is deprecated. Use store.modelFor (or better Snapshots or the store.getSchemaDefinitionService() apis) instead.`,
|
|
1369
|
+
this.modelName,
|
|
1370
|
+
{
|
|
1371
|
+
id: 'ember-data:deprecate-early-static',
|
|
1372
|
+
for: 'ember-data',
|
|
1373
|
+
until: '5.0',
|
|
1374
|
+
since: { available: '4.8', enabled: '4.8' },
|
|
1375
|
+
}
|
|
1376
|
+
);
|
|
1377
|
+
} else {
|
|
1378
|
+
assert(
|
|
1379
|
+
`Accessing schema information on Models without looking up the model via the store is disallowed.`,
|
|
1380
|
+
this.modelName
|
|
1381
|
+
);
|
|
1382
|
+
}
|
|
1316
1383
|
let inverseType = this.typeForRelationship(name, store);
|
|
1317
1384
|
if (!inverseType) {
|
|
1318
1385
|
return null;
|
|
@@ -1441,10 +1508,10 @@ class Model extends EmberObject {
|
|
|
1441
1508
|
import Post from 'app/models/post';
|
|
1442
1509
|
|
|
1443
1510
|
let relationships = Blog.relationships;
|
|
1444
|
-
relationships.
|
|
1511
|
+
relationships.user;
|
|
1445
1512
|
//=> [ { name: 'users', kind: 'hasMany' },
|
|
1446
1513
|
// { name: 'owner', kind: 'belongsTo' } ]
|
|
1447
|
-
relationships.
|
|
1514
|
+
relationships.post;
|
|
1448
1515
|
//=> [ { name: 'posts', kind: 'hasMany' } ]
|
|
1449
1516
|
```
|
|
1450
1517
|
|
|
@@ -1457,6 +1524,23 @@ class Model extends EmberObject {
|
|
|
1457
1524
|
|
|
1458
1525
|
@computeOnce
|
|
1459
1526
|
static get relationships() {
|
|
1527
|
+
if (DEPRECATE_EARLY_STATIC) {
|
|
1528
|
+
deprecate(
|
|
1529
|
+
`Accessing schema information on Models without looking up the model via the store is deprecated. Use store.modelFor (or better Snapshots or the store.getSchemaDefinitionService() apis) instead.`,
|
|
1530
|
+
this.modelName,
|
|
1531
|
+
{
|
|
1532
|
+
id: 'ember-data:deprecate-early-static',
|
|
1533
|
+
for: 'ember-data',
|
|
1534
|
+
until: '5.0',
|
|
1535
|
+
since: { available: '4.8', enabled: '4.8' },
|
|
1536
|
+
}
|
|
1537
|
+
);
|
|
1538
|
+
} else {
|
|
1539
|
+
assert(
|
|
1540
|
+
`Accessing schema information on Models without looking up the model via the store is disallowed.`,
|
|
1541
|
+
this.modelName
|
|
1542
|
+
);
|
|
1543
|
+
}
|
|
1460
1544
|
let map = new Map();
|
|
1461
1545
|
let relationshipsByName = this.relationshipsByName;
|
|
1462
1546
|
|
|
@@ -1511,6 +1595,23 @@ class Model extends EmberObject {
|
|
|
1511
1595
|
*/
|
|
1512
1596
|
@computeOnce
|
|
1513
1597
|
static get relationshipNames() {
|
|
1598
|
+
if (DEPRECATE_EARLY_STATIC) {
|
|
1599
|
+
deprecate(
|
|
1600
|
+
`Accessing schema information on Models without looking up the model via the store is deprecated. Use store.modelFor (or better Snapshots or the store.getSchemaDefinitionService() apis) instead.`,
|
|
1601
|
+
this.modelName,
|
|
1602
|
+
{
|
|
1603
|
+
id: 'ember-data:deprecate-early-static',
|
|
1604
|
+
for: 'ember-data',
|
|
1605
|
+
until: '5.0',
|
|
1606
|
+
since: { available: '4.8', enabled: '4.8' },
|
|
1607
|
+
}
|
|
1608
|
+
);
|
|
1609
|
+
} else {
|
|
1610
|
+
assert(
|
|
1611
|
+
`Accessing schema information on Models without looking up the model via the store is disallowed.`,
|
|
1612
|
+
this.modelName
|
|
1613
|
+
);
|
|
1614
|
+
}
|
|
1514
1615
|
let names = {
|
|
1515
1616
|
hasMany: [],
|
|
1516
1617
|
belongsTo: [],
|
|
@@ -1561,6 +1662,23 @@ class Model extends EmberObject {
|
|
|
1561
1662
|
*/
|
|
1562
1663
|
@computeOnce
|
|
1563
1664
|
static get relatedTypes() {
|
|
1665
|
+
if (DEPRECATE_EARLY_STATIC) {
|
|
1666
|
+
deprecate(
|
|
1667
|
+
`Accessing schema information on Models without looking up the model via the store is deprecated. Use store.modelFor (or better Snapshots or the store.getSchemaDefinitionService() apis) instead.`,
|
|
1668
|
+
this.modelName,
|
|
1669
|
+
{
|
|
1670
|
+
id: 'ember-data:deprecate-early-static',
|
|
1671
|
+
for: 'ember-data',
|
|
1672
|
+
until: '5.0',
|
|
1673
|
+
since: { available: '4.8', enabled: '4.8' },
|
|
1674
|
+
}
|
|
1675
|
+
);
|
|
1676
|
+
} else {
|
|
1677
|
+
assert(
|
|
1678
|
+
`Accessing schema information on Models without looking up the model via the store is disallowed.`,
|
|
1679
|
+
this.modelName
|
|
1680
|
+
);
|
|
1681
|
+
}
|
|
1564
1682
|
let types = [];
|
|
1565
1683
|
|
|
1566
1684
|
let rels = this.relationshipsObject;
|
|
@@ -1606,9 +1724,9 @@ class Model extends EmberObject {
|
|
|
1606
1724
|
import Blog from 'app/models/blog';
|
|
1607
1725
|
|
|
1608
1726
|
let relationshipsByName = Blog.relationshipsByName;
|
|
1609
|
-
relationshipsByName.
|
|
1727
|
+
relationshipsByName.users;
|
|
1610
1728
|
//=> { key: 'users', kind: 'hasMany', type: 'user', options: Object, isRelationship: true }
|
|
1611
|
-
relationshipsByName.
|
|
1729
|
+
relationshipsByName.owner;
|
|
1612
1730
|
//=> { key: 'owner', kind: 'belongsTo', type: 'user', options: Object, isRelationship: true }
|
|
1613
1731
|
```
|
|
1614
1732
|
|
|
@@ -1620,6 +1738,23 @@ class Model extends EmberObject {
|
|
|
1620
1738
|
*/
|
|
1621
1739
|
@computeOnce
|
|
1622
1740
|
static get relationshipsByName() {
|
|
1741
|
+
if (DEPRECATE_EARLY_STATIC) {
|
|
1742
|
+
deprecate(
|
|
1743
|
+
`Accessing schema information on Models without looking up the model via the store is deprecated. Use store.modelFor (or better Snapshots or the store.getSchemaDefinitionService() apis) instead.`,
|
|
1744
|
+
this.modelName,
|
|
1745
|
+
{
|
|
1746
|
+
id: 'ember-data:deprecate-early-static',
|
|
1747
|
+
for: 'ember-data',
|
|
1748
|
+
until: '5.0',
|
|
1749
|
+
since: { available: '4.8', enabled: '4.8' },
|
|
1750
|
+
}
|
|
1751
|
+
);
|
|
1752
|
+
} else {
|
|
1753
|
+
assert(
|
|
1754
|
+
`Accessing schema information on Models without looking up the model via the store is disallowed.`,
|
|
1755
|
+
this.modelName
|
|
1756
|
+
);
|
|
1757
|
+
}
|
|
1623
1758
|
let map = new Map();
|
|
1624
1759
|
let rels = this.relationshipsObject;
|
|
1625
1760
|
let relationships = Object.keys(rels);
|
|
@@ -1636,6 +1771,23 @@ class Model extends EmberObject {
|
|
|
1636
1771
|
|
|
1637
1772
|
@computeOnce
|
|
1638
1773
|
static get relationshipsObject() {
|
|
1774
|
+
if (DEPRECATE_EARLY_STATIC) {
|
|
1775
|
+
deprecate(
|
|
1776
|
+
`Accessing schema information on Models without looking up the model via the store is deprecated. Use store.modelFor (or better Snapshots or the store.getSchemaDefinitionService() apis) instead.`,
|
|
1777
|
+
this.modelName,
|
|
1778
|
+
{
|
|
1779
|
+
id: 'ember-data:deprecate-early-static',
|
|
1780
|
+
for: 'ember-data',
|
|
1781
|
+
until: '5.0',
|
|
1782
|
+
since: { available: '4.8', enabled: '4.8' },
|
|
1783
|
+
}
|
|
1784
|
+
);
|
|
1785
|
+
} else {
|
|
1786
|
+
assert(
|
|
1787
|
+
`Accessing schema information on Models without looking up the model via the store is disallowed.`,
|
|
1788
|
+
this.modelName
|
|
1789
|
+
);
|
|
1790
|
+
}
|
|
1639
1791
|
let relationships = Object.create(null);
|
|
1640
1792
|
let modelName = this.modelName;
|
|
1641
1793
|
this.eachComputedProperty((name, meta) => {
|
|
@@ -1675,7 +1827,7 @@ class Model extends EmberObject {
|
|
|
1675
1827
|
|
|
1676
1828
|
let fields = Blog.fields;
|
|
1677
1829
|
fields.forEach(function(kind, field) {
|
|
1678
|
-
|
|
1830
|
+
// do thing
|
|
1679
1831
|
});
|
|
1680
1832
|
|
|
1681
1833
|
// prints:
|
|
@@ -1693,6 +1845,23 @@ class Model extends EmberObject {
|
|
|
1693
1845
|
*/
|
|
1694
1846
|
@computeOnce
|
|
1695
1847
|
static get fields() {
|
|
1848
|
+
if (DEPRECATE_EARLY_STATIC) {
|
|
1849
|
+
deprecate(
|
|
1850
|
+
`Accessing schema information on Models without looking up the model via the store is deprecated. Use store.modelFor (or better Snapshots or the store.getSchemaDefinitionService() apis) instead.`,
|
|
1851
|
+
this.modelName,
|
|
1852
|
+
{
|
|
1853
|
+
id: 'ember-data:deprecate-early-static',
|
|
1854
|
+
for: 'ember-data',
|
|
1855
|
+
until: '5.0',
|
|
1856
|
+
since: { available: '4.8', enabled: '4.8' },
|
|
1857
|
+
}
|
|
1858
|
+
);
|
|
1859
|
+
} else {
|
|
1860
|
+
assert(
|
|
1861
|
+
`Accessing schema information on Models without looking up the model via the store is disallowed.`,
|
|
1862
|
+
this.modelName
|
|
1863
|
+
);
|
|
1864
|
+
}
|
|
1696
1865
|
let map = new Map();
|
|
1697
1866
|
|
|
1698
1867
|
this.eachComputedProperty((name, meta) => {
|
|
@@ -1718,6 +1887,23 @@ class Model extends EmberObject {
|
|
|
1718
1887
|
@param {any} binding the value to which the callback's `this` should be bound
|
|
1719
1888
|
*/
|
|
1720
1889
|
static eachRelationship(callback, binding) {
|
|
1890
|
+
if (DEPRECATE_EARLY_STATIC) {
|
|
1891
|
+
deprecate(
|
|
1892
|
+
`Accessing schema information on Models without looking up the model via the store is deprecated. Use store.modelFor (or better Snapshots or the store.getSchemaDefinitionService() apis) instead.`,
|
|
1893
|
+
this.modelName,
|
|
1894
|
+
{
|
|
1895
|
+
id: 'ember-data:deprecate-early-static',
|
|
1896
|
+
for: 'ember-data',
|
|
1897
|
+
until: '5.0',
|
|
1898
|
+
since: { available: '4.8', enabled: '4.8' },
|
|
1899
|
+
}
|
|
1900
|
+
);
|
|
1901
|
+
} else {
|
|
1902
|
+
assert(
|
|
1903
|
+
`Accessing schema information on Models without looking up the model via the store is disallowed.`,
|
|
1904
|
+
this.modelName
|
|
1905
|
+
);
|
|
1906
|
+
}
|
|
1721
1907
|
this.relationshipsByName.forEach((relationship, name) => {
|
|
1722
1908
|
callback.call(binding, name, relationship);
|
|
1723
1909
|
});
|
|
@@ -1736,6 +1922,23 @@ class Model extends EmberObject {
|
|
|
1736
1922
|
@param {any} binding the value to which the callback's `this` should be bound
|
|
1737
1923
|
*/
|
|
1738
1924
|
static eachRelatedType(callback, binding) {
|
|
1925
|
+
if (DEPRECATE_EARLY_STATIC) {
|
|
1926
|
+
deprecate(
|
|
1927
|
+
`Accessing schema information on Models without looking up the model via the store is deprecated. Use store.modelFor (or better Snapshots or the store.getSchemaDefinitionService() apis) instead.`,
|
|
1928
|
+
this.modelName,
|
|
1929
|
+
{
|
|
1930
|
+
id: 'ember-data:deprecate-early-static',
|
|
1931
|
+
for: 'ember-data',
|
|
1932
|
+
until: '5.0',
|
|
1933
|
+
since: { available: '4.8', enabled: '4.8' },
|
|
1934
|
+
}
|
|
1935
|
+
);
|
|
1936
|
+
} else {
|
|
1937
|
+
assert(
|
|
1938
|
+
`Accessing schema information on Models without looking up the model via the store is disallowed.`,
|
|
1939
|
+
this.modelName
|
|
1940
|
+
);
|
|
1941
|
+
}
|
|
1739
1942
|
let relationshipTypes = this.relatedTypes;
|
|
1740
1943
|
|
|
1741
1944
|
for (let i = 0; i < relationshipTypes.length; i++) {
|
|
@@ -1745,6 +1948,23 @@ class Model extends EmberObject {
|
|
|
1745
1948
|
}
|
|
1746
1949
|
|
|
1747
1950
|
static determineRelationshipType(knownSide, store) {
|
|
1951
|
+
if (DEPRECATE_EARLY_STATIC) {
|
|
1952
|
+
deprecate(
|
|
1953
|
+
`Accessing schema information on Models without looking up the model via the store is deprecated. Use store.modelFor (or better Snapshots or the store.getSchemaDefinitionService() apis) instead.`,
|
|
1954
|
+
this.modelName,
|
|
1955
|
+
{
|
|
1956
|
+
id: 'ember-data:deprecate-early-static',
|
|
1957
|
+
for: 'ember-data',
|
|
1958
|
+
until: '5.0',
|
|
1959
|
+
since: { available: '4.8', enabled: '4.8' },
|
|
1960
|
+
}
|
|
1961
|
+
);
|
|
1962
|
+
} else {
|
|
1963
|
+
assert(
|
|
1964
|
+
`Accessing schema information on Models without looking up the model via the store is disallowed.`,
|
|
1965
|
+
this.modelName
|
|
1966
|
+
);
|
|
1967
|
+
}
|
|
1748
1968
|
let knownKey = knownSide.key;
|
|
1749
1969
|
let knownKind = knownSide.kind;
|
|
1750
1970
|
let inverse = this.inverseFor(knownKey, store);
|
|
@@ -1789,7 +2009,7 @@ class Model extends EmberObject {
|
|
|
1789
2009
|
let attributes = Person.attributes
|
|
1790
2010
|
|
|
1791
2011
|
attributes.forEach(function(meta, name) {
|
|
1792
|
-
|
|
2012
|
+
// do thing
|
|
1793
2013
|
});
|
|
1794
2014
|
|
|
1795
2015
|
// prints:
|
|
@@ -1806,6 +2026,23 @@ class Model extends EmberObject {
|
|
|
1806
2026
|
*/
|
|
1807
2027
|
@computeOnce
|
|
1808
2028
|
static get attributes() {
|
|
2029
|
+
if (DEPRECATE_EARLY_STATIC) {
|
|
2030
|
+
deprecate(
|
|
2031
|
+
`Accessing schema information on Models without looking up the model via the store is deprecated. Use store.modelFor (or better Snapshots or the store.getSchemaDefinitionService() apis) instead.`,
|
|
2032
|
+
this.modelName,
|
|
2033
|
+
{
|
|
2034
|
+
id: 'ember-data:deprecate-early-static',
|
|
2035
|
+
for: 'ember-data',
|
|
2036
|
+
until: '5.0',
|
|
2037
|
+
since: { available: '4.8', enabled: '4.8' },
|
|
2038
|
+
}
|
|
2039
|
+
);
|
|
2040
|
+
} else {
|
|
2041
|
+
assert(
|
|
2042
|
+
`Accessing schema information on Models without looking up the model via the store is disallowed.`,
|
|
2043
|
+
this.modelName
|
|
2044
|
+
);
|
|
2045
|
+
}
|
|
1809
2046
|
let map = new Map();
|
|
1810
2047
|
|
|
1811
2048
|
this.eachComputedProperty((name, meta) => {
|
|
@@ -1849,7 +2086,7 @@ class Model extends EmberObject {
|
|
|
1849
2086
|
let transformedAttributes = Person.transformedAttributes
|
|
1850
2087
|
|
|
1851
2088
|
transformedAttributes.forEach(function(field, type) {
|
|
1852
|
-
|
|
2089
|
+
// do thing
|
|
1853
2090
|
});
|
|
1854
2091
|
|
|
1855
2092
|
// prints:
|
|
@@ -1865,6 +2102,23 @@ class Model extends EmberObject {
|
|
|
1865
2102
|
*/
|
|
1866
2103
|
@computeOnce
|
|
1867
2104
|
static get transformedAttributes() {
|
|
2105
|
+
if (DEPRECATE_EARLY_STATIC) {
|
|
2106
|
+
deprecate(
|
|
2107
|
+
`Accessing schema information on Models without looking up the model via the store is deprecated. Use store.modelFor (or better Snapshots or the store.getSchemaDefinitionService() apis) instead.`,
|
|
2108
|
+
this.modelName,
|
|
2109
|
+
{
|
|
2110
|
+
id: 'ember-data:deprecate-early-static',
|
|
2111
|
+
for: 'ember-data',
|
|
2112
|
+
until: '5.0',
|
|
2113
|
+
since: { available: '4.8', enabled: '4.8' },
|
|
2114
|
+
}
|
|
2115
|
+
);
|
|
2116
|
+
} else {
|
|
2117
|
+
assert(
|
|
2118
|
+
`Accessing schema information on Models without looking up the model via the store is disallowed.`,
|
|
2119
|
+
this.modelName
|
|
2120
|
+
);
|
|
2121
|
+
}
|
|
1868
2122
|
let map = new Map();
|
|
1869
2123
|
|
|
1870
2124
|
this.eachAttribute((key, meta) => {
|
|
@@ -1905,7 +2159,7 @@ class Model extends EmberObject {
|
|
|
1905
2159
|
}
|
|
1906
2160
|
|
|
1907
2161
|
PersonModel.eachAttribute(function(name, meta) {
|
|
1908
|
-
|
|
2162
|
+
// do thing
|
|
1909
2163
|
});
|
|
1910
2164
|
|
|
1911
2165
|
// prints:
|
|
@@ -1921,6 +2175,23 @@ class Model extends EmberObject {
|
|
|
1921
2175
|
@static
|
|
1922
2176
|
*/
|
|
1923
2177
|
static eachAttribute(callback, binding) {
|
|
2178
|
+
if (DEPRECATE_EARLY_STATIC) {
|
|
2179
|
+
deprecate(
|
|
2180
|
+
`Accessing schema information on Models without looking up the model via the store is deprecated. Use store.modelFor (or better Snapshots or the store.getSchemaDefinitionService() apis) instead.`,
|
|
2181
|
+
this.modelName,
|
|
2182
|
+
{
|
|
2183
|
+
id: 'ember-data:deprecate-early-static',
|
|
2184
|
+
for: 'ember-data',
|
|
2185
|
+
until: '5.0',
|
|
2186
|
+
since: { available: '4.8', enabled: '4.8' },
|
|
2187
|
+
}
|
|
2188
|
+
);
|
|
2189
|
+
} else {
|
|
2190
|
+
assert(
|
|
2191
|
+
`Accessing schema information on Models without looking up the model via the store is disallowed.`,
|
|
2192
|
+
this.modelName
|
|
2193
|
+
);
|
|
2194
|
+
}
|
|
1924
2195
|
this.attributes.forEach((meta, name) => {
|
|
1925
2196
|
callback.call(binding, name, meta);
|
|
1926
2197
|
});
|
|
@@ -1957,7 +2228,7 @@ class Model extends EmberObject {
|
|
|
1957
2228
|
});
|
|
1958
2229
|
|
|
1959
2230
|
Person.eachTransformedAttribute(function(name, type) {
|
|
1960
|
-
|
|
2231
|
+
// do thing
|
|
1961
2232
|
});
|
|
1962
2233
|
|
|
1963
2234
|
// prints:
|
|
@@ -1972,6 +2243,23 @@ class Model extends EmberObject {
|
|
|
1972
2243
|
@static
|
|
1973
2244
|
*/
|
|
1974
2245
|
static eachTransformedAttribute(callback, binding) {
|
|
2246
|
+
if (DEPRECATE_EARLY_STATIC) {
|
|
2247
|
+
deprecate(
|
|
2248
|
+
`Accessing schema information on Models without looking up the model via the store is deprecated. Use store.modelFor (or better Snapshots or the store.getSchemaDefinitionService() apis) instead.`,
|
|
2249
|
+
this.modelName,
|
|
2250
|
+
{
|
|
2251
|
+
id: 'ember-data:deprecate-early-static',
|
|
2252
|
+
for: 'ember-data',
|
|
2253
|
+
until: '5.0',
|
|
2254
|
+
since: { available: '4.8', enabled: '4.8' },
|
|
2255
|
+
}
|
|
2256
|
+
);
|
|
2257
|
+
} else {
|
|
2258
|
+
assert(
|
|
2259
|
+
`Accessing schema information on Models without looking up the model via the store is disallowed.`,
|
|
2260
|
+
this.modelName
|
|
2261
|
+
);
|
|
2262
|
+
}
|
|
1975
2263
|
this.transformedAttributes.forEach((type, name) => {
|
|
1976
2264
|
callback.call(binding, name, type);
|
|
1977
2265
|
});
|
|
@@ -1985,13 +2273,29 @@ class Model extends EmberObject {
|
|
|
1985
2273
|
@static
|
|
1986
2274
|
*/
|
|
1987
2275
|
static toString() {
|
|
1988
|
-
|
|
2276
|
+
if (DEPRECATE_EARLY_STATIC) {
|
|
2277
|
+
deprecate(
|
|
2278
|
+
`Accessing schema information on Models without looking up the model via the store is deprecated. Use store.modelFor (or better Snapshots or the store.getSchemaDefinitionService() apis) instead.`,
|
|
2279
|
+
this.modelName,
|
|
2280
|
+
{
|
|
2281
|
+
id: 'ember-data:deprecate-early-static',
|
|
2282
|
+
for: 'ember-data',
|
|
2283
|
+
until: '5.0',
|
|
2284
|
+
since: { available: '4.8', enabled: '4.8' },
|
|
2285
|
+
}
|
|
2286
|
+
);
|
|
2287
|
+
} else {
|
|
2288
|
+
assert(
|
|
2289
|
+
`Accessing schema information on Models without looking up the model via the store is disallowed.`,
|
|
2290
|
+
this.modelName
|
|
2291
|
+
);
|
|
2292
|
+
}
|
|
2293
|
+
return `model:${this.modelName}`;
|
|
1989
2294
|
}
|
|
1990
2295
|
}
|
|
1991
2296
|
|
|
1992
2297
|
// this is required to prevent `init` from passing
|
|
1993
2298
|
// the values initialized during create to `setUnknownProperty`
|
|
1994
|
-
Model.prototype._internalModel = null;
|
|
1995
2299
|
Model.prototype._createProps = null;
|
|
1996
2300
|
Model.prototype._secretInit = null;
|
|
1997
2301
|
|
|
@@ -2071,27 +2375,11 @@ if (DEBUG) {
|
|
|
2071
2375
|
} while (current !== null);
|
|
2072
2376
|
return null;
|
|
2073
2377
|
};
|
|
2074
|
-
let isBasicDesc = function isBasicDesc(desc) {
|
|
2075
|
-
return (
|
|
2076
|
-
!desc ||
|
|
2077
|
-
(!desc.get && !desc.set && desc.enumerable === true && desc.writable === true && desc.configurable === true)
|
|
2078
|
-
);
|
|
2079
|
-
};
|
|
2080
|
-
let isDefaultEmptyDescriptor = function isDefaultEmptyDescriptor(obj, keyName) {
|
|
2081
|
-
let instanceDesc = lookupDescriptor(obj, keyName);
|
|
2082
|
-
return isBasicDesc(instanceDesc) && lookupDescriptor(obj.constructor, keyName) === null;
|
|
2083
|
-
};
|
|
2084
2378
|
|
|
2085
2379
|
Model.reopen({
|
|
2086
2380
|
init() {
|
|
2087
2381
|
this._super(...arguments);
|
|
2088
2382
|
|
|
2089
|
-
if (!isDefaultEmptyDescriptor(this, '_internalModel') || !(this._internalModel instanceof InternalModel)) {
|
|
2090
|
-
throw new Error(
|
|
2091
|
-
`'_internalModel' is a reserved property name on instances of classes extending Model. Please choose a different property name for ${this.constructor.toString()}`
|
|
2092
|
-
);
|
|
2093
|
-
}
|
|
2094
|
-
|
|
2095
2383
|
let ourDescriptor = lookupDescriptor(Model.prototype, 'currentState');
|
|
2096
2384
|
let theirDescriptor = lookupDescriptor(this, 'currentState');
|
|
2097
2385
|
let realState = this.___recordState;
|
|
@@ -2111,6 +2399,35 @@ if (DEBUG) {
|
|
|
2111
2399
|
}
|
|
2112
2400
|
},
|
|
2113
2401
|
});
|
|
2402
|
+
|
|
2403
|
+
if (DEPRECATE_MODEL_REOPEN) {
|
|
2404
|
+
const originalReopen = Model.reopen;
|
|
2405
|
+
const originalReopenClass = Model.reopenClass;
|
|
2406
|
+
|
|
2407
|
+
Model.reopen = function deprecatedReopen() {
|
|
2408
|
+
deprecate(`Model.reopen is deprecated. Use Foo extends Model to extend your class instead.`, false, {
|
|
2409
|
+
id: 'ember-data:deprecate-model-reopen',
|
|
2410
|
+
for: 'ember-data',
|
|
2411
|
+
until: '5.0',
|
|
2412
|
+
since: { available: '4.8', enabled: '4.8' },
|
|
2413
|
+
});
|
|
2414
|
+
return originalReopen.call(this, arguments);
|
|
2415
|
+
};
|
|
2416
|
+
|
|
2417
|
+
Model.reopenClass = function deprecatedReopenClass() {
|
|
2418
|
+
deprecate(
|
|
2419
|
+
`Model.reopenClass is deprecated. Use Foo extends Model to add static methods and properties to your class instead.`,
|
|
2420
|
+
false,
|
|
2421
|
+
{
|
|
2422
|
+
id: 'ember-data:deprecate-model-reopenclass',
|
|
2423
|
+
for: 'ember-data',
|
|
2424
|
+
until: '5.0',
|
|
2425
|
+
since: { available: '4.8', enabled: '4.8' },
|
|
2426
|
+
}
|
|
2427
|
+
);
|
|
2428
|
+
return originalReopenClass.call(this, arguments);
|
|
2429
|
+
};
|
|
2430
|
+
}
|
|
2114
2431
|
}
|
|
2115
2432
|
|
|
2116
2433
|
export default Model;
|