@ember-data-mirror/store 5.3.9 → 5.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -6
- package/addon-main.cjs +1 -1
- package/dist/-private.js +1 -1
- package/dist/{handler-CET_Ja8V.js → handler-DX830Swd.js} +172 -276
- package/dist/handler-DX830Swd.js.map +1 -0
- package/dist/index.js +1 -1
- package/package.json +31 -20
- package/unstable-preview-types/-private/cache-handler/handler.d.ts +3 -5
- package/unstable-preview-types/-private/cache-handler/handler.d.ts.map +1 -1
- 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 +9 -12
- 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 +22 -25
- package/unstable-preview-types/index.d.ts.map +1 -1
- 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 {
|
|
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 { EnableHydration, SkipCache } 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
|
});
|
|
@@ -3723,12 +3622,9 @@ class Store extends BaseClass {
|
|
|
3723
3622
|
* import Fetch from '@ember-data-mirror/request/fetch';
|
|
3724
3623
|
*
|
|
3725
3624
|
* class extends Store {
|
|
3726
|
-
*
|
|
3727
|
-
*
|
|
3728
|
-
*
|
|
3729
|
-
* this.requestManager.use([Fetch]);
|
|
3730
|
-
* this.requestManager.useCache(CacheHandler);
|
|
3731
|
-
* }
|
|
3625
|
+
* requestManager = new RequestManager()
|
|
3626
|
+
* .use([Fetch])
|
|
3627
|
+
* .useCache(CacheHandler);
|
|
3732
3628
|
* }
|
|
3733
3629
|
* ```
|
|
3734
3630
|
*
|
|
@@ -3817,13 +3713,13 @@ class Store extends BaseClass {
|
|
|
3817
3713
|
this.isDestroyed = false;
|
|
3818
3714
|
}
|
|
3819
3715
|
_run(cb) {
|
|
3820
|
-
macroCondition(getGlobalConfig().
|
|
3716
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
3821
3717
|
if (!test) {
|
|
3822
3718
|
throw new Error(`EmberData should never encounter a nested run`);
|
|
3823
3719
|
}
|
|
3824
3720
|
})(!this._cbs) : {};
|
|
3825
3721
|
const _cbs = this._cbs = {};
|
|
3826
|
-
if (macroCondition(getGlobalConfig().
|
|
3722
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
3827
3723
|
try {
|
|
3828
3724
|
cb();
|
|
3829
3725
|
if (_cbs.coalesce) {
|
|
@@ -3870,12 +3766,12 @@ class Store extends BaseClass {
|
|
|
3870
3766
|
}
|
|
3871
3767
|
}
|
|
3872
3768
|
_schedule(name, cb) {
|
|
3873
|
-
macroCondition(getGlobalConfig().
|
|
3769
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
3874
3770
|
if (!test) {
|
|
3875
3771
|
throw new Error(`EmberData expects to schedule only when there is an active run`);
|
|
3876
3772
|
}
|
|
3877
3773
|
})(!!this._cbs) : {};
|
|
3878
|
-
macroCondition(getGlobalConfig().
|
|
3774
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
3879
3775
|
if (!test) {
|
|
3880
3776
|
throw new Error(`EmberData expects only one flush per queue name, cannot schedule ${name}`);
|
|
3881
3777
|
}
|
|
@@ -3898,7 +3794,7 @@ class Store extends BaseClass {
|
|
|
3898
3794
|
return this._requestCache;
|
|
3899
3795
|
}
|
|
3900
3796
|
_getAllPending() {
|
|
3901
|
-
if (macroCondition(getGlobalConfig().
|
|
3797
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.TESTING)) {
|
|
3902
3798
|
const all = [];
|
|
3903
3799
|
const pending = this._requestCache._pending;
|
|
3904
3800
|
pending.forEach(requests => {
|
|
@@ -3970,18 +3866,18 @@ class Store extends BaseClass {
|
|
|
3970
3866
|
// the user has had the chance to set the prop.
|
|
3971
3867
|
const opts = {
|
|
3972
3868
|
store: this,
|
|
3973
|
-
[EnableHydration]: true
|
|
3869
|
+
[EnableHydration]: requestConfig[EnableHydration] ?? true
|
|
3974
3870
|
};
|
|
3975
3871
|
if (requestConfig.records) {
|
|
3976
3872
|
const identifierCache = this.identifierCache;
|
|
3977
3873
|
opts.records = requestConfig.records.map(r => identifierCache.getOrCreateRecordIdentifier(r));
|
|
3978
3874
|
}
|
|
3979
|
-
if (macroCondition(getGlobalConfig().
|
|
3875
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.TESTING)) {
|
|
3980
3876
|
if (this.DISABLE_WAITER) {
|
|
3981
3877
|
opts.disableTestWaiter = typeof requestConfig.disableTestWaiter === 'boolean' ? requestConfig.disableTestWaiter : true;
|
|
3982
3878
|
}
|
|
3983
3879
|
}
|
|
3984
|
-
if (macroCondition(getGlobalConfig().
|
|
3880
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_REQUESTS)) {
|
|
3985
3881
|
let options;
|
|
3986
3882
|
try {
|
|
3987
3883
|
options = JSON.parse(JSON.stringify(requestConfig));
|
|
@@ -3994,7 +3890,7 @@ class Store extends BaseClass {
|
|
|
3994
3890
|
const request = Object.assign({}, requestConfig, opts);
|
|
3995
3891
|
const future = this.requestManager.request(request);
|
|
3996
3892
|
future.onFinalize(() => {
|
|
3997
|
-
if (macroCondition(getGlobalConfig().
|
|
3893
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_REQUESTS)) {
|
|
3998
3894
|
// eslint-disable-next-line no-console
|
|
3999
3895
|
console.log(`request: [[FINALIZE]] ${requestConfig.op && !requestConfig.url ? '(LEGACY) ' : ''}${requestConfig.op || '<unknown operation>'} ${requestConfig.url || '<empty url>'} ${requestConfig.method || '<empty method>'}`);
|
|
4000
3896
|
}
|
|
@@ -4059,15 +3955,15 @@ class Store extends BaseClass {
|
|
|
4059
3955
|
modelFor(type) {
|
|
4060
3956
|
// FIXME add deprecation and deprecation stripping
|
|
4061
3957
|
// FIXME/TODO update RFC to remove this method
|
|
4062
|
-
if (macroCondition(getGlobalConfig().
|
|
3958
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
4063
3959
|
assertDestroyedStoreOnly(this, 'modelFor');
|
|
4064
3960
|
}
|
|
4065
|
-
macroCondition(getGlobalConfig().
|
|
3961
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4066
3962
|
if (!test) {
|
|
4067
3963
|
throw new Error(`You need to pass <type> to the store's modelFor method`);
|
|
4068
3964
|
}
|
|
4069
3965
|
})(typeof type === 'string' && type.length) : {};
|
|
4070
|
-
macroCondition(getGlobalConfig().
|
|
3966
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4071
3967
|
if (!test) {
|
|
4072
3968
|
throw new Error(`No model was found for '${type}' and no schema handles the type`);
|
|
4073
3969
|
}
|
|
@@ -4103,15 +3999,15 @@ class Store extends BaseClass {
|
|
|
4103
3999
|
*/
|
|
4104
4000
|
|
|
4105
4001
|
createRecord(type, inputProperties) {
|
|
4106
|
-
if (macroCondition(getGlobalConfig().
|
|
4002
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
4107
4003
|
assertDestroyingStore(this, 'createRecord');
|
|
4108
4004
|
}
|
|
4109
|
-
macroCondition(getGlobalConfig().
|
|
4005
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4110
4006
|
if (!test) {
|
|
4111
4007
|
throw new Error(`You need to pass a model name to the store's createRecord method`);
|
|
4112
4008
|
}
|
|
4113
4009
|
})(type) : {};
|
|
4114
|
-
macroCondition(getGlobalConfig().
|
|
4010
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4115
4011
|
if (!test) {
|
|
4116
4012
|
throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`);
|
|
4117
4013
|
}
|
|
@@ -4150,7 +4046,7 @@ class Store extends BaseClass {
|
|
|
4150
4046
|
};
|
|
4151
4047
|
if (resource.id) {
|
|
4152
4048
|
const identifier = this.identifierCache.peekRecordIdentifier(resource);
|
|
4153
|
-
macroCondition(getGlobalConfig().
|
|
4049
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4154
4050
|
if (!test) {
|
|
4155
4051
|
throw new Error(`The id ${String(properties.id)} has already been used with another '${normalizedModelName}' record.`);
|
|
4156
4052
|
}
|
|
@@ -4179,12 +4075,12 @@ class Store extends BaseClass {
|
|
|
4179
4075
|
@param {unknown} record
|
|
4180
4076
|
*/
|
|
4181
4077
|
deleteRecord(record) {
|
|
4182
|
-
if (macroCondition(getGlobalConfig().
|
|
4078
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
4183
4079
|
assertDestroyingStore(this, 'deleteRecord');
|
|
4184
4080
|
}
|
|
4185
4081
|
const identifier = peekRecordIdentifier(record);
|
|
4186
4082
|
const cache = this.cache;
|
|
4187
|
-
macroCondition(getGlobalConfig().
|
|
4083
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4188
4084
|
if (!test) {
|
|
4189
4085
|
throw new Error(`expected the record to be connected to a cache`);
|
|
4190
4086
|
}
|
|
@@ -4211,7 +4107,7 @@ class Store extends BaseClass {
|
|
|
4211
4107
|
@param {Model} record
|
|
4212
4108
|
*/
|
|
4213
4109
|
unloadRecord(record) {
|
|
4214
|
-
if (macroCondition(getGlobalConfig().
|
|
4110
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
4215
4111
|
assertDestroyingStore(this, 'unloadRecord');
|
|
4216
4112
|
}
|
|
4217
4113
|
const identifier = peekRecordIdentifier(record);
|
|
@@ -4499,10 +4395,10 @@ class Store extends BaseClass {
|
|
|
4499
4395
|
*/
|
|
4500
4396
|
|
|
4501
4397
|
findRecord(resource, id, options) {
|
|
4502
|
-
if (macroCondition(getGlobalConfig().
|
|
4398
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
4503
4399
|
assertDestroyingStore(this, 'findRecord');
|
|
4504
4400
|
}
|
|
4505
|
-
macroCondition(getGlobalConfig().
|
|
4401
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4506
4402
|
if (!test) {
|
|
4507
4403
|
throw new Error(`You need to pass a modelName or resource identifier as the first argument to the store's findRecord method`);
|
|
4508
4404
|
}
|
|
@@ -4510,7 +4406,7 @@ class Store extends BaseClass {
|
|
|
4510
4406
|
if (isMaybeIdentifier(resource)) {
|
|
4511
4407
|
options = id;
|
|
4512
4408
|
} else {
|
|
4513
|
-
macroCondition(getGlobalConfig().
|
|
4409
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4514
4410
|
if (!test) {
|
|
4515
4411
|
throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${resource}`);
|
|
4516
4412
|
}
|
|
@@ -4578,7 +4474,7 @@ class Store extends BaseClass {
|
|
|
4578
4474
|
*/
|
|
4579
4475
|
// TODO @deprecate getReference (and references generally)
|
|
4580
4476
|
getReference(resource, id) {
|
|
4581
|
-
if (macroCondition(getGlobalConfig().
|
|
4477
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
4582
4478
|
assertDestroyingStore(this, 'getReference');
|
|
4583
4479
|
}
|
|
4584
4480
|
let resourceIdentifier;
|
|
@@ -4589,7 +4485,7 @@ class Store extends BaseClass {
|
|
|
4589
4485
|
const normalizedId = ensureStringId(id);
|
|
4590
4486
|
resourceIdentifier = constructResource(type, normalizedId);
|
|
4591
4487
|
}
|
|
4592
|
-
macroCondition(getGlobalConfig().
|
|
4488
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4593
4489
|
if (!test) {
|
|
4594
4490
|
throw new Error('getReference expected to receive either a resource identifier or type and id as arguments');
|
|
4595
4491
|
}
|
|
@@ -4641,15 +4537,15 @@ class Store extends BaseClass {
|
|
|
4641
4537
|
// this is basically an "are we not empty" query.
|
|
4642
4538
|
return isLoaded ? this._instanceCache.getRecord(stableIdentifier) : null;
|
|
4643
4539
|
}
|
|
4644
|
-
if (macroCondition(getGlobalConfig().
|
|
4540
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
4645
4541
|
assertDestroyingStore(this, 'peekRecord');
|
|
4646
4542
|
}
|
|
4647
|
-
macroCondition(getGlobalConfig().
|
|
4543
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4648
4544
|
if (!test) {
|
|
4649
4545
|
throw new Error(`You need to pass a model name to the store's peekRecord method`);
|
|
4650
4546
|
}
|
|
4651
4547
|
})(identifier) : {};
|
|
4652
|
-
macroCondition(getGlobalConfig().
|
|
4548
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4653
4549
|
if (!test) {
|
|
4654
4550
|
throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${String(identifier)}`);
|
|
4655
4551
|
}
|
|
@@ -4704,20 +4600,20 @@ class Store extends BaseClass {
|
|
|
4704
4600
|
*/
|
|
4705
4601
|
|
|
4706
4602
|
query(type, query, options = {}) {
|
|
4707
|
-
if (macroCondition(getGlobalConfig().
|
|
4603
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
4708
4604
|
assertDestroyingStore(this, 'query');
|
|
4709
4605
|
}
|
|
4710
|
-
macroCondition(getGlobalConfig().
|
|
4606
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4711
4607
|
if (!test) {
|
|
4712
4608
|
throw new Error(`You need to pass a model name to the store's query method`);
|
|
4713
4609
|
}
|
|
4714
4610
|
})(type) : {};
|
|
4715
|
-
macroCondition(getGlobalConfig().
|
|
4611
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4716
4612
|
if (!test) {
|
|
4717
4613
|
throw new Error(`You need to pass a query hash to the store's query method`);
|
|
4718
4614
|
}
|
|
4719
4615
|
})(query) : {};
|
|
4720
|
-
macroCondition(getGlobalConfig().
|
|
4616
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4721
4617
|
if (!test) {
|
|
4722
4618
|
throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`);
|
|
4723
4619
|
}
|
|
@@ -4819,20 +4715,20 @@ class Store extends BaseClass {
|
|
|
4819
4715
|
*/
|
|
4820
4716
|
|
|
4821
4717
|
queryRecord(type, query, options) {
|
|
4822
|
-
if (macroCondition(getGlobalConfig().
|
|
4718
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
4823
4719
|
assertDestroyingStore(this, 'queryRecord');
|
|
4824
4720
|
}
|
|
4825
|
-
macroCondition(getGlobalConfig().
|
|
4721
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4826
4722
|
if (!test) {
|
|
4827
4723
|
throw new Error(`You need to pass a model name to the store's queryRecord method`);
|
|
4828
4724
|
}
|
|
4829
4725
|
})(type) : {};
|
|
4830
|
-
macroCondition(getGlobalConfig().
|
|
4726
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4831
4727
|
if (!test) {
|
|
4832
4728
|
throw new Error(`You need to pass a query hash to the store's queryRecord method`);
|
|
4833
4729
|
}
|
|
4834
4730
|
})(query) : {};
|
|
4835
|
-
macroCondition(getGlobalConfig().
|
|
4731
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
4836
4732
|
if (!test) {
|
|
4837
4733
|
throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`);
|
|
4838
4734
|
}
|
|
@@ -4999,15 +4895,15 @@ class Store extends BaseClass {
|
|
|
4999
4895
|
*/
|
|
5000
4896
|
|
|
5001
4897
|
findAll(type, options = {}) {
|
|
5002
|
-
if (macroCondition(getGlobalConfig().
|
|
4898
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
5003
4899
|
assertDestroyingStore(this, 'findAll');
|
|
5004
4900
|
}
|
|
5005
|
-
macroCondition(getGlobalConfig().
|
|
4901
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5006
4902
|
if (!test) {
|
|
5007
4903
|
throw new Error(`You need to pass a model name to the store's findAll method`);
|
|
5008
4904
|
}
|
|
5009
4905
|
})(type) : {};
|
|
5010
|
-
macroCondition(getGlobalConfig().
|
|
4906
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5011
4907
|
if (!test) {
|
|
5012
4908
|
throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`);
|
|
5013
4909
|
}
|
|
@@ -5047,15 +4943,15 @@ class Store extends BaseClass {
|
|
|
5047
4943
|
*/
|
|
5048
4944
|
|
|
5049
4945
|
peekAll(type) {
|
|
5050
|
-
if (macroCondition(getGlobalConfig().
|
|
4946
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
5051
4947
|
assertDestroyingStore(this, 'peekAll');
|
|
5052
4948
|
}
|
|
5053
|
-
macroCondition(getGlobalConfig().
|
|
4949
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5054
4950
|
if (!test) {
|
|
5055
4951
|
throw new Error(`You need to pass a model name to the store's peekAll method`);
|
|
5056
4952
|
}
|
|
5057
4953
|
})(type) : {};
|
|
5058
|
-
macroCondition(getGlobalConfig().
|
|
4954
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5059
4955
|
if (!test) {
|
|
5060
4956
|
throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${type}`);
|
|
5061
4957
|
}
|
|
@@ -5077,10 +4973,10 @@ class Store extends BaseClass {
|
|
|
5077
4973
|
*/
|
|
5078
4974
|
|
|
5079
4975
|
unloadAll(type) {
|
|
5080
|
-
if (macroCondition(getGlobalConfig().
|
|
4976
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
5081
4977
|
assertDestroyedStoreOnly(this, 'unloadAll');
|
|
5082
4978
|
}
|
|
5083
|
-
macroCondition(getGlobalConfig().
|
|
4979
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5084
4980
|
if (!test) {
|
|
5085
4981
|
throw new Error(`Passing classes to store methods has been removed. Please pass a dasherized string instead of ${String(type)}`);
|
|
5086
4982
|
}
|
|
@@ -5231,7 +5127,7 @@ class Store extends BaseClass {
|
|
|
5231
5127
|
*/
|
|
5232
5128
|
|
|
5233
5129
|
push(data) {
|
|
5234
|
-
if (macroCondition(getGlobalConfig().
|
|
5130
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
5235
5131
|
assertDestroyingStore(this, 'push');
|
|
5236
5132
|
}
|
|
5237
5133
|
const pushed = this._push(data, false);
|
|
@@ -5253,10 +5149,10 @@ class Store extends BaseClass {
|
|
|
5253
5149
|
@return {StableRecordIdentifier|Array<StableRecordIdentifier>|null} identifiers for the primary records that had data loaded
|
|
5254
5150
|
*/
|
|
5255
5151
|
_push(jsonApiDoc, asyncFlush) {
|
|
5256
|
-
if (macroCondition(getGlobalConfig().
|
|
5152
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
5257
5153
|
assertDestroyingStore(this, '_push');
|
|
5258
5154
|
}
|
|
5259
|
-
if (macroCondition(getGlobalConfig().
|
|
5155
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.debug.LOG_PAYLOADS)) {
|
|
5260
5156
|
try {
|
|
5261
5157
|
const data = JSON.parse(JSON.stringify(jsonApiDoc));
|
|
5262
5158
|
// eslint-disable-next-line no-console
|
|
@@ -5291,10 +5187,10 @@ class Store extends BaseClass {
|
|
|
5291
5187
|
* @return {Promise<record>}
|
|
5292
5188
|
*/
|
|
5293
5189
|
saveRecord(record, options = {}) {
|
|
5294
|
-
if (macroCondition(getGlobalConfig().
|
|
5190
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
5295
5191
|
assertDestroyingStore(this, 'saveRecord');
|
|
5296
5192
|
}
|
|
5297
|
-
macroCondition(getGlobalConfig().
|
|
5193
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5298
5194
|
if (!test) {
|
|
5299
5195
|
throw new Error(`Unable to initiate save for a record in a disconnected state`);
|
|
5300
5196
|
}
|
|
@@ -5306,7 +5202,7 @@ class Store extends BaseClass {
|
|
|
5306
5202
|
// but just in case we reject here to prevent bad things.
|
|
5307
5203
|
return Promise.reject(new Error(`Record Is Disconnected`));
|
|
5308
5204
|
}
|
|
5309
|
-
macroCondition(getGlobalConfig().
|
|
5205
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5310
5206
|
if (!test) {
|
|
5311
5207
|
throw new Error(`Cannot initiate a save request for an unloaded record: ${identifier.lid}`);
|
|
5312
5208
|
}
|
|
@@ -5363,7 +5259,7 @@ class Store extends BaseClass {
|
|
|
5363
5259
|
} = this._instanceCache;
|
|
5364
5260
|
if (!cache) {
|
|
5365
5261
|
cache = this._instanceCache.cache = this.createCache(this._instanceCache._storeWrapper);
|
|
5366
|
-
if (macroCondition(getGlobalConfig().
|
|
5262
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
5367
5263
|
cache = new CacheManager(cache);
|
|
5368
5264
|
}
|
|
5369
5265
|
}
|
|
@@ -5387,19 +5283,19 @@ class Store extends BaseClass {
|
|
|
5387
5283
|
return new this(args);
|
|
5388
5284
|
}
|
|
5389
5285
|
}
|
|
5390
|
-
if (macroCondition(getGlobalConfig().
|
|
5286
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.ENABLE_LEGACY_SCHEMA_SERVICE)) {
|
|
5391
5287
|
Store.prototype.getSchemaDefinitionService = function () {
|
|
5392
|
-
macroCondition(getGlobalConfig().
|
|
5288
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5393
5289
|
if (!test) {
|
|
5394
5290
|
throw new Error(`You must registerSchemaDefinitionService with the store to use custom model classes`);
|
|
5395
5291
|
}
|
|
5396
5292
|
})(this._schema) : {};
|
|
5397
5293
|
deprecate(`Use \`store.schema\` instead of \`store.getSchemaDefinitionService()\``, false, {
|
|
5398
5294
|
id: 'ember-data-mirror:schema-service-updates',
|
|
5399
|
-
until: '
|
|
5295
|
+
until: '6.0',
|
|
5400
5296
|
for: 'ember-data-mirror',
|
|
5401
5297
|
since: {
|
|
5402
|
-
available: '
|
|
5298
|
+
available: '4.13',
|
|
5403
5299
|
enabled: '5.4'
|
|
5404
5300
|
}
|
|
5405
5301
|
});
|
|
@@ -5408,10 +5304,10 @@ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.ENABLE_LEGACY_SCHEMA
|
|
|
5408
5304
|
Store.prototype.registerSchemaDefinitionService = function (schema) {
|
|
5409
5305
|
deprecate(`Use \`store.createSchemaService\` instead of \`store.registerSchemaDefinitionService()\``, false, {
|
|
5410
5306
|
id: 'ember-data-mirror:schema-service-updates',
|
|
5411
|
-
until: '
|
|
5307
|
+
until: '6.0',
|
|
5412
5308
|
for: 'ember-data-mirror',
|
|
5413
5309
|
since: {
|
|
5414
|
-
available: '
|
|
5310
|
+
available: '4.13',
|
|
5415
5311
|
enabled: '5.4'
|
|
5416
5312
|
}
|
|
5417
5313
|
});
|
|
@@ -5420,10 +5316,10 @@ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.ENABLE_LEGACY_SCHEMA
|
|
|
5420
5316
|
Store.prototype.registerSchema = function (schema) {
|
|
5421
5317
|
deprecate(`Use \`store.createSchemaService\` instead of \`store.registerSchema()\``, false, {
|
|
5422
5318
|
id: 'ember-data-mirror:schema-service-updates',
|
|
5423
|
-
until: '
|
|
5319
|
+
until: '6.0',
|
|
5424
5320
|
for: 'ember-data-mirror',
|
|
5425
5321
|
since: {
|
|
5426
|
-
available: '
|
|
5322
|
+
available: '4.13',
|
|
5427
5323
|
enabled: '5.4'
|
|
5428
5324
|
}
|
|
5429
5325
|
});
|
|
@@ -5432,10 +5328,10 @@ if (macroCondition(getGlobalConfig().WarpDrive.deprecations.ENABLE_LEGACY_SCHEMA
|
|
|
5432
5328
|
}
|
|
5433
5329
|
let assertDestroyingStore;
|
|
5434
5330
|
let assertDestroyedStoreOnly;
|
|
5435
|
-
if (macroCondition(getGlobalConfig().
|
|
5331
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
5436
5332
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
5437
5333
|
assertDestroyingStore = function assertDestroyingStore(store, method) {
|
|
5438
|
-
macroCondition(getGlobalConfig().
|
|
5334
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5439
5335
|
if (!test) {
|
|
5440
5336
|
throw new Error(`Attempted to call store.${method}(), but the store instance has already been destroyed.`);
|
|
5441
5337
|
}
|
|
@@ -5443,7 +5339,7 @@ if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
|
5443
5339
|
};
|
|
5444
5340
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
5445
5341
|
assertDestroyedStoreOnly = function assertDestroyedStoreOnly(store, method) {
|
|
5446
|
-
macroCondition(getGlobalConfig().
|
|
5342
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5447
5343
|
if (!test) {
|
|
5448
5344
|
throw new Error(`Attempted to call store.${method}(), but the store instance has already been destroyed.`);
|
|
5449
5345
|
}
|
|
@@ -5457,13 +5353,13 @@ function normalizeProperties(store, identifier, properties) {
|
|
|
5457
5353
|
// assert here
|
|
5458
5354
|
if (properties !== undefined) {
|
|
5459
5355
|
if ('id' in properties) {
|
|
5460
|
-
macroCondition(getGlobalConfig().
|
|
5356
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5461
5357
|
if (!test) {
|
|
5462
5358
|
throw new Error(`expected id to be a string or null`);
|
|
5463
5359
|
}
|
|
5464
5360
|
})(properties.id !== undefined) : {};
|
|
5465
5361
|
}
|
|
5466
|
-
macroCondition(getGlobalConfig().
|
|
5362
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5467
5363
|
if (!test) {
|
|
5468
5364
|
throw new Error(`You passed '${typeof properties}' as properties for record creation instead of an object.`);
|
|
5469
5365
|
}
|
|
@@ -5483,7 +5379,7 @@ function normalizeProperties(store, identifier, properties) {
|
|
|
5483
5379
|
const field = defs.get(prop);
|
|
5484
5380
|
if (!field) continue;
|
|
5485
5381
|
if (field.kind === 'hasMany') {
|
|
5486
|
-
if (macroCondition(getGlobalConfig().
|
|
5382
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
5487
5383
|
assertRecordsPassedToHasMany(properties[prop]);
|
|
5488
5384
|
}
|
|
5489
5385
|
properties[prop] = extractIdentifiersFromRecords(properties[prop]);
|
|
@@ -5496,12 +5392,12 @@ function normalizeProperties(store, identifier, properties) {
|
|
|
5496
5392
|
return properties;
|
|
5497
5393
|
}
|
|
5498
5394
|
function assertRecordsPassedToHasMany(records) {
|
|
5499
|
-
macroCondition(getGlobalConfig().
|
|
5395
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5500
5396
|
if (!test) {
|
|
5501
5397
|
throw new Error(`You must pass an array of records to set a hasMany relationship`);
|
|
5502
5398
|
}
|
|
5503
5399
|
})(Array.isArray(records)) : {};
|
|
5504
|
-
macroCondition(getGlobalConfig().
|
|
5400
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5505
5401
|
if (!test) {
|
|
5506
5402
|
throw new Error(`All elements of a hasMany relationship must be instances of Model, you passed ${records.map(r => `${typeof r}`).join(', ')}`);
|
|
5507
5403
|
}
|
|
@@ -5631,7 +5527,7 @@ class Document {
|
|
|
5631
5527
|
* @return Promise<Document>
|
|
5632
5528
|
*/
|
|
5633
5529
|
fetch(options = {}) {
|
|
5634
|
-
macroCondition(getGlobalConfig().
|
|
5530
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5635
5531
|
if (!test) {
|
|
5636
5532
|
throw new Error(`No self or related link`);
|
|
5637
5533
|
}
|
|
@@ -5833,7 +5729,7 @@ function getPriority(identifier, deduped, priority) {
|
|
|
5833
5729
|
* approach of EmberData allows for this flexibility.
|
|
5834
5730
|
*
|
|
5835
5731
|
* ```ts
|
|
5836
|
-
* import { EnableHydration } from '@warp-drive/core-types/request';
|
|
5732
|
+
* import { EnableHydration } from '@warp-drive-mirror/core-types/request';
|
|
5837
5733
|
*
|
|
5838
5734
|
* requestManager.request({
|
|
5839
5735
|
* store: store,
|
|
@@ -5910,7 +5806,7 @@ const CacheHandler = {
|
|
|
5910
5806
|
}
|
|
5911
5807
|
store.requestManager._pending.set(context.id, promise);
|
|
5912
5808
|
}
|
|
5913
|
-
macroCondition(getGlobalConfig().
|
|
5809
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5914
5810
|
if (!test) {
|
|
5915
5811
|
throw new Error(`Expected a peeked request to be present`);
|
|
5916
5812
|
}
|
|
@@ -5938,7 +5834,7 @@ function maybeUpdateUiObjects(store, request, options, document, isFromCache) {
|
|
|
5938
5834
|
identifier
|
|
5939
5835
|
} = options;
|
|
5940
5836
|
if (!document) {
|
|
5941
|
-
macroCondition(getGlobalConfig().
|
|
5837
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
5942
5838
|
if (!test) {
|
|
5943
5839
|
throw new Error(`The CacheHandler expected response content but none was found`);
|
|
5944
5840
|
}
|
|
@@ -6130,7 +6026,7 @@ function fetchContentAndHydrate(next, context, identifier, priority) {
|
|
|
6130
6026
|
isMut = true;
|
|
6131
6027
|
// TODO should we handle multiple records in request.records by iteratively calling willCommit for each
|
|
6132
6028
|
const record = context.request.data?.record || context.request.records?.[0];
|
|
6133
|
-
macroCondition(getGlobalConfig().
|
|
6029
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
6134
6030
|
if (!test) {
|
|
6135
6031
|
throw new Error(`Expected to receive a list of records included in the ${context.request.op} request`);
|
|
6136
6032
|
}
|
|
@@ -6150,7 +6046,7 @@ function fetchContentAndHydrate(next, context, identifier, priority) {
|
|
|
6150
6046
|
if (!isMut) {
|
|
6151
6047
|
return promise;
|
|
6152
6048
|
}
|
|
6153
|
-
macroCondition(getGlobalConfig().
|
|
6049
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? (test => {
|
|
6154
6050
|
if (!test) {
|
|
6155
6051
|
throw new Error(`Expected a mutation`);
|
|
6156
6052
|
}
|