@ember-data-mirror/store 4.13.0-alpha.1 → 4.13.0-alpha.4

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 (25) hide show
  1. package/README.md +3 -6
  2. package/dist/{-private-Cy8UqsrK.js → -private-C5j0gwYO.js} +306 -215
  3. package/dist/-private-C5j0gwYO.js.map +1 -0
  4. package/dist/-private.js +1 -1
  5. package/dist/index.js +1 -1
  6. package/package.json +23 -13
  7. package/unstable-preview-types/-private/cache-handler/handler.d.ts +0 -2
  8. package/unstable-preview-types/-private/cache-handler/handler.d.ts.map +1 -1
  9. package/unstable-preview-types/-private/caches/identifier-cache.d.ts.map +1 -1
  10. package/unstable-preview-types/-private/caches/instance-cache.d.ts.map +1 -1
  11. package/unstable-preview-types/-private/debug/utils.d.ts +9 -0
  12. package/unstable-preview-types/-private/debug/utils.d.ts.map +1 -0
  13. package/unstable-preview-types/-private/managers/cache-capabilities-manager.d.ts +3 -3
  14. package/unstable-preview-types/-private/managers/cache-capabilities-manager.d.ts.map +1 -1
  15. package/unstable-preview-types/-private/managers/notification-manager.d.ts +3 -2
  16. package/unstable-preview-types/-private/managers/notification-manager.d.ts.map +1 -1
  17. package/unstable-preview-types/-private/store-service.d.ts +3 -6
  18. package/unstable-preview-types/-private/store-service.d.ts.map +1 -1
  19. package/unstable-preview-types/-private.d.ts +1 -0
  20. package/unstable-preview-types/-private.d.ts.map +1 -1
  21. package/unstable-preview-types/-types/q/cache-capabilities-manager.d.ts +4 -4
  22. package/unstable-preview-types/-types/q/cache-capabilities-manager.d.ts.map +1 -1
  23. package/unstable-preview-types/index.d.ts +25 -27
  24. package/unstable-preview-types/index.d.ts.map +1 -1
  25. package/dist/-private-Cy8UqsrK.js.map +0 -1
@@ -1,8 +1,8 @@
1
1
  import { deprecate, warn, assert } from '@ember/debug';
2
2
  import { dasherize } from '@ember-data-mirror/request-utils/string';
3
3
  import { macroCondition, getGlobalConfig, dependencySatisfies, importSync } from '@embroider/macros';
4
- import { SkipCache, EnableHydration } from '@warp-drive-mirror/core-types/request';
5
- import { getOrSetGlobal, setTransient, peekTransient } from '@warp-drive-mirror/core-types/-private';
4
+ import { EnableHydration, SkipCache } from '@warp-drive-mirror/core-types/request';
5
+ import { getOrSetGlobal, peekTransient, setTransient } from '@warp-drive-mirror/core-types/-private';
6
6
  import { CACHE_OWNER, DEBUG_STALE_CACHE_OWNER, DEBUG_CLIENT_ORIGINATED, DEBUG_IDENTIFIER_BUCKET } from '@warp-drive-mirror/core-types/identifier';
7
7
  import { defineSignal, createSignal, subscribe, createArrayTags, addToTransaction, addTransactionCB } from '@ember-data-mirror/tracking/-private';
8
8
  import { _backburner } from '@ember/runloop';
@@ -15,9 +15,9 @@ import { reads } from '@ember/object/computed';
15
15
  import PromiseProxyMixin from '@ember/object/promise-proxy-mixin';
16
16
  import ObjectProxy from '@ember/object/proxy';
