@ember-data/model 5.4.0-beta.9 → 5.4.1-beta.0

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.
Files changed (72) hide show
  1. package/LICENSE.md +19 -7
  2. package/README.md +2 -2
  3. package/dist/-private.js +3 -2
  4. package/dist/-private.js.map +1 -1
  5. package/dist/{has-many-78F2FHCC.js → has-many-DT3JBYYG.js} +2 -2
  6. package/dist/has-many-DT3JBYYG.js.map +1 -0
  7. package/dist/{hooks-BgrTI_ff.js → hooks-CNY5g4Ab.js} +2 -2
  8. package/dist/{hooks-BgrTI_ff.js.map → hooks-CNY5g4Ab.js.map} +1 -1
  9. package/dist/hooks.js +2 -2
  10. package/dist/index.js +5 -4
  11. package/dist/index.js.map +1 -1
  12. package/dist/migration-support.js +5 -2
  13. package/dist/migration-support.js.map +1 -1
  14. package/dist/{model-BFnMMaye.js → model-rk3atPqV.js} +132 -634
  15. package/dist/model-rk3atPqV.js.map +1 -0
  16. package/dist/{schema-provider-Cgpcwfn7.js → schema-provider-Bvogtzx9.js} +10 -7
  17. package/dist/schema-provider-Bvogtzx9.js.map +1 -0
  18. package/logos/NCC-1701-a-blue.svg +4 -0
  19. package/logos/NCC-1701-a-gold.svg +4 -0
  20. package/logos/NCC-1701-a-gold_100.svg +1 -0
  21. package/logos/NCC-1701-a-gold_base-64.txt +1 -0
  22. package/logos/NCC-1701-a.svg +4 -0
  23. package/logos/README.md +4 -0
  24. package/logos/docs-badge.svg +2 -0
  25. package/logos/github-header.svg +444 -0
  26. package/logos/social1.png +0 -0
  27. package/logos/social2.png +0 -0
  28. package/logos/warp-drive-logo-dark.svg +4 -0
  29. package/logos/warp-drive-logo-gold.svg +4 -0
  30. package/package.json +51 -71
  31. package/unstable-preview-types/-private/attr.d.ts +2 -1
  32. package/unstable-preview-types/-private/attr.d.ts.map +1 -1
  33. package/unstable-preview-types/-private/belongs-to.d.ts +1 -0
  34. package/unstable-preview-types/-private/belongs-to.d.ts.map +1 -1
  35. package/unstable-preview-types/-private/debug/assert-polymorphic-type.d.ts.map +1 -1
  36. package/unstable-preview-types/-private/errors.d.ts +0 -2
  37. package/unstable-preview-types/-private/errors.d.ts.map +1 -1
  38. package/unstable-preview-types/-private/legacy-relationships-support.d.ts +1 -1
  39. package/unstable-preview-types/-private/legacy-relationships-support.d.ts.map +1 -1
  40. package/unstable-preview-types/-private/model.d.ts +22 -25
  41. package/unstable-preview-types/-private/model.d.ts.map +1 -1
  42. package/unstable-preview-types/-private/notify-changes.d.ts.map +1 -1
  43. package/unstable-preview-types/-private/promise-belongs-to.d.ts +0 -2
  44. package/unstable-preview-types/-private/promise-belongs-to.d.ts.map +1 -1
  45. package/unstable-preview-types/-private/promise-many-array.d.ts +1 -1
  46. package/unstable-preview-types/-private/promise-many-array.d.ts.map +1 -1
  47. package/unstable-preview-types/-private/promise-proxy-base.d.ts +5 -0
  48. package/unstable-preview-types/-private/promise-proxy-base.d.ts.map +1 -0
  49. package/unstable-preview-types/-private/record-state.d.ts +1 -11
  50. package/unstable-preview-types/-private/record-state.d.ts.map +1 -1
  51. package/unstable-preview-types/-private/references/belongs-to.d.ts.map +1 -1
  52. package/unstable-preview-types/-private/references/has-many.d.ts +2 -2
  53. package/unstable-preview-types/-private/references/has-many.d.ts.map +1 -1
  54. package/unstable-preview-types/-private/schema-provider.d.ts +8 -7
  55. package/unstable-preview-types/-private/schema-provider.d.ts.map +1 -1
  56. package/unstable-preview-types/-private/type-utils.d.ts +1 -1
  57. package/unstable-preview-types/-private/type-utils.d.ts.map +1 -1
  58. package/unstable-preview-types/-private/util.d.ts +0 -3
  59. package/unstable-preview-types/-private/util.d.ts.map +1 -1
  60. package/unstable-preview-types/-private.d.ts +1 -1
  61. package/unstable-preview-types/-private.d.ts.map +1 -1
  62. package/unstable-preview-types/index.d.ts +18 -18
  63. package/unstable-preview-types/index.d.ts.map +1 -1
  64. package/unstable-preview-types/migration-support.d.ts +12 -4
  65. package/unstable-preview-types/migration-support.d.ts.map +1 -1
  66. package/dist/has-many-78F2FHCC.js.map +0 -1
  67. package/dist/model-BFnMMaye.js.map +0 -1
  68. package/dist/schema-provider-Cgpcwfn7.js.map +0 -1
  69. package/unstable-preview-types/-private/many-array.d.ts +0 -196
  70. package/unstable-preview-types/-private/many-array.d.ts.map +0 -1
  71. /package/{ember-data-logo-dark.svg → logos/ember-data-logo-dark.svg} +0 -0
  72. /package/{ember-data-logo-light.svg → logos/ember-data-logo-light.svg} +0 -0
@@ -3,15 +3,16 @@ 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 { LiveArray, MUTATE, SOURCE, recordIdentifierFor, ARRAY_SIGNAL, notifyArray, isStableIdentifier, storeFor, peekCache, fastPush, coerceId } from '@ember-data/store/-private';
7
- import { cached, compat } from '@ember-data/tracking';
8
- import { addToTransaction, defineSignal, peekSignal, getSignal, subscribe } from '@ember-data/tracking/-private';
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';
9
9
  import { RecordStore } from '@warp-drive/core-types/symbols';
10
10
  import { A } from '@ember/array';
11
11
  import ArrayProxy from '@ember/array/proxy';
