@ember-data/store 5.4.0-alpha.136 → 5.4.0-alpha.138
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/dist/-private.js +1 -1
- package/dist/{handler-DampzYZU.js → handler-BWl65Bke.js} +163 -100
- package/dist/handler-BWl65Bke.js.map +1 -0
- package/dist/index.js +1 -1
- package/package.json +11 -11
- package/unstable-preview-types/-private/store-service.d.ts.map +1 -1
- package/unstable-preview-types/index.d.ts +20 -20
- package/dist/handler-DampzYZU.js.map +0 -1
package/dist/-private.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as ARRAY_SIGNAL, C as CacheHandler, j as CollectionRecordArray, I as LiveArray, M as MUTATE, R as RecordArrayManager, k as SOURCE, S as Store, q as StoreMap, _ as _clearCaches, u as _deprecatingNormalize, g as coerceId, f as constructResource, h as ensureStringId, l as fastPush, i as isStableIdentifier, v as log, w as logGroup, n as notifyArray, p as peekCache, r as recordIdentifierFor, m as removeRecordDataFor, t as setCacheFor, o as setRecordIdentifier, s as storeFor } from "./handler-
|
|
1
|
+
export { A as ARRAY_SIGNAL, C as CacheHandler, j as CollectionRecordArray, I as LiveArray, M as MUTATE, R as RecordArrayManager, k as SOURCE, S as Store, q as StoreMap, _ as _clearCaches, u as _deprecatingNormalize, g as coerceId, f as constructResource, h as ensureStringId, l as fastPush, i as isStableIdentifier, v as log, w as logGroup, n as notifyArray, p as peekCache, r as recordIdentifierFor, m as removeRecordDataFor, t as setCacheFor, o as setRecordIdentifier, s as storeFor } from "./handler-BWl65Bke.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { deprecate, warn } from '@ember/debug';
|
|
2
2
|
import { macroCondition, getGlobalConfig, dependencySatisfies, importSync } from '@embroider/macros';
|
|
3
|
+
import { setLogging, getRuntimeConfig } from '@warp-drive/build-config/runtime';
|
|
3
4
|
import { EnableHydration, SkipCache } from '@warp-drive/core-types/request';
|
|
4
5
|
import { getOrSetGlobal, setTransient, peekTransient } from '@warp-drive/core-types/-private';
|
|
5
6
|
import { CACHE_OWNER, DEBUG_STALE_CACHE_OWNER, DEBUG_CLIENT_ORIGINATED, DEBUG_IDENTIFIER_BUCKET } from '@warp-drive/core-types/identifier';
|
|
@@ -309,9 +310,11 @@ class IdentifierCache {
|
|
|
309
310
|
*/
|
|
310
311
|
|
|
311
312
|
_getRecordIdentifier(resource, shouldGenerate) {
|
|
312
|
-
if (macroCondition(getGlobalConfig().WarpDrive.
|
|
313
|
-
|
|
314
|
-
|
|
313
|
+
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_IDENTIFIERS)) {
|
|
314
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_IDENTIFIERS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_IDENTIFIERS) {
|
|
315
|
+
// eslint-disable-next-line no-console
|
|
316
|
+
console.groupCollapsed(`Identifiers: ${shouldGenerate ? 'Generating' : 'Peeking'} Identifier`, resource);
|
|
317
|
+
}
|
|
315
318
|
}
|
|
316
319
|
// short circuit if we're already the stable version
|
|
317
320
|
if (isStableIdentifier(resource)) {
|
|
@@ -321,33 +324,41 @@ class IdentifierCache {
|
|
|
321
324
|
throw new Error(`The supplied identifier ${JSON.stringify(resource)} does not belong to this store instance`);
|
|
322
325
|
}
|
|
323
326
|
}
|
|
324
|
-
if (macroCondition(getGlobalConfig().WarpDrive.
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
327
|
+
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_IDENTIFIERS)) {
|
|
328
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_IDENTIFIERS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_IDENTIFIERS) {
|
|
329
|
+
// eslint-disable-next-line no-console
|
|
330
|
+
console.log(`Identifiers: cache HIT - Stable ${resource.lid}`);
|
|
331
|
+
// eslint-disable-next-line no-console
|
|
332
|
+
console.groupEnd();
|
|
333
|
+
}
|
|
329
334
|
}
|
|
330
335
|
return resource;
|
|
331
336
|
}
|
|
332
337
|
|
|
333
338
|
// the resource is unknown, ask the application to identify this data for us
|
|
334
339
|
const lid = this._generate(resource, 'record');
|
|
335
|
-
if (macroCondition(getGlobalConfig().WarpDrive.
|
|
336
|
-
|
|
337
|
-
|
|
340
|
+
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_IDENTIFIERS)) {
|
|
341
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_IDENTIFIERS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_IDENTIFIERS) {
|
|
342
|
+
// eslint-disable-next-line no-console
|
|
343
|
+
console.log(`Identifiers: ${lid ? 'no ' : ''}lid ${lid ? lid + ' ' : ''}determined for resource`, resource);
|
|
344
|
+
}
|
|
338
345
|
}
|
|
339
346
|
let identifier = /*#__NOINLINE__*/getIdentifierFromLid(this._cache, lid, resource);
|
|
340
347
|
if (identifier !== null) {
|
|
341
|
-
if (macroCondition(getGlobalConfig().WarpDrive.
|
|
342
|
-
|
|
343
|
-
|
|
348
|
+
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_IDENTIFIERS)) {
|
|
349
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_IDENTIFIERS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_IDENTIFIERS) {
|
|
350
|
+
// eslint-disable-next-line no-console
|
|
351
|
+
console.groupEnd();
|
|
352
|
+
}
|
|
344
353
|
}
|
|
345
354
|
return identifier;
|
|
346
355
|
}
|
|
347
356
|
if (shouldGenerate === 0) {
|
|
348
|
-
if (macroCondition(getGlobalConfig().WarpDrive.
|
|
349
|
-
|
|
350
|
-
|
|
357
|
+
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_IDENTIFIERS)) {
|
|
358
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_IDENTIFIERS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_IDENTIFIERS) {
|
|
359
|
+
// eslint-disable-next-line no-console
|
|
360
|
+
console.groupEnd();
|
|
361
|
+
}
|
|
351
362
|
}
|
|
352
363
|
return;
|
|
353
364
|
}
|
|
@@ -365,9 +376,11 @@ class IdentifierCache {
|
|
|
365
376
|
identifier = /*#__NOINLINE__*/makeStableRecordIdentifier(keyInfo, 'record', false);
|
|
366
377
|
}
|
|
367
378
|
addResourceToCache(this._cache, identifier);
|
|
368
|
-
if (macroCondition(getGlobalConfig().WarpDrive.
|
|
369
|
-
|
|
370
|
-
|
|
379
|
+
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_IDENTIFIERS)) {
|
|
380
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_IDENTIFIERS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_IDENTIFIERS) {
|
|
381
|
+
// eslint-disable-next-line no-console
|
|
382
|
+
console.groupEnd();
|
|
383
|
+
}
|
|
371
384
|
}
|
|
372
385
|
return identifier;
|
|
373
386
|
}
|
|
@@ -461,9 +474,11 @@ class IdentifierCache {
|
|
|
461
474
|
|
|
462
475
|
/*#__NOINLINE__*/
|
|
463
476
|
addResourceToCache(this._cache, identifier);
|
|
464
|
-
if (macroCondition(getGlobalConfig().WarpDrive.
|
|
465
|
-
|
|
466
|
-
|
|
477
|
+
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_IDENTIFIERS)) {
|
|
478
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_IDENTIFIERS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_IDENTIFIERS) {
|
|
479
|
+
// eslint-disable-next-line no-console
|
|
480
|
+
console.log(`Identifiers: created identifier ${String(identifier)} for newly generated resource`, data);
|
|
481
|
+
}
|
|
467
482
|
}
|
|
468
483
|
return identifier;
|
|
469
484
|
}
|
|
@@ -510,9 +525,11 @@ class IdentifierCache {
|
|
|
510
525
|
if (hadLid) {
|
|
511
526
|
data.lid = identifier.lid;
|
|
512
527
|
}
|
|
513
|
-
if (macroCondition(getGlobalConfig().WarpDrive.
|
|
514
|
-
|
|
515
|
-
|
|
528
|
+
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_IDENTIFIERS)) {
|
|
529
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_IDENTIFIERS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_IDENTIFIERS) {
|
|
530
|
+
// eslint-disable-next-line no-console
|
|
531
|
+
console.log(`Identifiers: merged identifiers ${generatedIdentifier.lid} and ${existingIdentifier.lid} for resource into ${identifier.lid}`, data);
|
|
532
|
+
}
|
|
516
533
|
}
|
|
517
534
|
}
|
|
518
535
|
const id = identifier.id;
|
|
@@ -522,9 +539,11 @@ class IdentifierCache {
|
|
|
522
539
|
|
|
523
540
|
// add to our own secondary lookup table
|
|
524
541
|
if (id !== newId && newId !== null) {
|
|
525
|
-
if (macroCondition(getGlobalConfig().WarpDrive.
|
|
526
|
-
|
|
527
|
-
|
|
542
|
+
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_IDENTIFIERS)) {
|
|
543
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_IDENTIFIERS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_IDENTIFIERS) {
|
|
544
|
+
// eslint-disable-next-line no-console
|
|
545
|
+
console.log(`Identifiers: updated id for identifier ${identifier.lid} from '${String(id)}' to '${String(newId)}' for resource`, data);
|
|
546
|
+
}
|
|
528
547
|
}
|
|
529
548
|
const typeSet = this._cache.resourcesByType[identifier.type];
|
|
530
549
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
@@ -536,9 +555,11 @@ class IdentifierCache {
|
|
|
536
555
|
if (id !== null) {
|
|
537
556
|
typeSet.id.delete(id);
|
|
538
557
|
}
|
|
539
|
-
} else if (macroCondition(getGlobalConfig().WarpDrive.
|
|
540
|
-
|
|
541
|
-
|
|
558
|
+
} else if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_IDENTIFIERS)) {
|
|
559
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_IDENTIFIERS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_IDENTIFIERS) {
|
|
560
|
+
// eslint-disable-next-line no-console
|
|
561
|
+
console.log(`Identifiers: updated identifier ${identifier.lid} resource`, data);
|
|
562
|
+
}
|
|
542
563
|
}
|
|
543
564
|
return identifier;
|
|
544
565
|
}
|
|
@@ -621,9 +642,11 @@ class IdentifierCache {
|
|
|
621
642
|
}
|
|
622
643
|
identifier[CACHE_OWNER] = undefined;
|
|
623
644
|
this._forget(identifier, 'record');
|
|
624
|
-
if (macroCondition(getGlobalConfig().WarpDrive.
|
|
625
|
-
|
|
626
|
-
|
|
645
|
+
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_IDENTIFIERS)) {
|
|
646
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_IDENTIFIERS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_IDENTIFIERS) {
|
|
647
|
+
// eslint-disable-next-line no-console
|
|
648
|
+
console.log(`Identifiers: released identifier ${identifierObject.lid}`);
|
|
649
|
+
}
|
|
627
650
|
}
|
|
628
651
|
}
|
|
629
652
|
destroy() {
|
|
@@ -771,9 +794,11 @@ function detectMerge(cache, keyInfo, identifier, data) {
|
|
|
771
794
|
}
|
|
772
795
|
function getIdentifierFromLid(cache, lid, resource) {
|
|
773
796
|
const identifier = cache.resources.get(lid);
|
|
774
|
-
if (macroCondition(getGlobalConfig().WarpDrive.
|
|
775
|
-
|
|
776
|
-
|
|
797
|
+
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_IDENTIFIERS)) {
|
|
798
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_IDENTIFIERS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_IDENTIFIERS) {
|
|
799
|
+
// eslint-disable-next-line no-console
|
|
800
|
+
console.log(`Identifiers: cache ${identifier ? 'HIT' : 'MISS'} - Non-Stable ${lid}`, resource);
|
|
801
|
+
}
|
|
777
802
|
}
|
|
778
803
|
return identifier || null;
|
|
779
804
|
}
|
|
@@ -1329,14 +1354,16 @@ class InstanceCache {
|
|
|
1329
1354
|
setCacheFor(record, cache);
|
|
1330
1355
|
StoreMap.set(record, this.store);
|
|
1331
1356
|
this.__instances.record.set(identifier, record);
|
|
1332
|
-
if (macroCondition(getGlobalConfig().WarpDrive.
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1357
|
+
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_INSTANCE_CACHE)) {
|
|
1358
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_INSTANCE_CACHE || globalThis.getWarpDriveRuntimeConfig().debug.LOG_INSTANCE_CACHE) {
|
|
1359
|
+
logGroup('reactive-ui', '', identifier.type, identifier.lid, 'created', '');
|
|
1360
|
+
// eslint-disable-next-line no-console
|
|
1361
|
+
console.log({
|
|
1362
|
+
properties
|
|
1363
|
+
});
|
|
1364
|
+
// eslint-disable-next-line no-console
|
|
1365
|
+
console.groupEnd();
|
|
1366
|
+
}
|
|
1340
1367
|
}
|
|
1341
1368
|
}
|
|
1342
1369
|
return record;
|
|
@@ -1382,8 +1409,10 @@ class InstanceCache {
|
|
|
1382
1409
|
this.store.identifierCache.forgetRecordIdentifier(identifier);
|
|
1383
1410
|
removeRecordDataFor(identifier);
|
|
1384
1411
|
this.store._requestCache._clearEntries(identifier);
|
|
1385
|
-
if (macroCondition(getGlobalConfig().WarpDrive.
|
|
1386
|
-
|
|
1412
|
+
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_INSTANCE_CACHE)) {
|
|
1413
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_INSTANCE_CACHE || globalThis.getWarpDriveRuntimeConfig().debug.LOG_INSTANCE_CACHE) {
|
|
1414
|
+
log('reactive-ui', '', identifier.type, identifier.lid, 'disconnected', '');
|
|
1415
|
+
}
|
|
1387
1416
|
}
|
|
1388
1417
|
}
|
|
1389
1418
|
unloadRecord(identifier) {
|
|
@@ -1399,9 +1428,11 @@ class InstanceCache {
|
|
|
1399
1428
|
})() : {};
|
|
1400
1429
|
}
|
|
1401
1430
|
}
|
|
1402
|
-
if (macroCondition(getGlobalConfig().WarpDrive.
|
|
1403
|
-
|
|
1404
|
-
|
|
1431
|
+
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_INSTANCE_CACHE)) {
|
|
1432
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_INSTANCE_CACHE || globalThis.getWarpDriveRuntimeConfig().debug.LOG_INSTANCE_CACHE) {
|
|
1433
|
+
// eslint-disable-next-line no-console
|
|
1434
|
+
console.groupCollapsed(`InstanceCache: unloading record for ${String(identifier)}`);
|
|
1435
|
+
}
|
|
1405
1436
|
}
|
|
1406
1437
|
|
|
1407
1438
|
// TODO is this join still necessary?
|
|
@@ -1414,27 +1445,33 @@ class InstanceCache {
|
|
|
1414
1445
|
StoreMap.delete(record);
|
|
1415
1446
|
RecordCache.delete(record);
|
|
1416
1447
|
removeRecordDataFor(record);
|
|
1417
|
-
if (macroCondition(getGlobalConfig().WarpDrive.
|
|
1418
|
-
|
|
1419
|
-
|
|
1448
|
+
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_INSTANCE_CACHE)) {
|
|
1449
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_INSTANCE_CACHE || globalThis.getWarpDriveRuntimeConfig().debug.LOG_INSTANCE_CACHE) {
|
|
1450
|
+
// eslint-disable-next-line no-console
|
|
1451
|
+
console.log(`InstanceCache: destroyed record for ${String(identifier)}`);
|
|
1452
|
+
}
|
|
1420
1453
|
}
|
|
1421
1454
|
}
|
|
1422
1455
|
if (cache) {
|
|
1423
1456
|
cache.unloadRecord(identifier);
|
|
1424
1457
|
removeRecordDataFor(identifier);
|
|
1425
|
-
if (macroCondition(getGlobalConfig().WarpDrive.
|
|
1426
|
-
|
|
1427
|
-
|
|
1458
|
+
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_INSTANCE_CACHE)) {
|
|
1459
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_INSTANCE_CACHE || globalThis.getWarpDriveRuntimeConfig().debug.LOG_INSTANCE_CACHE) {
|
|
1460
|
+
// eslint-disable-next-line no-console
|
|
1461
|
+
console.log(`InstanceCache: destroyed cache for ${String(identifier)}`);
|
|
1462
|
+
}
|
|
1428
1463
|
}
|
|
1429
1464
|
} else {
|
|
1430
1465
|
this.disconnect(identifier);
|
|
1431
1466
|
}
|
|
1432
1467
|
this.store._requestCache._clearEntries(identifier);
|
|
1433
|
-
if (macroCondition(getGlobalConfig().WarpDrive.
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1468
|
+
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_INSTANCE_CACHE)) {
|
|
1469
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_INSTANCE_CACHE || globalThis.getWarpDriveRuntimeConfig().debug.LOG_INSTANCE_CACHE) {
|
|
1470
|
+
// eslint-disable-next-line no-console
|
|
1471
|
+
console.log(`InstanceCache: unloaded RecordData for ${String(identifier)}`);
|
|
1472
|
+
// eslint-disable-next-line no-console
|
|
1473
|
+
console.groupEnd();
|
|
1474
|
+
}
|
|
1438
1475
|
}
|
|
1439
1476
|
});
|
|
1440
1477
|
}
|
|
@@ -1489,9 +1526,11 @@ class InstanceCache {
|
|
|
1489
1526
|
warn(`Your ${type} record was saved to the server, but the response does not have an id.`, !(oldId !== null && id === null));
|
|
1490
1527
|
return;
|
|
1491
1528
|
}
|
|
1492
|
-
if (macroCondition(getGlobalConfig().WarpDrive.
|
|
1493
|
-
|
|
1494
|
-
|
|
1529
|
+
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_INSTANCE_CACHE)) {
|
|
1530
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_INSTANCE_CACHE || globalThis.getWarpDriveRuntimeConfig().debug.LOG_INSTANCE_CACHE) {
|
|
1531
|
+
// eslint-disable-next-line no-console
|
|
1532
|
+
console.log(`InstanceCache: updating id to '${id}' for record ${String(identifier)}`);
|
|
1533
|
+
}
|
|
1495
1534
|
}
|
|
1496
1535
|
const existingIdentifier = this.store.identifierCache.peekRecordIdentifier({
|
|
1497
1536
|
type,
|
|
@@ -2254,14 +2293,16 @@ function count(label) {
|
|
|
2254
2293
|
globalThis.counts = globalThis.counts || {};
|
|
2255
2294
|
// @ts-expect-error
|
|
2256
2295
|
// eslint-disable-next-line
|
|
2257
|
-
|
|
2296
|
+
globalThis.counts[label] = (globalThis.counts[label] || 0) + 1;
|
|
2258
2297
|
}
|
|
2259
2298
|
function _unsubscribe(tokens, token, cache) {
|
|
2260
2299
|
const identifier = tokens.get(token);
|
|
2261
|
-
if (macroCondition(getGlobalConfig().WarpDrive.
|
|
2262
|
-
if (
|
|
2263
|
-
|
|
2264
|
-
|
|
2300
|
+
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_NOTIFICATIONS)) {
|
|
2301
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_NOTIFICATIONS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_NOTIFICATIONS) {
|
|
2302
|
+
if (!identifier) {
|
|
2303
|
+
// eslint-disable-next-line no-console
|
|
2304
|
+
console.log('Passed unknown unsubscribe token to unsubscribe', identifier);
|
|
2305
|
+
}
|
|
2265
2306
|
}
|
|
2266
2307
|
}
|
|
2267
2308
|
if (identifier) {
|
|
@@ -2369,9 +2410,11 @@ class NotificationManager {
|
|
|
2369
2410
|
}
|
|
2370
2411
|
})(!key || value === 'attributes' || value === 'relationships') : {};
|
|
2371
2412
|
if (!isStableIdentifier(identifier) && !isDocumentIdentifier(identifier)) {
|
|
2372
|
-
if (macroCondition(getGlobalConfig().WarpDrive.
|
|
2373
|
-
|
|
2374
|
-
|
|
2413
|
+
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_NOTIFICATIONS)) {
|
|
2414
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_NOTIFICATIONS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_NOTIFICATIONS) {
|
|
2415
|
+
// eslint-disable-next-line no-console
|
|
2416
|
+
console.log(`Notifying: Expected to receive a stable Identifier to notify '${value}' '${key || ''}' with, but ${String(identifier)} is not in the cache`, identifier);
|
|
2417
|
+
}
|
|
2375
2418
|
}
|
|
2376
2419
|
return false;
|
|
2377
2420
|
}
|
|
@@ -2383,16 +2426,22 @@ class NotificationManager {
|
|
|
2383
2426
|
this._buffered.set(identifier, buffer);
|
|
2384
2427
|
}
|
|
2385
2428
|
buffer.push([value, key]);
|
|
2386
|
-
if (macroCondition(getGlobalConfig().WarpDrive.
|
|
2387
|
-
|
|
2429
|
+
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_METRIC_COUNTS)) {
|
|
2430
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_METRIC_COUNTS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_METRIC_COUNTS) {
|
|
2431
|
+
count(`notify ${'type' in identifier ? identifier.type : '<document>'} ${value} ${key}`);
|
|
2432
|
+
}
|
|
2388
2433
|
}
|
|
2389
2434
|
if (!this._scheduleNotify()) {
|
|
2390
|
-
if (macroCondition(getGlobalConfig().WarpDrive.
|
|
2391
|
-
|
|
2435
|
+
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_NOTIFICATIONS)) {
|
|
2436
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_NOTIFICATIONS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_NOTIFICATIONS) {
|
|
2437
|
+
log('notify', 'buffered', `${'type' in identifier ? identifier.type : 'document'}`, identifier.lid, `${value}`, key || '');
|
|
2438
|
+
}
|
|
2392
2439
|
}
|
|
2393
2440
|
}
|
|
2394
|
-
} else if (macroCondition(getGlobalConfig().WarpDrive.
|
|
2395
|
-
|
|
2441
|
+
} else if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_METRIC_COUNTS)) {
|
|
2442
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_METRIC_COUNTS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_METRIC_COUNTS) {
|
|
2443
|
+
count(`DISCARDED notify ${'type' in identifier ? identifier.type : '<document>'} ${value} ${key}`);
|
|
2444
|
+
}
|
|
2396
2445
|
}
|
|
2397
2446
|
return hasSubscribers;
|
|
2398
2447
|
}
|
|
@@ -2429,8 +2478,10 @@ class NotificationManager {
|
|
|
2429
2478
|
this._onFlushCB = undefined;
|
|
2430
2479
|
}
|
|
2431
2480
|
_flushNotification(identifier, value, key) {
|
|
2432
|
-
if (macroCondition(getGlobalConfig().WarpDrive.
|
|
2433
|
-
|
|
2481
|
+
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_NOTIFICATIONS)) {
|
|
2482
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_NOTIFICATIONS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_NOTIFICATIONS) {
|
|
2483
|
+
log('notify', '', `${'type' in identifier ? identifier.type : 'document'}`, identifier.lid, `${value}`, key || '');
|
|
2484
|
+
}
|
|
2434
2485
|
}
|
|
2435
2486
|
|
|
2436
2487
|
// TODO for documents this will need to switch based on Identifier kind
|
|
@@ -3589,6 +3640,12 @@ function constructResource(type, id, lid) {
|
|
|
3589
3640
|
*/
|
|
3590
3641
|
// this import location is deprecated but breaks in 4.8 and older
|
|
3591
3642
|
|
|
3643
|
+
// @ts-expect-error adding to globalThis
|
|
3644
|
+
globalThis.setWarpDriveLogging = setLogging;
|
|
3645
|
+
|
|
3646
|
+
// @ts-expect-error adding to globalThis
|
|
3647
|
+
globalThis.getWarpDriveRuntimeConfig = getRuntimeConfig;
|
|
3648
|
+
|
|
3592
3649
|
// `AwaitedKeys` is needed here to resolve any promise types like `PromiseBelongsTo`.
|
|
3593
3650
|
|
|
3594
3651
|
/**
|
|
@@ -3971,22 +4028,26 @@ class Store extends BaseClass {
|
|
|
3971
4028
|
opts.disableTestWaiter = typeof requestConfig.disableTestWaiter === 'boolean' ? requestConfig.disableTestWaiter : true;
|
|
3972
4029
|
}
|
|
3973
4030
|
}
|
|
3974
|
-
if (macroCondition(getGlobalConfig().WarpDrive.
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
4031
|
+
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_REQUESTS)) {
|
|
4032
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_REQUESTS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_REQUESTS) {
|
|
4033
|
+
let options;
|
|
4034
|
+
try {
|
|
4035
|
+
options = JSON.parse(JSON.stringify(requestConfig));
|
|
4036
|
+
} catch {
|
|
4037
|
+
options = requestConfig;
|
|
4038
|
+
}
|
|
4039
|
+
// eslint-disable-next-line no-console
|
|
4040
|
+
console.log(`request: [[START]] ${requestConfig.op && !requestConfig.url ? '(LEGACY) ' : ''}${requestConfig.op || '<unknown operation>'} ${requestConfig.url || '<empty url>'} ${requestConfig.method || '<empty method>'}`, options);
|
|
3980
4041
|
}
|
|
3981
|
-
// eslint-disable-next-line no-console
|
|
3982
|
-
console.log(`request: [[START]] ${requestConfig.op && !requestConfig.url ? '(LEGACY) ' : ''}${requestConfig.op || '<unknown operation>'} ${requestConfig.url || '<empty url>'} ${requestConfig.method || '<empty method>'}`, options);
|
|
3983
4042
|
}
|
|
3984
4043
|
const request = Object.assign({}, requestConfig, opts);
|
|
3985
4044
|
const future = this.requestManager.request(request);
|
|
3986
4045
|
future.onFinalize(() => {
|
|
3987
|
-
if (macroCondition(getGlobalConfig().WarpDrive.
|
|
3988
|
-
|
|
3989
|
-
|
|
4046
|
+
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_REQUESTS)) {
|
|
4047
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_REQUESTS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_REQUESTS) {
|
|
4048
|
+
// eslint-disable-next-line no-console
|
|
4049
|
+
console.log(`request: [[FINALIZE]] ${requestConfig.op && !requestConfig.url ? '(LEGACY) ' : ''}${requestConfig.op || '<unknown operation>'} ${requestConfig.url || '<empty url>'} ${requestConfig.method || '<empty method>'}`);
|
|
4050
|
+
}
|
|
3990
4051
|
}
|
|
3991
4052
|
// skip flush for legacy belongsTo
|
|
3992
4053
|
if (requestConfig.op === 'findBelongsTo' && !requestConfig.url) {
|
|
@@ -5246,14 +5307,16 @@ class Store extends BaseClass {
|
|
|
5246
5307
|
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
5247
5308
|
assertDestroyingStore(this, '_push');
|
|
5248
5309
|
}
|
|
5249
|
-
if (macroCondition(getGlobalConfig().WarpDrive.
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5310
|
+
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_PAYLOADS)) {
|
|
5311
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_PAYLOADS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_PAYLOADS) {
|
|
5312
|
+
try {
|
|
5313
|
+
const data = JSON.parse(JSON.stringify(jsonApiDoc));
|
|
5314
|
+
// eslint-disable-next-line no-console
|
|
5315
|
+
console.log('EmberData | Payload - push', data);
|
|
5316
|
+
} catch {
|
|
5317
|
+
// eslint-disable-next-line no-console
|
|
5318
|
+
console.log('EmberData | Payload - push', jsonApiDoc);
|
|
5319
|
+
}
|
|
5257
5320
|
}
|
|
5258
5321
|
}
|
|
5259
5322
|
if (asyncFlush) {
|