@ember-data/model 5.4.1-beta.1 → 5.4.1-beta.2
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/README.md +1 -1
- package/dist/-private.js +2 -2
- package/dist/{has-many-DT3JBYYG.js → has-many-BXU96bZ9.js} +13 -5
- package/dist/has-many-BXU96bZ9.js.map +1 -0
- package/dist/{hooks-CNY5g4Ab.js → hooks-o1U_cEA3.js} +2 -2
- package/dist/{hooks-CNY5g4Ab.js.map → hooks-o1U_cEA3.js.map} +1 -1
- package/dist/hooks.js +2 -2
- package/dist/index.js +4 -4
- package/dist/migration-support.js +177 -2
- package/dist/migration-support.js.map +1 -1
- package/dist/{model-rk3atPqV.js → model-Dkk-TZlL.js} +82 -88
- package/dist/model-Dkk-TZlL.js.map +1 -0
- package/dist/{schema-provider-Bvogtzx9.js → schema-provider-DyG6fJXt.js} +1 -1
- package/dist/{schema-provider-Bvogtzx9.js.map → schema-provider-DyG6fJXt.js.map} +1 -1
- package/package.json +16 -18
- package/unstable-preview-types/-private/belongs-to.d.ts +2 -2
- package/unstable-preview-types/-private/belongs-to.d.ts.map +1 -1
- package/unstable-preview-types/-private/errors.d.ts +2 -2
- package/unstable-preview-types/-private/has-many.d.ts +2 -2
- package/unstable-preview-types/-private/legacy-relationships-support.d.ts.map +1 -1
- package/unstable-preview-types/-private/model.d.ts.map +1 -1
- package/unstable-preview-types/-private/notify-changes.d.ts.map +1 -1
- package/unstable-preview-types/-private/promise-many-array.d.ts +9 -4
- package/unstable-preview-types/-private/promise-many-array.d.ts.map +1 -1
- package/unstable-preview-types/-private/record-state.d.ts +3 -3
- package/unstable-preview-types/-private/record-state.d.ts.map +1 -1
- package/unstable-preview-types/-private/references/belongs-to.d.ts +6 -3
- package/unstable-preview-types/-private/references/belongs-to.d.ts.map +1 -1
- package/unstable-preview-types/-private/references/has-many.d.ts +6 -3
- package/unstable-preview-types/-private/references/has-many.d.ts.map +1 -1
- package/unstable-preview-types/index.d.ts +18 -17
- package/unstable-preview-types/migration-support.d.ts +210 -3
- package/unstable-preview-types/migration-support.d.ts.map +1 -1
- package/unstable-preview-types/migration-support.type-test.d.ts +4 -0
- package/unstable-preview-types/migration-support.type-test.d.ts.map +1 -0
- package/dist/has-many-DT3JBYYG.js.map +0 -1
- package/dist/model-rk3atPqV.js.map +0 -1
|
@@ -3,9 +3,7 @@ import { dasherize } from '@ember-data/request-utils/string';
|
|
|
3
3
|
import { macroCondition, getGlobalConfig, dependencySatisfies, importSync } from '@embroider/macros';
|
|
4
4
|
import EmberObject, { computed, get } from '@ember/object';
|
|
5
5
|
import { recordIdentifierFor as recordIdentifierFor$1, storeFor as storeFor$1 } from '@ember-data/store';
|
|
6
|
-
import { isStableIdentifier, recordIdentifierFor, storeFor, peekCache, SOURCE, fastPush, RelatedCollection, coerceId } from '@ember-data/store/-private';
|
|
7
|
-
import { cached, compat, notifySignal } from '@ember-data/tracking';
|
|
8
|
-
import { defineSignal, subscribed } from '@ember-data/tracking/-private';
|
|
6
|
+
import { memoized, defineSignal, defineNonEnumerableSignal, isStableIdentifier, recordIdentifierFor, storeFor, peekCache, SOURCE, fastPush, RelatedCollection, notifyInternalSignal, ARRAY_SIGNAL, peekInternalSignal, withSignalStore, gate, coerceId, entangleSignal } from '@ember-data/store/-private';
|
|
9
7
|
import { RecordStore } from '@warp-drive/core-types/symbols';
|
|
10
8
|
import { A } from '@ember/array';
|
|
11
9
|
import ArrayProxy from '@ember/array/proxy';
|
|
@@ -145,7 +143,7 @@ class PromiseBelongsTo extends Extended {
|
|
|
145
143
|
// however, meta on relationships does not trigger change notifications.
|
|
146
144
|
// if you need relationship meta, you should do `record.belongsTo(relationshipName).meta()`
|
|
147
145
|
static {
|
|
148
|
-
decorateMethodV2(this.prototype, "id", [
|
|
146
|
+
decorateMethodV2(this.prototype, "id", [memoized]);
|
|
149
147
|
}
|
|
150
148
|
get meta() {
|
|
151
149
|
// eslint-disable-next-line no-constant-condition
|
|
@@ -217,6 +215,21 @@ class PromiseManyArray {
|
|
|
217
215
|
return this.content ? this.content.length : 0;
|
|
218
216
|
}
|
|
219
217
|
|
|
218
|
+
// this will error if someone tries to call
|
|
219
|
+
// A(identifierArray) since it is not configurable
|
|
220
|
+
// which is preferrable to the `meta` override we used
|
|
221
|
+
// before which required importing all of Ember
|
|
222
|
+
static {
|
|
223
|
+
decorateMethodV2(this.prototype, "length", [memoized]);
|
|
224
|
+
}
|
|
225
|
+
get '[]'() {
|
|
226
|
+
// ember-source < 3.23 (e.g. 3.20 lts)
|
|
227
|
+
// requires that the tag `'[]'` be notified
|
|
228
|
+
// on the ArrayProxy in order for `{{#each}}`
|
|
229
|
+
// to recompute. We entangle content.
|
|
230
|
+
return this.content?.length && this.content;
|
|
231
|
+
}
|
|
232
|
+
|
|
220
233
|
/**
|
|
221
234
|
* Iterate the proxied content. Called by the glimmer iterator in #each
|
|
222
235
|
* We do not guarantee that forEach will always be available. This
|
|
@@ -228,7 +241,7 @@ class PromiseManyArray {
|
|
|
228
241
|
* @private
|
|
229
242
|
*/
|
|
230
243
|
static {
|
|
231
|
-
decorateMethodV2(this.prototype,
|
|
244
|
+
decorateMethodV2(this.prototype, '[]', [memoized]);
|
|
232
245
|
}
|
|
233
246
|
forEach(cb) {
|
|
234
247
|
if (this.content && this.length) {
|
|
@@ -258,28 +271,32 @@ class PromiseManyArray {
|
|
|
258
271
|
/**
|
|
259
272
|
* Whether the loading promise is still pending
|
|
260
273
|
*
|
|
261
|
-
* @property
|
|
274
|
+
* @property isPending
|
|
275
|
+
* @type {Boolean}
|
|
262
276
|
* @public
|
|
263
277
|
*/
|
|
264
278
|
|
|
265
279
|
/**
|
|
266
280
|
* Whether the loading promise rejected
|
|
267
281
|
*
|
|
268
|
-
* @property
|
|
282
|
+
* @property isRejected
|
|
283
|
+
* @type {Boolean}
|
|
269
284
|
* @public
|
|
270
285
|
*/
|
|
271
286
|
|
|
272
287
|
/**
|
|
273
288
|
* Whether the loading promise succeeded
|
|
274
289
|
*
|
|
275
|
-
* @property
|
|
290
|
+
* @property isFulfilled
|
|
291
|
+
* @type {Boolean}
|
|
276
292
|
* @public
|
|
277
293
|
*/
|
|
278
294
|
|
|
279
295
|
/**
|
|
280
296
|
* Whether the loading promise completed (resolved or rejected)
|
|
281
297
|
*
|
|
282
|
-
* @property
|
|
298
|
+
* @property isSettled
|
|
299
|
+
* @type {Boolean}
|
|
283
300
|
* @public
|
|
284
301
|
*/
|
|
285
302
|
|
|
@@ -344,7 +361,7 @@ class PromiseManyArray {
|
|
|
344
361
|
* @public
|
|
345
362
|
*/
|
|
346
363
|
static {
|
|
347
|
-
decorateMethodV2(this.prototype, "links", [
|
|
364
|
+
decorateMethodV2(this.prototype, "links", [memoized]);
|
|
348
365
|
}
|
|
349
366
|
get meta() {
|
|
350
367
|
return this.content ? this.content.meta : undefined;
|
|
@@ -352,7 +369,7 @@ class PromiseManyArray {
|
|
|
352
369
|
|
|
353
370
|
//---- Our own stuff
|
|
354
371
|
static {
|
|
355
|
-
decorateMethodV2(this.prototype, "meta", [
|
|
372
|
+
decorateMethodV2(this.prototype, "meta", [memoized]);
|
|
356
373
|
}
|
|
357
374
|
_update(promise, content) {
|
|
358
375
|
if (content !== undefined) {
|
|
@@ -373,28 +390,6 @@ defineSignal(PromiseManyArray.prototype, 'isPending', false);
|
|
|
373
390
|
defineSignal(PromiseManyArray.prototype, 'isRejected', false);
|
|
374
391
|
defineSignal(PromiseManyArray.prototype, 'isFulfilled', false);
|
|
375
392
|
defineSignal(PromiseManyArray.prototype, 'isSettled', false);
|
|
376
|
-
|
|
377
|
-
// this will error if someone tries to call
|
|
378
|
-
// A(identifierArray) since it is not configurable
|
|
379
|
-
// which is preferrable to the `meta` override we used
|
|
380
|
-
// before which required importing all of Ember
|
|
381
|
-
if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_COMPUTED_CHAINS)) {
|
|
382
|
-
const desc = {
|
|
383
|
-
enumerable: true,
|
|
384
|
-
configurable: false,
|
|
385
|
-
get: function () {
|
|
386
|
-
return this.content?.length && this.content;
|
|
387
|
-
}
|
|
388
|
-
};
|
|
389
|
-
compat(desc);
|
|
390
|
-
|
|
391
|
-
// ember-source < 3.23 (e.g. 3.20 lts)
|
|
392
|
-
// requires that the tag `'[]'` be notified
|
|
393
|
-
// on the ArrayProxy in order for `{{#each}}`
|
|
394
|
-
// to recompute. We entangle the '[]' tag from content
|
|
395
|
-
|
|
396
|
-
Object.defineProperty(PromiseManyArray.prototype, '[]', desc);
|
|
397
|
-
}
|
|
398
393
|
function tapPromise(proxy, promise) {
|
|
399
394
|
proxy.isPending = true;
|
|
400
395
|
proxy.isSettled = false;
|
|
@@ -486,14 +481,16 @@ class HasManyReference {
|
|
|
486
481
|
/**
|
|
487
482
|
* The field name on the parent record for this has-many relationship.
|
|
488
483
|
*
|
|
489
|
-
* @property
|
|
484
|
+
* @property key
|
|
485
|
+
* @type {String}
|
|
490
486
|
* @public
|
|
491
487
|
*/
|
|
492
488
|
|
|
493
489
|
/**
|
|
494
490
|
* The type of resource this relationship will contain.
|
|
495
491
|
*
|
|
496
|
-
* @property
|
|
492
|
+
* @property type
|
|
493
|
+
* @type {String}
|
|
497
494
|
* @public
|
|
498
495
|
*/
|
|
499
496
|
|
|
@@ -533,7 +530,8 @@ class HasManyReference {
|
|
|
533
530
|
/**
|
|
534
531
|
* An array of identifiers for the records that this reference refers to.
|
|
535
532
|
*
|
|
536
|
-
* @property
|
|
533
|
+
* @property identifiers
|
|
534
|
+
* @type {StableRecordIdentifier[]}
|
|
537
535
|
* @public
|
|
538
536
|
*/
|
|
539
537
|
get identifiers() {
|
|
@@ -567,7 +565,7 @@ class HasManyReference {
|
|
|
567
565
|
return [];
|
|
568
566
|
}
|
|
569
567
|
static {
|
|
570
|
-
decorateMethodV2(this.prototype, "identifiers", [
|
|
568
|
+
decorateMethodV2(this.prototype, "identifiers", [memoized]);
|
|
571
569
|
}
|
|
572
570
|
_resource() {
|
|
573
571
|
const cache = this.store.cache;
|
|
@@ -1036,7 +1034,7 @@ class HasManyReference {
|
|
|
1036
1034
|
return support.reloadHasMany(this.key, options);
|
|
1037
1035
|
}
|
|
1038
1036
|
}
|
|
1039
|
-
|
|
1037
|
+
defineNonEnumerableSignal(HasManyReference.prototype, '_ref', 0);
|
|
1040
1038
|
function isMaybeResource(object) {
|
|
1041
1039
|
const keys = Object.keys(object).filter(k => k !== 'id' && k !== 'type' && k !== 'lid');
|
|
1042
1040
|
return keys.length > 0;
|
|
@@ -1097,14 +1095,16 @@ class BelongsToReference {
|
|
|
1097
1095
|
/**
|
|
1098
1096
|
* The field name on the parent record for this has-many relationship.
|
|
1099
1097
|
*
|
|
1100
|
-
* @property
|
|
1098
|
+
* @property key
|
|
1099
|
+
* @type {String}
|
|
1101
1100
|
* @public
|
|
1102
1101
|
*/
|
|
1103
1102
|
|
|
1104
1103
|
/**
|
|
1105
1104
|
* The type of resource this relationship will contain.
|
|
1106
1105
|
*
|
|
1107
|
-
* @property
|
|
1106
|
+
* @property type
|
|
1107
|
+
* @type {String}
|
|
1108
1108
|
* @public
|
|
1109
1109
|
*/
|
|
1110
1110
|
|
|
@@ -1141,7 +1141,8 @@ class BelongsToReference {
|
|
|
1141
1141
|
* The identifier of the record that this reference refers to.
|
|
1142
1142
|
* `null` if no related record is known.
|
|
1143
1143
|
*
|
|
1144
|
-
* @property
|
|
1144
|
+
* @property identifier
|
|
1145
|
+
* @type {StableRecordIdentifier | null}
|
|
1145
1146
|
* @public
|
|
1146
1147
|
*/
|
|
1147
1148
|
get identifier() {
|
|
@@ -1197,7 +1198,7 @@ class BelongsToReference {
|
|
|
1197
1198
|
@return {String} The id of the record in this belongsTo relationship.
|
|
1198
1199
|
*/
|
|
1199
1200
|
static {
|
|
1200
|
-
decorateMethodV2(this.prototype, "identifier", [
|
|
1201
|
+
decorateMethodV2(this.prototype, "identifier", [memoized]);
|
|
1201
1202
|
}
|
|
1202
1203
|
id() {
|
|
1203
1204
|
return this.identifier?.id || null;
|
|
@@ -1620,7 +1621,7 @@ class BelongsToReference {
|
|
|
1620
1621
|
return support.reloadBelongsTo(this.key, options).then(() => this.value());
|
|
1621
1622
|
}
|
|
1622
1623
|
}
|
|
1623
|
-
|
|
1624
|
+
defineNonEnumerableSignal(BelongsToReference.prototype, '_ref', 0);
|
|
1624
1625
|
const LEGACY_SUPPORT = getOrSetGlobal('LEGACY_SUPPORT', new Map());
|
|
1625
1626
|
function lookupLegacySupport(record) {
|
|
1626
1627
|
const identifier = recordIdentifierFor(record);
|
|
@@ -2232,7 +2233,7 @@ function handleCompletedRelationshipRequest(recordExt, key, relationship, value,
|
|
|
2232
2233
|
if (isHasMany) {
|
|
2233
2234
|
// we don't notify the record property here to avoid refetch
|
|
2234
2235
|
// only the many array
|
|
2235
|
-
value
|
|
2236
|
+
notifyInternalSignal(value[ARRAY_SIGNAL]);
|
|
2236
2237
|
}
|
|
2237
2238
|
if (error) {
|
|
2238
2239
|
relationship.state.hasFailedLoadAttempt = true;
|
|
@@ -2528,7 +2529,7 @@ class Errors extends ArrayProxyWithCustomOverrides {
|
|
|
2528
2529
|
```
|
|
2529
2530
|
@method add
|
|
2530
2531
|
@public
|
|
2531
|
-
@param {
|
|
2532
|
+
@param {String} attribute - the property name of an attribute or relationship
|
|
2532
2533
|
@param {string[]|string} messages - an error message or array of error messages for the attribute
|
|
2533
2534
|
*/
|
|
2534
2535
|
add(attribute, messages) {
|
|
@@ -2582,7 +2583,7 @@ class Errors extends ArrayProxyWithCustomOverrides {
|
|
|
2582
2583
|
```
|
|
2583
2584
|
@method remove
|
|
2584
2585
|
@public
|
|
2585
|
-
@param {
|
|
2586
|
+
@param {String} member - the property name of an attribute or relationship
|
|
2586
2587
|
*/
|
|
2587
2588
|
remove(attribute) {
|
|
2588
2589
|
if (this.isEmpty) {
|
|
@@ -2803,7 +2804,7 @@ function notifyChanges(identifier, value, key, record, store) {
|
|
|
2803
2804
|
}
|
|
2804
2805
|
break;
|
|
2805
2806
|
case 'identity':
|
|
2806
|
-
record
|
|
2807
|
+
notifyInternalSignal(peekInternalSignal(withSignalStore(record), 'id'));
|
|
2807
2808
|
break;
|
|
2808
2809
|
}
|
|
2809
2810
|
}
|
|
@@ -2820,7 +2821,7 @@ function notifyRelationship(identifier, key, record, meta) {
|
|
|
2820
2821
|
return;
|
|
2821
2822
|
}
|
|
2822
2823
|
if (manyArray) {
|
|
2823
|
-
manyArray
|
|
2824
|
+
notifyInternalSignal(manyArray[ARRAY_SIGNAL]);
|
|
2824
2825
|
|
|
2825
2826
|
//We need to notifyPropertyChange in the adding case because we need to make sure
|
|
2826
2827
|
//we fetch the newly added record in case it is unloaded
|
|
@@ -2988,7 +2989,11 @@ class RecordState {
|
|
|
2988
2989
|
storeFor$1(this.record).notifications.unsubscribe(this.handler);
|
|
2989
2990
|
}
|
|
2990
2991
|
notify(key) {
|
|
2991
|
-
|
|
2992
|
+
const signals = withSignalStore(this);
|
|
2993
|
+
const signal = peekInternalSignal(signals, key);
|
|
2994
|
+
if (signal) {
|
|
2995
|
+
notifyInternalSignal(signal);
|
|
2996
|
+
}
|
|
2992
2997
|
}
|
|
2993
2998
|
updateInvalidErrors(errors) {
|
|
2994
2999
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
@@ -3031,7 +3036,7 @@ class RecordState {
|
|
|
3031
3036
|
return !this.isLoaded && this.pendingCount > 0 && this.fulfilledCount === 0;
|
|
3032
3037
|
}
|
|
3033
3038
|
static {
|
|
3034
|
-
decorateMethodV2(this.prototype, "isLoading", [
|
|
3039
|
+
decorateMethodV2(this.prototype, "isLoading", [gate]);
|
|
3035
3040
|
}
|
|
3036
3041
|
get isLoaded() {
|
|
3037
3042
|
if (this.isNew) {
|
|
@@ -3040,7 +3045,7 @@ class RecordState {
|
|
|
3040
3045
|
return this.fulfilledCount > 0 || !this.isEmpty;
|
|
3041
3046
|
}
|
|
3042
3047
|
static {
|
|
3043
|
-
decorateMethodV2(this.prototype, "isLoaded", [
|
|
3048
|
+
decorateMethodV2(this.prototype, "isLoaded", [gate]);
|
|
3044
3049
|
}
|
|
3045
3050
|
get isSaved() {
|
|
3046
3051
|
const rd = this.cache;
|
|
@@ -3058,7 +3063,7 @@ class RecordState {
|
|
|
3058
3063
|
return true;
|
|
3059
3064
|
}
|
|
3060
3065
|
static {
|
|
3061
|
-
decorateMethodV2(this.prototype, "isSaved", [
|
|
3066
|
+
decorateMethodV2(this.prototype, "isSaved", [gate]);
|
|
3062
3067
|
}
|
|
3063
3068
|
get isEmpty() {
|
|
3064
3069
|
const rd = this.cache;
|
|
@@ -3072,7 +3077,7 @@ class RecordState {
|
|
|
3072
3077
|
return !this.isNew && rd.isEmpty(this.identifier);
|
|
3073
3078
|
}
|
|
3074
3079
|
static {
|
|
3075
|
-
decorateMethodV2(this.prototype, "isEmpty", [
|
|
3080
|
+
decorateMethodV2(this.prototype, "isEmpty", [gate]);
|
|
3076
3081
|
}
|
|
3077
3082
|
get isNew() {
|
|
3078
3083
|
const rd = this.cache;
|
|
@@ -3084,7 +3089,7 @@ class RecordState {
|
|
|
3084
3089
|
return rd.isNew(this.identifier);
|
|
3085
3090
|
}
|
|
3086
3091
|
static {
|
|
3087
|
-
decorateMethodV2(this.prototype, "isNew", [
|
|
3092
|
+
decorateMethodV2(this.prototype, "isNew", [gate]);
|
|
3088
3093
|
}
|
|
3089
3094
|
get isDeleted() {
|
|
3090
3095
|
const rd = this.cache;
|
|
@@ -3096,13 +3101,13 @@ class RecordState {
|
|
|
3096
3101
|
return rd.isDeleted(this.identifier);
|
|
3097
3102
|
}
|
|
3098
3103
|
static {
|
|
3099
|
-
decorateMethodV2(this.prototype, "isDeleted", [
|
|
3104
|
+
decorateMethodV2(this.prototype, "isDeleted", [gate]);
|
|
3100
3105
|
}
|
|
3101
3106
|
get isValid() {
|
|
3102
3107
|
return this.record.errors.length === 0;
|
|
3103
3108
|
}
|
|
3104
3109
|
static {
|
|
3105
|
-
decorateMethodV2(this.prototype, "isValid", [
|
|
3110
|
+
decorateMethodV2(this.prototype, "isValid", [gate]);
|
|
3106
3111
|
}
|
|
3107
3112
|
get isDirty() {
|
|
3108
3113
|
const rd = this.cache;
|
|
@@ -3112,7 +3117,7 @@ class RecordState {
|
|
|
3112
3117
|
return this.isDeleted || this.isNew || rd.hasChangedAttrs(this.identifier);
|
|
3113
3118
|
}
|
|
3114
3119
|
static {
|
|
3115
|
-
decorateMethodV2(this.prototype, "isDirty", [
|
|
3120
|
+
decorateMethodV2(this.prototype, "isDirty", [gate]);
|
|
3116
3121
|
}
|
|
3117
3122
|
get isError() {
|
|
3118
3123
|
const errorReq = this._errorRequests[this._errorRequests.length - 1];
|
|
@@ -3123,7 +3128,7 @@ class RecordState {
|
|
|
3123
3128
|
}
|
|
3124
3129
|
}
|
|
3125
3130
|
static {
|
|
3126
|
-
decorateMethodV2(this.prototype, "isError", [
|
|
3131
|
+
decorateMethodV2(this.prototype, "isError", [gate]);
|
|
3127
3132
|
}
|
|
3128
3133
|
get adapterError() {
|
|
3129
3134
|
const request = this._lastError;
|
|
@@ -3133,13 +3138,13 @@ class RecordState {
|
|
|
3133
3138
|
return request.state === 'rejected' && request.response.data;
|
|
3134
3139
|
}
|
|
3135
3140
|
static {
|
|
3136
|
-
decorateMethodV2(this.prototype, "adapterError", [
|
|
3141
|
+
decorateMethodV2(this.prototype, "adapterError", [gate]);
|
|
3137
3142
|
}
|
|
3138
3143
|
get isPreloaded() {
|
|
3139
3144
|
return !this.isEmpty && this.isLoading;
|
|
3140
3145
|
}
|
|
3141
3146
|
static {
|
|
3142
|
-
decorateMethodV2(this.prototype, "isPreloaded", [
|
|
3147
|
+
decorateMethodV2(this.prototype, "isPreloaded", [memoized]);
|
|
3143
3148
|
}
|
|
3144
3149
|
get stateName() {
|
|
3145
3150
|
// we might be empty while loading so check this first
|
|
@@ -3186,7 +3191,7 @@ class RecordState {
|
|
|
3186
3191
|
}
|
|
3187
3192
|
}
|
|
3188
3193
|
static {
|
|
3189
|
-
decorateMethodV2(this.prototype, "stateName", [
|
|
3194
|
+
decorateMethodV2(this.prototype, "stateName", [memoized]);
|
|
3190
3195
|
}
|
|
3191
3196
|
get dirtyType() {
|
|
3192
3197
|
// we might be empty while loading so check this first
|
|
@@ -3211,7 +3216,7 @@ class RecordState {
|
|
|
3211
3216
|
}
|
|
3212
3217
|
}
|
|
3213
3218
|
static {
|
|
3214
|
-
decorateMethodV2(this.prototype, "dirtyType", [
|
|
3219
|
+
decorateMethodV2(this.prototype, "dirtyType", [memoized]);
|
|
3215
3220
|
}
|
|
3216
3221
|
}
|
|
3217
3222
|
defineSignal(RecordState.prototype, 'isSaving', false);
|
|
@@ -3304,18 +3309,6 @@ class Model extends EmberObject {
|
|
|
3304
3309
|
this.___recordState?.destroy();
|
|
3305
3310
|
const store = storeFor$1(this);
|
|
3306
3311
|
store.notifications.unsubscribe(this.___private_notifications);
|
|
3307
|
-
// Legacy behavior is to notify the relationships on destroy
|
|
3308
|
-
// such that they "clear". It's uncertain this behavior would
|
|
3309
|
-
// be good for a new model paradigm, likely cheaper and safer
|
|
3310
|
-
// to simply not notify, for this reason the store does not itself
|
|
3311
|
-
// notify individual changes once the delete has been signaled,
|
|
3312
|
-
// this decision is left to model instances.
|
|
3313
|
-
|
|
3314
|
-
this.eachRelationship((name, meta) => {
|
|
3315
|
-
if (meta.kind === 'belongsTo') {
|
|
3316
|
-
this.notifyPropertyChange(name);
|
|
3317
|
-
}
|
|
3318
|
-
});
|
|
3319
3312
|
LEGACY_SUPPORT.get(this)?.destroy();
|
|
3320
3313
|
LEGACY_SUPPORT.delete(this);
|
|
3321
3314
|
LEGACY_SUPPORT.delete(identifier);
|
|
@@ -3350,7 +3343,7 @@ class Model extends EmberObject {
|
|
|
3350
3343
|
@readOnly
|
|
3351
3344
|
*/
|
|
3352
3345
|
static {
|
|
3353
|
-
decorateMethodV2(this.prototype, "isEmpty", [
|
|
3346
|
+
decorateMethodV2(this.prototype, "isEmpty", [memoized]);
|
|
3354
3347
|
}
|
|
3355
3348
|
get isLoading() {
|
|
3356
3349
|
return this.currentState.isLoading;
|
|
@@ -3374,7 +3367,7 @@ class Model extends EmberObject {
|
|
|
3374
3367
|
@readOnly
|
|
3375
3368
|
*/
|
|
3376
3369
|
static {
|
|
3377
|
-
decorateMethodV2(this.prototype, "isLoading", [
|
|
3370
|
+
decorateMethodV2(this.prototype, "isLoading", [memoized]);
|
|
3378
3371
|
}
|
|
3379
3372
|
get isLoaded() {
|
|
3380
3373
|
return this.currentState.isLoaded;
|
|
@@ -3401,7 +3394,7 @@ class Model extends EmberObject {
|
|
|
3401
3394
|
@readOnly
|
|
3402
3395
|
*/
|
|
3403
3396
|
static {
|
|
3404
|
-
decorateMethodV2(this.prototype, "isLoaded", [
|
|
3397
|
+
decorateMethodV2(this.prototype, "isLoaded", [memoized]);
|
|
3405
3398
|
}
|
|
3406
3399
|
get hasDirtyAttributes() {
|
|
3407
3400
|
return this.currentState.isDirty;
|
|
@@ -3428,7 +3421,7 @@ class Model extends EmberObject {
|
|
|
3428
3421
|
@readOnly
|
|
3429
3422
|
*/
|
|
3430
3423
|
static {
|
|
3431
|
-
decorateMethodV2(this.prototype, "hasDirtyAttributes", [
|
|
3424
|
+
decorateMethodV2(this.prototype, "hasDirtyAttributes", [memoized]);
|
|
3432
3425
|
}
|
|
3433
3426
|
get isSaving() {
|
|
3434
3427
|
return this.currentState.isSaving;
|
|
@@ -3467,7 +3460,7 @@ class Model extends EmberObject {
|
|
|
3467
3460
|
@readOnly
|
|
3468
3461
|
*/
|
|
3469
3462
|
static {
|
|
3470
|
-
decorateMethodV2(this.prototype, "isSaving", [
|
|
3463
|
+
decorateMethodV2(this.prototype, "isSaving", [memoized]);
|
|
3471
3464
|
}
|
|
3472
3465
|
get isDeleted() {
|
|
3473
3466
|
return this.currentState.isDeleted;
|
|
@@ -3492,7 +3485,7 @@ class Model extends EmberObject {
|
|
|
3492
3485
|
@readOnly
|
|
3493
3486
|
*/
|
|
3494
3487
|
static {
|
|
3495
|
-
decorateMethodV2(this.prototype, "isDeleted", [
|
|
3488
|
+
decorateMethodV2(this.prototype, "isDeleted", [memoized]);
|
|
3496
3489
|
}
|
|
3497
3490
|
get isNew() {
|
|
3498
3491
|
return this.currentState.isNew;
|
|
@@ -3508,7 +3501,7 @@ class Model extends EmberObject {
|
|
|
3508
3501
|
@readOnly
|
|
3509
3502
|
*/
|
|
3510
3503
|
static {
|
|
3511
|
-
decorateMethodV2(this.prototype, "isNew", [
|
|
3504
|
+
decorateMethodV2(this.prototype, "isNew", [memoized]);
|
|
3512
3505
|
}
|
|
3513
3506
|
get isValid() {
|
|
3514
3507
|
return this.currentState.isValid;
|
|
@@ -3532,7 +3525,7 @@ class Model extends EmberObject {
|
|
|
3532
3525
|
@readOnly
|
|
3533
3526
|
*/
|
|
3534
3527
|
static {
|
|
3535
|
-
decorateMethodV2(this.prototype, "isValid", [
|
|
3528
|
+
decorateMethodV2(this.prototype, "isValid", [memoized]);
|
|
3536
3529
|
}
|
|
3537
3530
|
get dirtyType() {
|
|
3538
3531
|
return this.currentState.dirtyType;
|
|
@@ -3556,13 +3549,13 @@ class Model extends EmberObject {
|
|
|
3556
3549
|
@readOnly
|
|
3557
3550
|
*/
|
|
3558
3551
|
static {
|
|
3559
|
-
decorateMethodV2(this.prototype, "dirtyType", [
|
|
3552
|
+
decorateMethodV2(this.prototype, "dirtyType", [memoized]);
|
|
3560
3553
|
}
|
|
3561
3554
|
get isError() {
|
|
3562
3555
|
return this.currentState.isError;
|
|
3563
3556
|
}
|
|
3564
3557
|
static {
|
|
3565
|
-
decorateMethodV2(this.prototype, "isError", [
|
|
3558
|
+
decorateMethodV2(this.prototype, "isError", [memoized]);
|
|
3566
3559
|
}
|
|
3567
3560
|
set isError(v) {
|
|
3568
3561
|
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
@@ -3614,7 +3607,7 @@ class Model extends EmberObject {
|
|
|
3614
3607
|
return recordIdentifierFor$1(this).id;
|
|
3615
3608
|
}
|
|
3616
3609
|
static {
|
|
3617
|
-
decorateMethodV2(this.prototype, "id", [
|
|
3610
|
+
decorateMethodV2(this.prototype, "id", [gate]);
|
|
3618
3611
|
}
|
|
3619
3612
|
set id(id) {
|
|
3620
3613
|
const normalizedId = coerceId(id);
|
|
@@ -3654,7 +3647,7 @@ class Model extends EmberObject {
|
|
|
3654
3647
|
return this.___recordState;
|
|
3655
3648
|
}
|
|
3656
3649
|
static {
|
|
3657
|
-
decorateMethodV2(this.prototype, "currentState", [
|
|
3650
|
+
decorateMethodV2(this.prototype, "currentState", [gate]);
|
|
3658
3651
|
}
|
|
3659
3652
|
set currentState(_v) {
|
|
3660
3653
|
throw new Error('cannot set currentState');
|
|
@@ -3732,7 +3725,7 @@ class Model extends EmberObject {
|
|
|
3732
3725
|
return this.currentState.adapterError;
|
|
3733
3726
|
}
|
|
3734
3727
|
static {
|
|
3735
|
-
decorateMethodV2(this.prototype, "adapterError", [
|
|
3728
|
+
decorateMethodV2(this.prototype, "adapterError", [memoized]);
|
|
3736
3729
|
}
|
|
3737
3730
|
set adapterError(v) {
|
|
3738
3731
|
throw new Error(`adapterError is not directly settable`);
|
|
@@ -3760,7 +3753,8 @@ class Model extends EmberObject {
|
|
|
3760
3753
|
*/
|
|
3761
3754
|
// @ts-expect-error no return is necessary, but Ember's types are forcing it
|
|
3762
3755
|
notifyPropertyChange(prop) {
|
|
3763
|
-
|
|
3756
|
+
const signals = withSignalStore(this);
|
|
3757
|
+
entangleSignal(signals, this, prop, undefined);
|
|
3764
3758
|
super.notifyPropertyChange(prop);
|
|
3765
3759
|
}
|
|
3766
3760
|
|