@ember-data-mirror/store 5.3.9 → 5.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/addon-main.cjs +1 -1
- package/dist/-private.js +1 -1
- package/dist/{handler-CET_Ja8V.js → handler-CW2kp6Ua.js} +168 -269
- package/dist/handler-CW2kp6Ua.js.map +1 -0
- package/dist/index.js +1 -1
- package/package.json +30 -19
- package/unstable-preview-types/-private/cache-handler/handler.d.ts +4 -4
- package/unstable-preview-types/-private/cache-handler/types.d.ts +2 -2
- package/unstable-preview-types/-private/cache-handler/utils.d.ts +4 -4
- package/unstable-preview-types/-private/caches/cache-utils.d.ts +2 -2
- package/unstable-preview-types/-private/caches/identifier-cache.d.ts +3 -3
- package/unstable-preview-types/-private/caches/instance-cache.d.ts +4 -4
- package/unstable-preview-types/-private/document.d.ts +3 -3
- package/unstable-preview-types/-private/legacy-model-support/record-reference.d.ts +2 -2
- package/unstable-preview-types/-private/legacy-model-support/shim-model-class.d.ts +2 -2
- package/unstable-preview-types/-private/managers/cache-capabilities-manager.d.ts +1 -1
- package/unstable-preview-types/-private/managers/cache-manager.d.ts +10 -10
- package/unstable-preview-types/-private/managers/cache-manager.d.ts.map +1 -1
- package/unstable-preview-types/-private/managers/notification-manager.d.ts +4 -1
- package/unstable-preview-types/-private/managers/notification-manager.d.ts.map +1 -1
- package/unstable-preview-types/-private/managers/record-array-manager.d.ts +3 -3
- package/unstable-preview-types/-private/network/request-cache.d.ts +1 -1
- package/unstable-preview-types/-private/record-arrays/identifier-array.d.ts +4 -4
- package/unstable-preview-types/-private/record-arrays/identifier-array.d.ts.map +1 -1
- package/unstable-preview-types/-private/record-arrays/native-proxy-type-fix.d.ts +3 -3
- package/unstable-preview-types/-private/store-service.d.ts +6 -6
- package/unstable-preview-types/-private/store-service.d.ts.map +1 -1
- package/unstable-preview-types/-private/utils/construct-resource.d.ts +1 -1
- package/unstable-preview-types/-types/q/cache-capabilities-manager.d.ts +1 -1
- package/unstable-preview-types/-types/q/ds-model.d.ts +2 -2
- package/unstable-preview-types/-types/q/identifier.d.ts +1 -1
- package/unstable-preview-types/-types/q/record-data-json-api.d.ts +2 -2
- package/unstable-preview-types/-types/q/schema-service.d.ts +8 -8
- package/unstable-preview-types/-types/q/store.d.ts +2 -2
- package/unstable-preview-types/index.d.ts +20 -20
- package/dist/handler-CET_Ja8V.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { deprecate, warn } from '@ember/debug';
|
|
2
2
|
import { macroCondition, getGlobalConfig, dependencySatisfies, importSync } from '@embroider/macros';
|
|
3
|
-
import { SkipCache, EnableHydration } from '@warp-drive/core-types/request';
|
|
4
|
-
import { getOrSetGlobal, setTransient, peekTransient } from '@warp-drive/core-types/-private';
|
|
5
|
-
import { CACHE_OWNER, DEBUG_STALE_CACHE_OWNER, DEBUG_CLIENT_ORIGINATED, DEBUG_IDENTIFIER_BUCKET } from '@warp-drive/core-types/identifier';
|
|
3
|
+
import { SkipCache, EnableHydration } from '@warp-drive-mirror/core-types/request';
|
|
4
|
+
import { getOrSetGlobal, setTransient, peekTransient } from '@warp-drive-mirror/core-types/-private';
|
|
5
|
+
import { CACHE_OWNER, DEBUG_STALE_CACHE_OWNER, DEBUG_CLIENT_ORIGINATED, DEBUG_IDENTIFIER_BUCKET } from '@warp-drive-mirror/core-types/identifier';
|
|
6
6
|
import { dasherize } from '@ember-data-mirror/request-utils/string';
|
|
7
7
|
import { defineSignal, createSignal, subscribe, createArrayTags, addToTransaction, addTransactionCB } from '@ember-data-mirror/tracking/-private';
|
|
8
8
|
import { _backburner } from '@ember/runloop';
|
|
@@ -13,7 +13,7 @@ import { compat } from '@ember-data-mirror/tracking';
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
function coerceId(id) {
|
|
16
|
-
if (macroCondition(getGlobalConfig().
|
|
16
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_NON_STRICT_ID)) {
|
|
17
17
|
let normalized;
|
|
18
18
|
if (id === null || id === undefined || id === '') {
|
|
19
19
|
normalized = null;
|
|
@@ -25,13 +25,13 @@ function coerceId(id) {
|
|
|
25
25
|
until: '6.0',
|
|
26
26
|
for: 'ember-data-mirror',
|
|
27
27
|
since: {
|
|
28
|
-
available: '
|
|
28
|
+
available: '4.13',
|
|
29
29
|
enabled: '5.3'
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
return normalized;
|
|
33
33
|
}
|
|
34
|
-
macroCondition(getGlobalConfig().
|
|
34
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
35
35
|
if (!test) {
|
|
36
36
|
throw new Error(`Resource IDs must be a non-empty string or null. Received '${String(id)}'.`);
|
|
37
37
|
}
|
|
@@ -45,7 +45,7 @@ function ensureStringId(id) {
|
|
|
45
45
|
} else if (typeof id === 'number' && !isNaN(id)) {
|
|
46
46
|
normalized = String(id);
|
|
47
47
|
}
|
|
48
|
-
macroCondition(getGlobalConfig().
|
|
48
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
49
49
|
if (!test) {
|
|
50
50
|
throw new Error(`Expected id to be a string or number, received ${String(id)}`);
|
|
51
51
|
}
|
|
@@ -53,14 +53,14 @@ function ensureStringId(id) {
|
|
|
53
53
|
return normalized;
|
|
54
54
|
}
|
|
55
55
|
function normalizeModelName(type) {
|
|
56
|
-
if (macroCondition(getGlobalConfig().
|
|
56
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_NON_STRICT_TYPES)) {
|
|
57
57
|
const result = dasherize(type);
|
|
58
58
|
deprecate(`The resource type '${type}' is not normalized. Update your application code to use '${result}' instead of '${type}'.`, result === type, {
|
|
59
59
|
id: 'ember-data-mirror:deprecate-non-strict-types',
|
|
60
60
|
until: '6.0',
|
|
61
61
|
for: 'ember-data-mirror',
|
|
62
62
|
since: {
|
|
63
|
-
available: '
|
|
63
|
+
available: '4.13',
|
|
64
64
|
enabled: '5.3'
|
|
65
65
|
}
|
|
66
66
|
});
|
|
@@ -139,11 +139,11 @@ function isDocumentIdentifier(identifier) {
|
|
|
139
139
|
}
|
|
140
140
|
const isFastBoot = typeof FastBoot !== 'undefined';
|
|
141
141
|
const _crypto = isFastBoot ? FastBoot.require('crypto') : globalThis.crypto;
|
|
142
|
-
if (macroCondition(getGlobalConfig().
|
|
142
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.polyfillUUID)) {
|
|
143
143
|
installPolyfill();
|
|
144
144
|
}
|
|
145
145
|
function uuidv4() {
|
|
146
|
-
macroCondition(getGlobalConfig().
|
|
146
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
147
147
|
if (!test) {
|
|
148
148
|
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');
|
|
149
149
|
}
|
|
@@ -192,7 +192,7 @@ function updateTypeIdMapping(typeMap, identifier, id) {
|
|
|
192
192
|
}
|
|
193
193
|
function defaultUpdateMethod(identifier, data, bucket) {
|
|
194
194
|
if (bucket === 'record') {
|
|
195
|
-
macroCondition(getGlobalConfig().
|
|
195
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
196
196
|
if (!test) {
|
|
197
197
|
throw new Error(`Expected identifier to be a StableRecordIdentifier`);
|
|
198
198
|
}
|
|
@@ -206,7 +206,7 @@ function defaultKeyInfoMethod(resource, known) {
|
|
|
206
206
|
// TODO RFC something to make this configurable
|
|
207
207
|
const id = hasId(resource) ? coerceId(resource.id) : null;
|
|
208
208
|
const type = hasType(resource) ? normalizeModelName(resource.type) : known ? known.type : null;
|
|
209
|
-
macroCondition(getGlobalConfig().
|
|
209
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
210
210
|
if (!test) {
|
|
211
211
|
throw new Error(`Expected keyInfoForResource to provide a type for the resource`);
|
|
212
212
|
}
|
|
@@ -221,7 +221,7 @@ function defaultGenerationMethod(data, bucket) {
|
|
|
221
221
|
if (hasLid(data)) {
|
|
222
222
|
return data.lid;
|
|
223
223
|
}
|
|
224
|
-
macroCondition(getGlobalConfig().
|
|
224
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
225
225
|
if (!test) {
|
|
226
226
|
throw new Error(`Cannot generate an identifier for a resource without a type`);
|
|
227
227
|
}
|
|
@@ -241,7 +241,7 @@ function defaultGenerationMethod(data, bucket) {
|
|
|
241
241
|
}
|
|
242
242
|
return null;
|
|
243
243
|
}
|
|
244
|
-
macroCondition(getGlobalConfig().
|
|
244
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
245
245
|
{
|
|
246
246
|
throw new Error(`Unknown bucket ${bucket}`);
|
|
247
247
|
}
|
|
@@ -252,7 +252,7 @@ function defaultMergeMethod(a, _b, _c) {
|
|
|
252
252
|
return a;
|
|
253
253
|
}
|
|
254
254
|
let DEBUG_MAP;
|
|
255
|
-
if (macroCondition(getGlobalConfig().
|
|
255
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
256
256
|
DEBUG_MAP = getOrSetGlobal('DEBUG_MAP', new WeakMap());
|
|
257
257
|
}
|
|
258
258
|
|
|
@@ -310,19 +310,19 @@ class IdentifierCache {
|
|
|
310
310
|
*/
|
|
311
311
|
|
|
312
312
|
_getRecordIdentifier(resource, shouldGenerate) {
|
|
313
|
-
if (macroCondition(getGlobalConfig().
|
|
313
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_IDENTIFIERS)) {
|
|
314
314
|
// eslint-disable-next-line no-console
|
|
315
315
|
console.groupCollapsed(`Identifiers: ${shouldGenerate ? 'Generating' : 'Peeking'} Identifier`, resource);
|
|
316
316
|
}
|
|
317
317
|
// short circuit if we're already the stable version
|
|
318
318
|
if (isStableIdentifier(resource)) {
|
|
319
|
-
if (macroCondition(getGlobalConfig().
|
|
319
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
320
320
|
// TODO should we instead just treat this case as a new generation skipping the short circuit?
|
|
321
321
|
if (!this._cache.resources.has(resource.lid) || this._cache.resources.get(resource.lid) !== resource) {
|
|
322
322
|
throw new Error(`The supplied identifier ${JSON.stringify(resource)} does not belong to this store instance`);
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
|
-
if (macroCondition(getGlobalConfig().
|
|
325
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_IDENTIFIERS)) {
|
|
326
326
|
// eslint-disable-next-line no-console
|
|
327
327
|
console.log(`Identifiers: cache HIT - Stable ${resource.lid}`);
|
|
328
328
|
// eslint-disable-next-line no-console
|
|
@@ -333,20 +333,20 @@ class IdentifierCache {
|
|
|
333
333
|
|
|
334
334
|
// the resource is unknown, ask the application to identify this data for us
|
|
335
335
|
const lid = this._generate(resource, 'record');
|
|
336
|
-
if (macroCondition(getGlobalConfig().
|
|
336
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_IDENTIFIERS)) {
|
|
337
337
|
// eslint-disable-next-line no-console
|
|
338
338
|
console.log(`Identifiers: ${lid ? 'no ' : ''}lid ${lid ? lid + ' ' : ''}determined for resource`, resource);
|
|
339
339
|
}
|
|
340
340
|
let identifier = /*#__NOINLINE__*/getIdentifierFromLid(this._cache, lid, resource);
|
|
341
341
|
if (identifier !== null) {
|
|
342
|
-
if (macroCondition(getGlobalConfig().
|
|
342
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_IDENTIFIERS)) {
|
|
343
343
|
// eslint-disable-next-line no-console
|
|
344
344
|
console.groupEnd();
|
|
345
345
|
}
|
|
346
346
|
return identifier;
|
|
347
347
|
}
|
|
348
348
|
if (shouldGenerate === 0) {
|
|
349
|
-
if (macroCondition(getGlobalConfig().
|
|
349
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_IDENTIFIERS)) {
|
|
350
350
|
// eslint-disable-next-line no-console
|
|
351
351
|
console.groupEnd();
|
|
352
352
|
}
|
|
@@ -366,7 +366,7 @@ class IdentifierCache {
|
|
|
366
366
|
identifier = /*#__NOINLINE__*/makeStableRecordIdentifier(keyInfo, 'record', false);
|
|
367
367
|
}
|
|
368
368
|
addResourceToCache(this._cache, identifier);
|
|
369
|
-
if (macroCondition(getGlobalConfig().
|
|
369
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_IDENTIFIERS)) {
|
|
370
370
|
// eslint-disable-next-line no-console
|
|
371
371
|
console.groupEnd();
|
|
372
372
|
}
|
|
@@ -408,7 +408,7 @@ class IdentifierCache {
|
|
|
408
408
|
identifier = {
|
|
409
409
|
lid: cacheKey
|
|
410
410
|
};
|
|
411
|
-
if (macroCondition(getGlobalConfig().
|
|
411
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
412
412
|
Object.freeze(identifier);
|
|
413
413
|
}
|
|
414
414
|
DOCUMENTS.add(identifier);
|
|
@@ -454,7 +454,7 @@ class IdentifierCache {
|
|
|
454
454
|
}, 'record', true);
|
|
455
455
|
|
|
456
456
|
// populate our unique table
|
|
457
|
-
if (macroCondition(getGlobalConfig().
|
|
457
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
458
458
|
if (this._cache.resources.has(identifier.lid)) {
|
|
459
459
|
throw new Error(`The lid generated for the new record is not unique as it matches an existing identifier`);
|
|
460
460
|
}
|
|
@@ -462,7 +462,7 @@ class IdentifierCache {
|
|
|
462
462
|
|
|
463
463
|
/*#__NOINLINE__*/
|
|
464
464
|
addResourceToCache(this._cache, identifier);
|
|
465
|
-
if (macroCondition(getGlobalConfig().
|
|
465
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_IDENTIFIERS)) {
|
|
466
466
|
// eslint-disable-next-line no-console
|
|
467
467
|
console.log(`Identifiers: created identifier ${String(identifier)} for newly generated resource`, data);
|
|
468
468
|
}
|
|
@@ -511,7 +511,7 @@ class IdentifierCache {
|
|
|
511
511
|
if (hadLid) {
|
|
512
512
|
data.lid = identifier.lid;
|
|
513
513
|
}
|
|
514
|
-
if (macroCondition(getGlobalConfig().
|
|
514
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_IDENTIFIERS)) {
|
|
515
515
|
// eslint-disable-next-line no-console
|
|
516
516
|
console.log(`Identifiers: merged identifiers ${generatedIdentifier.lid} and ${existingIdentifier.lid} for resource into ${identifier.lid}`, data);
|
|
517
517
|
}
|
|
@@ -523,12 +523,12 @@ class IdentifierCache {
|
|
|
523
523
|
|
|
524
524
|
// add to our own secondary lookup table
|
|
525
525
|
if (id !== newId && newId !== null) {
|
|
526
|
-
if (macroCondition(getGlobalConfig().
|
|
526
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_IDENTIFIERS)) {
|
|
527
527
|
// eslint-disable-next-line no-console
|
|
528
528
|
console.log(`Identifiers: updated id for identifier ${identifier.lid} from '${String(id)}' to '${String(newId)}' for resource`, data);
|
|
529
529
|
}
|
|
530
530
|
const typeSet = this._cache.resourcesByType[identifier.type];
|
|
531
|
-
macroCondition(getGlobalConfig().
|
|
531
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
532
532
|
if (!test) {
|
|
533
533
|
throw new Error(`Expected to find a typeSet for ${identifier.type}`);
|
|
534
534
|
}
|
|
@@ -537,7 +537,7 @@ class IdentifierCache {
|
|
|
537
537
|
if (id !== null) {
|
|
538
538
|
typeSet.id.delete(id);
|
|
539
539
|
}
|
|
540
|
-
} else if (macroCondition(getGlobalConfig().
|
|
540
|
+
} else if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_IDENTIFIERS)) {
|
|
541
541
|
// eslint-disable-next-line no-console
|
|
542
542
|
console.log(`Identifiers: updated identifier ${identifier.lid} resource`, data);
|
|
543
543
|
}
|
|
@@ -549,7 +549,7 @@ class IdentifierCache {
|
|
|
549
549
|
* @private
|
|
550
550
|
*/
|
|
551
551
|
_mergeRecordIdentifiers(keyInfo, identifier, existingIdentifier, data) {
|
|
552
|
-
macroCondition(getGlobalConfig().
|
|
552
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
553
553
|
if (!test) {
|
|
554
554
|
throw new Error(`Expected keyInfo to contain an id`);
|
|
555
555
|
}
|
|
@@ -600,7 +600,7 @@ class IdentifierCache {
|
|
|
600
600
|
forgetRecordIdentifier(identifierObject) {
|
|
601
601
|
const identifier = this.getOrCreateRecordIdentifier(identifierObject);
|
|
602
602
|
const typeSet = this._cache.resourcesByType[identifier.type];
|
|
603
|
-
macroCondition(getGlobalConfig().
|
|
603
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
604
604
|
if (!test) {
|
|
605
605
|
throw new Error(`Expected to find a typeSet for ${identifier.type}`);
|
|
606
606
|
}
|
|
@@ -617,13 +617,13 @@ class IdentifierCache {
|
|
|
617
617
|
});
|
|
618
618
|
this._cache.polymorphicLidBackMap.delete(identifier.lid);
|
|
619
619
|
}
|
|
620
|
-
if (macroCondition(getGlobalConfig().
|
|
620
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
621
621
|
identifier[DEBUG_STALE_CACHE_OWNER] = identifier[CACHE_OWNER];
|
|
622
622
|
}
|
|
623
623
|
identifier[CACHE_OWNER] = undefined;
|
|
624
624
|
IDENTIFIERS.delete(identifier);
|
|
625
625
|
this._forget(identifier, 'record');
|
|
626
|
-
if (macroCondition(getGlobalConfig().
|
|
626
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_IDENTIFIERS)) {
|
|
627
627
|
// eslint-disable-next-line no-console
|
|
628
628
|
console.log(`Identifiers: released identifier ${identifierObject.lid}`);
|
|
629
629
|
}
|
|
@@ -638,7 +638,7 @@ class IdentifierCache {
|
|
|
638
638
|
}
|
|
639
639
|
function makeStableRecordIdentifier(recordIdentifier, bucket, clientOriginated) {
|
|
640
640
|
IDENTIFIERS.add(recordIdentifier);
|
|
641
|
-
if (macroCondition(getGlobalConfig().
|
|
641
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
642
642
|
// we enforce immutability in dev
|
|
643
643
|
// but preserve our ability to do controlled updates to the reference
|
|
644
644
|
let wrapper = {
|
|
@@ -700,7 +700,7 @@ function makeStableRecordIdentifier(recordIdentifier, bucket, clientOriginated)
|
|
|
700
700
|
return recordIdentifier;
|
|
701
701
|
}
|
|
702
702
|
function performRecordIdentifierUpdate(identifier, keyInfo, data, updateFn) {
|
|
703
|
-
if (macroCondition(getGlobalConfig().
|
|
703
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
704
704
|
const {
|
|
705
705
|
id,
|
|
706
706
|
type
|
|
@@ -775,7 +775,7 @@ function detectMerge(cache, keyInfo, identifier, data) {
|
|
|
775
775
|
}
|
|
776
776
|
function getIdentifierFromLid(cache, lid, resource) {
|
|
777
777
|
const identifier = cache.resources.get(lid);
|
|
778
|
-
if (macroCondition(getGlobalConfig().
|
|
778
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_IDENTIFIERS)) {
|
|
779
779
|
// eslint-disable-next-line no-console
|
|
780
780
|
console.log(`Identifiers: cache ${identifier ? 'HIT' : 'MISS'} - Non-Stable ${lid}`, resource);
|
|
781
781
|
}
|
|
@@ -956,7 +956,7 @@ class RecordReference {
|
|
|
956
956
|
if (id !== null) {
|
|
957
957
|
return this.store.findRecord(this.type, id);
|
|
958
958
|
}
|
|
959
|
-
macroCondition(getGlobalConfig().
|
|
959
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
960
960
|
{
|
|
961
961
|
throw new Error(`Unable to fetch record of type ${this.type} without an id`);
|
|
962
962
|
}
|
|
@@ -983,7 +983,7 @@ class RecordReference {
|
|
|
983
983
|
reload: true
|
|
984
984
|
});
|
|
985
985
|
}
|
|
986
|
-
macroCondition(getGlobalConfig().
|
|
986
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
987
987
|
{
|
|
988
988
|
throw new Error(`Unable to fetch record of type ${this.type} without an id`);
|
|
989
989
|
}
|
|
@@ -1039,7 +1039,7 @@ class CacheCapabilitiesManager {
|
|
|
1039
1039
|
});
|
|
1040
1040
|
}
|
|
1041
1041
|
notifyChange(identifier, namespace, key) {
|
|
1042
|
-
macroCondition(getGlobalConfig().
|
|
1042
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
1043
1043
|
if (!test) {
|
|
1044
1044
|
throw new Error(`Expected a stable identifier`);
|
|
1045
1045
|
}
|
|
@@ -1058,7 +1058,7 @@ class CacheCapabilitiesManager {
|
|
|
1058
1058
|
return this._store.schema;
|
|
1059
1059
|
}
|
|
1060
1060
|
setRecordId(identifier, id) {
|
|
1061
|
-
macroCondition(getGlobalConfig().
|
|
1061
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
1062
1062
|
if (!test) {
|
|
1063
1063
|
throw new Error(`Expected a stable identifier`);
|
|
1064
1064
|
}
|
|
@@ -1069,7 +1069,7 @@ class CacheCapabilitiesManager {
|
|
|
1069
1069
|
return Boolean(this._store._instanceCache.peek(identifier));
|
|
1070
1070
|
}
|
|
1071
1071
|
disconnectRecord(identifier) {
|
|
1072
|
-
macroCondition(getGlobalConfig().
|
|
1072
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
1073
1073
|
if (!test) {
|
|
1074
1074
|
throw new Error(`Expected a stable identifier`);
|
|
1075
1075
|
}
|
|
@@ -1078,7 +1078,7 @@ class CacheCapabilitiesManager {
|
|
|
1078
1078
|
this._pendingNotifies.delete(identifier);
|
|
1079
1079
|
}
|
|
1080
1080
|
}
|
|
1081
|
-
if (macroCondition(getGlobalConfig().
|
|
1081
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.ENABLE_LEGACY_SCHEMA_SERVICE)) {
|
|
1082
1082
|
CacheCapabilitiesManager.prototype.getSchemaDefinitionService = function () {
|
|
1083
1083
|
// FIXME add deprecation for this
|
|
1084
1084
|
return this._store.schema;
|
|
@@ -1092,7 +1092,7 @@ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.ENABLE_LEGACY_SCHEMA
|
|
|
1092
1092
|
|
|
1093
1093
|
const CacheForIdentifierCache = getOrSetGlobal('CacheForIdentifierCache', new Map());
|
|
1094
1094
|
function setCacheFor(identifier, cache) {
|
|
1095
|
-
macroCondition(getGlobalConfig().
|
|
1095
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
1096
1096
|
if (!test) {
|
|
1097
1097
|
throw new Error(`Illegal set of identifier`);
|
|
1098
1098
|
}
|
|
@@ -1142,7 +1142,7 @@ function peekRecordIdentifier(record) {
|
|
|
1142
1142
|
*/
|
|
1143
1143
|
|
|
1144
1144
|
function recordIdentifierFor(record) {
|
|
1145
|
-
macroCondition(getGlobalConfig().
|
|
1145
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
1146
1146
|
if (!test) {
|
|
1147
1147
|
throw new Error(`${String(record)} is not a record instantiated by @ember-data-mirror/store`);
|
|
1148
1148
|
}
|
|
@@ -1150,7 +1150,7 @@ function recordIdentifierFor(record) {
|
|
|
1150
1150
|
return RecordCache.get(record);
|
|
1151
1151
|
}
|
|
1152
1152
|
function setRecordIdentifier(record, identifier) {
|
|
1153
|
-
if (macroCondition(getGlobalConfig().
|
|
1153
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
1154
1154
|
if (RecordCache.has(record) && RecordCache.get(record) !== identifier) {
|
|
1155
1155
|
throw new Error(`${String(record)} was already assigned an identifier`);
|
|
1156
1156
|
}
|
|
@@ -1169,7 +1169,7 @@ function setRecordIdentifier(record, identifier) {
|
|
|
1169
1169
|
const StoreMap = getOrSetGlobal('StoreMap', new Map());
|
|
1170
1170
|
function storeFor(record) {
|
|
1171
1171
|
const store = StoreMap.get(record);
|
|
1172
|
-
macroCondition(getGlobalConfig().
|
|
1172
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
1173
1173
|
if (!test) {
|
|
1174
1174
|
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.`);
|
|
1175
1175
|
}
|
|
@@ -1211,7 +1211,7 @@ class InstanceCache {
|
|
|
1211
1211
|
if ('id' in resourceData) {
|
|
1212
1212
|
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})'`);
|
|
1213
1213
|
}
|
|
1214
|
-
macroCondition(getGlobalConfig().
|
|
1214
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
1215
1215
|
{
|
|
1216
1216
|
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)})'`);
|
|
1217
1217
|
}
|
|
@@ -1240,7 +1240,7 @@ class InstanceCache {
|
|
|
1240
1240
|
getRecord(identifier, properties) {
|
|
1241
1241
|
let record = this.__instances.record.get(identifier);
|
|
1242
1242
|
if (!record) {
|
|
1243
|
-
macroCondition(getGlobalConfig().
|
|
1243
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
1244
1244
|
if (!test) {
|
|
1245
1245
|
throw new Error(`Cannot create a new record instance while the store is being destroyed`);
|
|
1246
1246
|
}
|
|
@@ -1252,7 +1252,7 @@ class InstanceCache {
|
|
|
1252
1252
|
setCacheFor(record, cache);
|
|
1253
1253
|
StoreMap.set(record, this.store);
|
|
1254
1254
|
this.__instances.record.set(identifier, record);
|
|
1255
|
-
if (macroCondition(getGlobalConfig().
|
|
1255
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_INSTANCE_CACHE)) {
|
|
1256
1256
|
// eslint-disable-next-line no-console
|
|
1257
1257
|
console.log(`InstanceCache: created Record for ${String(identifier)}`, properties);
|
|
1258
1258
|
}
|
|
@@ -1291,7 +1291,7 @@ class InstanceCache {
|
|
|
1291
1291
|
}
|
|
1292
1292
|
disconnect(identifier) {
|
|
1293
1293
|
const record = this.__instances.record.get(identifier);
|
|
1294
|
-
macroCondition(getGlobalConfig().
|
|
1294
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
1295
1295
|
if (!test) {
|
|
1296
1296
|
throw new Error('Cannot destroy record while it is still materialized');
|
|
1297
1297
|
}
|
|
@@ -1300,25 +1300,25 @@ class InstanceCache {
|
|
|
1300
1300
|
this.store.identifierCache.forgetRecordIdentifier(identifier);
|
|
1301
1301
|
removeRecordDataFor(identifier);
|
|
1302
1302
|
this.store._requestCache._clearEntries(identifier);
|
|
1303
|
-
if (macroCondition(getGlobalConfig().
|
|
1303
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_INSTANCE_CACHE)) {
|
|
1304
1304
|
// eslint-disable-next-line no-console
|
|
1305
1305
|
console.log(`InstanceCache: disconnected ${String(identifier)}`);
|
|
1306
1306
|
}
|
|
1307
1307
|
}
|
|
1308
1308
|
unloadRecord(identifier) {
|
|
1309
|
-
if (macroCondition(getGlobalConfig().
|
|
1309
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
1310
1310
|
const requests = this.store.getRequestStateService().getPendingRequestsForRecord(identifier);
|
|
1311
1311
|
if (requests.some(req => {
|
|
1312
1312
|
return req.type === 'mutation';
|
|
1313
1313
|
})) {
|
|
1314
|
-
macroCondition(getGlobalConfig().
|
|
1314
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
1315
1315
|
{
|
|
1316
1316
|
throw new Error(`You can only unload a record which is not inFlight. '${String(identifier)}'`);
|
|
1317
1317
|
}
|
|
1318
1318
|
})() : {};
|
|
1319
1319
|
}
|
|
1320
1320
|
}
|
|
1321
|
-
if (macroCondition(getGlobalConfig().
|
|
1321
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_INSTANCE_CACHE)) {
|
|
1322
1322
|
// eslint-disable-next-line no-console
|
|
1323
1323
|
console.groupCollapsed(`InstanceCache: unloading record for ${String(identifier)}`);
|
|
1324
1324
|
}
|
|
@@ -1333,7 +1333,7 @@ class InstanceCache {
|
|
|
1333
1333
|
StoreMap.delete(record);
|
|
1334
1334
|
RecordCache.delete(record);
|
|
1335
1335
|
removeRecordDataFor(record);
|
|
1336
|
-
if (macroCondition(getGlobalConfig().
|
|
1336
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_INSTANCE_CACHE)) {
|
|
1337
1337
|
// eslint-disable-next-line no-console
|
|
1338
1338
|
console.log(`InstanceCache: destroyed record for ${String(identifier)}`);
|
|
1339
1339
|
}
|
|
@@ -1341,7 +1341,7 @@ class InstanceCache {
|
|
|
1341
1341
|
if (cache) {
|
|
1342
1342
|
cache.unloadRecord(identifier);
|
|
1343
1343
|
removeRecordDataFor(identifier);
|
|
1344
|
-
if (macroCondition(getGlobalConfig().
|
|
1344
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_INSTANCE_CACHE)) {
|
|
1345
1345
|
// eslint-disable-next-line no-console
|
|
1346
1346
|
console.log(`InstanceCache: destroyed cache for ${String(identifier)}`);
|
|
1347
1347
|
}
|
|
@@ -1349,7 +1349,7 @@ class InstanceCache {
|
|
|
1349
1349
|
this.disconnect(identifier);
|
|
1350
1350
|
}
|
|
1351
1351
|
this.store._requestCache._clearEntries(identifier);
|
|
1352
|
-
if (macroCondition(getGlobalConfig().
|
|
1352
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_INSTANCE_CACHE)) {
|
|
1353
1353
|
// eslint-disable-next-line no-console
|
|
1354
1354
|
console.log(`InstanceCache: unloaded RecordData for ${String(identifier)}`);
|
|
1355
1355
|
// eslint-disable-next-line no-console
|
|
@@ -1388,7 +1388,7 @@ class InstanceCache {
|
|
|
1388
1388
|
const oldId = identifier.id;
|
|
1389
1389
|
|
|
1390
1390
|
// ID absolutely can't be missing if the oldID is empty (missing Id in response for a new record)
|
|
1391
|
-
macroCondition(getGlobalConfig().
|
|
1391
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
1392
1392
|
if (!test) {
|
|
1393
1393
|
throw new Error(`'${type}' was saved to the server, but the response does not have an id and your record does not either.`);
|
|
1394
1394
|
}
|
|
@@ -1396,7 +1396,7 @@ class InstanceCache {
|
|
|
1396
1396
|
|
|
1397
1397
|
// ID absolutely can't be different than oldID if oldID is not null
|
|
1398
1398
|
// TODO this assertion and restriction may not strictly be needed in the identifiers world
|
|
1399
|
-
macroCondition(getGlobalConfig().
|
|
1399
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
1400
1400
|
if (!test) {
|
|
1401
1401
|
throw new Error(`Cannot update the id for '${type}:${lid}' from '${String(oldId)}' to '${id}'.`);
|
|
1402
1402
|
}
|
|
@@ -1408,7 +1408,7 @@ class InstanceCache {
|
|
|
1408
1408
|
warn(`Your ${type} record was saved to the server, but the response does not have an id.`, !(oldId !== null && id === null));
|
|
1409
1409
|
return;
|
|
1410
1410
|
}
|
|
1411
|
-
if (macroCondition(getGlobalConfig().
|
|
1411
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_INSTANCE_CACHE)) {
|
|
1412
1412
|
// eslint-disable-next-line no-console
|
|
1413
1413
|
console.log(`InstanceCache: updating id to '${id}' for record ${String(identifier)}`);
|
|
1414
1414
|
}
|
|
@@ -1416,7 +1416,7 @@ class InstanceCache {
|
|
|
1416
1416
|
type,
|
|
1417
1417
|
id
|
|
1418
1418
|
});
|
|
1419
|
-
macroCondition(getGlobalConfig().
|
|
1419
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
1420
1420
|
if (!test) {
|
|
1421
1421
|
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.'`);
|
|
1422
1422
|
}
|
|
@@ -1481,7 +1481,7 @@ function preloadData(store, identifier, preload) {
|
|
|
1481
1481
|
function preloadRelationship(schema, preloadValue) {
|
|
1482
1482
|
const relatedType = schema.type;
|
|
1483
1483
|
if (schema.kind === 'hasMany') {
|
|
1484
|
-
macroCondition(getGlobalConfig().
|
|
1484
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
1485
1485
|
if (!test) {
|
|
1486
1486
|
throw new Error('You need to pass in an array to set a hasMany property on a record');
|
|
1487
1487
|
}
|
|
@@ -1490,7 +1490,7 @@ function preloadRelationship(schema, preloadValue) {
|
|
|
1490
1490
|
data: preloadValue.map(value => _convertPreloadRelationshipToJSON(value, relatedType))
|
|
1491
1491
|
};
|
|
1492
1492
|
}
|
|
1493
|
-
macroCondition(getGlobalConfig().
|
|
1493
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
1494
1494
|
if (!test) {
|
|
1495
1495
|
throw new Error('You should not pass in an array to set a belongsTo property on a record');
|
|
1496
1496
|
}
|
|
@@ -2157,7 +2157,7 @@ class CacheManager {
|
|
|
2157
2157
|
/**
|
|
2158
2158
|
* @module @ember-data-mirror/store
|
|
2159
2159
|
*/
|
|
2160
|
-
|
|
2160
|
+
|
|
2161
2161
|
let tokenId = 0;
|
|
2162
2162
|
const CacheOperations = new Set(['added', 'removed', 'state', 'updated', 'invalidated']);
|
|
2163
2163
|
function isCacheOperationValue(value) {
|
|
@@ -2169,7 +2169,7 @@ function runLoopIsFlushing() {
|
|
|
2169
2169
|
}
|
|
2170
2170
|
function _unsubscribe(tokens, token, cache) {
|
|
2171
2171
|
const identifier = tokens.get(token);
|
|
2172
|
-
if (macroCondition(getGlobalConfig().
|
|
2172
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_NOTIFICATIONS)) {
|
|
2173
2173
|
if (!identifier) {
|
|
2174
2174
|
// eslint-disable-next-line no-console
|
|
2175
2175
|
console.log('Passed unknown unsubscribe token to unsubscribe', identifier);
|
|
@@ -2231,7 +2231,7 @@ class NotificationManager {
|
|
|
2231
2231
|
*/
|
|
2232
2232
|
|
|
2233
2233
|
subscribe(identifier, callback) {
|
|
2234
|
-
macroCondition(getGlobalConfig().
|
|
2234
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
2235
2235
|
if (!test) {
|
|
2236
2236
|
throw new Error(`Expected to receive a stable Identifier to subscribe to`);
|
|
2237
2237
|
}
|
|
@@ -2241,7 +2241,7 @@ class NotificationManager {
|
|
|
2241
2241
|
map = new Map();
|
|
2242
2242
|
this._cache.set(identifier, map);
|
|
2243
2243
|
}
|
|
2244
|
-
const unsubToken = macroCondition(getGlobalConfig().
|
|
2244
|
+
const unsubToken = macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? {
|
|
2245
2245
|
_tokenRef: tokenId++
|
|
2246
2246
|
} : {};
|
|
2247
2247
|
map.set(unsubToken, callback);
|
|
@@ -2274,19 +2274,19 @@ class NotificationManager {
|
|
|
2274
2274
|
*/
|
|
2275
2275
|
|
|
2276
2276
|
notify(identifier, value, key) {
|
|
2277
|
-
macroCondition(getGlobalConfig().
|
|
2277
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
2278
2278
|
if (!test) {
|
|
2279
2279
|
throw new Error(`Notify does not accept a key argument for the namespace '${value}'. Received key '${key || ''}'.`);
|
|
2280
2280
|
}
|
|
2281
2281
|
})(!key || value === 'attributes' || value === 'relationships') : {};
|
|
2282
2282
|
if (!isStableIdentifier(identifier) && !isDocumentIdentifier(identifier)) {
|
|
2283
|
-
if (macroCondition(getGlobalConfig().
|
|
2283
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_NOTIFICATIONS)) {
|
|
2284
2284
|
// eslint-disable-next-line no-console
|
|
2285
2285
|
console.log(`Notifying: Expected to receive a stable Identifier to notify '${value}' '${key || ''}' with, but ${String(identifier)} is not in the cache`, identifier);
|
|
2286
2286
|
}
|
|
2287
2287
|
return false;
|
|
2288
2288
|
}
|
|
2289
|
-
if (macroCondition(getGlobalConfig().
|
|
2289
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_NOTIFICATIONS)) {
|
|
2290
2290
|
// eslint-disable-next-line no-console
|
|
2291
2291
|
console.log(`Buffering Notify: ${String(identifier.lid)}\t${value}\t${key || ''}`);
|
|
2292
2292
|
}
|
|
@@ -2334,7 +2334,7 @@ class NotificationManager {
|
|
|
2334
2334
|
this._onFlushCB = undefined;
|
|
2335
2335
|
}
|
|
2336
2336
|
_flushNotification(identifier, value, key) {
|
|
2337
|
-
if (macroCondition(getGlobalConfig().
|
|
2337
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_NOTIFICATIONS)) {
|
|
2338
2338
|
// eslint-disable-next-line no-console
|
|
2339
2339
|
console.log(`Notifying: ${String(identifier)}\t${value}\t${key || ''}`);
|
|
2340
2340
|
}
|
|
@@ -2374,71 +2374,6 @@ class NotificationManager {
|
|
|
2374
2374
|
*/
|
|
2375
2375
|
|
|
2376
2376
|
const NativeProxy = Proxy;
|
|
2377
|
-
var __defProp = Object.defineProperty;
|
|
2378
|
-
var __export = (target, all) => {
|
|
2379
|
-
for (var name in all) __defProp(target, name, {
|
|
2380
|
-
get: all[name],
|
|
2381
|
-
enumerable: true
|
|
2382
|
-
});
|
|
2383
|
-
};
|
|
2384
|
-
|
|
2385
|
-
// src/runtime.ts
|
|
2386
|
-
var runtime_exports = {};
|
|
2387
|
-
__export(runtime_exports, {
|
|
2388
|
-
c: () => decorateClass,
|
|
2389
|
-
f: () => decorateFieldV1,
|
|
2390
|
-
g: () => decorateFieldV2,
|
|
2391
|
-
i: () => initializeDeferredDecorator,
|
|
2392
|
-
m: () => decorateMethodV1,
|
|
2393
|
-
n: () => decorateMethodV2,
|
|
2394
|
-
p: () => decoratePOJO
|
|
2395
|
-
});
|
|
2396
|
-
var deferred = /* @__PURE__ */new WeakMap();
|
|
2397
|
-
function deferDecorator(proto, prop, desc) {
|
|
2398
|
-
let map = deferred.get(proto);
|
|
2399
|
-
if (!map) {
|
|
2400
|
-
map = /* @__PURE__ */new Map();
|
|
2401
|
-
deferred.set(proto, map);
|
|
2402
|
-
}
|
|
2403
|
-
map.set(prop, desc);
|
|
2404
|
-
}
|
|
2405
|
-
function findDeferredDecorator(target, prop) {
|
|
2406
|
-
let cursor = target.prototype;
|
|
2407
|
-
while (cursor) {
|
|
2408
|
-
let desc = deferred.get(cursor)?.get(prop);
|
|
2409
|
-
if (desc) {
|
|
2410
|
-
return desc;
|
|
2411
|
-
}
|
|
2412
|
-
cursor = cursor.prototype;
|
|
2413
|
-
}
|
|
2414
|
-
}
|
|
2415
|
-
function decorateFieldV1(target, prop, decorators, initializer) {
|
|
2416
|
-
return decorateFieldV2(target.prototype, prop, decorators, initializer);
|
|
2417
|
-
}
|
|
2418
|
-
function decorateFieldV2(prototype, prop, decorators, initializer) {
|
|
2419
|
-
let desc = {
|
|
2420
|
-
configurable: true,
|
|
2421
|
-
enumerable: true,
|
|
2422
|
-
writable: true,
|
|
2423
|
-
initializer: null
|
|
2424
|
-
};
|
|
2425
|
-
if (initializer) {
|
|
2426
|
-
desc.initializer = initializer;
|
|
2427
|
-
}
|
|
2428
|
-
for (let decorator of decorators) {
|
|
2429
|
-
desc = decorator(prototype, prop, desc) || desc;
|
|
2430
|
-
}
|
|
2431
|
-
if (desc.initializer === void 0) {
|
|
2432
|
-
Object.defineProperty(prototype, prop, desc);
|
|
2433
|
-
} else {
|
|
2434
|
-
deferDecorator(prototype, prop, desc);
|
|
2435
|
-
}
|
|
2436
|
-
}
|
|
2437
|
-
function decorateMethodV1({
|
|
2438
|
-
prototype
|
|
2439
|
-
}, prop, decorators) {
|
|
2440
|
-
return decorateMethodV2(prototype, prop, decorators);
|
|
2441
|
-
}
|
|
2442
2377
|
function decorateMethodV2(prototype, prop, decorators) {
|
|
2443
2378
|
const origDesc = Object.getOwnPropertyDescriptor(prototype, prop);
|
|
2444
2379
|
let desc = {
|
|
@@ -2453,46 +2388,6 @@ function decorateMethodV2(prototype, prop, decorators) {
|
|
|
2453
2388
|
}
|
|
2454
2389
|
Object.defineProperty(prototype, prop, desc);
|
|
2455
2390
|
}
|
|
2456
|
-
function initializeDeferredDecorator(target, prop) {
|
|
2457
|
-
let desc = findDeferredDecorator(target.constructor, prop);
|
|
2458
|
-
if (desc) {
|
|
2459
|
-
Object.defineProperty(target, prop, {
|
|
2460
|
-
enumerable: desc.enumerable,
|
|
2461
|
-
configurable: desc.configurable,
|
|
2462
|
-
writable: desc.writable,
|
|
2463
|
-
value: desc.initializer ? desc.initializer.call(target) : void 0
|
|
2464
|
-
});
|
|
2465
|
-
}
|
|
2466
|
-
}
|
|
2467
|
-
function decorateClass(target, decorators) {
|
|
2468
|
-
return decorators.reduce((accum, decorator) => decorator(accum) || accum, target);
|
|
2469
|
-
}
|
|
2470
|
-
function decoratePOJO(pojo, decorated) {
|
|
2471
|
-
for (let [type, prop, decorators] of decorated) {
|
|
2472
|
-
if (type === "field") {
|
|
2473
|
-
decoratePojoField(pojo, prop, decorators);
|
|
2474
|
-
} else {
|
|
2475
|
-
decorateMethodV2(pojo, prop, decorators);
|
|
2476
|
-
}
|
|
2477
|
-
}
|
|
2478
|
-
return pojo;
|
|
2479
|
-
}
|
|
2480
|
-
function decoratePojoField(pojo, prop, decorators) {
|
|
2481
|
-
let desc = {
|
|
2482
|
-
configurable: true,
|
|
2483
|
-
enumerable: true,
|
|
2484
|
-
writable: true,
|
|
2485
|
-
initializer: () => Object.getOwnPropertyDescriptor(pojo, prop)?.value
|
|
2486
|
-
};
|
|
2487
|
-
for (let decorator of decorators) {
|
|
2488
|
-
desc = decorator(pojo, prop, desc) || desc;
|
|
2489
|
-
}
|
|
2490
|
-
if (desc.initializer) {
|
|
2491
|
-
desc.value = desc.initializer.call(pojo);
|
|
2492
|
-
delete desc.initializer;
|
|
2493
|
-
}
|
|
2494
|
-
Object.defineProperty(pojo, prop, desc);
|
|
2495
|
-
}
|
|
2496
2391
|
|
|
2497
2392
|
/**
|
|
2498
2393
|
@module @ember-data-mirror/store
|
|
@@ -2529,7 +2424,7 @@ function safeForEach(instance, arr, store, callback, target) {
|
|
|
2529
2424
|
}
|
|
2530
2425
|
// clone to prevent mutation
|
|
2531
2426
|
arr = arr.slice();
|
|
2532
|
-
macroCondition(getGlobalConfig().
|
|
2427
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
2533
2428
|
if (!test) {
|
|
2534
2429
|
throw new Error('`forEach` expects a function as first argument.');
|
|
2535
2430
|
}
|
|
@@ -2683,7 +2578,7 @@ class IdentifierArray {
|
|
|
2683
2578
|
// array functions must run through Reflect to work properly
|
|
2684
2579
|
// binding via other means will not work.
|
|
2685
2580
|
if (!options.allowMutation) {
|
|
2686
|
-
macroCondition(getGlobalConfig().
|
|
2581
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
2687
2582
|
if (!test) {
|
|
2688
2583
|
throw new Error(`Mutating this array of records via ${String(prop)} is not allowed.`);
|
|
2689
2584
|
}
|
|
@@ -2691,7 +2586,7 @@ class IdentifierArray {
|
|
|
2691
2586
|
return;
|
|
2692
2587
|
}
|
|
2693
2588
|
const args = Array.prototype.slice.call(arguments);
|
|
2694
|
-
macroCondition(getGlobalConfig().
|
|
2589
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
2695
2590
|
if (!test) {
|
|
2696
2591
|
throw new Error(`Cannot start a new array transaction while a previous transaction is underway`);
|
|
2697
2592
|
}
|
|
@@ -2737,7 +2632,7 @@ class IdentifierArray {
|
|
|
2737
2632
|
} else if (transaction) {
|
|
2738
2633
|
return Reflect.set(target, prop, value);
|
|
2739
2634
|
} else {
|
|
2740
|
-
macroCondition(getGlobalConfig().
|
|
2635
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
2741
2636
|
{
|
|
2742
2637
|
throw new Error(`unexpected length set`);
|
|
2743
2638
|
}
|
|
@@ -2764,7 +2659,7 @@ class IdentifierArray {
|
|
|
2764
2659
|
if (index === null || index > target.length) {
|
|
2765
2660
|
if (index !== null && transaction) {
|
|
2766
2661
|
const identifier = recordIdentifierFor(value);
|
|
2767
|
-
macroCondition(getGlobalConfig().
|
|
2662
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
2768
2663
|
if (!test) {
|
|
2769
2664
|
throw new Error(`Cannot set index ${index} past the end of the array.`);
|
|
2770
2665
|
}
|
|
@@ -2779,7 +2674,7 @@ class IdentifierArray {
|
|
|
2779
2674
|
return false;
|
|
2780
2675
|
}
|
|
2781
2676
|
if (!options.allowMutation) {
|
|
2782
|
-
macroCondition(getGlobalConfig().
|
|
2677
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
2783
2678
|
if (!test) {
|
|
2784
2679
|
throw new Error(`Mutating ${String(prop)} on this Array is not allowed.`);
|
|
2785
2680
|
}
|
|
@@ -2788,8 +2683,7 @@ class IdentifierArray {
|
|
|
2788
2683
|
}
|
|
2789
2684
|
const original = target[index];
|
|
2790
2685
|
const newIdentifier = extractIdentifierFromRecord$1(value);
|
|
2791
|
-
|
|
2792
|
-
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2686
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
2793
2687
|
if (!test) {
|
|
2794
2688
|
throw new Error(`Expected a record`);
|
|
2795
2689
|
}
|
|
@@ -2818,7 +2712,7 @@ class IdentifierArray {
|
|
|
2818
2712
|
return true;
|
|
2819
2713
|
},
|
|
2820
2714
|
deleteProperty(target, prop) {
|
|
2821
|
-
macroCondition(getGlobalConfig().
|
|
2715
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
2822
2716
|
if (!test) {
|
|
2823
2717
|
throw new Error(`Deleting keys on managed arrays is disallowed`);
|
|
2824
2718
|
}
|
|
@@ -2874,7 +2768,7 @@ class IdentifierArray {
|
|
|
2874
2768
|
is finished.
|
|
2875
2769
|
*/
|
|
2876
2770
|
_update() {
|
|
2877
|
-
macroCondition(getGlobalConfig().
|
|
2771
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
2878
2772
|
if (!test) {
|
|
2879
2773
|
throw new Error(`_update cannot be used with this array`);
|
|
2880
2774
|
}
|
|
@@ -2917,7 +2811,11 @@ const desc = {
|
|
|
2917
2811
|
enumerable: true,
|
|
2918
2812
|
configurable: false,
|
|
2919
2813
|
get: function () {
|
|
2920
|
-
|
|
2814
|
+
// here to support computed chains
|
|
2815
|
+
// and {{#each}}
|
|
2816
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_COMPUTED_CHAINS)) {
|
|
2817
|
+
return this;
|
|
2818
|
+
}
|
|
2921
2819
|
}
|
|
2922
2820
|
};
|
|
2923
2821
|
compat(desc);
|
|
@@ -2937,12 +2835,12 @@ class Collection extends IdentifierArray {
|
|
|
2937
2835
|
} = this;
|
|
2938
2836
|
|
|
2939
2837
|
// TODO save options from initial request?
|
|
2940
|
-
macroCondition(getGlobalConfig().
|
|
2838
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
2941
2839
|
if (!test) {
|
|
2942
2840
|
throw new Error(`update cannot be used with this array`);
|
|
2943
2841
|
}
|
|
2944
2842
|
})(this.modelName) : {};
|
|
2945
|
-
macroCondition(getGlobalConfig().
|
|
2843
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
2946
2844
|
if (!test) {
|
|
2947
2845
|
throw new Error(`update cannot be used with no query`);
|
|
2948
2846
|
}
|
|
@@ -2969,7 +2867,7 @@ Collection.prototype.query = null;
|
|
|
2969
2867
|
// Object.setPrototypeOf(IdentifierArray.prototype, Array.prototype);
|
|
2970
2868
|
|
|
2971
2869
|
function assertRecordPassedToHasMany(record) {
|
|
2972
|
-
macroCondition(getGlobalConfig().
|
|
2870
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
2973
2871
|
if (!test) {
|
|
2974
2872
|
throw new Error(`All elements of a hasMany relationship must be instances of Model, you passed $${typeof record}`);
|
|
2975
2873
|
}
|
|
@@ -3344,7 +3242,7 @@ function sync(array, changes, arraySet) {
|
|
|
3344
3242
|
|
|
3345
3243
|
const Touching = getOrSetGlobal('Touching', Symbol('touching'));
|
|
3346
3244
|
const RequestPromise = getOrSetGlobal('RequestPromise', Symbol('promise'));
|
|
3347
|
-
const EMPTY_ARR = macroCondition(getGlobalConfig().
|
|
3245
|
+
const EMPTY_ARR = macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? Object.freeze([]) : [];
|
|
3348
3246
|
function hasRecordIdentifier(op) {
|
|
3349
3247
|
return 'recordIdentifier' in op;
|
|
3350
3248
|
}
|
|
@@ -3415,7 +3313,7 @@ class RequestStateService {
|
|
|
3415
3313
|
throw error;
|
|
3416
3314
|
});
|
|
3417
3315
|
}
|
|
3418
|
-
macroCondition(getGlobalConfig().
|
|
3316
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
3419
3317
|
{
|
|
3420
3318
|
throw new Error(`Expected a well formed query`);
|
|
3421
3319
|
}
|
|
@@ -3552,12 +3450,12 @@ function constructResource(type, id, lid) {
|
|
|
3552
3450
|
if ('id' in resource) {
|
|
3553
3451
|
resource.id = coerceId(resource.id);
|
|
3554
3452
|
}
|
|
3555
|
-
macroCondition(getGlobalConfig().
|
|
3453
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
3556
3454
|
if (!test) {
|
|
3557
3455
|
throw new Error('Expected either id or lid to be a valid string');
|
|
3558
3456
|
}
|
|
3559
3457
|
})('id' in resource && isNonEmptyString(resource.id) || isNonEmptyString(resource.lid)) : {};
|
|
3560
|
-
macroCondition(getGlobalConfig().
|
|
3458
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
3561
3459
|
if (!test) {
|
|
3562
3460
|
throw new Error('if id is present, the type must be a string');
|
|
3563
3461
|
}
|
|
@@ -3573,7 +3471,7 @@ function constructResource(type, id, lid) {
|
|
|
3573
3471
|
}
|
|
3574
3472
|
throw new Error('Expected either id or lid to be a valid string');
|
|
3575
3473
|
}
|
|
3576
|
-
macroCondition(getGlobalConfig().
|
|
3474
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
3577
3475
|
if (!test) {
|
|
3578
3476
|
throw new Error('type must be a string');
|
|
3579
3477
|
}
|
|
@@ -3641,7 +3539,8 @@ const EmptyClass = class {
|
|
|
3641
3539
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
3642
3540
|
constructor(args) {}
|
|
3643
3541
|
};
|
|
3644
|
-
const
|
|
3542
|
+
const _BaseClass = macroCondition(dependencySatisfies('ember-source', '*')) ? macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.DEPRECATE_STORE_EXTENDS_EMBER_OBJECT) ? importSync('@ember/object') : EmptyClass : EmptyClass;
|
|
3543
|
+
const BaseClass = _BaseClass.default ? _BaseClass.default : _BaseClass;
|
|
3645
3544
|
if (BaseClass !== EmptyClass) {
|
|
3646
3545
|
deprecate(`The Store class extending from EmberObject is deprecated.
|
|
3647
3546
|
Please remove usage of EmberObject APIs and mark your class as not requiring it.
|
|
@@ -3663,7 +3562,7 @@ const app = new EmberApp(defaults, {
|
|
|
3663
3562
|
until: '6.0',
|
|
3664
3563
|
for: 'ember-data-mirror',
|
|
3665
3564
|
since: {
|
|
3666
|
-
available: '
|
|
3565
|
+
available: '4.13',
|
|
3667
3566
|
enabled: '5.4'
|
|
3668
3567
|
}
|
|
3669
3568
|
});
|
|
@@ -3817,13 +3716,13 @@ class Store extends BaseClass {
|
|
|
3817
3716
|
this.isDestroyed = false;
|
|
3818
3717
|
}
|
|
3819
3718
|
_run(cb) {
|
|
3820
|
-
macroCondition(getGlobalConfig().
|
|
3719
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
3821
3720
|
if (!test) {
|
|
3822
3721
|
throw new Error(`EmberData should never encounter a nested run`);
|
|
3823
3722
|
}
|
|
3824
3723
|
})(!this._cbs) : {};
|
|
3825
3724
|
const _cbs = this._cbs = {};
|
|
3826
|
-
if (macroCondition(getGlobalConfig().
|
|
3725
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
3827
3726
|
try {
|
|
3828
3727
|
cb();
|
|
3829
3728
|
if (_cbs.coalesce) {
|
|
@@ -3870,12 +3769,12 @@ class Store extends BaseClass {
|
|
|
3870
3769
|
}
|
|
3871
3770
|
}
|
|
3872
3771
|
_schedule(name, cb) {
|
|
3873
|
-
macroCondition(getGlobalConfig().
|
|
3772
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
3874
3773
|
if (!test) {
|
|
3875
3774
|
throw new Error(`EmberData expects to schedule only when there is an active run`);
|
|
3876
3775
|
}
|
|
3877
3776
|
})(!!this._cbs) : {};
|
|
3878
|
-
macroCondition(getGlobalConfig().
|
|
3777
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
3879
3778
|
if (!test) {
|
|
3880
3779
|
throw new Error(`EmberData expects only one flush per queue name, cannot schedule ${name}`);
|
|
3881
3780
|
}
|
|
@@ -3898,7 +3797,7 @@ class Store extends BaseClass {
|
|
|
3898
3797
|
return this._requestCache;
|
|
3899
3798
|
}
|
|
3900
3799
|
_getAllPending() {
|
|
3901
|
-
if (macroCondition(getGlobalConfig().
|
|
3800
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.TESTING)) {
|
|
3902
3801
|
const all = [];
|
|
3903
3802
|
const pending = this._requestCache._pending;
|
|
3904
3803
|
pending.forEach(requests => {
|
|
@@ -3976,12 +3875,12 @@ class Store extends BaseClass {
|
|
|
3976
3875
|
const identifierCache = this.identifierCache;
|
|
3977
3876
|
opts.records = requestConfig.records.map(r => identifierCache.getOrCreateRecordIdentifier(r));
|
|
3978
3877
|
}
|
|
3979
|
-
if (macroCondition(getGlobalConfig().
|
|
3878
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.TESTING)) {
|
|
3980
3879
|
if (this.DISABLE_WAITER) {
|
|
3981
3880
|
opts.disableTestWaiter = typeof requestConfig.disableTestWaiter === 'boolean' ? requestConfig.disableTestWaiter : true;
|
|
3982
3881
|
}
|
|
3983
3882
|
}
|
|
3984
|
-
if (macroCondition(getGlobalConfig().
|
|
3883
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_REQUESTS)) {
|
|
3985
3884
|
let options;
|
|
3986
3885
|
try {
|
|
3987
3886
|
options = JSON.parse(JSON.stringify(requestConfig));
|
|
@@ -3994,7 +3893,7 @@ class Store extends BaseClass {
|
|
|
3994
3893
|
const request = Object.assign({}, requestConfig, opts);
|
|
3995
3894
|
const future = this.requestManager.request(request);
|
|
3996
3895
|
future.onFinalize(() => {
|
|
3997
|
-
if (macroCondition(getGlobalConfig().
|
|
3896
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_REQUESTS)) {
|
|
3998
3897
|
// eslint-disable-next-line no-console
|
|
3999
3898
|
console.log(`request: [[FINALIZE]] ${requestConfig.op && !requestConfig.url ? '(LEGACY) ' : ''}${requestConfig.op || '<unknown operation>'} ${requestConfig.url || '<empty url>'} ${requestConfig.method || '<empty method>'}`);
|
|
4000
3899
|
}
|
|
@@ -4059,15 +3958,15 @@ class Store extends BaseClass {
|
|
|
4059
3958
|
modelFor(type) {
|
|
4060
3959
|
// FIXME add deprecation and deprecation stripping
|
|
4061
3960
|
// FIXME/TODO update RFC to remove this method
|
|
4062
|
-
if (macroCondition(getGlobalConfig().
|
|
3961
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
4063
3962
|
assertDestroyedStoreOnly(this, 'modelFor');
|
|
4064
3963
|
}
|
|
4065
|
-
macroCondition(getGlobalConfig().
|
|
3964
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4066
3965
|
if (!test) {
|
|
4067
3966
|
throw new Error(`You need to pass <type> to the store's modelFor method`);
|
|
4068
3967
|
}
|
|
4069
3968
|
})(typeof type === 'string' && type.length) : {};
|
|
4070
|
-
macroCondition(getGlobalConfig().
|
|
3969
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4071
3970
|
if (!test) {
|
|
4072
3971
|
throw new Error(`No model was found for '${type}' and no schema handles the type`);
|
|
4073
3972
|
}
|
|
@@ -4103,15 +4002,15 @@ class Store extends BaseClass {
|
|
|
4103
4002
|
*/
|
|
4104
4003
|
|
|
4105
4004
|
createRecord(type, inputProperties) {
|
|
4106
|
-
if (macroCondition(getGlobalConfig().
|
|
4005
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
4107
4006
|
assertDestroyingStore(this, 'createRecord');
|
|
4108
4007
|
}
|
|
4109
|
-
macroCondition(getGlobalConfig().
|
|
4008
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4110
4009
|
if (!test) {
|
|
4111
4010
|
throw new Error(`You need to pass a model name to the store's createRecord method`);
|
|
4112
4011
|
}
|
|
4113
4012
|
})(type) : {};
|
|
4114
|
-
macroCondition(getGlobalConfig().
|
|
4013
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4115
4014
|
if (!test) {
|
|
4116
4015
|
throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`);
|
|
4117
4016
|
}
|
|
@@ -4150,7 +4049,7 @@ class Store extends BaseClass {
|
|
|
4150
4049
|
};
|
|
4151
4050
|
if (resource.id) {
|
|
4152
4051
|
const identifier = this.identifierCache.peekRecordIdentifier(resource);
|
|
4153
|
-
macroCondition(getGlobalConfig().
|
|
4052
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4154
4053
|
if (!test) {
|
|
4155
4054
|
throw new Error(`The id ${String(properties.id)} has already been used with another '${normalizedModelName}' record.`);
|
|
4156
4055
|
}
|
|
@@ -4179,12 +4078,12 @@ class Store extends BaseClass {
|
|
|
4179
4078
|
@param {unknown} record
|
|
4180
4079
|
*/
|
|
4181
4080
|
deleteRecord(record) {
|
|
4182
|
-
if (macroCondition(getGlobalConfig().
|
|
4081
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
4183
4082
|
assertDestroyingStore(this, 'deleteRecord');
|
|
4184
4083
|
}
|
|
4185
4084
|
const identifier = peekRecordIdentifier(record);
|
|
4186
4085
|
const cache = this.cache;
|
|
4187
|
-
macroCondition(getGlobalConfig().
|
|
4086
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4188
4087
|
if (!test) {
|
|
4189
4088
|
throw new Error(`expected the record to be connected to a cache`);
|
|
4190
4089
|
}
|
|
@@ -4211,7 +4110,7 @@ class Store extends BaseClass {
|
|
|
4211
4110
|
@param {Model} record
|
|
4212
4111
|
*/
|
|
4213
4112
|
unloadRecord(record) {
|
|
4214
|
-
if (macroCondition(getGlobalConfig().
|
|
4113
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
4215
4114
|
assertDestroyingStore(this, 'unloadRecord');
|
|
4216
4115
|
}
|
|
4217
4116
|
const identifier = peekRecordIdentifier(record);
|
|
@@ -4499,10 +4398,10 @@ class Store extends BaseClass {
|
|
|
4499
4398
|
*/
|
|
4500
4399
|
|
|
4501
4400
|
findRecord(resource, id, options) {
|
|
4502
|
-
if (macroCondition(getGlobalConfig().
|
|
4401
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
4503
4402
|
assertDestroyingStore(this, 'findRecord');
|
|
4504
4403
|
}
|
|
4505
|
-
macroCondition(getGlobalConfig().
|
|
4404
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4506
4405
|
if (!test) {
|
|
4507
4406
|
throw new Error(`You need to pass a modelName or resource identifier as the first argument to the store's findRecord method`);
|
|
4508
4407
|
}
|
|
@@ -4510,7 +4409,7 @@ class Store extends BaseClass {
|
|
|
4510
4409
|
if (isMaybeIdentifier(resource)) {
|
|
4511
4410
|
options = id;
|
|
4512
4411
|
} else {
|
|
4513
|
-
macroCondition(getGlobalConfig().
|
|
4412
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4514
4413
|
if (!test) {
|
|
4515
4414
|
throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${resource}`);
|
|
4516
4415
|
}
|
|
@@ -4578,7 +4477,7 @@ class Store extends BaseClass {
|
|
|
4578
4477
|
*/
|
|
4579
4478
|
// TODO @deprecate getReference (and references generally)
|
|
4580
4479
|
getReference(resource, id) {
|
|
4581
|
-
if (macroCondition(getGlobalConfig().
|
|
4480
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
4582
4481
|
assertDestroyingStore(this, 'getReference');
|
|
4583
4482
|
}
|
|
4584
4483
|
let resourceIdentifier;
|
|
@@ -4589,7 +4488,7 @@ class Store extends BaseClass {
|
|
|
4589
4488
|
const normalizedId = ensureStringId(id);
|
|
4590
4489
|
resourceIdentifier = constructResource(type, normalizedId);
|
|
4591
4490
|
}
|
|
4592
|
-
macroCondition(getGlobalConfig().
|
|
4491
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4593
4492
|
if (!test) {
|
|
4594
4493
|
throw new Error('getReference expected to receive either a resource identifier or type and id as arguments');
|
|
4595
4494
|
}
|
|
@@ -4641,15 +4540,15 @@ class Store extends BaseClass {
|
|
|
4641
4540
|
// this is basically an "are we not empty" query.
|
|
4642
4541
|
return isLoaded ? this._instanceCache.getRecord(stableIdentifier) : null;
|
|
4643
4542
|
}
|
|
4644
|
-
if (macroCondition(getGlobalConfig().
|
|
4543
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
4645
4544
|
assertDestroyingStore(this, 'peekRecord');
|
|
4646
4545
|
}
|
|
4647
|
-
macroCondition(getGlobalConfig().
|
|
4546
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4648
4547
|
if (!test) {
|
|
4649
4548
|
throw new Error(`You need to pass a model name to the store's peekRecord method`);
|
|
4650
4549
|
}
|
|
4651
4550
|
})(identifier) : {};
|
|
4652
|
-
macroCondition(getGlobalConfig().
|
|
4551
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4653
4552
|
if (!test) {
|
|
4654
4553
|
throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${String(identifier)}`);
|
|
4655
4554
|
}
|
|
@@ -4704,20 +4603,20 @@ class Store extends BaseClass {
|
|
|
4704
4603
|
*/
|
|
4705
4604
|
|
|
4706
4605
|
query(type, query, options = {}) {
|
|
4707
|
-
if (macroCondition(getGlobalConfig().
|
|
4606
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
4708
4607
|
assertDestroyingStore(this, 'query');
|
|
4709
4608
|
}
|
|
4710
|
-
macroCondition(getGlobalConfig().
|
|
4609
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4711
4610
|
if (!test) {
|
|
4712
4611
|
throw new Error(`You need to pass a model name to the store's query method`);
|
|
4713
4612
|
}
|
|
4714
4613
|
})(type) : {};
|
|
4715
|
-
macroCondition(getGlobalConfig().
|
|
4614
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4716
4615
|
if (!test) {
|
|
4717
4616
|
throw new Error(`You need to pass a query hash to the store's query method`);
|
|
4718
4617
|
}
|
|
4719
4618
|
})(query) : {};
|
|
4720
|
-
macroCondition(getGlobalConfig().
|
|
4619
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4721
4620
|
if (!test) {
|
|
4722
4621
|
throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`);
|
|
4723
4622
|
}
|
|
@@ -4819,20 +4718,20 @@ class Store extends BaseClass {
|
|
|
4819
4718
|
*/
|
|
4820
4719
|
|
|
4821
4720
|
queryRecord(type, query, options) {
|
|
4822
|
-
if (macroCondition(getGlobalConfig().
|
|
4721
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
4823
4722
|
assertDestroyingStore(this, 'queryRecord');
|
|
4824
4723
|
}
|
|
4825
|
-
macroCondition(getGlobalConfig().
|
|
4724
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4826
4725
|
if (!test) {
|
|
4827
4726
|
throw new Error(`You need to pass a model name to the store's queryRecord method`);
|
|
4828
4727
|
}
|
|
4829
4728
|
})(type) : {};
|
|
4830
|
-
macroCondition(getGlobalConfig().
|
|
4729
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4831
4730
|
if (!test) {
|
|
4832
4731
|
throw new Error(`You need to pass a query hash to the store's queryRecord method`);
|
|
4833
4732
|
}
|
|
4834
4733
|
})(query) : {};
|
|
4835
|
-
macroCondition(getGlobalConfig().
|
|
4734
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4836
4735
|
if (!test) {
|
|
4837
4736
|
throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`);
|
|
4838
4737
|
}
|
|
@@ -4999,15 +4898,15 @@ class Store extends BaseClass {
|
|
|
4999
4898
|
*/
|
|
5000
4899
|
|
|
5001
4900
|
findAll(type, options = {}) {
|
|
5002
|
-
if (macroCondition(getGlobalConfig().
|
|
4901
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
5003
4902
|
assertDestroyingStore(this, 'findAll');
|
|
5004
4903
|
}
|
|
5005
|
-
macroCondition(getGlobalConfig().
|
|
4904
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5006
4905
|
if (!test) {
|
|
5007
4906
|
throw new Error(`You need to pass a model name to the store's findAll method`);
|
|
5008
4907
|
}
|
|
5009
4908
|
})(type) : {};
|
|
5010
|
-
macroCondition(getGlobalConfig().
|
|
4909
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5011
4910
|
if (!test) {
|
|
5012
4911
|
throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`);
|
|
5013
4912
|
}
|
|
@@ -5047,15 +4946,15 @@ class Store extends BaseClass {
|
|
|
5047
4946
|
*/
|
|
5048
4947
|
|
|
5049
4948
|
peekAll(type) {
|
|
5050
|
-
if (macroCondition(getGlobalConfig().
|
|
4949
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
5051
4950
|
assertDestroyingStore(this, 'peekAll');
|
|
5052
4951
|
}
|
|
5053
|
-
macroCondition(getGlobalConfig().
|
|
4952
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5054
4953
|
if (!test) {
|
|
5055
4954
|
throw new Error(`You need to pass a model name to the store's peekAll method`);
|
|
5056
4955
|
}
|
|
5057
4956
|
})(type) : {};
|
|
5058
|
-
macroCondition(getGlobalConfig().
|
|
4957
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5059
4958
|
if (!test) {
|
|
5060
4959
|
throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`);
|
|
5061
4960
|
}
|
|
@@ -5077,10 +4976,10 @@ class Store extends BaseClass {
|
|
|
5077
4976
|
*/
|
|
5078
4977
|
|
|
5079
4978
|
unloadAll(type) {
|
|
5080
|
-
if (macroCondition(getGlobalConfig().
|
|
4979
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
5081
4980
|
assertDestroyedStoreOnly(this, 'unloadAll');
|
|
5082
4981
|
}
|
|
5083
|
-
macroCondition(getGlobalConfig().
|
|
4982
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5084
4983
|
if (!test) {
|
|
5085
4984
|
throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${String(type)}`);
|
|
5086
4985
|
}
|
|
@@ -5231,7 +5130,7 @@ class Store extends BaseClass {
|
|
|
5231
5130
|
*/
|
|
5232
5131
|
|
|
5233
5132
|
push(data) {
|
|
5234
|
-
if (macroCondition(getGlobalConfig().
|
|
5133
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
5235
5134
|
assertDestroyingStore(this, 'push');
|
|
5236
5135
|
}
|
|
5237
5136
|
const pushed = this._push(data, false);
|
|
@@ -5253,10 +5152,10 @@ class Store extends BaseClass {
|
|
|
5253
5152
|
@return {StableRecordIdentifier|Array<StableRecordIdentifier>|null} identifiers for the primary records that had data loaded
|
|
5254
5153
|
*/
|
|
5255
5154
|
_push(jsonApiDoc, asyncFlush) {
|
|
5256
|
-
if (macroCondition(getGlobalConfig().
|
|
5155
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
5257
5156
|
assertDestroyingStore(this, '_push');
|
|
5258
5157
|
}
|
|
5259
|
-
if (macroCondition(getGlobalConfig().
|
|
5158
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_PAYLOADS)) {
|
|
5260
5159
|
try {
|
|
5261
5160
|
const data = JSON.parse(JSON.stringify(jsonApiDoc));
|
|
5262
5161
|
// eslint-disable-next-line no-console
|
|
@@ -5291,10 +5190,10 @@ class Store extends BaseClass {
|
|
|
5291
5190
|
* @return {Promise<record>}
|
|
5292
5191
|
*/
|
|
5293
5192
|
saveRecord(record, options = {}) {
|
|
5294
|
-
if (macroCondition(getGlobalConfig().
|
|
5193
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
5295
5194
|
assertDestroyingStore(this, 'saveRecord');
|
|
5296
5195
|
}
|
|
5297
|
-
macroCondition(getGlobalConfig().
|
|
5196
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5298
5197
|
if (!test) {
|
|
5299
5198
|
throw new Error(`Unable to initiate save for a record in a disconnected state`);
|
|
5300
5199
|
}
|
|
@@ -5306,7 +5205,7 @@ class Store extends BaseClass {
|
|
|
5306
5205
|
// but just in case we reject here to prevent bad things.
|
|
5307
5206
|
return Promise.reject(new Error(`Record Is Disconnected`));
|
|
5308
5207
|
}
|
|
5309
|
-
macroCondition(getGlobalConfig().
|
|
5208
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5310
5209
|
if (!test) {
|
|
5311
5210
|
throw new Error(`Cannot initiate a save request for an unloaded record: ${identifier.lid}`);
|
|
5312
5211
|
}
|
|
@@ -5363,7 +5262,7 @@ class Store extends BaseClass {
|
|
|
5363
5262
|
} = this._instanceCache;
|
|
5364
5263
|
if (!cache) {
|
|
5365
5264
|
cache = this._instanceCache.cache = this.createCache(this._instanceCache._storeWrapper);
|
|
5366
|
-
if (macroCondition(getGlobalConfig().
|
|
5265
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
5367
5266
|
cache = new CacheManager(cache);
|
|
5368
5267
|
}
|
|
5369
5268
|
}
|
|
@@ -5387,19 +5286,19 @@ class Store extends BaseClass {
|
|
|
5387
5286
|
return new this(args);
|
|
5388
5287
|
}
|
|
5389
5288
|
}
|
|
5390
|
-
if (macroCondition(getGlobalConfig().
|
|
5289
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.ENABLE_LEGACY_SCHEMA_SERVICE)) {
|
|
5391
5290
|
Store.prototype.getSchemaDefinitionService = function () {
|
|
5392
|
-
macroCondition(getGlobalConfig().
|
|
5291
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5393
5292
|
if (!test) {
|
|
5394
5293
|
throw new Error(`You must registerSchemaDefinitionService with the store to use custom model classes`);
|
|
5395
5294
|
}
|
|
5396
5295
|
})(this._schema) : {};
|
|
5397
5296
|
deprecate(`Use \`store.schema\` instead of \`store.getSchemaDefinitionService()\``, false, {
|
|
5398
5297
|
id: 'ember-data-mirror:schema-service-updates',
|
|
5399
|
-
until: '
|
|
5298
|
+
until: '6.0',
|
|
5400
5299
|
for: 'ember-data-mirror',
|
|
5401
5300
|
since: {
|
|
5402
|
-
available: '
|
|
5301
|
+
available: '4.13',
|
|
5403
5302
|
enabled: '5.4'
|
|
5404
5303
|
}
|
|
5405
5304
|
});
|
|
@@ -5408,10 +5307,10 @@ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.ENABLE_LEGACY_SCHEMA
|
|
|
5408
5307
|
Store.prototype.registerSchemaDefinitionService = function (schema) {
|
|
5409
5308
|
deprecate(`Use \`store.createSchemaService\` instead of \`store.registerSchemaDefinitionService()\``, false, {
|
|
5410
5309
|
id: 'ember-data-mirror:schema-service-updates',
|
|
5411
|
-
until: '
|
|
5310
|
+
until: '6.0',
|
|
5412
5311
|
for: 'ember-data-mirror',
|
|
5413
5312
|
since: {
|
|
5414
|
-
available: '
|
|
5313
|
+
available: '4.13',
|
|
5415
5314
|
enabled: '5.4'
|
|
5416
5315
|
}
|
|
5417
5316
|
});
|
|
@@ -5420,10 +5319,10 @@ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.ENABLE_LEGACY_SCHEMA
|
|
|
5420
5319
|
Store.prototype.registerSchema = function (schema) {
|
|
5421
5320
|
deprecate(`Use \`store.createSchemaService\` instead of \`store.registerSchema()\``, false, {
|
|
5422
5321
|
id: 'ember-data-mirror:schema-service-updates',
|
|
5423
|
-
until: '
|
|
5322
|
+
until: '6.0',
|
|
5424
5323
|
for: 'ember-data-mirror',
|
|
5425
5324
|
since: {
|
|
5426
|
-
available: '
|
|
5325
|
+
available: '4.13',
|
|
5427
5326
|
enabled: '5.4'
|
|
5428
5327
|
}
|
|
5429
5328
|
});
|
|
@@ -5432,10 +5331,10 @@ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.ENABLE_LEGACY_SCHEMA
|
|
|
5432
5331
|
}
|
|
5433
5332
|
let assertDestroyingStore;
|
|
5434
5333
|
let assertDestroyedStoreOnly;
|
|
5435
|
-
if (macroCondition(getGlobalConfig().
|
|
5334
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
5436
5335
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
5437
5336
|
assertDestroyingStore = function assertDestroyingStore(store, method) {
|
|
5438
|
-
macroCondition(getGlobalConfig().
|
|
5337
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5439
5338
|
if (!test) {
|
|
5440
5339
|
throw new Error(`Attempted to call store.${method}(), but the store instance has already been destroyed.`);
|
|
5441
5340
|
}
|
|
@@ -5443,7 +5342,7 @@ if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
|
5443
5342
|
};
|
|
5444
5343
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
5445
5344
|
assertDestroyedStoreOnly = function assertDestroyedStoreOnly(store, method) {
|
|
5446
|
-
macroCondition(getGlobalConfig().
|
|
5345
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5447
5346
|
if (!test) {
|
|
5448
5347
|
throw new Error(`Attempted to call store.${method}(), but the store instance has already been destroyed.`);
|
|
5449
5348
|
}
|
|
@@ -5457,13 +5356,13 @@ function normalizeProperties(store, identifier, properties) {
|
|
|
5457
5356
|
// assert here
|
|
5458
5357
|
if (properties !== undefined) {
|
|
5459
5358
|
if ('id' in properties) {
|
|
5460
|
-
macroCondition(getGlobalConfig().
|
|
5359
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5461
5360
|
if (!test) {
|
|
5462
5361
|
throw new Error(`expected id to be a string or null`);
|
|
5463
5362
|
}
|
|
5464
5363
|
})(properties.id !== undefined) : {};
|
|
5465
5364
|
}
|
|
5466
|
-
macroCondition(getGlobalConfig().
|
|
5365
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5467
5366
|
if (!test) {
|
|
5468
5367
|
throw new Error(`You passed '${typeof properties}' as properties for record creation instead of an object.`);
|
|
5469
5368
|
}
|
|
@@ -5483,7 +5382,7 @@ function normalizeProperties(store, identifier, properties) {
|
|
|
5483
5382
|
const field = defs.get(prop);
|
|
5484
5383
|
if (!field) continue;
|
|
5485
5384
|
if (field.kind === 'hasMany') {
|
|
5486
|
-
if (macroCondition(getGlobalConfig().
|
|
5385
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
5487
5386
|
assertRecordsPassedToHasMany(properties[prop]);
|
|
5488
5387
|
}
|
|
5489
5388
|
properties[prop] = extractIdentifiersFromRecords(properties[prop]);
|
|
@@ -5496,12 +5395,12 @@ function normalizeProperties(store, identifier, properties) {
|
|
|
5496
5395
|
return properties;
|
|
5497
5396
|
}
|
|
5498
5397
|
function assertRecordsPassedToHasMany(records) {
|
|
5499
|
-
macroCondition(getGlobalConfig().
|
|
5398
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5500
5399
|
if (!test) {
|
|
5501
5400
|
throw new Error(`You must pass an array of records to set a hasMany relationship`);
|
|
5502
5401
|
}
|
|
5503
5402
|
})(Array.isArray(records)) : {};
|
|
5504
|
-
macroCondition(getGlobalConfig().
|
|
5403
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5505
5404
|
if (!test) {
|
|
5506
5405
|
throw new Error(`All elements of a hasMany relationship must be instances of Model, you passed ${records.map(r => `${typeof r}`).join(', ')}`);
|
|
5507
5406
|
}
|
|
@@ -5631,7 +5530,7 @@ class Document {
|
|
|
5631
5530
|
* @return Promise<Document>
|
|
5632
5531
|
*/
|
|
5633
5532
|
fetch(options = {}) {
|
|
5634
|
-
macroCondition(getGlobalConfig().
|
|
5533
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5635
5534
|
if (!test) {
|
|
5636
5535
|
throw new Error(`No self or related link`);
|
|
5637
5536
|
}
|
|
@@ -5833,7 +5732,7 @@ function getPriority(identifier, deduped, priority) {
|
|
|
5833
5732
|
* approach of EmberData allows for this flexibility.
|
|
5834
5733
|
*
|
|
5835
5734
|
* ```ts
|
|
5836
|
-
* import { EnableHydration } from '@warp-drive/core-types/request';
|
|
5735
|
+
* import { EnableHydration } from '@warp-drive-mirror/core-types/request';
|
|
5837
5736
|
*
|
|
5838
5737
|
* requestManager.request({
|
|
5839
5738
|
* store: store,
|
|
@@ -5910,7 +5809,7 @@ const CacheHandler = {
|
|
|
5910
5809
|
}
|
|
5911
5810
|
store.requestManager._pending.set(context.id, promise);
|
|
5912
5811
|
}
|
|
5913
|
-
macroCondition(getGlobalConfig().
|
|
5812
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5914
5813
|
if (!test) {
|
|
5915
5814
|
throw new Error(`Expected a peeked request to be present`);
|
|
5916
5815
|
}
|
|
@@ -5938,7 +5837,7 @@ function maybeUpdateUiObjects(store, request, options, document, isFromCache) {
|
|
|
5938
5837
|
identifier
|
|
5939
5838
|
} = options;
|
|
5940
5839
|
if (!document) {
|
|
5941
|
-
macroCondition(getGlobalConfig().
|
|
5840
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5942
5841
|
if (!test) {
|
|
5943
5842
|
throw new Error(`The CacheHandler expected response content but none was found`);
|
|
5944
5843
|
}
|
|
@@ -6130,7 +6029,7 @@ function fetchContentAndHydrate(next, context, identifier, priority) {
|
|
|
6130
6029
|
isMut = true;
|
|
6131
6030
|
// TODO should we handle multiple records in request.records by iteratively calling willCommit for each
|
|
6132
6031
|
const record = context.request.data?.record || context.request.records?.[0];
|
|
6133
|
-
macroCondition(getGlobalConfig().
|
|
6032
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
6134
6033
|
if (!test) {
|
|
6135
6034
|
throw new Error(`Expected to receive a list of records included in the ${context.request.op} request`);
|
|
6136
6035
|
}
|
|
@@ -6150,7 +6049,7 @@ function fetchContentAndHydrate(next, context, identifier, priority) {
|
|
|
6150
6049
|
if (!isMut) {
|
|
6151
6050
|
return promise;
|
|
6152
6051
|
}
|
|
6153
|
-
macroCondition(getGlobalConfig().
|
|
6052
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
6154
6053
|
if (!test) {
|
|
6155
6054
|
throw new Error(`Expected a mutation`);
|
|
6156
6055
|
}
|