12
12
  import { mapBy, not } from '@ember/object/computed';
13
13
  import { upgradeStore } from '@ember-data/legacy-compat/-private';
14
14
  import { getOrSetGlobal } from '@warp-drive/core-types/-private';
15
+ import { EnableHydration } from '@warp-drive/core-types/request';
15
16
  import PromiseProxyMixin from '@ember/object/promise-proxy-mixin';
16
17
  import ObjectProxy from '@ember/object/proxy';
17
18
  import { cacheFor } from '@ember/object/internals';
@@ -38,7 +39,7 @@ function normalizeModelName(type) {
38
39
  until: '6.0',
39
40
  for: 'ember-data',
40
41
  since: {
41
- available: '5.3',
42
+ available: '4.13',
42
43
  enabled: '5.3'
43
44
  }
44
45
  });
@@ -46,487 +47,8 @@ function normalizeModelName(type) {
46
47
  }
47
48
  return type;
48
49
  }
49
-
50
- /**
51
- @module @ember-data/store
52
- */
53
- /**
54
- A `ManyArray` is a `MutableArray` that represents the contents of a has-many
55
- relationship.
56
-
57
- The `ManyArray` is instantiated lazily the first time the relationship is
58
- requested.
59
-
60
- This class is not intended to be directly instantiated by consuming applications.
61
-
62
- ### Inverses
63
-
64
- Often, the relationships in Ember Data applications will have
65
- an inverse. For example, imagine the following models are
66
- defined:
67
-
68
- ```app/models/post.js
69
- import Model, { hasMany } from '@ember-data/model';
70
-
71
- export default class PostModel extends Model {
72
- @hasMany('comment') comments;
73
- }
74
- ```
75
-
76
- ```app/models/comment.js
77
- import Model, { belongsTo } from '@ember-data/model';
78
-
79
- export default class CommentModel extends Model {
80
- @belongsTo('post') post;
81
- }
82
- ```
83
-
84
- If you created a new instance of `Post` and added
85
- a `Comment` record to its `comments` has-many
86
- relationship, you would expect the comment's `post`
87
- property to be set to the post that contained
88
- the has-many.
89
-
90
- We call the record to which a relationship belongs-to the
91
- relationship's _owner_.
92
-
93
- @class ManyArray
94
- @public
95
- */
96
- class RelatedCollection extends LiveArray {
97
- /**
98
- The loading state of this array
99
- @property {Boolean} isLoaded
100
- @public
101
- */
102
-
103
- /**
104
- `true` if the relationship is polymorphic, `false` otherwise.
105
- @property {Boolean} isPolymorphic
106
- @private
107
- */
108
-
109
- /**
110
- Metadata associated with the request for async hasMany relationships.
111
- Example
112
- Given that the server returns the following JSON payload when fetching a
113
- hasMany relationship:
114
- ```js
115
- {
116
- "comments": [{
117
- "id": 1,
118
- "comment": "This is the first comment",
119
- }, {
120
- // ...
121
- }],
122
- "meta": {
123
- "page": 1,
124
- "total": 5
125
- }
126
- }
127
- ```
128
- You can then access the meta data via the `meta` property:
129
- ```js
130
- let comments = await post.comments;
131
- let meta = comments.meta;
132
- // meta.page => 1
133
- // meta.total => 5
134
- ```
135
- @property {Object | null} meta
136
- @public
137
- */
138
-
139
- /**
140
- * Retrieve the links for this relationship
141
- *
142
- @property {Object | null} links
143
- @public
144
- */
145
-
146
- constructor(options) {
147
- super(options);
148
- this.isLoaded = options.isLoaded || false;
149
- this.isAsync = options.isAsync || false;
150
- this.isPolymorphic = options.isPolymorphic || false;
151
- this.identifier = options.identifier;
152
- this.key = options.key;
153
- }
154
- [MUTATE](target, receiver, prop, args, _SIGNAL) {
155
- switch (prop) {
156
- case 'length 0':
157
- {
158
- Reflect.set(target, 'length', 0);
159
- mutateReplaceRelatedRecords(this, [], _SIGNAL);
160
- return true;
161
- }
162
- case 'replace cell':
163
- {
164
- const [index, prior, value] = args;
165
- target[index] = value;
166
- mutateReplaceRelatedRecord(this, {
167
- value,
168
- prior,
169
- index
170
- }, _SIGNAL);
171
- return true;
172
- }
173
- case 'push':
174
- {
175
- const newValues = extractIdentifiersFromRecords(args);
176
- assertNoDuplicates(this, target, currentState => currentState.push(...newValues), `Cannot push duplicates to a hasMany's state.`);
177
- if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_MANY_ARRAY_DUPLICATES)) {
178
- // dedupe
179
- const seen = new Set(target);
180
- const unique = new Set();
181
- args.forEach(item => {
182
- const identifier = recordIdentifierFor(item);
183
- if (!seen.has(identifier)) {
184
- seen.add(identifier);
185
- unique.add(item);
186
- }
187
- });
188
- const newArgs = Array.from(unique);
189
- const result = Reflect.apply(target[prop], receiver, newArgs);
190
- if (newArgs.length) {
191
- mutateAddToRelatedRecords(this, {
192
- value: extractIdentifiersFromRecords(newArgs)
193
- }, _SIGNAL);
194
- }
195
- return result;
196
- }
197
-
198
- // else, no dedupe, error on duplicates
199
- const result = Reflect.apply(target[prop], receiver, args);
200
- if (newValues.length) {
201
- mutateAddToRelatedRecords(this, {
202
- value: newValues
203
- }, _SIGNAL);
204
- }
205
- return result;
206
- }
207
- case 'pop':
208
- {
209
- const result = Reflect.apply(target[prop], receiver, args);
210
- if (result) {
211
- mutateRemoveFromRelatedRecords(this, {
212
- value: recordIdentifierFor(result)
213
- }, _SIGNAL);
214
- }
215
- return result;
216
- }
217
- case 'unshift':
218
- {
219
- const newValues = extractIdentifiersFromRecords(args);
220
- assertNoDuplicates(this, target, currentState => currentState.unshift(...newValues), `Cannot unshift duplicates to a hasMany's state.`);
221
- if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_MANY_ARRAY_DUPLICATES)) {
222
- // dedupe
223
- const seen = new Set(target);
224
- const unique = new Set();
225
- args.forEach(item => {
226
- const identifier = recordIdentifierFor(item);
227
- if (!seen.has(identifier)) {
228
- seen.add(identifier);
229
- unique.add(item);
230
- }
231
- });
232
- const newArgs = Array.from(unique);
233
- const result = Reflect.apply(target[prop], receiver, newArgs);
234
- if (newArgs.length) {
235
- mutateAddToRelatedRecords(this, {
236
- value: extractIdentifiersFromRecords(newArgs),
237
- index: 0
238
- }, _SIGNAL);
239
- }
240
- return result;
241
- }
242
-
243
- // else, no dedupe, error on duplicates
244
- const result = Reflect.apply(target[prop], receiver, args);
245
- if (newValues.length) {
246
- mutateAddToRelatedRecords(this, {
247
- value: newValues,
248
- index: 0
249
- }, _SIGNAL);
250
- }
251
- return result;
252
- }
253
- case 'shift':
254
- {
255
- const result = Reflect.apply(target[prop], receiver, args);
256
- if (result) {
257
- mutateRemoveFromRelatedRecords(this, {
258
- value: recordIdentifierFor(result),
259
- index: 0
260
- }, _SIGNAL);
261
- }
262
- return result;
263
- }
264
- case 'sort':
265
- {
266
- const result = Reflect.apply(target[prop], receiver, args);
267
- mutateSortRelatedRecords(this, result.map(recordIdentifierFor), _SIGNAL);
268
- return result;
269
- }
270
- case 'splice':
271
- {
272
- const [start, deleteCount, ...adds] = args;
273
-
274
- // detect a full replace
275
- if (start === 0 && deleteCount === this[SOURCE].length) {
276
- const newValues = extractIdentifiersFromRecords(adds);
277
- assertNoDuplicates(this, target, currentState => currentState.splice(start, deleteCount, ...newValues), `Cannot replace a hasMany's state with a new state that contains duplicates.`);
278
- if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_MANY_ARRAY_DUPLICATES)) {
279
- // dedupe
280
- const current = new Set(adds);
281
- const unique = Array.from(current);
282
- const newArgs = [start, deleteCount].concat(unique);
283
- const result = Reflect.apply(target[prop], receiver, newArgs);
284
- mutateReplaceRelatedRecords(this, extractIdentifiersFromRecords(unique), _SIGNAL);
285
- return result;
286
- }
287
-
288
- // else, no dedupe, error on duplicates
289
- const result = Reflect.apply(target[prop], receiver, args);
290
- mutateReplaceRelatedRecords(this, newValues, _SIGNAL);
291
- return result;
292
- }
293
- const newValues = extractIdentifiersFromRecords(adds);
294
- assertNoDuplicates(this, target, currentState => currentState.splice(start, deleteCount, ...newValues), `Cannot splice a hasMany's state with a new state that contains duplicates.`);
295
- if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_MANY_ARRAY_DUPLICATES)) {
296
- // dedupe
297
- const currentState = target.slice();
298
- currentState.splice(start, deleteCount);
299
- const seen = new Set(currentState);
300
- const unique = [];
301
- adds.forEach(item => {
302
- const identifier = recordIdentifierFor(item);
303
- if (!seen.has(identifier)) {
304
- seen.add(identifier);
305
- unique.push(item);
306
- }
307
- });
308
- const newArgs = [start, deleteCount, ...unique];
309
- const result = Reflect.apply(target[prop], receiver, newArgs);
310
- if (deleteCount > 0) {
311
- mutateRemoveFromRelatedRecords(this, {
312
- value: result.map(recordIdentifierFor),
313
- index: start
314
- }, _SIGNAL);
315
- }
316
- if (unique.length > 0) {
317
- mutateAddToRelatedRecords(this, {
318
- value: extractIdentifiersFromRecords(unique),
319
- index: start
320
- }, _SIGNAL);
321
- }
322
- return result;
323
- }
324
-
325
- // else, no dedupe, error on duplicates
326
- const result = Reflect.apply(target[prop], receiver, args);
327
- if (deleteCount > 0) {
328
- mutateRemoveFromRelatedRecords(this, {
329
- value: result.map(recordIdentifierFor),
330
- index: start
331
- }, _SIGNAL);
332
- }
333
- if (newValues.length > 0) {
334
- mutateAddToRelatedRecords(this, {
335
- value: newValues,
336
- index: start
337
- }, _SIGNAL);
338
- }
339
- return result;
340
- }
341
- default:
342
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
343
- {
344
- throw new Error(`unable to convert ${prop} into a transaction that updates the cache state for this record array`);
345
- }
346
- })() : {};
347
- }
348
- }
349
- notify() {
350
- const signal = this[ARRAY_SIGNAL];
351
- signal.shouldReset = true;
352
- notifyArray(this);
353
- }
354
-
355
- /**
356
- Reloads all of the records in the manyArray. If the manyArray
357
- holds a relationship that was originally fetched using a links url
358
- EmberData will revisit the original links url to repopulate the
359
- relationship.
360
- If the ManyArray holds the result of a `store.query()` reload will
361
- re-run the original query.
362
- Example
363
- ```javascript
364
- let user = store.peekRecord('user', '1')
365
- await login(user);
366
- let permissions = await user.permissions;
367
- await permissions.reload();
368
- ```
369
- @method reload
370
- @public
371
- */
372
- reload(options) {
373
- // TODO this is odd, we don't ask the store for anything else like this?
374
- return this._manager.reloadHasMany(this.key, options);
375
- }
376
-
377
- /**
378
- Saves all of the records in the `ManyArray`.
379
- Example
380
- ```javascript
381
- let inbox = await store.findRecord('inbox', '1');
382
- let messages = await inbox.messages;
383
- messages.forEach((message) => {
384
- message.isRead = true;
385
- });
386
- messages.save();
387
- ```
388
- @method save
389
- @public
390
- @return {PromiseArray} promise
391
- */
392
-
393
- /**
394
- Create a child record within the owner
395
- @method createRecord
396
- @public
397
- @param {Object} hash
398
- @return {Model} record
399
- */
400
- createRecord(hash) {
401
- const {
402
- store
403
- } = this;
404
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
405
- if (!test) {
406
- throw new Error(`Expected modelName to be set`);
407
- }
408
- })(this.modelName) : {};
409
- const record = store.createRecord(this.modelName, hash);
410
- this.push(record);
411
- return record;
412
- }
413
- destroy() {
414
- super.destroy(false);
415
- }
416
- }
417
- RelatedCollection.prototype.isAsync = false;
418
- RelatedCollection.prototype.isPolymorphic = false;
419
- RelatedCollection.prototype.identifier = null;
420
- RelatedCollection.prototype.cache = null;
421
- RelatedCollection.prototype._inverseIsAsync = false;
422
- RelatedCollection.prototype.key = '';
423
- RelatedCollection.prototype.DEPRECATED_CLASS_NAME = 'ManyArray';
424
- function assertRecordPassedToHasMany(record) {
425
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
426
- if (!test) {
427
- throw new Error(`All elements of a hasMany relationship must be instances of Model, you passed $${typeof record}`);
428
- }
429
- })(function () {
430
- try {
431
- recordIdentifierFor(record);
432
- return true;
433
- } catch {
434
- return false;
435
- }
436
- }()) : {};
437
- }
438
- function extractIdentifiersFromRecords(records) {
439
- return records.map(extractIdentifierFromRecord$1);
440
- }
441
- function extractIdentifierFromRecord$1(recordOrPromiseRecord) {
442
- assertRecordPassedToHasMany(recordOrPromiseRecord);
443
- return recordIdentifierFor(recordOrPromiseRecord);
444
- }
445
- function assertNoDuplicates(collection, target, callback, reason) {
446
- const state = target.slice();
447
- callback(state);
448
- if (state.length !== new Set(state).size) {
449
- const duplicates = state.filter((currentValue, currentIndex) => state.indexOf(currentValue) !== currentIndex);
450
- if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_MANY_ARRAY_DUPLICATES)) {
451
- deprecate(`${reason} This behavior is deprecated. Found duplicates for the following records within the new state provided to \`<${collection.identifier.type}:${collection.identifier.id || collection.identifier.lid}>.${collection.key}\`\n\t- ${Array.from(new Set(duplicates)).map(r => isStableIdentifier(r) ? r.lid : recordIdentifierFor(r).lid).sort((a, b) => a.localeCompare(b)).join('\n\t- ')}`, false, {
452
- id: 'ember-data:deprecate-many-array-duplicates',
453
- for: 'ember-data',
454
- until: '6.0',
455
- since: {
456
- enabled: '5.3',
457
- available: '5.3'
458
- }
459
- });
460
- } else {
461
- throw new Error(`${reason} Found duplicates for the following records within the new state provided to \`<${collection.identifier.type}:${collection.identifier.id || collection.identifier.lid}>.${collection.key}\`\n\t- ${Array.from(new Set(duplicates)).map(r => isStableIdentifier(r) ? r.lid : recordIdentifierFor(r).lid).sort((a, b) => a.localeCompare(b)).join('\n\t- ')}`);
462
- }
463
- }
464
- }
465
- function mutateAddToRelatedRecords(collection, operationInfo, _SIGNAL) {
466
- mutate(collection, {
467
- op: 'addToRelatedRecords',
468
- record: collection.identifier,
469
- field: collection.key,
470
- ...operationInfo
471
- }, _SIGNAL);
472
- }
473
- function mutateRemoveFromRelatedRecords(collection, operationInfo, _SIGNAL) {
474
- mutate(collection, {
475
- op: 'removeFromRelatedRecords',
476
- record: collection.identifier,
477
- field: collection.key,
478
- ...operationInfo
479
- }, _SIGNAL);
480
- }
481
- function mutateReplaceRelatedRecord(collection, operationInfo, _SIGNAL) {
482
- mutate(collection, {
483
- op: 'replaceRelatedRecord',
484
- record: collection.identifier,
485
- field: collection.key,
486
- ...operationInfo
487
- }, _SIGNAL);
488
- }
489
- function mutateReplaceRelatedRecords(collection, value, _SIGNAL) {
490
- mutate(collection, {
491
- op: 'replaceRelatedRecords',
492
- record: collection.identifier,
493
- field: collection.key,
494
- value
495
- }, _SIGNAL);
496
- }
497
- function mutateSortRelatedRecords(collection, value, _SIGNAL) {
498
- mutate(collection, {
499
- op: 'sortRelatedRecords',
500
- record: collection.identifier,
501
- field: collection.key,
502
- value
503
- }, _SIGNAL);
504
- }
505
- function mutate(collection, mutation, _SIGNAL) {
506
- collection._manager.mutate(mutation);
507
- addToTransaction(_SIGNAL);
508
- }
509
50
  const PromiseObject = ObjectProxy.extend(PromiseProxyMixin);