17
17
  function normalizeModelName$1(type) {
18
- if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_NON_STRICT_TYPES)) {
18
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_NON_STRICT_TYPES)) {
19
19
  const result = dasherize(type);
20
- deprecate(`The resource type '${type}' is not normalized. Update your application code to use '${result}' instead of '${type}'.`, /* inline-macro-config */getGlobalConfig().WarpDrive.deprecations.DISABLE_6X_DEPRECATIONS ? true : result === type, {
20
+ deprecate(`The resource type '${type}' is not normalized. Update your application code to use '${result}' instead of '${type}'.`, /* inline-macro-config */getGlobalConfig().WarpDriveMirror.deprecations.DISABLE_6X_DEPRECATIONS ? true : result === type, {
21
21
  id: 'ember-data-mirror:deprecate-non-strict-types',
22
22
  until: '6.0',
23
23
  for: 'ember-data-mirror',
@@ -36,14 +36,14 @@ function normalizeModelName$1(type) {
36
36
  */
37
37
 
38
38
  function coerceId(id) {
39
- if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_NON_STRICT_ID)) {
39
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_NON_STRICT_ID)) {
40
40
  let normalized;
41
41
  if (id === null || id === undefined || id === '') {
42
42
  normalized = null;
43
43
  } else {
44
44
  normalized = String(id);
45
45
  }
46
- deprecate(`The resource id '<${typeof id}> ${String(id)} ' is not normalized. Update your application code to use '${JSON.stringify(normalized)}' instead.`, /* inline-macro-config */getGlobalConfig().WarpDrive.deprecations.DISABLE_6X_DEPRECATIONS ? true : normalized === id, {
46
+ deprecate(`The resource id '<${typeof id}> ${String(id)} ' is not normalized. Update your application code to use '${JSON.stringify(normalized)}' instead.`, /* inline-macro-config */getGlobalConfig().WarpDriveMirror.deprecations.DISABLE_6X_DEPRECATIONS ? true : normalized === id, {
47
47
  id: 'ember-data-mirror:deprecate-non-strict-id',
48
48
  until: '6.0',
49
49
  for: 'ember-data-mirror',
@@ -54,7 +54,7 @@ function coerceId(id) {
54
54
  });
55
55
  return normalized;
56
56
  }
57
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
57
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
58
58
  if (!test) {
59
59
  throw new Error(`Resource IDs must be a non-empty string or null. Received '${String(id)}'.`);
60
60
  }
@@ -68,7 +68,7 @@ function ensureStringId(id) {
68
68
  } else if (typeof id === 'number' && !isNaN(id)) {
69
69
  normalized = String(id);
70
70
  }
71
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
71
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
72
72
  if (!test) {
73
73
  throw new Error(`Expected id to be a string or number, received ${String(id)}`);
74
74
  }
@@ -136,21 +136,20 @@ function hasType(resource) {
136
136
  /**
137
137
  @module @ember-data-mirror/store
138
138
  */
139
- const IDENTIFIERS = getOrSetGlobal('IDENTIFIERS', new Set());
140
139
  const DOCUMENTS = getOrSetGlobal('DOCUMENTS', new Set());
141
140
  function isStableIdentifier(identifier) {
142
- return identifier[CACHE_OWNER] !== undefined || IDENTIFIERS.has(identifier);
141
+ return identifier[CACHE_OWNER] !== undefined;
143
142
  }
144
143
  function isDocumentIdentifier(identifier) {
145
144
  return DOCUMENTS.has(identifier);
146
145
  }
147
146
  const isFastBoot = typeof FastBoot !== 'undefined';
148
147
  const _crypto = isFastBoot ? FastBoot.require('crypto') : globalThis.crypto;
149
- if (macroCondition(getGlobalConfig().WarpDrive.polyfillUUID)) {
148
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.polyfillUUID)) {
150
149
  installPolyfill();
151
150
  }
152
151
  function uuidv4() {
153
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
152
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
154
153
  if (!test) {
155
154
  throw new Error('crypto.randomUUID needs to be avaliable. Some browsers incorrectly disallow it in insecure contexts. You maybe want to enable the polyfill: https://github.com/emberjs/data#randomuuid-polyfill');
156
155
  }
@@ -199,7 +198,7 @@ function updateTypeIdMapping(typeMap, identifier, id) {
199
198
  }
200
199
  function defaultUpdateMethod(identifier, data, bucket) {
201
200
  if (bucket === 'record') {
202
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
201
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
203
202
  if (!test) {
204
203
  throw new Error(`Expected identifier to be a StableRecordIdentifier`);
205
204
  }
@@ -213,7 +212,7 @@ function defaultKeyInfoMethod(resource, known) {
213
212
  // TODO RFC something to make this configurable
214
213
  const id = hasId(resource) ? coerceId(resource.id) : null;
215
214
  const type = hasType(resource) ? normalizeModelName$1(resource.type) : known ? known.type : null;
216
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
215
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
217
216
  if (!test) {
218
217
  throw new Error(`Expected keyInfoForResource to provide a type for the resource`);
219
218
  }
@@ -228,7 +227,7 @@ function defaultGenerationMethod(data, bucket) {
228
227
  if (hasLid(data)) {
229
228
  return data.lid;
230
229
  }
231
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
230
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
232
231
  if (!test) {
233
232
  throw new Error(`Cannot generate an identifier for a resource without a type`);
234
233
  }
@@ -248,7 +247,7 @@ function defaultGenerationMethod(data, bucket) {
248
247
  }
249
248
  return null;
250
249
  }
251
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
250
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
252
251
  {
253
252
  throw new Error(`Unknown bucket ${bucket}`);
254
253
  }
@@ -259,7 +258,7 @@ function defaultMergeMethod(a, _b, _c) {
259
258
  return a;
260
259
  }
261
260
  let DEBUG_MAP;
262
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
261
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
263
262
  DEBUG_MAP = getOrSetGlobal('DEBUG_MAP', new WeakMap());
264
263
  }
265
264
 
@@ -317,19 +316,19 @@ class IdentifierCache {
317
316
  */
318
317
 
319
318
  _getRecordIdentifier(resource, shouldGenerate) {
320
- if (macroCondition(getGlobalConfig().WarpDrive.debug.LOG_IDENTIFIERS)) {
319
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_IDENTIFIERS)) {
321
320
  // eslint-disable-next-line no-console
322
321
  console.groupCollapsed(`Identifiers: ${shouldGenerate ? 'Generating' : 'Peeking'} Identifier`, resource);
323
322
  }
324
323
  // short circuit if we're already the stable version
325
324
  if (isStableIdentifier(resource)) {
326
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
325
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
327
326
  // TODO should we instead just treat this case as a new generation skipping the short circuit?
328
327
  if (!this._cache.resources.has(resource.lid) || this._cache.resources.get(resource.lid) !== resource) {
329
328
  throw new Error(`The supplied identifier ${JSON.stringify(resource)} does not belong to this store instance`);
330
329
  }
331
330
  }
332
- if (macroCondition(getGlobalConfig().WarpDrive.debug.LOG_IDENTIFIERS)) {
331
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_IDENTIFIERS)) {
333
332
  // eslint-disable-next-line no-console
334
333
  console.log(`Identifiers: cache HIT - Stable ${resource.lid}`);
335
334
  // eslint-disable-next-line no-console
@@ -340,20 +339,20 @@ class IdentifierCache {
340
339
 
341
340
  // the resource is unknown, ask the application to identify this data for us
342
341
  const lid = this._generate(resource, 'record');
343
- if (macroCondition(getGlobalConfig().WarpDrive.debug.LOG_IDENTIFIERS)) {
342
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_IDENTIFIERS)) {
344
343
  // eslint-disable-next-line no-console
345
344
  console.log(`Identifiers: ${lid ? 'no ' : ''}lid ${lid ? lid + ' ' : ''}determined for resource`, resource);
346
345
  }
347
346
  let identifier = /*#__NOINLINE__*/getIdentifierFromLid(this._cache, lid, resource);
348
347
  if (identifier !== null) {
349
- if (macroCondition(getGlobalConfig().WarpDrive.debug.LOG_IDENTIFIERS)) {
348
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_IDENTIFIERS)) {
350
349
  // eslint-disable-next-line no-console
351
350
  console.groupEnd();
352
351
  }
353
352
  return identifier;
354
353
  }
355
354
  if (shouldGenerate === 0) {
356
- if (macroCondition(getGlobalConfig().WarpDrive.debug.LOG_IDENTIFIERS)) {
355
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_IDENTIFIERS)) {
357
356
  // eslint-disable-next-line no-console
358
357
  console.groupEnd();
359
358
  }
@@ -373,7 +372,7 @@ class IdentifierCache {
373
372
  identifier = /*#__NOINLINE__*/makeStableRecordIdentifier(keyInfo, 'record', false);
374
373
  }
375
374
  addResourceToCache(this._cache, identifier);
376
- if (macroCondition(getGlobalConfig().WarpDrive.debug.LOG_IDENTIFIERS)) {
375
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_IDENTIFIERS)) {
377
376
  // eslint-disable-next-line no-console
378
377
  console.groupEnd();
379
378
  }
@@ -415,7 +414,7 @@ class IdentifierCache {
415
414
  identifier = {
416
415
  lid: cacheKey
417
416
  };
418
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
417
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
419
418
  Object.freeze(identifier);
420
419
  }
421
420
  DOCUMENTS.add(identifier);
@@ -461,7 +460,7 @@ class IdentifierCache {
461
460
  }, 'record', true);
462
461
 
463
462
  // populate our unique table
464
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
463
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
465
464
  if (this._cache.resources.has(identifier.lid)) {
466
465
  throw new Error(`The lid generated for the new record is not unique as it matches an existing identifier`);
467
466
  }
@@ -469,7 +468,7 @@ class IdentifierCache {
469
468
 
470
469
  /*#__NOINLINE__*/
471
470
  addResourceToCache(this._cache, identifier);
472
- if (macroCondition(getGlobalConfig().WarpDrive.debug.LOG_IDENTIFIERS)) {
471
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_IDENTIFIERS)) {
473
472
  // eslint-disable-next-line no-console
474
473
  console.log(`Identifiers: created identifier ${String(identifier)} for newly generated resource`, data);
475
474
  }
@@ -518,7 +517,7 @@ class IdentifierCache {
518
517
  if (hadLid) {
519
518
  data.lid = identifier.lid;
520
519
  }
521
- if (macroCondition(getGlobalConfig().WarpDrive.debug.LOG_IDENTIFIERS)) {
520
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_IDENTIFIERS)) {
522
521
  // eslint-disable-next-line no-console
523
522
  console.log(`Identifiers: merged identifiers ${generatedIdentifier.lid} and ${existingIdentifier.lid} for resource into ${identifier.lid}`, data);
524
523
  }
@@ -530,12 +529,12 @@ class IdentifierCache {
530
529
 
531
530
  // add to our own secondary lookup table
532
531
  if (id !== newId && newId !== null) {
533
- if (macroCondition(getGlobalConfig().WarpDrive.debug.LOG_IDENTIFIERS)) {
532
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_IDENTIFIERS)) {
534
533
  // eslint-disable-next-line no-console
535
534
  console.log(`Identifiers: updated id for identifier ${identifier.lid} from '${String(id)}' to '${String(newId)}' for resource`, data);
536
535
  }
537
536
  const typeSet = this._cache.resourcesByType[identifier.type];
538
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
537
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
539
538
  if (!test) {
540
539
  throw new Error(`Expected to find a typeSet for ${identifier.type}`);
541
540
  }
@@ -544,7 +543,7 @@ class IdentifierCache {
544
543
  if (id !== null) {
545
544
  typeSet.id.delete(id);
546
545
  }
547
- } else if (macroCondition(getGlobalConfig().WarpDrive.debug.LOG_IDENTIFIERS)) {
546
+ } else if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_IDENTIFIERS)) {
548
547
  // eslint-disable-next-line no-console
549
548
  console.log(`Identifiers: updated identifier ${identifier.lid} resource`, data);
550
549
  }
@@ -556,7 +555,7 @@ class IdentifierCache {
556
555
  * @private
557
556
  */
558
557
  _mergeRecordIdentifiers(keyInfo, identifier, existingIdentifier, data) {
559
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
558
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
560
559
  if (!test) {
561
560
  throw new Error(`Expected keyInfo to contain an id`);
562
561
  }
@@ -607,7 +606,7 @@ class IdentifierCache {
607
606
  forgetRecordIdentifier(identifierObject) {
608
607
  const identifier = this.getOrCreateRecordIdentifier(identifierObject);
609
608
  const typeSet = this._cache.resourcesByType[identifier.type];
610
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
609
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
611
610
  if (!test) {
612
611
  throw new Error(`Expected to find a typeSet for ${identifier.type}`);
613
612
  }
@@ -624,13 +623,12 @@ class IdentifierCache {
624
623
  });
625
624
  this._cache.polymorphicLidBackMap.delete(identifier.lid);
626
625
  }
627
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
626
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
628
627
  identifier[DEBUG_STALE_CACHE_OWNER] = identifier[CACHE_OWNER];
629
628
  }
630
629
  identifier[CACHE_OWNER] = undefined;
631
- IDENTIFIERS.delete(identifier);
632
630
  this._forget(identifier, 'record');
633
- if (macroCondition(getGlobalConfig().WarpDrive.debug.LOG_IDENTIFIERS)) {
631
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_IDENTIFIERS)) {
634
632
  // eslint-disable-next-line no-console
635
633
  console.log(`Identifiers: released identifier ${identifierObject.lid}`);
636
634
  }
@@ -644,8 +642,7 @@ class IdentifierCache {
644
642
  }
645
643
  }
646
644
  function makeStableRecordIdentifier(recordIdentifier, bucket, clientOriginated) {
647
- IDENTIFIERS.add(recordIdentifier);
648
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
645
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
649
646
  // we enforce immutability in dev
650
647
  // but preserve our ability to do controlled updates to the reference
651
648
  let wrapper = {
@@ -699,7 +696,6 @@ function makeStableRecordIdentifier(recordIdentifier, bucket, clientOriginated)
699
696
  });
700
697
  wrapper[DEBUG_CLIENT_ORIGINATED] = clientOriginated;
701
698
  wrapper[DEBUG_IDENTIFIER_BUCKET] = bucket;
702
- IDENTIFIERS.add(wrapper);
703
699
  DEBUG_MAP.set(wrapper, recordIdentifier);
704
700
  wrapper = freeze(wrapper);
705
701
  return wrapper;
@@ -707,7 +703,7 @@ function makeStableRecordIdentifier(recordIdentifier, bucket, clientOriginated)
707
703
  return recordIdentifier;
708
704
  }
709
705
  function performRecordIdentifierUpdate(identifier, keyInfo, data, updateFn) {
710
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
706
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
711
707
  const {
712
708
  id,
713
709
  type
@@ -782,7 +778,7 @@ function detectMerge(cache, keyInfo, identifier, data) {
782
778
  }
783
779
  function getIdentifierFromLid(cache, lid, resource) {
784
780
  const identifier = cache.resources.get(lid);
785
- if (macroCondition(getGlobalConfig().WarpDrive.debug.LOG_IDENTIFIERS)) {
781
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_IDENTIFIERS)) {
786
782
  // eslint-disable-next-line no-console
787
783
  console.log(`Identifiers: cache ${identifier ? 'HIT' : 'MISS'} - Non-Stable ${lid}`, resource);
788
784
  }
@@ -803,6 +799,87 @@ function addResourceToCache(cache, identifier) {
803
799
  typeSet.id.set(identifier.id, identifier);
804
800
  }
805
801
  }
802
+ const TEXT_COLORS = {
803
+ TEXT: 'inherit',
804
+ notify: ['white', 'white', 'inherit', 'magenta', 'inherit'],
805
+ 'reactive-ui': ['white', 'white', 'inherit', 'magenta', 'inherit'],
806
+ graph: ['white', 'white', 'inherit', 'magenta', 'inherit'],
807
+ request: ['white', 'white', 'inherit', 'magenta', 'inherit'],
808
+ cache: ['white', 'white', 'inherit', 'magenta', 'inherit']
809
+ };
810
+ const BG_COLORS = {
811
+ TEXT: 'transparent',
812
+ notify: ['dimgray', 'cadetblue', 'transparent', 'transparent', 'transparent'],
813
+ 'reactive-ui': ['dimgray', 'cadetblue', 'transparent', 'transparent', 'transparent'],
814
+ graph: ['dimgray', 'cadetblue', 'transparent', 'transparent', 'transparent'],
815
+ request: ['dimgray', 'cadetblue', 'transparent', 'transparent', 'transparent'],
816
+ cache: ['dimgray', 'cadetblue', 'transparent', 'transparent', 'transparent']
817
+ };
818
+ const NOTIFY_BORDER = {
819
+ TEXT: 0,
820
+ notify: [3, 2, 0, 0, 0],
821
+ 'reactive-ui': [3, 2, 0, 0, 0],
822
+ graph: [3, 2, 0, 0, 0],
823
+ request: [3, 2, 0, 0, 0],
824
+ cache: [3, 2, 0, 0, 0]
825
+ };
826
+ const LIGHT_DARK_ALT = {
827
+ lightgreen: 'green',
828
+ green: 'lightgreen'
829
+ };
830
+ function badge(isLight, color, bgColor, border) {
831
+ return [`color: ${correctColor(isLight, color)}; background-color: ${correctColor(isLight, bgColor)}; padding: ${border}px ${2 * border}px; border-radius: ${border}px;`, `color: ${TEXT_COLORS.TEXT}; background-color: ${BG_COLORS.TEXT};`];
832
+ }
833
+ function colorForBucket(isLight, scope, bucket) {
834
+ if (scope === 'notify') {
835
+ return bucket === 'added' ? badge(isLight, 'lightgreen', 'transparent', 0) : bucket === 'removed' ? badge(isLight, 'red', 'transparent', 0) : badge(isLight, TEXT_COLORS[scope][2], BG_COLORS[scope][2], NOTIFY_BORDER[scope][2]);
836
+ }
837
+ if (scope === 'reactive-ui') {
838
+ return bucket === 'created' ? badge(isLight, 'lightgreen', 'transparent', 0) : bucket === 'disconnected' ? badge(isLight, 'red', 'transparent', 0) : badge(isLight, TEXT_COLORS[scope][2], BG_COLORS[scope][2], NOTIFY_BORDER[scope][2]);
839
+ }
840
+ if (scope === 'cache') {
841
+ return bucket === 'inserted' ? badge(isLight, 'lightgreen', 'transparent', 0) : bucket === 'removed' ? badge(isLight, 'red', 'transparent', 0) : badge(isLight, TEXT_COLORS[scope][2], BG_COLORS[scope][2], NOTIFY_BORDER[scope][2]);
842
+ }
843
+ return badge(isLight, TEXT_COLORS[scope][3], BG_COLORS[scope][3], NOTIFY_BORDER[scope][3]);
844
+ }
845
+ function logGroup(scope, prefix, subScop1, subScop2, subScop3, subScop4) {
846
+ // eslint-disable-next-line no-console
847
+ console.groupCollapsed(..._log(scope, prefix, subScop1, subScop2, subScop3, subScop4));
848
+ }
849
+ function log(scope, prefix, subScop1, subScop2, subScop3, subScop4) {
850
+ // eslint-disable-next-line no-console
851
+ console.log(..._log(scope, prefix, subScop1, subScop2, subScop3, subScop4));
852
+ }
853
+ function correctColor(isLight, color) {
854
+ if (!isLight) {
855
+ return color;
856
+ }
857
+ return color in LIGHT_DARK_ALT ? LIGHT_DARK_ALT[color] : color;
858
+ }
859
+ function isLightMode() {
860
+ if (window?.matchMedia?.('(prefers-color-scheme: light)').matches) {
861
+ return true;
862
+ }
863
+ return false;
864
+ }
865
+ function _log(scope, prefix, subScop1, subScop2, subScop3, subScop4) {
866
+ const isLight = isLightMode();
867
+ switch (scope) {
868
+ case 'reactive-ui':
869
+ case 'notify':
870
+ {
871
+ const scopePath = prefix ? `[${prefix}] ${scope}` : scope;
872
+ const path = subScop4 ? `${subScop3}.${subScop4}` : subScop3;
873
+ return [`%c@warp%c-%cdrive%c %c${scopePath}%c %c${subScop1}%c %c${subScop2}%c %c${path}%c`, ...badge(isLight, 'lightgreen', 'transparent', 0), ...badge(isLight, 'magenta', 'transparent', 0), ...badge(isLight, TEXT_COLORS[scope][0], BG_COLORS[scope][0], NOTIFY_BORDER[scope][0]), ...badge(isLight, TEXT_COLORS[scope][1], BG_COLORS[scope][1], NOTIFY_BORDER[scope][1]), ...badge(isLight, TEXT_COLORS[scope][2], BG_COLORS[scope][2], NOTIFY_BORDER[scope][2]), ...colorForBucket(isLight, scope, path)];
874
+ }
875
+ case 'cache':
876
+ {
877
+ const scopePath = prefix ? `${scope} (${prefix})` : scope;
878
+ return [`%c@warp%c-%cdrive%c %c${scopePath}%c %c${subScop1}%c %c${subScop2}%c %c${subScop3}%c %c${subScop4}%c`, ...badge(isLight, 'lightgreen', 'transparent', 0), ...badge(isLight, 'magenta', 'transparent', 0), ...badge(isLight, TEXT_COLORS[scope][0], BG_COLORS[scope][0], NOTIFY_BORDER[scope][0]), ...badge(isLight, TEXT_COLORS[scope][1], BG_COLORS[scope][1], NOTIFY_BORDER[scope][1]), ...badge(isLight, TEXT_COLORS[scope][2], BG_COLORS[scope][2], NOTIFY_BORDER[scope][2]), ...colorForBucket(isLight, scope, subScop3), ...badge(isLight, TEXT_COLORS[scope][4], BG_COLORS[scope][4], NOTIFY_BORDER[scope][4])];
879
+ }
880
+ }
881
+ return [];
882
+ }
806
883
 
807
884
  /**
808
885
  @module @ember-data-mirror/store
@@ -963,7 +1040,7 @@ class RecordReference {
963
1040
  if (id !== null) {
964
1041
  return this.store.findRecord(this.type, id);
965
1042
  }
966
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
1043
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
967
1044
  {
968
1045
  throw new Error(`Unable to fetch record of type ${this.type} without an id`);
969
1046
  }
@@ -990,7 +1067,7 @@ class RecordReference {
990
1067
  reload: true
991
1068
  });
992
1069
  }
993
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
1070
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
994
1071
  {
995
1072
  throw new Error(`Unable to fetch record of type ${this.type} without an id`);
996
1073
  }
@@ -1046,7 +1123,7 @@ class CacheCapabilitiesManager {
1046
1123
  });
1047
1124
  }
1048
1125
  notifyChange(identifier, namespace, key) {
1049
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
1126
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
1050
1127
  if (!test) {
1051
1128
  throw new Error(`Expected a stable identifier`);
1052
1129
  }
@@ -1065,7 +1142,7 @@ class CacheCapabilitiesManager {
1065
1142
  return this._store.schema;
1066
1143
  }
1067
1144
  setRecordId(identifier, id) {
1068
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
1145
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
1069
1146
  if (!test) {
1070
1147
  throw new Error(`Expected a stable identifier`);
1071
1148
  }
@@ -1076,7 +1153,7 @@ class CacheCapabilitiesManager {
1076
1153
  return Boolean(this._store._instanceCache.peek(identifier));
1077
1154
  }
1078
1155
  disconnectRecord(identifier) {
1079
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
1156
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
1080
1157
  if (!test) {
1081
1158
  throw new Error(`Expected a stable identifier`);
1082
1159
  }
@@ -1085,7 +1162,7 @@ class CacheCapabilitiesManager {
1085
1162
  this._pendingNotifies.delete(identifier);
1086
1163
  }
1087
1164
  }
1088
- if (macroCondition(getGlobalConfig().WarpDrive.deprecations.ENABLE_LEGACY_SCHEMA_SERVICE)) {
1165
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.ENABLE_LEGACY_SCHEMA_SERVICE)) {
1089
1166
  CacheCapabilitiesManager.prototype.getSchemaDefinitionService = function () {
1090
1167
  // FIXME add deprecation for this
1091
1168
  return this._store.schema;
@@ -1099,7 +1176,7 @@ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.ENABLE_LEGACY_SCHEMA
1099
1176
 
1100
1177
  const CacheForIdentifierCache = getOrSetGlobal('CacheForIdentifierCache', new Map());
1101
1178
  function setCacheFor(identifier, cache) {
1102
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
1179
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
1103
1180
  if (!test) {
1104
1181
  throw new Error(`Illegal set of identifier`);
1105
1182
  }
@@ -1149,7 +1226,7 @@ function peekRecordIdentifier(record) {
1149
1226
  */
1150
1227
 
1151
1228
  function recordIdentifierFor(record) {
1152
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
1229
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
1153
1230
  if (!test) {
1154
1231
  throw new Error(`${String(record)} is not a record instantiated by @ember-data-mirror/store`);
1155
1232
  }
@@ -1157,7 +1234,7 @@ function recordIdentifierFor(record) {
1157
1234
  return RecordCache.get(record);
1158
1235
  }
1159
1236
  function setRecordIdentifier(record, identifier) {
1160
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
1237
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
1161
1238
  if (RecordCache.has(record) && RecordCache.get(record) !== identifier) {
1162
1239
  throw new Error(`${String(record)} was already assigned an identifier`);
1163
1240
  }
@@ -1176,7 +1253,7 @@ function setRecordIdentifier(record, identifier) {
1176
1253
  const StoreMap = getOrSetGlobal('StoreMap', new Map());
1177
1254
  function storeFor(record) {
1178
1255
  const store = StoreMap.get(record);
1179
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
1256
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
1180
1257
  if (!test) {
1181
1258
  throw new Error(`A record in a disconnected state cannot utilize the store. This typically means the record has been destroyed, most commonly by unloading it.`);
1182
1259
  }
@@ -1218,7 +1295,7 @@ class InstanceCache {
1218
1295
  if ('id' in resourceData) {
1219
1296
  throw new Error(`Failed to update the 'id' for the RecordIdentifier '${identifier.type}:${String(identifier.id)} (${identifier.lid})' to '${String(resourceData.id)}', because that id is already in use by '${matchedIdentifier.type}:${String(matchedIdentifier.id)} (${matchedIdentifier.lid})'`);
1220
1297
  }
1221
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
1298
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
1222
1299
  {
1223
1300
  throw new Error(`Failed to update the RecordIdentifier '${identifier.type}:${String(identifier.id)} (${identifier.lid})' to merge with the detected duplicate identifier '${matchedIdentifier.type}:${String(matchedIdentifier.id)} (${String(matchedIdentifier.lid)})'`);
1224
1301
  }
@@ -1247,7 +1324,7 @@ class InstanceCache {
1247
1324
  getRecord(identifier, properties) {
1248
1325
  let record = this.__instances.record.get(identifier);
1249
1326
  if (!record) {
1250
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
1327
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
1251
1328
  if (!test) {
1252
1329
  throw new Error(`Cannot create a new record instance while the store is being destroyed`);
1253
1330
  }
@@ -1259,9 +1336,14 @@ class InstanceCache {
1259
1336
  setCacheFor(record, cache);
1260
1337
  StoreMap.set(record, this.store);
1261
1338
  this.__instances.record.set(identifier, record);
1262
- if (macroCondition(getGlobalConfig().WarpDrive.debug.LOG_INSTANCE_CACHE)) {
1339
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_INSTANCE_CACHE)) {
1340
+ logGroup('reactive-ui', '', identifier.type, identifier.lid, 'created', '');
1341
+ // eslint-disable-next-line no-console
1342
+ console.log({
1343
+ properties
1344
+ });
1263
1345
  // eslint-disable-next-line no-console
1264
- console.log(`InstanceCache: created Record for ${String(identifier)}`, properties);
1346
+ console.groupEnd();
1265
1347
  }
1266
1348
  }
1267
1349
  return record;
@@ -1298,7 +1380,7 @@ class InstanceCache {
1298
1380
  }
1299
1381
  disconnect(identifier) {
1300
1382
  const record = this.__instances.record.get(identifier);
1301
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
1383
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
1302
1384
  if (!test) {
1303
1385
  throw new Error('Cannot destroy record while it is still materialized');
1304
1386
  }
@@ -1307,25 +1389,24 @@ class InstanceCache {
1307
1389
  this.store.identifierCache.forgetRecordIdentifier(identifier);
1308
1390
  removeRecordDataFor(identifier);
1309
1391
  this.store._requestCache._clearEntries(identifier);
1310
- if (macroCondition(getGlobalConfig().WarpDrive.debug.LOG_INSTANCE_CACHE)) {
1311
- // eslint-disable-next-line no-console
1312
- console.log(`InstanceCache: disconnected ${String(identifier)}`);
1392
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_INSTANCE_CACHE)) {
1393
+ log('reactive-ui', '', identifier.type, identifier.lid, 'disconnected', '');
1313
1394
  }
1314
1395
  }
1315
1396
  unloadRecord(identifier) {
1316
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
1397
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
1317
1398
  const requests = this.store.getRequestStateService().getPendingRequestsForRecord(identifier);
1318
1399
  if (requests.some(req => {
1319
1400
  return req.type === 'mutation';
1320
1401
  })) {
1321
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
1402
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
1322
1403
  {
1323
1404
  throw new Error(`You can only unload a record which is not inFlight. '${String(identifier)}'`);
1324
1405
  }
1325
1406
  })() : {};
1326
1407
  }
1327
1408
  }
1328
- if (macroCondition(getGlobalConfig().WarpDrive.debug.LOG_INSTANCE_CACHE)) {
1409
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_INSTANCE_CACHE)) {
1329
1410
  // eslint-disable-next-line no-console
1330
1411
  console.groupCollapsed(`InstanceCache: unloading record for ${String(identifier)}`);
1331
1412
  }
@@ -1340,7 +1421,7 @@ class InstanceCache {
1340
1421
  StoreMap.delete(record);
1341
1422
  RecordCache.delete(record);
1342
1423
  removeRecordDataFor(record);
1343
- if (macroCondition(getGlobalConfig().WarpDrive.debug.LOG_INSTANCE_CACHE)) {
1424
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_INSTANCE_CACHE)) {
1344
1425
  // eslint-disable-next-line no-console
1345
1426
  console.log(`InstanceCache: destroyed record for ${String(identifier)}`);
1346
1427
  }
@@ -1348,7 +1429,7 @@ class InstanceCache {
1348
1429
  if (cache) {
1349
1430
  cache.unloadRecord(identifier);
1350
1431
  removeRecordDataFor(identifier);
1351
- if (macroCondition(getGlobalConfig().WarpDrive.debug.LOG_INSTANCE_CACHE)) {
1432
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_INSTANCE_CACHE)) {
1352
1433
  // eslint-disable-next-line no-console
1353
1434
  console.log(`InstanceCache: destroyed cache for ${String(identifier)}`);
1354
1435
  }
@@ -1356,7 +1437,7 @@ class InstanceCache {
1356
1437
  this.disconnect(identifier);
1357
1438
  }
1358
1439
  this.store._requestCache._clearEntries(identifier);
1359
- if (macroCondition(getGlobalConfig().WarpDrive.debug.LOG_INSTANCE_CACHE)) {
1440
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_INSTANCE_CACHE)) {
1360
1441
  // eslint-disable-next-line no-console
1361
1442
  console.log(`InstanceCache: unloaded RecordData for ${String(identifier)}`);
1362
1443
  // eslint-disable-next-line no-console
@@ -1395,7 +1476,7 @@ class InstanceCache {
1395
1476
  const oldId = identifier.id;
1396
1477
 
1397
1478
  // ID absolutely can't be missing if the oldID is empty (missing Id in response for a new record)
1398
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
1479
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
1399
1480
  if (!test) {
1400
1481
  throw new Error(`'${type}' was saved to the server, but the response does not have an id and your record does not either.`);
1401
1482
  }
@@ -1403,7 +1484,7 @@ class InstanceCache {
1403
1484
 
1404
1485
  // ID absolutely can't be different than oldID if oldID is not null
1405
1486
  // TODO this assertion and restriction may not strictly be needed in the identifiers world
1406
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
1487
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
1407
1488
  if (!test) {
1408
1489
  throw new Error(`Cannot update the id for '${type}:${lid}' from '${String(oldId)}' to '${id}'.`);
1409
1490
  }
@@ -1415,7 +1496,7 @@ class InstanceCache {
1415
1496
  warn(`Your ${type} record was saved to the server, but the response does not have an id.`, !(oldId !== null && id === null));
1416
1497
  return;
1417
1498
  }
1418
- if (macroCondition(getGlobalConfig().WarpDrive.debug.LOG_INSTANCE_CACHE)) {
1499
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_INSTANCE_CACHE)) {
1419
1500
  // eslint-disable-next-line no-console
1420
1501
  console.log(`InstanceCache: updating id to '${id}' for record ${String(identifier)}`);
1421
1502
  }
@@ -1423,7 +1504,7 @@ class InstanceCache {
1423
1504
  type,
1424
1505
  id
1425
1506
  });
1426
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
1507
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
1427
1508
  if (!test) {
1428
1509
  throw new Error(`'${type}' was saved to the server, but the response returned the new id '${id}', which has already been used with another record.'`);
1429
1510
  }
@@ -1488,7 +1569,7 @@ function preloadData(store, identifier, preload) {
1488
1569
  function preloadRelationship(schema, preloadValue) {
1489
1570
  const relatedType = schema.type;
1490
1571
  if (schema.kind === 'hasMany') {
1491
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
1572
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
1492
1573
  if (!test) {
1493
1574
  throw new Error('You need to pass in an array to set a hasMany property on a record');
1494
1575
  }
@@ -1497,7 +1578,7 @@ function preloadRelationship(schema, preloadValue) {
1497
1578
  data: preloadValue.map(value => _convertPreloadRelationshipToJSON(value, relatedType))
1498
1579
  };
1499
1580
  }
1500
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
1581
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
1501
1582
  if (!test) {
1502
1583
  throw new Error('You should not pass in an array to set a belongsTo property on a record');
1503
1584
  }
@@ -2174,9 +2255,17 @@ function runLoopIsFlushing() {
2174
2255
  //@ts-expect-error
2175
2256
  return !!_backburner.currentInstance && _backburner._autorun !== true;
2176
2257
  }
2258
+ function count(label) {
2259
+ // @ts-expect-error
2260
+ // eslint-disable-next-line
2261
+ globalThis.counts = globalThis.counts || {};
2262
+ // @ts-expect-error
2263
+ // eslint-disable-next-line
2264
+ globalThis.counts[label] = (globalThis.counts[label] || 0) + 1;
2265
+ }
2177
2266
  function _unsubscribe(tokens, token, cache) {
2178
2267
  const identifier = tokens.get(token);
2179
- if (macroCondition(getGlobalConfig().WarpDrive.debug.LOG_NOTIFICATIONS)) {
2268
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_NOTIFICATIONS)) {
2180
2269
  if (!identifier) {
2181
2270
  // eslint-disable-next-line no-console
2182
2271
  console.log('Passed unknown unsubscribe token to unsubscribe', identifier);
@@ -2238,7 +2327,7 @@ class NotificationManager {
2238
2327
  */
2239
2328
 
2240
2329
  subscribe(identifier, callback) {
2241
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
2330
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
2242
2331
  if (!test) {
2243
2332
  throw new Error(`Expected to receive a stable Identifier to subscribe to`);
2244
2333
  }
@@ -2248,7 +2337,7 @@ class NotificationManager {
2248
2337
  map = new Map();
2249
2338
  this._cache.set(identifier, map);
2250
2339
  }
2251
- const unsubToken = macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? {
2340
+ const unsubToken = macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? {
2252
2341
  _tokenRef: tokenId++
2253
2342
  } : {};
2254
2343
  map.set(unsubToken, callback);
@@ -2281,22 +2370,18 @@ class NotificationManager {
2281
2370
  */
2282
2371
 
2283
2372
  notify(identifier, value, key) {
2284
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
2373
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
2285
2374
  if (!test) {
2286
2375
  throw new Error(`Notify does not accept a key argument for the namespace '${value}'. Received key '${key || ''}'.`);
2287
2376
  }
2288
2377
  })(!key || value === 'attributes' || value === 'relationships') : {};
2289
2378
  if (!isStableIdentifier(identifier) && !isDocumentIdentifier(identifier)) {
2290
- if (macroCondition(getGlobalConfig().WarpDrive.debug.LOG_NOTIFICATIONS)) {
2379
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_NOTIFICATIONS)) {
2291
2380
  // eslint-disable-next-line no-console
2292
2381
  console.log(`Notifying: Expected to receive a stable Identifier to notify '${value}' '${key || ''}' with, but ${String(identifier)} is not in the cache`, identifier);
2293
2382
  }
2294
2383
  return false;
2295
2384
  }
2296
- if (macroCondition(getGlobalConfig().WarpDrive.debug.LOG_NOTIFICATIONS)) {
2297
- // eslint-disable-next-line no-console
2298
- console.log(`Buffering Notify: ${String(identifier.lid)}\t${value}\t${key || ''}`);
2299
- }
2300
2385
  const hasSubscribers = Boolean(this._cache.get(identifier)?.size);
2301
2386
  if (isCacheOperationValue(value) || hasSubscribers) {
2302
2387
  let buffer = this._buffered.get(identifier);
@@ -2305,7 +2390,16 @@ class NotificationManager {
2305
2390
  this._buffered.set(identifier, buffer);
2306
2391
  }
2307
2392
  buffer.push([value, key]);
2308
- this._scheduleNotify();
2393
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_METRIC_COUNTS)) {
2394
+ count(`notify ${'type' in identifier ? identifier.type : '<document>'} ${value} ${key}`);
2395
+ }
2396
+ if (!this._scheduleNotify()) {
2397
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_NOTIFICATIONS)) {
2398
+ log('notify', 'buffered', `${'type' in identifier ? identifier.type : 'document'}`, identifier.lid, `${value}`, key || '');
2399
+ }
2400
+ }
2401
+ } else if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_METRIC_COUNTS)) {
2402
+ count(`DISCARDED notify ${'type' in identifier ? identifier.type : '<document>'} ${value} ${key}`);
2309
2403
  }
2310
2404
  return hasSubscribers;
2311
2405
  }
@@ -2316,14 +2410,15 @@ class NotificationManager {
2316
2410
  const asyncFlush = this.store._enableAsyncFlush;
2317
2411
  if (this._hasFlush) {
2318
2412
  if (asyncFlush !== false && !runLoopIsFlushing()) {
2319
- return;
2413
+ return false;
2320
2414
  }
2321
2415
  }
2322
2416
  if (asyncFlush && !runLoopIsFlushing()) {
2323
2417
  this._hasFlush = true;
2324
- return;
2418
+ return false;
2325
2419
  }
2326
2420
  this._flush();
2421
+ return true;
2327
2422
  }
2328
2423
  _flush() {
2329
2424
  const buffered = this._buffered;
@@ -2341,9 +2436,8 @@ class NotificationManager {
2341
2436
  this._onFlushCB = undefined;
2342
2437
  }
2343
2438
  _flushNotification(identifier, value, key) {
2344
- if (macroCondition(getGlobalConfig().WarpDrive.debug.LOG_NOTIFICATIONS)) {
2345
- // eslint-disable-next-line no-console
2346
- console.log(`Notifying: ${String(identifier)}\t${value}\t${key || ''}`);
2439
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_NOTIFICATIONS)) {
2440
+ log('notify', '', `${'type' in identifier ? identifier.type : 'document'}`, identifier.lid, `${value}`, key || '');
2347
2441
  }
2348
2442
 
2349
2443
  // TODO for documents this will need to switch based on Identifier kind
@@ -2465,7 +2559,7 @@ function isAllowedProp(prop) {
2465
2559
  }
2466
2560
  function promiseArray(promise) {
2467
2561
  const promiseObjectProxy = _promiseArray(promise);
2468
- if (macroCondition(!getGlobalConfig().WarpDrive.env.DEBUG)) {
2562
+ if (macroCondition(!getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
2469
2563
  return promiseObjectProxy;
2470
2564
  }
2471
2565
  const handler = {
@@ -2504,7 +2598,7 @@ function promiseArray(promise) {
2504
2598
  const ProxySymbolString = String(Symbol.for('PROXY_CONTENT'));
2505
2599
  function promiseObject(promise) {
2506
2600
  const promiseObjectProxy = _promiseObject(promise);
2507
- if (macroCondition(!getGlobalConfig().WarpDrive.env.DEBUG)) {
2601
+ if (macroCondition(!getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
2508
2602
  return promiseObjectProxy;
2509
2603
  }
2510
2604
  const handler = {
@@ -2605,7 +2699,7 @@ function safeForEach(instance, arr, store, callback, target) {
2605
2699
  }
2606
2700
  // clone to prevent mutation
2607
2701
  arr = arr.slice();
2608
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
2702
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
2609
2703
  if (!test) {
2610
2704
  throw new Error('`forEach` expects a function as first argument.');
2611
2705
  }
@@ -2767,7 +2861,7 @@ class IdentifierArray {
2767
2861
  // array functions must run through Reflect to work properly
2768
2862
  // binding via other means will not work.
2769
2863
  if (!options.allowMutation) {
2770
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
2864
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
2771
2865
  if (!test) {
2772
2866
  throw new Error(`Mutating this array of records via ${String(prop)} is not allowed.`);
2773
2867
  }
@@ -2775,7 +2869,7 @@ class IdentifierArray {
2775
2869
  return;
2776
2870
  }
2777
2871
  const args = Array.prototype.slice.call(arguments);
2778
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
2872
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
2779
2873
  if (!test) {
2780
2874
  throw new Error(`Cannot start a new array transaction while a previous transaction is underway`);
2781
2875
  }
@@ -2790,7 +2884,7 @@ class IdentifierArray {
2790
2884
  return fn;
2791
2885
  }
2792
2886
  if (isSelfProp(self, prop)) {
2793
- if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_ARRAY_LIKE)) {
2887
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_ARRAY_LIKE)) {
2794
2888
  if (prop === 'firstObject') {
2795
2889
  deprecateArrayLike(self.DEPRECATED_CLASS_NAME, prop, '[0]');
2796
2890
  // @ts-expect-error adding MutableArray method calling index signature
@@ -2832,7 +2926,7 @@ class IdentifierArray {
2832
2926
  } else if (transaction) {
2833
2927
  return Reflect.set(target, prop, value);
2834
2928
  } else {
2835
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
2929
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
2836
2930
  {
2837
2931
  throw new Error(`unexpected length set`);
2838
2932
  }
@@ -2859,7 +2953,7 @@ class IdentifierArray {
2859
2953
  if (index === null || index > target.length) {
2860
2954
  if (index !== null && transaction) {
2861
2955
  const identifier = recordIdentifierFor(value);
2862
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
2956
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
2863
2957
  if (!test) {
2864
2958
  throw new Error(`Cannot set index ${index} past the end of the array.`);
2865
2959
  }
@@ -2874,7 +2968,7 @@ class IdentifierArray {
2874
2968
  return false;
2875
2969
  }
2876
2970
  if (!options.allowMutation) {
2877
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
2971
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
2878
2972
  if (!test) {
2879
2973
  throw new Error(`Mutating ${String(prop)} on this Array is not allowed.`);
2880
2974
  }
@@ -2883,7 +2977,7 @@ class IdentifierArray {
2883
2977
  }
2884
2978
  const original = target[index];
2885
2979
  const newIdentifier = extractIdentifierFromRecord$1(value);
2886
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
2980
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
2887
2981
  if (!test) {
2888
2982
  throw new Error(`Expected a record`);
2889
2983
  }
@@ -2912,7 +3006,7 @@ class IdentifierArray {
2912
3006
  return true;
2913
3007
  },
2914
3008
  deleteProperty(target, prop) {
2915
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
3009
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
2916
3010
  if (!test) {
2917
3011
  throw new Error(`Deleting keys on managed arrays is disallowed`);
2918
3012
  }
@@ -2926,7 +3020,7 @@ class IdentifierArray {
2926
3020
  return IdentifierArray.prototype;
2927
3021
  }
2928
3022
  });
2929
- if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_A_USAGE)) {
3023
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_A_USAGE)) {
2930
3024
  const meta = Ember.meta(this);
2931
3025
  meta.hasMixin = mixin => {
2932
3026
  deprecate(`Do not call A() on EmberData RecordArrays`, false, {
@@ -2944,10 +3038,10 @@ class IdentifierArray {
2944
3038
  }
2945
3039
  return false;
2946
3040
  };
2947
- } else if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
3041
+ } else if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
2948
3042
  const meta = Ember.meta(this);
2949
3043
  meta.hasMixin = mixin => {
2950
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
3044
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
2951
3045
  {
2952
3046
  throw new Error(`Do not call A() on EmberData RecordArrays`);
2953
3047
  }
@@ -2996,7 +3090,7 @@ class IdentifierArray {
2996
3090
  is finished.
2997
3091
  */
2998
3092
  _update() {
2999
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
3093
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
3000
3094
  if (!test) {
3001
3095
  throw new Error(`_update cannot be used with this array`);
3002
3096
  }
@@ -3027,7 +3121,7 @@ class IdentifierArray {
3027
3121
  */
3028
3122
  save() {
3029
3123
  const promise = Promise.all(this.map(record => this.store.saveRecord(record))).then(() => this);
3030
- if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_PROMISE_PROXIES)) {
3124
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_PROMISE_PROXIES)) {
3031
3125
  // @ts-expect-error IdentifierArray is not a MutableArray
3032
3126
  return promiseArray(promise);
3033
3127
  }
@@ -3045,7 +3139,7 @@ const desc = {
3045
3139
  get: function () {
3046
3140
  // here to support computed chains
3047
3141
  // and {{#each}}
3048
- if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_COMPUTED_CHAINS)) {
3142
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_COMPUTED_CHAINS)) {
3049
3143
  return this;
3050
3144
  }
3051
3145
  }
@@ -3053,7 +3147,7 @@ const desc = {
3053
3147
  compat(desc);
3054
3148
  Object.defineProperty(IdentifierArray.prototype, '[]', desc);
3055
3149
  defineSignal(IdentifierArray.prototype, 'isUpdating', false);
3056
- if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_SNAPSHOT_MODEL_CLASS_ACCESS)) {
3150
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_SNAPSHOT_MODEL_CLASS_ACCESS)) {
3057
3151
  Object.defineProperty(IdentifierArray.prototype, 'type', {
3058
3152
  get() {
3059
3153
  deprecate(`Using RecordArray.type to access the ModelClass for a record is deprecated. Use store.modelFor(<modelName>) instead.`, false, {
@@ -3088,12 +3182,12 @@ class Collection extends IdentifierArray {
3088
3182
  } = this;
3089
3183
 
3090
3184
  // TODO save options from initial request?
3091
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
3185
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
3092
3186
  if (!test) {
3093
3187
  throw new Error(`update cannot be used with this array`);
3094
3188
  }
3095
3189
  })(this.modelName) : {};
3096
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
3190
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
3097
3191
  if (!test) {
3098
3192
  throw new Error(`update cannot be used with no query`);
3099
3193
  }
@@ -3105,7 +3199,7 @@ class Collection extends IdentifierArray {
3105
3199
  const promise = store.query(this.modelName, query, {
3106
3200
  _recordArray: this
3107
3201
  });
3108
- if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_PROMISE_PROXIES)) {
3202
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_PROMISE_PROXIES)) {
3109
3203
  // @ts-expect-error Collection is not a MutableArray
3110
3204
  return promiseArray(promise);
3111
3205
  }
@@ -3123,7 +3217,7 @@ Collection.prototype.query = null;
3123
3217
  // Ensure instanceof works correctly
3124
3218
  //Object.setPrototypeOf(IdentifierArray.prototype, Array.prototype);
3125
3219
 
3126
- if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_ARRAY_LIKE)) {
3220
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_ARRAY_LIKE)) {
3127
3221
  IdentifierArray.prototype.DEPRECATED_CLASS_NAME = 'RecordArray';
3128
3222
  Collection.prototype.DEPRECATED_CLASS_NAME = 'RecordArray';
3129
3223
  const EmberObjectMethods = ['addObserver', 'cacheFor', 'decrementProperty', 'get', 'getProperties', 'incrementProperty', 'notifyPropertyChange', 'removeObserver', 'set', 'setProperties', 'toggleProperty'];
@@ -3287,7 +3381,7 @@ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_ARRAY_LIKE
3287
3381
  // @ts-expect-error adding MutableArray method
3288
3382
  IdentifierArray.prototype.setObjects = function (objects) {
3289
3383
  deprecateArrayLike(this.DEPRECATED_CLASS_NAME, 'setObjects', '`arr.length = 0; arr.push(objects);`');
3290
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
3384
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
3291
3385
  if (!test) {
3292
3386
  throw new Error(`${this.DEPRECATED_CLASS_NAME}.setObjects expects to receive an array as its argument`);
3293
3387
  }
@@ -3428,7 +3522,7 @@ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_ARRAY_LIKE
3428
3522
  // @ts-expect-error adding MutableArray method
3429
3523
  IdentifierArray.prototype.reject = function (callback, target) {
3430
3524
  deprecateArrayLike(this.DEPRECATED_CLASS_NAME, 'reject', 'filter');
3431
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
3525
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
3432
3526
  if (!test) {
3433
3527
  throw new Error('`reject` expects a function as first argument.');
3434
3528
  }
@@ -3506,7 +3600,7 @@ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_ARRAY_LIKE
3506
3600
  IdentifierArray.prototype.lastObject = null;
3507
3601
  }
3508
3602
  function assertRecordPassedToHasMany(record) {
3509
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
3603
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
3510
3604
  if (!test) {
3511
3605
  throw new Error(`All elements of a hasMany relationship must be instances of Model, you passed $${typeof record}`);
3512
3606
  }
@@ -3525,7 +3619,7 @@ function extractIdentifierFromRecord$1(recordOrPromiseRecord) {
3525
3619
  }
3526
3620
  if (isPromiseRecord$1(recordOrPromiseRecord)) {
3527
3621
  const content = recordOrPromiseRecord.content;
3528
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
3622
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
3529
3623
  if (!test) {
3530
3624
  throw new Error('You passed in a promise that did not originate from an EmberData relationship. You can only pass promises that come from a belongsTo relationship.');
3531
3625
  }
@@ -3894,7 +3988,7 @@ function sync(array, changes, arraySet) {
3894
3988
 
3895
3989
  const Touching = getOrSetGlobal('Touching', Symbol('touching'));
3896
3990
  const RequestPromise = getOrSetGlobal('RequestPromise', Symbol('promise'));
3897
- const EMPTY_ARR = macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? Object.freeze([]) : [];
3991
+ const EMPTY_ARR = macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? Object.freeze([]) : [];
3898
3992
  function hasRecordIdentifier(op) {
3899
3993
  return 'recordIdentifier' in op;
3900
3994
  }
@@ -3965,7 +4059,7 @@ class RequestStateService {
3965
4059
  throw error;
3966
4060
  });
3967
4061
  }
3968
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
4062
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
3969
4063
  {
3970
4064
  throw new Error(`Expected a well formed query`);
3971
4065
  }
@@ -4102,12 +4196,12 @@ function constructResource(type, id, lid) {
4102
4196
  if ('id' in resource) {
4103
4197
  resource.id = coerceId(resource.id);
4104
4198
  }
4105
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
4199
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
4106
4200
  if (!test) {
4107
4201
  throw new Error('Expected either id or lid to be a valid string');
4108
4202
  }
4109
4203
  })('id' in resource && isNonEmptyString(resource.id) || isNonEmptyString(resource.lid)) : {};
4110
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
4204
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
4111
4205
  if (!test) {
4112
4206
  throw new Error('if id is present, the type must be a string');
4113
4207
  }
@@ -4123,7 +4217,7 @@ function constructResource(type, id, lid) {
4123
4217
  }
4124
4218
  throw new Error('Expected either id or lid to be a valid string');
4125
4219
  }
4126
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
4220
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
4127
4221
  if (!test) {
4128
4222
  throw new Error('type must be a string');
4129
4223
  }
@@ -4191,7 +4285,7 @@ const EmptyClass = class {
4191
4285
  // eslint-disable-next-line @typescript-eslint/no-useless-constructor
4192
4286
  constructor(args) {}
4193
4287
  };
4194
- const _BaseClass = macroCondition(dependencySatisfies('ember-source', '*')) ? macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_STORE_EXTENDS_EMBER_OBJECT) ? importSync('@ember/object') : EmptyClass : EmptyClass;
4288
+ const _BaseClass = macroCondition(dependencySatisfies('ember-source', '*')) ? macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_STORE_EXTENDS_EMBER_OBJECT) ? importSync('@ember/object') : EmptyClass : EmptyClass;
4195
4289
  const BaseClass = _BaseClass.default ? _BaseClass.default : _BaseClass;
4196
4290
  if (BaseClass !== EmptyClass) {
4197
4291
  deprecate(`The Store class extending from EmberObject is deprecated.
@@ -4209,7 +4303,7 @@ const app = new EmberApp(defaults, {
4209
4303
  }
4210
4304
  });
4211
4305
  \`\`\`
4212
- `, /* inline-macro-config */getGlobalConfig().WarpDrive.deprecations.DISABLE_6X_DEPRECATIONS, {
4306
+ `, /* inline-macro-config */getGlobalConfig().WarpDriveMirror.deprecations.DISABLE_6X_DEPRECATIONS, {
4213
4307
  id: 'ember-data-mirror:deprecate-store-extends-ember-object',
4214
4308
  until: '6.0',
4215
4309
  for: 'ember-data-mirror',
@@ -4274,12 +4368,9 @@ class Store extends BaseClass {
4274
4368
  * import Fetch from '@ember-data-mirror/request/fetch';
4275
4369
  *
4276
4370
  * class extends Store {
4277
- * constructor() {
4278
- * super(...arguments);
4279
- * this.requestManager = new RequestManager();
4280
- * this.requestManager.use([Fetch]);
4281
- * this.requestManager.useCache(CacheHandler);
4282
- * }
4371
+ * requestManager = new RequestManager()
4372
+ * .use([Fetch])
4373
+ * .useCache(CacheHandler);
4283
4374
  * }
4284
4375
  * ```
4285
4376
  *
@@ -4368,13 +4459,13 @@ class Store extends BaseClass {
4368
4459
  this.isDestroyed = false;
4369
4460
  }
4370
4461
  _run(cb) {
4371
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
4462
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
4372
4463
  if (!test) {
4373
4464
  throw new Error(`EmberData should never encounter a nested run`);
4374
4465
  }
4375
4466
  })(!this._cbs) : {};
4376
4467
  const _cbs = this._cbs = {};
4377
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
4468
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
4378
4469
  try {
4379
4470
  cb();
4380
4471
  if (_cbs.coalesce) {
@@ -4421,12 +4512,12 @@ class Store extends BaseClass {
4421
4512
  }
4422
4513
  }
4423
4514
  _schedule(name, cb) {
4424
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
4515
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
4425
4516
  if (!test) {
4426
4517
  throw new Error(`EmberData expects to schedule only when there is an active run`);
4427
4518
  }
4428
4519
  })(!!this._cbs) : {};
4429
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
4520
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
4430
4521
  if (!test) {
4431
4522
  throw new Error(`EmberData expects only one flush per queue name, cannot schedule ${name}`);
4432
4523
  }
@@ -4449,7 +4540,7 @@ class Store extends BaseClass {
4449
4540
  return this._requestCache;
4450
4541
  }
4451
4542
  _getAllPending() {
4452
- if (macroCondition(getGlobalConfig().WarpDrive.env.TESTING)) {
4543
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.TESTING)) {
4453
4544
  const all = [];
4454
4545
  const pending = this._requestCache._pending;
4455
4546
  pending.forEach(requests => {
@@ -4521,18 +4612,18 @@ class Store extends BaseClass {
4521
4612
  // the user has had the chance to set the prop.
4522
4613
  const opts = {
4523
4614
  store: this,
4524
- [EnableHydration]: true
4615
+ [EnableHydration]: requestConfig[EnableHydration] ?? true
4525
4616
  };
4526
4617
  if (requestConfig.records) {
4527
4618
  const identifierCache = this.identifierCache;
4528
4619
  opts.records = requestConfig.records.map(r => identifierCache.getOrCreateRecordIdentifier(r));
4529
4620
  }
4530
- if (macroCondition(getGlobalConfig().WarpDrive.env.TESTING)) {
4621
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.TESTING)) {
4531
4622
  if (this.DISABLE_WAITER) {
4532
4623
  opts.disableTestWaiter = typeof requestConfig.disableTestWaiter === 'boolean' ? requestConfig.disableTestWaiter : true;
4533
4624
  }
4534
4625
  }
4535
- if (macroCondition(getGlobalConfig().WarpDrive.debug.LOG_REQUESTS)) {
4626
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_REQUESTS)) {
4536
4627
  let options;
4537
4628
  try {
4538
4629
  options = JSON.parse(JSON.stringify(requestConfig));
@@ -4545,7 +4636,7 @@ class Store extends BaseClass {
4545
4636
  const request = Object.assign({}, requestConfig, opts);
4546
4637
  const future = this.requestManager.request(request);
4547
4638
  future.onFinalize(() => {
4548
- if (macroCondition(getGlobalConfig().WarpDrive.debug.LOG_REQUESTS)) {
4639
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_REQUESTS)) {
4549
4640
  // eslint-disable-next-line no-console
4550
4641
  console.log(`request: [[FINALIZE]] ${requestConfig.op && !requestConfig.url ? '(LEGACY) ' : ''}${requestConfig.op || '<unknown operation>'} ${requestConfig.url || '<empty url>'} ${requestConfig.method || '<empty method>'}`);
4551
4642
  }
@@ -4610,15 +4701,15 @@ class Store extends BaseClass {
4610
4701
  modelFor(type) {
4611
4702
  // FIXME add deprecation and deprecation stripping
4612
4703
  // FIXME/TODO update RFC to remove this method
4613
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
4704
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
4614
4705
  assertDestroyedStoreOnly(this, 'modelFor');
4615
4706
  }
4616
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
4707
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
4617
4708
  if (!test) {
4618
4709
  throw new Error(`You need to pass <type> to the store's modelFor method`);
4619
4710
  }
4620
4711
  })(typeof type === 'string' && type.length) : {};
4621
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
4712
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
4622
4713
  if (!test) {
4623
4714
  throw new Error(`No model was found for '${type}' and no schema handles the type`);
4624
4715
  }
@@ -4654,15 +4745,15 @@ class Store extends BaseClass {
4654
4745
  */
4655
4746
 
4656
4747
  createRecord(type, inputProperties) {
4657
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
4748
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
4658
4749
  assertDestroyingStore(this, 'createRecord');
4659
4750
  }
4660
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
4751
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
4661
4752
  if (!test) {
4662
4753
  throw new Error(`You need to pass a model name to the store's createRecord method`);
4663
4754
  }
4664
4755
  })(type) : {};
4665
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
4756
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
4666
4757
  if (!test) {
4667
4758
  throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`);
4668
4759
  }
@@ -4701,7 +4792,7 @@ class Store extends BaseClass {
4701
4792
  };
4702
4793
  if (resource.id) {
4703
4794
  const identifier = this.identifierCache.peekRecordIdentifier(resource);
4704
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
4795
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
4705
4796
  if (!test) {
4706
4797
  throw new Error(`The id ${String(properties.id)} has already been used with another '${normalizedModelName}' record.`);
4707
4798
  }
@@ -4730,12 +4821,12 @@ class Store extends BaseClass {
4730
4821
  @param {unknown} record
4731
4822
  */
4732
4823
  deleteRecord(record) {
4733
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
4824
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
4734
4825
  assertDestroyingStore(this, 'deleteRecord');
4735
4826
  }
4736
4827
  const identifier = peekRecordIdentifier(record);
4737
4828
  const cache = this.cache;
4738
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
4829
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
4739
4830
  if (!test) {
4740
4831
  throw new Error(`expected the record to be connected to a cache`);
4741
4832
  }
@@ -4762,7 +4853,7 @@ class Store extends BaseClass {
4762
4853
  @param {Model} record
4763
4854
  */
4764
4855
  unloadRecord(record) {
4765
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
4856
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
4766
4857
  assertDestroyingStore(this, 'unloadRecord');
4767
4858
  }
4768
4859
  const identifier = peekRecordIdentifier(record);
@@ -4781,43 +4872,43 @@ class Store extends BaseClass {
4781
4872
  @private
4782
4873
  */
4783
4874
  find(modelName, id, options) {
4784
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
4875
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
4785
4876
  assertDestroyingStore(this, 'find');
4786
4877
  }
4787
4878
  // The default `model` hook in Route calls `find(modelName, id)`,
4788
4879
  // that's why we have to keep this method around even though `findRecord` is
4789
4880
  // the public way to get a record by modelName and id.
4790
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
4881
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
4791
4882
  if (!test) {
4792
4883
  throw new Error(`Using store.find(type) has been removed. Use store.findAll(modelName) to retrieve all records for a given type.`);
4793
4884
  }
4794
4885
  })(arguments.length !== 1) : {};
4795
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
4886
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
4796
4887
  if (!test) {
4797
4888
  throw new Error(`Calling store.find(modelName, id, { preload: preload }) is no longer supported. Use store.findRecord(modelName, id, { preload: preload }) instead.`);
4798
4889
  }
4799
4890
  })(!options) : {};
4800
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
4891
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
4801
4892
  if (!test) {
4802
4893
  throw new Error(`You need to pass the model name and id to the store's find method`);
4803
4894
  }
4804
4895
  })(arguments.length === 2) : {};
4805
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
4896
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
4806
4897
  if (!test) {
4807
4898
  throw new Error(`You cannot pass '${id}' as id to the store's find method`);
4808
4899
  }
4809
4900
  })(typeof id === 'string' || typeof id === 'number') : {};
4810
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
4901
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
4811
4902
  if (!test) {
4812
4903
  throw new Error(`Calling store.find() with a query object is no longer supported. Use store.query() instead.`);
4813
4904
  }
4814
4905
  })(typeof id !== 'object') : {};
4815
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
4906
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
4816
4907
  if (!test) {
4817
4908
  throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${modelName}`);
4818
4909
  }
4819
4910
  })(typeof modelName === 'string') : {};
4820
- if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_STORE_FIND)) {
4911
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_STORE_FIND)) {
4821
4912
  deprecate(`Using store.find is deprecated, use store.findRecord instead. Likely this means you are relying on the implicit store fetching behavior of routes unknowingly.`, false, {
4822
4913
  id: 'ember-data-mirror:deprecate-store-find',
4823
4914
  since: {
@@ -4829,7 +4920,7 @@ class Store extends BaseClass {
4829
4920
  });
4830
4921
  return this.findRecord(modelName, id);
4831
4922
  }
4832
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
4923
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
4833
4924
  {
4834
4925
  throw new Error(`store.find has been removed. Use store.findRecord instead.`);
4835
4926
  }
@@ -5115,10 +5206,10 @@ class Store extends BaseClass {
5115
5206
  */
5116
5207
 
5117
5208
  findRecord(resource, id, options) {
5118
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
5209
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
5119
5210
  assertDestroyingStore(this, 'findRecord');
5120
5211
  }
5121
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
5212
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
5122
5213
  if (!test) {
5123
5214
  throw new Error(`You need to pass a modelName or resource identifier as the first argument to the store's findRecord method`);
5124
5215
  }
@@ -5126,7 +5217,7 @@ class Store extends BaseClass {
5126
5217
  if (isMaybeIdentifier(resource)) {
5127
5218
  options = id;
5128
5219
  } else {
5129
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
5220
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
5130
5221
  if (!test) {
5131
5222
  throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${resource}`);
5132
5223
  }
@@ -5158,7 +5249,7 @@ class Store extends BaseClass {
5158
5249
  [SkipCache]: true
5159
5250
  }
5160
5251
  });
5161
- if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_PROMISE_PROXIES)) {
5252
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_PROMISE_PROXIES)) {
5162
5253
  return promiseObject(promise.then(document => {
5163
5254
  return document.content;
5164
5255
  }));
@@ -5199,7 +5290,7 @@ class Store extends BaseClass {
5199
5290
  */
5200
5291
  // TODO @deprecate getReference (and references generally)
5201
5292
  getReference(resource, id) {
5202
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
5293
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
5203
5294
  assertDestroyingStore(this, 'getReference');
5204
5295
  }
5205
5296
  let resourceIdentifier;
@@ -5210,7 +5301,7 @@ class Store extends BaseClass {
5210
5301
  const normalizedId = ensureStringId(id);
5211
5302
  resourceIdentifier = constructResource(type, normalizedId);
5212
5303
  }
5213
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
5304
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
5214
5305
  if (!test) {
5215
5306
  throw new Error('getReference expected to receive either a resource identifier or type and id as arguments');
5216
5307
  }
@@ -5262,15 +5353,15 @@ class Store extends BaseClass {
5262
5353
  // this is basically an "are we not empty" query.
5263
5354
  return isLoaded ? this._instanceCache.getRecord(stableIdentifier) : null;
5264
5355
  }
5265
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
5356
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
5266
5357
  assertDestroyingStore(this, 'peekRecord');
5267
5358
  }
5268
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
5359
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
5269
5360
  if (!test) {
5270
5361
  throw new Error(`You need to pass a model name to the store's peekRecord method`);
5271
5362
  }
5272
5363
  })(identifier) : {};
5273
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
5364
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
5274
5365
  if (!test) {
5275
5366
  throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${String(identifier)}`);
5276
5367
  }
@@ -5305,7 +5396,7 @@ class Store extends BaseClass {
5305
5396
  @return {Boolean}
5306
5397
  */
5307
5398
  hasRecordForId(modelName, id) {
5308
- if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_HAS_RECORD)) {
5399
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_HAS_RECORD)) {
5309
5400
  deprecate(`store.hasRecordForId has been deprecated in favor of store.peekRecord`, false, {
5310
5401
  id: 'ember-data-mirror:deprecate-has-record-for-id',
5311
5402
  since: {
@@ -5315,15 +5406,15 @@ class Store extends BaseClass {
5315
5406
  until: '5.0',
5316
5407
  for: 'ember-data-mirror'
5317
5408
  });
5318
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
5409
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
5319
5410
  assertDestroyingStore(this, 'hasRecordForId');
5320
5411
  }
5321
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
5412
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
5322
5413
  if (!test) {
5323
5414
  throw new Error(`You need to pass a model name to the store's hasRecordForId method`);
5324
5415
  }
5325
5416
  })(modelName) : {};
5326
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
5417
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
5327
5418
  if (!test) {
5328
5419
  throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${modelName}`);
5329
5420
  }
@@ -5337,7 +5428,7 @@ class Store extends BaseClass {
5337
5428
  const identifier = this.identifierCache.peekRecordIdentifier(resource);
5338
5429
  return Boolean(identifier && this._instanceCache.recordIsLoaded(identifier));
5339
5430
  }
5340
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
5431
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
5341
5432
  {
5342
5433
  throw new Error(`store.hasRecordForId has been removed`);
5343
5434
  }
@@ -5383,20 +5474,20 @@ class Store extends BaseClass {
5383
5474
  */
5384
5475
 
5385
5476
  query(type, query, options = {}) {
5386
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
5477
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
5387
5478
  assertDestroyingStore(this, 'query');
5388
5479
  }
5389
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
5480
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
5390
5481
  if (!test) {
5391
5482
  throw new Error(`You need to pass a model name to the store's query method`);
5392
5483
  }
5393
5484
  })(type) : {};
5394
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
5485
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
5395
5486
  if (!test) {
5396
5487
  throw new Error(`You need to pass a query hash to the store's query method`);
5397
5488
  }
5398
5489
  })(query) : {};
5399
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
5490
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
5400
5491
  if (!test) {
5401
5492
  throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`);
5402
5493
  }
@@ -5412,7 +5503,7 @@ class Store extends BaseClass {
5412
5503
  [SkipCache]: true
5413
5504
  }
5414
5505
  });
5415
- if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_PROMISE_PROXIES)) {
5506
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_PROMISE_PROXIES)) {
5416
5507
  return promiseArray(promise.then(document => document.content));
5417
5508
  }
5418
5509
  return promise.then(document => document.content);
@@ -5501,20 +5592,20 @@ class Store extends BaseClass {
5501
5592
  */
5502
5593
 
5503
5594
  queryRecord(type, query, options) {
5504
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
5595
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
5505
5596
  assertDestroyingStore(this, 'queryRecord');
5506
5597
  }
5507
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
5598
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
5508
5599
  if (!test) {
5509
5600
  throw new Error(`You need to pass a model name to the store's queryRecord method`);
5510
5601
  }
5511
5602
  })(type) : {};
5512
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
5603
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
5513
5604
  if (!test) {
5514
5605
  throw new Error(`You need to pass a query hash to the store's queryRecord method`);
5515
5606
  }
5516
5607
  })(query) : {};
5517
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
5608
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
5518
5609
  if (!test) {
5519
5610
  throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`);
5520
5611
  }
@@ -5530,7 +5621,7 @@ class Store extends BaseClass {
5530
5621
  [SkipCache]: true
5531
5622
  }
5532
5623
  });
5533
- if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_PROMISE_PROXIES)) {
5624
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_PROMISE_PROXIES)) {
5534
5625
  return promiseObject(promise.then(document => document.content));
5535
5626
  }
5536
5627
  return promise.then(document => document.content);
@@ -5684,15 +5775,15 @@ class Store extends BaseClass {
5684
5775
  */
5685
5776
 
5686
5777
  findAll(type, options = {}) {
5687
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
5778
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
5688
5779
  assertDestroyingStore(this, 'findAll');
5689
5780
  }
5690
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
5781
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
5691
5782
  if (!test) {
5692
5783
  throw new Error(`You need to pass a model name to the store's findAll method`);
5693
5784
  }
5694
5785
  })(type) : {};
5695
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
5786
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
5696
5787
  if (!test) {
5697
5788
  throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`);
5698
5789
  }
@@ -5707,7 +5798,7 @@ class Store extends BaseClass {
5707
5798
  [SkipCache]: true
5708
5799
  }
5709
5800
  });
5710
- if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_PROMISE_PROXIES)) {
5801
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_PROMISE_PROXIES)) {
5711
5802
  return promiseArray(promise.then(document => document.content));
5712
5803
  }
5713
5804
  return promise.then(document => document.content);
@@ -5735,15 +5826,15 @@ class Store extends BaseClass {
5735
5826
  */
5736
5827
 
5737
5828
  peekAll(type) {
5738
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
5829
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
5739
5830
  assertDestroyingStore(this, 'peekAll');
5740
5831
  }
5741
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
5832
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
5742
5833
  if (!test) {
5743
5834
  throw new Error(`You need to pass a model name to the store's peekAll method`);
5744
5835
  }
5745
5836
  })(type) : {};
5746
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
5837
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
5747
5838
  if (!test) {
5748
5839
  throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`);
5749
5840
  }
@@ -5765,10 +5856,10 @@ class Store extends BaseClass {
5765
5856
  */
5766
5857
 
5767
5858
  unloadAll(type) {
5768
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
5859
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
5769
5860
  assertDestroyedStoreOnly(this, 'unloadAll');
5770
5861
  }
5771
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
5862
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
5772
5863
  if (!test) {
5773
5864
  throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${String(type)}`);
5774
5865
  }
@@ -5919,7 +6010,7 @@ class Store extends BaseClass {
5919
6010
  */
5920
6011
 
5921
6012
  push(data) {
5922
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
6013
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
5923
6014
  assertDestroyingStore(this, 'push');
5924
6015
  }
5925
6016
  const pushed = this._push(data, false);
@@ -5941,10 +6032,10 @@ class Store extends BaseClass {
5941
6032
  @return {StableRecordIdentifier|Array<StableRecordIdentifier>|null} identifiers for the primary records that had data loaded
5942
6033
  */
5943
6034
  _push(jsonApiDoc, asyncFlush) {
5944
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
6035
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
5945
6036
  assertDestroyingStore(this, '_push');
5946
6037
  }
5947
- if (macroCondition(getGlobalConfig().WarpDrive.debug.LOG_PAYLOADS)) {
6038
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_PAYLOADS)) {
5948
6039
  try {
5949
6040
  const data = JSON.parse(JSON.stringify(jsonApiDoc));
5950
6041
  // eslint-disable-next-line no-console
@@ -5979,10 +6070,10 @@ class Store extends BaseClass {
5979
6070
  * @return {Promise<record>}
5980
6071
  */
5981
6072
  saveRecord(record, options = {}) {
5982
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
6073
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
5983
6074
  assertDestroyingStore(this, 'saveRecord');
5984
6075
  }
5985
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
6076
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
5986
6077
  if (!test) {
5987
6078
  throw new Error(`Unable to initiate save for a record in a disconnected state`);
5988
6079
  }
@@ -5994,7 +6085,7 @@ class Store extends BaseClass {
5994
6085
  // but just in case we reject here to prevent bad things.
5995
6086
  return Promise.reject(new Error(`Record Is Disconnected`));
5996
6087
  }
5997
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
6088
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
5998
6089
  if (!test) {
5999
6090
  throw new Error(`Cannot initiate a save request for an unloaded record: ${identifier.lid}`);
6000
6091
  }
@@ -6051,7 +6142,7 @@ class Store extends BaseClass {
6051
6142
  } = this._instanceCache;
6052
6143
  if (!cache) {
6053
6144
  cache = this._instanceCache.cache = this.createCache(this._instanceCache._storeWrapper);
6054
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
6145
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
6055
6146
  cache = new CacheManager(cache);
6056
6147
  }
6057
6148
  }
@@ -6075,14 +6166,14 @@ class Store extends BaseClass {
6075
6166
  return new this(args);
6076
6167
  }
6077
6168
  }
6078
- if (macroCondition(getGlobalConfig().WarpDrive.deprecations.ENABLE_LEGACY_SCHEMA_SERVICE)) {
6169
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.ENABLE_LEGACY_SCHEMA_SERVICE)) {
6079
6170
  Store.prototype.getSchemaDefinitionService = function () {
6080
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
6171
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
6081
6172
  if (!test) {
6082
6173
  throw new Error(`You must registerSchemaDefinitionService with the store to use custom model classes`);
6083
6174
  }
6084
6175
  })(this._schema) : {};
6085
- deprecate(`Use \`store.schema\` instead of \`store.getSchemaDefinitionService()\``, /* inline-macro-config */getGlobalConfig().WarpDrive.deprecations.DISABLE_6X_DEPRECATIONS, {
6176
+ deprecate(`Use \`store.schema\` instead of \`store.getSchemaDefinitionService()\``, /* inline-macro-config */getGlobalConfig().WarpDriveMirror.deprecations.DISABLE_6X_DEPRECATIONS, {
6086
6177
  id: 'ember-data-mirror:schema-service-updates',
6087
6178
  until: '6.0',
6088
6179
  for: 'ember-data-mirror',
@@ -6094,7 +6185,7 @@ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.ENABLE_LEGACY_SCHEMA
6094
6185
  return this._schema;
6095
6186
  };
6096
6187
  Store.prototype.registerSchemaDefinitionService = function (schema) {
6097
- deprecate(`Use \`store.createSchemaService\` instead of \`store.registerSchemaDefinitionService()\``, /* inline-macro-config */getGlobalConfig().WarpDrive.deprecations.DISABLE_6X_DEPRECATIONS, {
6188
+ deprecate(`Use \`store.createSchemaService\` instead of \`store.registerSchemaDefinitionService()\``, /* inline-macro-config */getGlobalConfig().WarpDriveMirror.deprecations.DISABLE_6X_DEPRECATIONS, {
6098
6189
  id: 'ember-data-mirror:schema-service-updates',
6099
6190
  until: '6.0',
6100
6191
  for: 'ember-data-mirror',
@@ -6106,7 +6197,7 @@ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.ENABLE_LEGACY_SCHEMA
6106
6197
  this._schema = schema;
6107
6198
  };
6108
6199
  Store.prototype.registerSchema = function (schema) {
6109
- deprecate(`Use \`store.createSchemaService\` instead of \`store.registerSchema()\``, /* inline-macro-config */getGlobalConfig().WarpDrive.deprecations.DISABLE_6X_DEPRECATIONS, {
6200
+ deprecate(`Use \`store.createSchemaService\` instead of \`store.registerSchema()\``, /* inline-macro-config */getGlobalConfig().WarpDriveMirror.deprecations.DISABLE_6X_DEPRECATIONS, {
6110
6201
  id: 'ember-data-mirror:schema-service-updates',
6111
6202
  until: '6.0',
6112
6203
  for: 'ember-data-mirror',
@@ -6120,10 +6211,10 @@ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.ENABLE_LEGACY_SCHEMA
6120
6211
  }
6121
6212
  let assertDestroyingStore;
6122
6213
  let assertDestroyedStoreOnly;
6123
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
6214
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
6124
6215
  // eslint-disable-next-line @typescript-eslint/no-shadow
6125
6216
  assertDestroyingStore = function assertDestroyingStore(store, method) {
6126
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
6217
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
6127
6218
  if (!test) {
6128
6219
  throw new Error(`Attempted to call store.${method}(), but the store instance has already been destroyed.`);
6129
6220
  }
@@ -6131,7 +6222,7 @@ if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
6131
6222
  };
6132
6223
  // eslint-disable-next-line @typescript-eslint/no-shadow
6133
6224
  assertDestroyedStoreOnly = function assertDestroyedStoreOnly(store, method) {
6134
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
6225
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
6135
6226
  if (!test) {
6136
6227
  throw new Error(`Attempted to call store.${method}(), but the store instance has already been destroyed.`);
6137
6228
  }
@@ -6145,13 +6236,13 @@ function normalizeProperties(store, identifier, properties) {
6145
6236
  // assert here
6146
6237
  if (properties !== undefined) {
6147
6238
  if ('id' in properties) {
6148
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
6239
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
6149
6240
  if (!test) {
6150
6241
  throw new Error(`expected id to be a string or null`);
6151
6242
  }
6152
6243
  })(properties.id !== undefined) : {};
6153
6244
  }
6154
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
6245
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
6155
6246
  if (!test) {
6156
6247
  throw new Error(`You passed '${typeof properties}' as properties for record creation instead of an object.`);
6157
6248
  }
@@ -6171,7 +6262,7 @@ function normalizeProperties(store, identifier, properties) {
6171
6262
  const field = defs.get(prop);
6172
6263
  if (!field) continue;
6173
6264
  if (field.kind === 'hasMany') {
6174
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
6265
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
6175
6266
  assertRecordsPassedToHasMany(properties[prop]);
6176
6267
  }
6177
6268
  properties[prop] = extractIdentifiersFromRecords(properties[prop]);
@@ -6184,12 +6275,12 @@ function normalizeProperties(store, identifier, properties) {
6184
6275
  return properties;
6185
6276
  }
6186
6277
  function assertRecordsPassedToHasMany(records) {
6187
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
6278
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
6188
6279
  if (!test) {
6189
6280
  throw new Error(`You must pass an array of records to set a hasMany relationship`);
6190
6281
  }
6191
6282
  })(Array.isArray(records)) : {};
6192
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
6283
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
6193
6284
  if (!test) {
6194
6285
  throw new Error(`All elements of a hasMany relationship must be instances of Model, you passed ${records.map(r => `${typeof r}`).join(', ')}`);
6195
6286
  }
@@ -6212,10 +6303,10 @@ function extractIdentifierFromRecord(recordOrPromiseRecord) {
6212
6303
  return null;
6213
6304
  }
6214
6305
  const extract = recordIdentifierFor;
6215
- if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_PROMISE_PROXIES)) {
6306
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_PROMISE_PROXIES)) {
6216
6307
  if (isPromiseRecord(recordOrPromiseRecord)) {
6217
6308
  const content = recordOrPromiseRecord.content;
6218
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
6309
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
6219
6310
  if (!test) {
6220
6311
  throw new Error('You passed in a promise that did not originate from an EmberData relationship. You can only pass promises that come from a belongsTo or hasMany relationship to the get call.');
6221
6312
  }
@@ -6342,7 +6433,7 @@ class Document {
6342
6433
  * @return Promise<Document>
6343
6434
  */
6344
6435
  fetch(options = {}) {
6345
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
6436
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
6346
6437
  if (!test) {
6347
6438
  throw new Error(`No self or related link`);
6348
6439
  }
@@ -6621,7 +6712,7 @@ const CacheHandler = {
6621
6712
  }
6622
6713
  store.requestManager._pending.set(context.id, promise);
6623
6714
  }
6624
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
6715
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
6625
6716
  if (!test) {
6626
6717
  throw new Error(`Expected a peeked request to be present`);
6627
6718
  }
@@ -6649,7 +6740,7 @@ function maybeUpdateUiObjects(store, request, options, document, isFromCache) {
6649
6740
  identifier
6650
6741
  } = options;
6651
6742
  if (!document) {
6652
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
6743
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
6653
6744
  if (!test) {
6654
6745
  throw new Error(`The CacheHandler expected response content but none was found`);
6655
6746
  }
@@ -6841,7 +6932,7 @@ function fetchContentAndHydrate(next, context, identifier, priority) {
6841
6932
  isMut = true;
6842
6933
  // TODO should we handle multiple records in request.records by iteratively calling willCommit for each
6843
6934
  const record = context.request.data?.record || context.request.records?.[0];
6844
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
6935
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
6845
6936
  if (!test) {
6846
6937
  throw new Error(`Expected to receive a list of records included in the ${context.request.op} request`);
6847
6938
  }
@@ -6861,7 +6952,7 @@ function fetchContentAndHydrate(next, context, identifier, priority) {
6861
6952
  if (!isMut) {
6862
6953
  return promise;
6863
6954
  }
6864
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
6955
+ macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
6865
6956
  if (!test) {
6866
6957
  throw new Error(`Expected a mutation`);
6867
6958
  }
@@ -6895,7 +6986,7 @@ function fetchContentAndHydrate(next, context, identifier, priority) {
6895
6986
  @return {String} normalizedModelName
6896
6987
  */
6897
6988
  function normalizeModelName(modelName) {
6898
- if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_HELPERS)) {
6989
+ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_HELPERS)) {
6899
6990
  deprecate(`the helper function normalizeModelName is deprecated. You should use model names that are already normalized, or use string helpers of your own. This function is primarily an alias for dasherize from @ember/string.`, false, {
6900
6991
  id: 'ember-data-mirror:deprecate-normalize-modelname-helper',
6901
6992
  for: 'ember-data-mirror',
@@ -6909,4 +7000,4 @@ function normalizeModelName(modelName) {
6909
7000
  }
6910
7001
  assert(`normalizeModelName support has been removed`);
6911
7002
  }
6912
- export { ARRAY_SIGNAL as A, CacheHandler as C, IdentifierArray as I, MUTATE as M, RecordArrayManager as R, Store as S, _clearCaches as _, setIdentifierGenerationMethod as a, setIdentifierUpdateMethod as b, setIdentifierForgetMethod as c, setIdentifierResetMethod as d, setKeyInfoForResource as e, constructResource as f, coerceId as g, ensureStringId as h, isStableIdentifier as i, Collection as j, notifyArray as k, SOURCE as l, fastPush as m, normalizeModelName as n, removeRecordDataFor as o, peekCache as p, setRecordIdentifier as q, recordIdentifierFor as r, storeFor as s, StoreMap as t, setCacheFor as u };
7003
+ export { ARRAY_SIGNAL as A, CacheHandler as C, IdentifierArray as I, MUTATE as M, RecordArrayManager as R, Store as S, _clearCaches as _, setIdentifierGenerationMethod as a, setIdentifierUpdateMethod as b, setIdentifierForgetMethod as c, setIdentifierResetMethod as d, setKeyInfoForResource as e, constructResource as f, coerceId as g, ensureStringId as h, isStableIdentifier as i, Collection as j, notifyArray as k, SOURCE as l, fastPush as m, normalizeModelName as n, removeRecordDataFor as o, peekCache as p, setRecordIdentifier as q, recordIdentifierFor as r, storeFor as s, StoreMap as t, setCacheFor as u, log as v, logGroup as w };