510
- var __defProp = Object.defineProperty;
511
- var __export = (target, all) => {
512
- for (var name in all) __defProp(target, name, {
513
- get: all[name],
514
- enumerable: true
515
- });
516
- };
517
-
518
- // src/runtime.ts
519
- var runtime_exports = {};
520
- __export(runtime_exports, {
521
- c: () => decorateClass,
522
- f: () => decorateFieldV1,
523
- g: () => decorateFieldV2,
524
- i: () => initializeDeferredDecorator,
525
- m: () => decorateMethodV1,
526
- n: () => decorateMethodV2,
527
- p: () => decoratePOJO
528
- });
529
- var deferred = /* @__PURE__ */new WeakMap();
51
+ const deferred = /* @__PURE__ */new WeakMap();
530
52
  function deferDecorator(proto, prop, desc) {
531
53
  let map = deferred.get(proto);
532
54
  if (!map) {
@@ -536,18 +58,16 @@ function deferDecorator(proto, prop, desc) {
536
58
  map.set(prop, desc);
537
59
  }
538
60
  function findDeferredDecorator(target, prop) {
61
+ var _a;
539
62
  let cursor = target.prototype;
540
63
  while (cursor) {
541
- let desc = deferred.get(cursor)?.get(prop);
64
+ let desc = (_a = deferred.get(cursor)) == null ? void 0 : _a.get(prop);
542
65
  if (desc) {
543
66
  return desc;
544
67
  }
545
68
  cursor = cursor.prototype;
546
69
  }
547
70
  }
548
- function decorateFieldV1(target, prop, decorators, initializer) {
549
- return decorateFieldV2(target.prototype, prop, decorators, initializer);
550
- }
551
71
  function decorateFieldV2(prototype, prop, decorators, initializer) {
552
72
  let desc = {
553
73
  configurable: true,
@@ -567,11 +87,6 @@ function decorateFieldV2(prototype, prop, decorators, initializer) {
567
87
  deferDecorator(prototype, prop, desc);
568
88
  }
569
89
  }
570
- function decorateMethodV1({
571
- prototype
572
- }, prop, decorators) {
573
- return decorateMethodV2(prototype, prop, decorators);
574
- }
575
90
  function decorateMethodV2(prototype, prop, decorators) {
576
91
  const origDesc = Object.getOwnPropertyDescriptor(prototype, prop);
577
92
  let desc = {
@@ -597,35 +112,6 @@ function initializeDeferredDecorator(target, prop) {
597
112
  });
598
113
  }
599
114
  }
600
- function decorateClass(target, decorators) {
601
- return decorators.reduce((accum, decorator) => decorator(accum) || accum, target);
602
- }
603
- function decoratePOJO(pojo, decorated) {
604
- for (let [type, prop, decorators] of decorated) {
605
- if (type === "field") {
606
- decoratePojoField(pojo, prop, decorators);
607
- } else {
608
- decorateMethodV2(pojo, prop, decorators);
609
- }
610
- }
611
- return pojo;
612
- }
613
- function decoratePojoField(pojo, prop, decorators) {
614
- let desc = {
615
- configurable: true,
616
- enumerable: true,
617
- writable: true,
618
- initializer: () => Object.getOwnPropertyDescriptor(pojo, prop)?.value
619
- };
620
- for (let decorator of decorators) {
621
- desc = decorator(pojo, prop, desc) || desc;
622
- }
623
- if (desc.initializer) {
624
- desc.value = desc.initializer.call(pojo);
625
- delete desc.initializer;
626
- }
627
- Object.defineProperty(pojo, prop, desc);
628
- }
629
115
  const LegacyPromiseProxy = Symbol.for('LegacyPromiseProxy');
630
116
 
631
117
  // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-extraneous-class
@@ -725,6 +211,7 @@ class PromiseManyArray {
725
211
  // shouldn't be needed, but ends up being needed
726
212
  // for computed chains even in 4.x
727
213
  if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_COMPUTED_CHAINS)) {
214
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
728
215
  this['[]'];
729
216
  }
730
217
  return this.content ? this.content.length : 0;
@@ -905,7 +392,7 @@ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_COMPUTED_C
905
392
  // requires that the tag `'[]'` be notified
906
393
  // on the ArrayProxy in order for `{{#each}}`
907
394
  // to recompute. We entangle the '[]' tag from content
908
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
395
+
909
396
  Object.defineProperty(PromiseManyArray.prototype, '[]', desc);
910
397
  }
911
398
  function tapPromise(proxy, promise) {
@@ -949,16 +436,18 @@ if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
949
436
  }
950
437
  if (parentDefinition.isPolymorphic) {
951
438
  const meta = store.schema.fields(addedIdentifier)?.get(parentDefinition.inverseKey);
952
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
953
- if (!test) {
954
- throw new Error(`Expected the schema for the field ${parentDefinition.inverseKey} on ${addedIdentifier.type} to be for a legacy relationship`);
955
- }
956
- })(!meta || meta.kind === 'belongsTo' || meta.kind === 'hasMany') : {};
957
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
958
- if (!test) {
959
- throw new Error(`The schema for the relationship '${parentDefinition.inverseKey}' on '${addedIdentifier.type}' type does not implement '${parentDefinition.type}' and thus cannot be assigned to the '${parentDefinition.key}' relationship in '${parentIdentifier.type}'. The definition should specify 'as: "${parentDefinition.type}"' in options.`);
960
- }
961
- })(meta?.options.as === parentDefinition.type) : {};
439
+ if (meta) {
440
+ macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
441
+ if (!test) {
442
+ throw new Error(`Expected the schema for the field ${parentDefinition.inverseKey} on ${addedIdentifier.type} to be for a legacy relationship`);
443
+ }
444
+ })(meta.kind === 'belongsTo' || meta.kind === 'hasMany') : {};
445
+ macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
446
+ if (!test) {
447
+ throw new Error(`The schema for the relationship '${parentDefinition.inverseKey}' on '${addedIdentifier.type}' type does not implement '${parentDefinition.type}' and thus cannot be assigned to the '${parentDefinition.key}' relationship in '${parentIdentifier.type}'. The definition should specify 'as: "${parentDefinition.type}"' in options.`);
448
+ }
449
+ })(meta?.options?.as === parentDefinition.type) : {};
450
+ }
962
451
  }
963
452
  };
964
453
  }
@@ -1048,8 +537,9 @@ class HasManyReference {
1048
537
  * @public
1049
538
  */
1050
539
  get identifiers() {
1051
- this._ref; // consume the tracked prop
1052
-
540
+ ensureRefCanSubscribe(this);
541
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
542
+ this._ref;
1053
543
  const resource = this._resource();
1054
544
  const map = this.___relatedTokenMap;
1055
545
  this.___relatedTokenMap = new Map();
@@ -1431,10 +921,8 @@ class HasManyReference {
1431
921
  */
1432
922
  value() {
1433
923
  const support = LEGACY_SUPPORT.get(this.___identifier);
1434
- const loaded = this._isLoaded();
1435
- if (!loaded) {
1436
- // subscribe to changes
1437
- // for when we are not loaded yet
924
+ if (!ensureRefCanSubscribe(this)) {
925
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
1438
926
  this._ref;
1439
927
  return null;
1440
928
  }
@@ -1553,6 +1041,26 @@ function isMaybeResource(object) {
1553
1041
  const keys = Object.keys(object).filter(k => k !== 'id' && k !== 'type' && k !== 'lid');
1554
1042
  return keys.length > 0;
1555
1043
  }
1044
+ function ensureRefCanSubscribe(rel) {
1045
+ const loaded = rel._isLoaded();
1046
+ if (!loaded) {
1047
+ // subscribe to changes
1048
+ // for when we are not loaded yet
1049
+ //
1050
+ // because the graph optimizes the case where a relationship has never been subscribed,
1051
+ // we force accessed to be true here. When we make the graph public we should create a
1052
+ // subscribe/unsubscribe API
1053
+ const edge = rel.graph.get(rel.___identifier, rel.key);
1054
+ macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
1055
+ if (!test) {
1056
+ throw new Error(`Expected a hasMany relationship for ${rel.___identifier.type}:${rel.key}`);
1057
+ }
1058
+ })('accessed' in edge) : {};
1059
+ edge.accessed = true;
1060
+ return false;
1061
+ }
1062
+ return true;
1063
+ }
1556
1064
  function isResourceIdentiferWithRelatedLinks(value) {
1557
1065
  return Boolean(value && value.links && value.links.related);
1558
1066
  }
@@ -1794,6 +1302,7 @@ class BelongsToReference {
1794
1302
  return meta;
1795
1303
  }
1796
1304
  _resource() {
1305
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
1797
1306
  this._ref; // subscribe
1798
1307
  const cache = this.store.cache;
1799
1308
  return cache.getRelationship(this.___identifier, this.key);
@@ -2238,13 +1747,12 @@ class LegacySupport {
2238
1747
  if (relatedIdentifier === null) {
2239
1748
  return null;
2240
1749
  } else {
2241
- const toReturn = store._instanceCache.getRecord(relatedIdentifier);
2242
1750
  macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
2243
1751
  if (!test) {
2244
1752
  throw new Error(`You looked up the '${key}' relationship on a '${identifier.type}' with id ${identifier.id || 'null'} but some of the associated records were not loaded. Either make sure they are all loaded together with the parent record, or specify that the relationship is async (\`belongsTo(<type>, { async: true, inverse: <inverse> })\`)`);
2245
1753
  }
2246
- })(toReturn === null || store._instanceCache.recordIsLoaded(relatedIdentifier, true)) : {};
2247
- return toReturn;
1754
+ })(store._instanceCache.recordIsLoaded(relatedIdentifier, true)) : {};
1755
+ return store._instanceCache.getRecord(relatedIdentifier);
2248
1756
  }
2249
1757
  }
2250
1758
  }
@@ -2297,6 +1805,7 @@ class LegacySupport {
2297
1805
  isPolymorphic: definition.isPolymorphic,
2298
1806
  isAsync: definition.isAsync,
2299
1807
  _inverseIsAsync: definition.inverseIsAsync,
1808
+ // @ts-expect-error Typescript doesn't have a way for us to thread the generic backwards so it infers unknown instead of T
2300
1809
  manager: this,
2301
1810
  isLoaded: !definition.isAsync,
2302
1811
  allowMutation: true
@@ -2521,14 +2030,22 @@ class LegacySupport {
2521
2030
  throw new Error(`Expected stable identifiers`);
2522
2031
  }
2523
2032
  })(!identifiers || identifiers.every(isStableIdentifier)) : {};
2524
- return this.store.request({
2033
+ const req = field.options.linksMode ? {
2034
+ url: getRelatedLink(resource),
2035
+ op: 'findHasMany',
2036
+ method: 'GET',
2037
+ records: identifiers || [],
2038
+ data: request,
2039
+ [EnableHydration]: false
2040
+ } : {
2525
2041
  op: 'findHasMany',
2526
2042
  records: identifiers || [],
2527
2043
  data: request,
2528
2044
  cacheOptions: {
2529
2045
  [Symbol.for('wd:skip-cache')]: true
2530
2046
  }
2531
- });
2047
+ };
2048
+ return this.store.request(req);
2532
2049
  }
2533
2050
  const preferLocalCache = hasReceivedData && !isEmpty;
2534
2051
  const hasLocalPartialData = hasDematerializedInverse || isEmpty && Array.isArray(identifiers) && identifiers.length > 0;
@@ -2613,15 +2130,23 @@ class LegacySupport {
2613
2130
 
2614
2131
  // fetch via link
2615
2132
  if (shouldFindViaLink) {
2616
- const future = this.store.request({
2133
+ const req = field.options.linksMode ? {
2134
+ url: getRelatedLink(resource),
2135
+ op: 'findBelongsTo',
2136
+ method: 'GET',
2137
+ records: identifier ? [identifier] : [],
2138
+ data: request,
2139
+ [EnableHydration]: false
2140
+ } : {
2617
2141
  op: 'findBelongsTo',
2618
2142
  records: identifier ? [identifier] : [],
2619
2143
  data: request,
2620
2144
  cacheOptions: {
2621
2145
  [Symbol.for('wd:skip-cache')]: true
2622
2146
  }
2623
- });
2624
- this._pending[key] = future.then(doc => doc.content).finally(() => {
2147
+ };
2148
+ const future = this.store.request(req);
2149
+ this._pending[key] = future.then(doc => field.options.linksMode ? doc.content.data : doc.content).finally(() => {
2625
2150
  this._pending[key] = undefined;
2626
2151
  });
2627
2152
  return this._pending[key];
@@ -2691,6 +2216,15 @@ class LegacySupport {
2691
2216
  this.isDestroyed = true;
2692
2217
  }
2693
2218
  }
2219
+ function getRelatedLink(resource) {
2220
+ const related = resource.links?.related;
2221
+ macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
2222
+ if (!test) {
2223
+ throw new Error(`Expected a related link`);
2224
+ }
2225
+ })(related) : {};
2226
+ return typeof related === 'object' ? related.href : related;
2227
+ }
2694
2228
  function handleCompletedRelationshipRequest(recordExt, key, relationship, value, error) {
2695
2229
  delete recordExt._relationshipPromisesCache[key];
2696
2230
  relationship.state.shouldForceReload = false;
@@ -3242,30 +2776,35 @@ function createSnapshot() {
3242
2776
  return store._fetchManager.createSnapshot(recordIdentifierFor$1(this));
3243
2777
  }
3244
2778
  function notifyChanges(identifier, value, key, record, store) {
3245
- if (value === 'attributes') {
3246
- if (key) {
3247
- notifyAttribute(store, identifier, key, record);
3248
- } else {
3249
- record.eachAttribute(name => {
3250
- notifyAttribute(store, identifier, name, record);
3251
- });
3252
- }
3253
- } else if (value === 'relationships') {
3254
- if (key) {
3255
- const meta = record.constructor.relationshipsByName.get(key);
3256
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
3257
- if (!test) {
3258
- throw new Error(`Expected to find a relationship for ${key} on ${identifier.type}`);
3259
- }
3260
- })(meta) : {};
3261
- notifyRelationship(identifier, key, record, meta);
3262
- } else {
3263
- record.eachRelationship((name, meta) => {
3264
- notifyRelationship(identifier, name, record, meta);
3265
- });
3266
- }
3267
- } else if (value === 'identity') {
3268
- record.notifyPropertyChange('id');
2779
+ switch (value) {
2780
+ case 'added':
2781
+ case 'attributes':
2782
+ if (key) {
2783
+ notifyAttribute(store, identifier, key, record);
2784
+ } else {
2785
+ record.eachAttribute(name => {
2786
+ notifyAttribute(store, identifier, name, record);
2787
+ });
2788
+ }
2789
+ break;
2790
+ case 'relationships':
2791
+ if (key) {
2792
+ const meta = record.constructor.relationshipsByName.get(key);
2793
+ macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
2794
+ if (!test) {
2795
+ throw new Error(`Expected to find a relationship for ${key} on ${identifier.type}`);
2796
+ }
2797
+ })(meta) : {};
2798
+ notifyRelationship(identifier, key, record, meta);
2799
+ } else {
2800
+ record.eachRelationship((name, meta) => {
2801
+ notifyRelationship(identifier, name, record, meta);
2802
+ });
2803
+ }
2804
+ break;
2805
+ case 'identity':
2806
+ record.notifyPropertyChange('id');
2807
+ break;
3269
2808
  }
3270
2809
  }
3271
2810
  function notifyRelationship(identifier, key, record, meta) {
@@ -3316,44 +2855,6 @@ function isInvalidError(error) {
3316
2855
  return !!error && error instanceof Error && 'isAdapterError' in error && error.isAdapterError === true && 'code' in error && error.code === 'InvalidError';
3317
2856
  }
3318
2857
 
3319
- /**
3320
- * A decorator that caches a getter while
3321
- * providing the ability to bust that cache
3322
- * when we so choose in a way that notifies
3323
- * tracking systems.
3324
- *
3325
- * @internal
3326
- */
3327
- function tagged(_target, key, desc) {
3328
- // eslint-disable-next-line @typescript-eslint/unbound-method
3329
- const getter = desc.get;
3330
- // eslint-disable-next-line @typescript-eslint/unbound-method
3331
- const setter = desc.set;
3332
- desc.get = function () {
3333
- const signal = getSignal(this, key, true);
3334
- subscribe(signal);
3335
- if (signal.shouldReset) {
3336
- signal.shouldReset = false;
3337
- signal.lastValue = getter.call(this);
3338
- }
3339
- return signal.lastValue;
3340
- };
3341
- desc.set = function (v) {
3342
- getSignal(this, key, true); // ensure signal is setup in case we want to use it.
3343
- // probably notify here but not yet.
3344
- setter.call(this, v);
3345
- };
3346
- compat(desc);
3347
- return desc;
3348
- }
3349
- function notifySignal(obj, key) {
3350
- const signal = peekSignal(obj, key);
3351
- if (signal) {
3352
- signal.shouldReset = true;
3353
- addToTransaction(signal);
3354
- }
3355
- }
3356
-
3357
2858
  /**
3358
2859
  Historically EmberData managed a state machine
3359
2860
  for each record, the localState for which
@@ -3530,7 +3031,7 @@ class RecordState {
3530
3031
  return !this.isLoaded && this.pendingCount > 0 && this.fulfilledCount === 0;
3531
3032
  }
3532
3033
  static {
3533
- decorateMethodV2(this.prototype, "isLoading", [tagged]);
3034
+ decorateMethodV2(this.prototype, "isLoading", [subscribed]);
3534
3035
  }
3535
3036
  get isLoaded() {
3536
3037
  if (this.isNew) {
@@ -3539,7 +3040,7 @@ class RecordState {
3539
3040
  return this.fulfilledCount > 0 || !this.isEmpty;
3540
3041
  }
3541
3042
  static {
3542
- decorateMethodV2(this.prototype, "isLoaded", [tagged]);
3043
+ decorateMethodV2(this.prototype, "isLoaded", [subscribed]);
3543
3044
  }
3544
3045
  get isSaved() {
3545
3046
  const rd = this.cache;
@@ -3557,7 +3058,7 @@ class RecordState {
3557
3058
  return true;
3558
3059
  }
3559
3060
  static {
3560
- decorateMethodV2(this.prototype, "isSaved", [tagged]);
3061
+ decorateMethodV2(this.prototype, "isSaved", [subscribed]);
3561
3062
  }
3562
3063
  get isEmpty() {
3563
3064
  const rd = this.cache;
@@ -3571,7 +3072,7 @@ class RecordState {
3571
3072
  return !this.isNew && rd.isEmpty(this.identifier);
3572
3073
  }
3573
3074
  static {
3574
- decorateMethodV2(this.prototype, "isEmpty", [tagged]);
3075
+ decorateMethodV2(this.prototype, "isEmpty", [subscribed]);
3575
3076
  }
3576
3077
  get isNew() {
3577
3078
  const rd = this.cache;
@@ -3583,7 +3084,7 @@ class RecordState {
3583
3084
  return rd.isNew(this.identifier);
3584
3085
  }
3585
3086
  static {
3586
- decorateMethodV2(this.prototype, "isNew", [tagged]);
3087
+ decorateMethodV2(this.prototype, "isNew", [subscribed]);
3587
3088
  }
3588
3089
  get isDeleted() {
3589
3090
  const rd = this.cache;
@@ -3595,13 +3096,13 @@ class RecordState {
3595
3096
  return rd.isDeleted(this.identifier);
3596
3097
  }
3597
3098
  static {
3598
- decorateMethodV2(this.prototype, "isDeleted", [tagged]);
3099
+ decorateMethodV2(this.prototype, "isDeleted", [subscribed]);
3599
3100
  }
3600
3101
  get isValid() {
3601
3102
  return this.record.errors.length === 0;
3602
3103
  }
3603
3104
  static {
3604
- decorateMethodV2(this.prototype, "isValid", [tagged]);
3105
+ decorateMethodV2(this.prototype, "isValid", [subscribed]);
3605
3106
  }
3606
3107
  get isDirty() {
3607
3108
  const rd = this.cache;
@@ -3611,7 +3112,7 @@ class RecordState {
3611
3112
  return this.isDeleted || this.isNew || rd.hasChangedAttrs(this.identifier);
3612
3113
  }
3613
3114
  static {
3614
- decorateMethodV2(this.prototype, "isDirty", [tagged]);
3115
+ decorateMethodV2(this.prototype, "isDirty", [subscribed]);
3615
3116
  }
3616
3117
  get isError() {
3617
3118
  const errorReq = this._errorRequests[this._errorRequests.length - 1];
@@ -3622,7 +3123,7 @@ class RecordState {
3622
3123
  }
3623
3124
  }
3624
3125
  static {
3625
- decorateMethodV2(this.prototype, "isError", [tagged]);
3126
+ decorateMethodV2(this.prototype, "isError", [subscribed]);
3626
3127
  }
3627
3128
  get adapterError() {
3628
3129
  const request = this._lastError;
@@ -3632,7 +3133,7 @@ class RecordState {
3632
3133
  return request.state === 'rejected' && request.response.data;
3633
3134
  }
3634
3135
  static {
3635
- decorateMethodV2(this.prototype, "adapterError", [tagged]);
3136
+ decorateMethodV2(this.prototype, "adapterError", [subscribed]);
3636
3137
  }
3637
3138
  get isPreloaded() {
3638
3139
  return !this.isEmpty && this.isLoading;
@@ -3864,9 +3365,8 @@ class Model extends EmberObject {
3864
3365
  ```javascript
3865
3366
  let record = store.createRecord('model');
3866
3367
  record.isLoaded; // true
3867
- store.findRecord('model', 1).then(function(model) {
3868
- model.isLoaded; // true
3869
- });
3368
+ const { content: { data: model } } = await store.request(findRecord({ type: 'model', id: '1' }));
3369
+ model.isLoaded;
3870
3370
  ```
3871
3371
  @property isLoaded
3872
3372
  @public
@@ -3889,11 +3389,10 @@ class Model extends EmberObject {
3889
3389
  ```javascript
3890
3390
  let record = store.createRecord('model');
3891
3391
  record.hasDirtyAttributes; // true
3892
- store.findRecord('model', 1).then(function(model) {
3893
- model.hasDirtyAttributes; // false
3894
- model.set('foo', 'some value');
3895
- model.hasDirtyAttributes; // true
3896
- });
3392
+ const { content: { data: model } } = await store.request(findRecord({ type: 'model', id: '1' }));
3393
+ model.hasDirtyAttributes; // false
3394
+ model.foo = 'some value';
3395
+ model.hasDirtyAttributes; // true
3897
3396
  ```
3898
3397
  @since 1.13.0
3899
3398
  @property hasDirtyAttributes
@@ -4094,9 +3593,8 @@ class Model extends EmberObject {
4094
3593
  ```javascript
4095
3594
  let record = store.createRecord('model');
4096
3595
  record.id; // null
4097
- store.findRecord('model', 1).then(function(model) {
4098
- model.id; // '1'
4099
- });
3596
+ const { content: { data: model } } = await store.request(findRecord({ type: 'model', id: '1' }));
3597
+ model.id; // '1'
4100
3598
  ```
4101
3599
  @property id
4102
3600
  @public
@@ -4116,7 +3614,7 @@ class Model extends EmberObject {
4116
3614
  return recordIdentifierFor$1(this).id;
4117
3615
  }
4118
3616
  static {
4119
- decorateMethodV2(this.prototype, "id", [tagged]);
3617
+ decorateMethodV2(this.prototype, "id", [subscribed]);
4120
3618
  }
4121
3619
  set id(id) {
4122
3620
  const normalizedId = coerceId(id);
@@ -4156,7 +3654,7 @@ class Model extends EmberObject {
4156
3654
  return this.___recordState;
4157
3655
  }
4158
3656
  static {
4159
- decorateMethodV2(this.prototype, "currentState", [tagged]);
3657
+ decorateMethodV2(this.prototype, "currentState", [subscribed]);
4160
3658
  }
4161
3659
  set currentState(_v) {
4162
3660
  throw new Error('cannot set currentState');
@@ -5169,7 +4667,7 @@ class Model extends EmberObject {
5169
4667
  if (isAttributeSchema(meta)) {
5170
4668
  macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
5171
4669
  if (!test) {
5172
- throw new Error("You may not set `id` as an attribute on your model. Please remove any lines that look like: `id: attr('<type>')` from " + this.toString());
4670
+ throw new Error("You may not set 'id' as an attribute on your model. Please remove any lines that look like: `id: attr('<type>')` from " + this.toString());
5173
4671
  }
5174
4672
  })(name !== 'id') : {};
5175
4673
 
@@ -5404,4 +4902,4 @@ function isRelationshipSchema(meta) {
5404
4902
  function isAttributeSchema(meta) {
5405
4903
  return typeof meta === 'object' && meta !== null && 'kind' in meta && meta.kind === 'attribute';
5406
4904
  }
5407
- export { Errors as E, LEGACY_SUPPORT as L, Model as M, PromiseBelongsTo as P, RelatedCollection as R, PromiseManyArray as a, save as b, reload as c, destroyRecord as d, deleteRecord as e, RecordState as f, changedAttributes as g, hasMany as h, belongsTo as i, createSnapshot as j, isElementDescriptor as k, lookupLegacySupport as l, normalizeModelName as n, rollbackAttributes as r, serialize as s, unloadRecord as u };
4905
+ export { Errors as E, LEGACY_SUPPORT as L, Model as M, PromiseBelongsTo as P, RecordState as R, PromiseManyArray as a, save as b, reload as c, destroyRecord as d, deleteRecord as e, changedAttributes as f, belongsTo as g, hasMany as h, createSnapshot as i, isElementDescriptor as j, lookupLegacySupport as l, normalizeModelName as n, rollbackAttributes as r, serialize as s, unloadRecord as u };