@warp-drive/core 5.7.0-alpha.30 → 5.7.0-alpha.31

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.
@@ -1,6 +1,7 @@
1
1
  export declare function logGroup(scope: "cache", prefix: string, type: string, lid: string, bucket: string, key: string): void;
2
2
  export declare function logGroup(scope: "reactive-ui", prefix: string, type: string, lid: string, bucket: string, key: ""): void;
3
3
  export declare function logGroup(scope: "notify", prefix: string, type: string, lid: string, bucket: string, key: string): void;
4
+ export declare function log(scope: "request", prefix: string, type: string, lid: string, bucket: string, key: string): void;
4
5
  export declare function log(scope: "cache", prefix: string, type: string, lid: string, bucket: string, key: string): void;
5
6
  export declare function log(scope: "reactive-ui", prefix: string, type: string, lid: string, bucket: string, key: ""): void;
6
7
  export declare function log(scope: "notify", prefix: string, type: string, lid: string, bucket: string, key: string): void;
@@ -147,6 +147,8 @@ export declare function initializeSignalStore<T extends object>(obj: T): asserts
147
147
  };
148
148
  export declare function createInternalSignal(signals: SignalStore, obj: object, key: string | symbol, initialValue: unknown): WarpDriveSignal;
149
149
  export declare function getOrCreateInternalSignal(signals: SignalStore, obj: object, key: string | symbol, initialValue: unknown): WarpDriveSignal;
150
+ export declare function createInternalMemo<T>(signals: SignalStore, object: object, key: string | symbol, fn: () => T): () => T;
151
+ export declare function consumeInternalMemo<T>(fn: () => T): T;
150
152
  export declare function peekInternalSignal(signals: SignalStore | undefined, key: string | symbol): WarpDriveSignal | undefined;
151
153
  export declare function consumeInternalSignal(signal: WarpDriveSignal): void;
152
154
  export declare function notifyInternalSignal(signal: WarpDriveSignal | undefined): void;
@@ -7,6 +7,7 @@ import type { SignalStore, WarpDriveSignal } from "./internal.js";
7
7
  * @private
8
8
  */
9
9
  export declare function entangleSignal<T extends object>(signals: SignalStore, obj: T, key: string | symbol, initialValue: unknown): WarpDriveSignal;
10
+ export declare function entangleInitiallyStaleSignal<T extends object>(signals: SignalStore, obj: T, key: string | symbol, initialValue: unknown): WarpDriveSignal;
10
11
  export declare function createSignalDescriptor(key: string | symbol, intialValue: unknown): PropertyDescriptor;
11
12
  /**
12
13
  * define an enumerable signal property.
@@ -3,11 +3,6 @@ import type { Future } from "../../../request.js";
3
3
  import type { StructuredErrorDocument } from "../../../types/request.js";
4
4
  import type { RequestState } from "../../-private.js";
5
5
  export declare const DISPOSE: "(symbol) dispose";
6
- export interface ErrorFeatures {
7
- isHidden: boolean;
8
- isOnline: boolean;
9
- retry: () => Promise<void>;
10
- }
11
6
  export type AutorefreshBehaviorType = "online" | "interval" | "invalid";
12
7
  export type AutorefreshBehaviorCombos = boolean | AutorefreshBehaviorType | `${AutorefreshBehaviorType},${AutorefreshBehaviorType}` | `${AutorefreshBehaviorType},${AutorefreshBehaviorType},${AutorefreshBehaviorType}`;
13
8
  /**
@@ -18,6 +13,8 @@ export interface RecoveryFeatures {
18
13
  isHidden: boolean;
19
14
  retry: () => Promise<void>;
20
15
  }
16
+ /** @deprecated use {@link RecoveryFeatures} */
17
+ export type ErrorFeatures = RecoveryFeatures;
21
18
  /**
22
19
  * Utilities for keeping the request fresh
23
20
  */
@@ -177,7 +174,7 @@ export declare class RequestSubscription<
177
174
  /**
178
175
  * features to yield to the error slot of a component
179
176
  */
180
- get errorFeatures(): ErrorFeatures;
177
+ get errorFeatures(): RecoveryFeatures;
181
178
  /**
182
179
  * features to yield to the content slot of a component
183
180
  */
@@ -30,6 +30,6 @@ export { log, logGroup } from "./-private/debug/utils.js";
30
30
  export { getPromiseState, type PromiseState } from "./-private/new-core-tmp/promise-state.js";
31
31
  export { DISPOSE, createRequestSubscription, type RequestArgs, type SubscriptionArgs, type RequestComponentArgs, type RequestSubscription, type ContentFeatures, type RecoveryFeatures, type AutorefreshBehaviorCombos, type AutorefreshBehaviorType } from "./-private/new-core-tmp/request-subscription.js";
32
32
  export { getRequestState, type RequestLoadingState, type RequestCacheRequestState as RequestState } from "./-private/new-core-tmp/request-state.js";
33
- export { createMemo, type SignalHooks, waitFor } from "./-private/new-core-tmp/reactivity/configure.js";
34
- export { signal, memoized, gate, entangleSignal, defineSignal, defineGate, defineNonEnumerableSignal } from "./-private/new-core-tmp/reactivity/signal.js";
35
- export { ARRAY_SIGNAL, OBJECT_SIGNAL, Signals, type WarpDriveSignal, peekInternalSignal, withSignalStore, notifyInternalSignal, consumeInternalSignal, getOrCreateInternalSignal } from "./-private/new-core-tmp/reactivity/internal.js";
33
+ export { type SignalHooks, waitFor } from "./-private/new-core-tmp/reactivity/configure.js";
34
+ export { signal, memoized, gate, entangleSignal, entangleInitiallyStaleSignal, defineSignal, defineGate, defineNonEnumerableSignal } from "./-private/new-core-tmp/reactivity/signal.js";
35
+ export { ARRAY_SIGNAL, OBJECT_SIGNAL, Signals, type WarpDriveSignal, peekInternalSignal, createInternalMemo, withSignalStore, notifyInternalSignal, consumeInternalSignal, getOrCreateInternalSignal } from "./-private/new-core-tmp/reactivity/internal.js";
@@ -178,4 +178,4 @@ function waitFor(promise) {
178
178
  }
179
179
  return promise;
180
180
  }
181
- export { ARRAY_SIGNAL as A, OBJECT_SIGNAL as O, createSignal as a, consumeSignal as b, createMemo as c, willSyncFlushWatchers as d, notifySignal as n, setupSignals as s, waitFor as w };
181
+ export { ARRAY_SIGNAL as A, OBJECT_SIGNAL as O, consumeSignal as a, createMemo as b, createSignal as c, willSyncFlushWatchers as d, notifySignal as n, setupSignals as s, waitFor as w };
package/dist/configure.js CHANGED
@@ -1 +1 @@
1
- export { s as setupSignals } from "./configure-CiFDHArV.js";
1
+ export { s as setupSignals } from "./configure-C3x8YXzL.js";
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { setLogging, getRuntimeConfig } from './types/runtime.js';
2
2
  import { a as cloneResponseProperties, I as IS_CACHE_HANDLER, b as assertValidRequest, e as executeNextHandler, d as getRequestResult, u as upgradePromise, s as setPromiseResult, f as clearRequestResult } from "./context-Bh-MA_tH.js";
3
3
  import { macroCondition, getGlobalConfig } from '@embroider/macros';
4
- import { w as waitFor } from "./configure-CiFDHArV.js";
4
+ import { w as waitFor } from "./configure-C3x8YXzL.js";
5
5
  import { peekUniversalTransient, setUniversalTransient } from './types/-private.js';
6
6
  import { EnableHydration } from './types/request.js';
7
- export { C as CacheHandler, S as Store, r as recordIdentifierFor, Q as setIdentifierForgetMethod, O as setIdentifierGenerationMethod, T as setIdentifierResetMethod, P as setIdentifierUpdateMethod, U as setKeyInfoForResource, s as storeFor } from "./request-state-B908BvPK.js";
7
+ export { C as CacheHandler, S as Store, r as recordIdentifierFor, U as setIdentifierForgetMethod, Q as setIdentifierGenerationMethod, V as setIdentifierResetMethod, T as setIdentifierUpdateMethod, W as setKeyInfoForResource, s as storeFor } from "./request-state-DGyt5EV8.js";
8
8
  import '@ember/debug';
9
9
  import './utils/string.js';
10
10
  import "./symbols-sql1_mdx.js";
package/dist/reactive.js CHANGED
@@ -1,5 +1,5 @@
1
- import { J as ReactiveResource, K as isNonIdentityCacheableField, L as getFieldCacheKeyStrict, r as recordIdentifierFor, F as withSignalStore } from "./request-state-B908BvPK.js";
2
- export { M as checkout, N as commit } from "./request-state-B908BvPK.js";
1
+ import { L as ReactiveResource, M as isNonIdentityCacheableField, N as getFieldCacheKeyStrict, r as recordIdentifierFor, H as withSignalStore, G as createInternalMemo } from "./request-state-DGyt5EV8.js";
2
+ export { O as checkout, P as commit } from "./request-state-DGyt5EV8.js";
3
3
  import { isResourceSchema } from './types/schema/fields.js';
4
4
  import { D as Destroy, C as Context } from "./symbols-sql1_mdx.js";
5
5
  export { a as Checkout } from "./symbols-sql1_mdx.js";
@@ -8,7 +8,7 @@ import { warn, deprecate } from '@ember/debug';
8
8
  import './index.js';
9
9
  import './types/request.js';
10
10
  import './utils/string.js';
11
- import { c as createMemo } from "./configure-CiFDHArV.js";
11
+ import "./configure-C3x8YXzL.js";
12
12
  import { getOrSetGlobal } from './types/-private.js';
13
13
  import { Type } from './types/symbols.js';
14
14
  function instantiateRecord(store, identifier, createArgs) {
@@ -311,10 +311,9 @@ function makeCachedDerivation(derivation) {
311
311
  const signals = withSignalStore(record);
312
312
  let signal = signals.get(prop);
313
313
  if (!signal) {
314
- signal = createMemo(record, prop, () => {
314
+ signal = createInternalMemo(signals, record, prop, () => {
315
315
  return derivation(record, options, prop);
316
316
  }); // a total lie, for convenience of reusing the storage
317
- signals.set(prop, signal);
318
317
  }
319
318
  return signal();
320
319
  };
@@ -6,7 +6,7 @@ import { getOrSetGlobal, peekTransient, setTransient } from './types/-private.js
6
6
  import { CACHE_OWNER, DEBUG_STALE_CACHE_OWNER, DEBUG_KEY_TYPE, DEBUG_CLIENT_ORIGINATED } from './types/identifier.js';
7
7
  import { dasherize } from './utils/string.js';
8
8
  import { S as SOURCE, C as Context, D as Destroy, a as Checkout, b as Commit } from "./symbols-sql1_mdx.js";
9
- import { a as createSignal, b as consumeSignal, n as notifySignal, c as createMemo, A as ARRAY_SIGNAL, O as OBJECT_SIGNAL, d as willSyncFlushWatchers } from "./configure-CiFDHArV.js";
9
+ import { c as createSignal, a as consumeSignal, n as notifySignal, b as createMemo, A as ARRAY_SIGNAL, O as OBJECT_SIGNAL, d as willSyncFlushWatchers } from "./configure-C3x8YXzL.js";
10
10
  import { g as getPromiseResult, s as setPromiseResult } from "./context-Bh-MA_tH.js";
11
11
  import { RecordStore } from './types/symbols.js';
12
12
  const INITIALIZER_PROTO = {
@@ -121,10 +121,25 @@ function getOrCreateInternalSignal(signals, obj, key, initialValue) {
121
121
  }
122
122
  return signal;
123
123
  }
124
+ function createInternalMemo(signals, object, key, fn) {
125
+ macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
126
+ if (!test) {
127
+ throw new Error(`Expected no signal/memo to exist for key "${String(key)}"`);
128
+ }
129
+ })(!peekInternalSignal(signals, key)) : {};
130
+ if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
131
+ return withFrame(signals, object, key, fn);
132
+ } else {
133
+ const memo = createMemo(object, key, fn);
134
+ signals.set(key, memo);
135
+ return memo;
136
+ }
137
+ }
124
138
  function peekInternalSignal(signals, key) {
125
139
  return signals?.get(key);
126
140
  }
127
141
  function consumeInternalSignal(signal) {
142
+ TrackingFrame?.signals.add(signal);
128
143
  consumeSignal(signal.signal);
129
144
  }
130
145
  function notifyInternalSignal(signal) {
@@ -133,6 +148,164 @@ function notifyInternalSignal(signal) {
133
148
  notifySignal(signal.signal);
134
149
  }
135
150
  }
151
+ let TrackingFrame = null;
152
+
153
+ /**
154
+ * This is currently just for signals debugging, but it could be used in production
155
+ * if we wanted to eliminate the need for frameworks to implement createMemo / to
156
+ * allow us to add our own Watcher.
157
+ *
158
+ * @internal
159
+ */
160
+ function withFrame(signals, object, key, fn) {
161
+ const frameSignals = new Set();
162
+ const frameFn = () => {
163
+ if (frameSignals.size) {
164
+ frameSignals.clear();
165
+ }
166
+ TrackingFrame = {
167
+ object,
168
+ key,
169
+ signals: frameSignals,
170
+ parent: TrackingFrame
171
+ };
172
+ try {
173
+ return fn();
174
+ } finally {
175
+ TrackingFrame = TrackingFrame.parent;
176
+ }
177
+ };
178
+ const memo = createMemo(object, key, frameFn);
179
+ // @ts-expect-error
180
+ memo.signals = frameSignals;
181
+ signals.set(key, memo);
182
+ return memo;
183
+ }
184
+ function isMemo(obj) {
185
+ // @ts-expect-error
186
+ return typeof obj === 'function' && obj.signals instanceof Set;
187
+ }
188
+ if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
189
+ // @ts-expect-error adding to global API
190
+ globalThis.debugWarpDriveSignals = (obj, key) => {
191
+ const signals = obj[Signals];
192
+ if (!signals) {
193
+ log$1('The object has no associated signals');
194
+ return false;
195
+ }
196
+ if (key) {
197
+ const signal = signals.get(key);
198
+ if (!signal) {
199
+ log$1(`No signal found for key "${String(key)}"`);
200
+ return false;
201
+ }
202
+ log$1(signal);
203
+ if (isMemo(signal)) {
204
+ colorizeLines(printMemo(signal, key));
205
+ return true;
206
+ } else {
207
+ colorizeLines(printSignal(signal, key));
208
+ return true;
209
+ }
210
+ }
211
+ const lines = [];
212
+ for (const [k, signal] of signals) {
213
+ if (isMemo(signal)) continue;
214
+ printSignal(signal, k, lines);
215
+ }
216
+ for (const [k, signal] of signals) {
217
+ if (isMemo(signal)) {
218
+ printMemo(signal, k, lines);
219
+ }
220
+ }
221
+ log$1(signals);
222
+ colorizeLines(lines);
223
+ return true;
224
+ };
225
+ }
226
+ const LightColors = {
227
+ red: 'color: red;',
228
+ green: 'color: green;',
229
+ reset: 'color: inherit;'
230
+ };
231
+ const DarkColors = {
232
+ red: 'color: red;',
233
+ green: 'color: lightgreen;',
234
+ reset: 'color: inherit;'
235
+ };
236
+ function isLightMode$1() {
237
+ if (window?.matchMedia?.('(prefers-color-scheme: light)').matches) {
238
+ return true;
239
+ }
240
+ return false;
241
+ }
242
+ const RED = {};
243
+ const GREEN = {};
244
+ const RESET = {};
245
+ const EOL = {};
246
+ function colorizeLines(lines) {
247
+ const Colors = isLightMode$1() ? LightColors : DarkColors;
248
+ const colors = [];
249
+ let line = '';
250
+ for (const str of lines) {
251
+ if (str === RED) {
252
+ colors.push(Colors.red);
253
+ line += '%c';
254
+ } else if (str === GREEN) {
255
+ colors.push(Colors.green);
256
+ line += '%c';
257
+ } else if (str === RESET) {
258
+ colors.push(Colors.reset);
259
+ line += '%c';
260
+ } else if (str === EOL) {
261
+ line += '\n';
262
+ } else {
263
+ line += str;
264
+ }
265
+ }
266
+ log$1(line, ...colors);
267
+ }
268
+ function log$1(...args) {
269
+ // eslint-disable-next-line no-console
270
+ console.log(...args);
271
+ }
272
+ function isDirty(signal) {
273
+ return signal.isStale;
274
+ }
275
+ function isDirtyMemo(memo) {
276
+ // iterate simple signals first to get fastest answer
277
+ for (const signal of memo.signals) {
278
+ if (isMemo(signal)) continue;
279
+ if (isDirty(signal)) {
280
+ return true;
281
+ }
282
+ }
283
+ for (const signal of memo.signals) {
284
+ if (isMemo(signal)) {
285
+ return isDirtyMemo(signal);
286
+ }
287
+ }
288
+ return false;
289
+ }
290
+ function printSignal(signal, key, lines = [], depth = 0) {
291
+ const _dirty = isDirty(signal);
292
+ lines.push(`${''.padStart(depth * 2, ' ')}${_dirty ? '❌' : '✅'} `, _dirty ? RED : GREEN, `${String(key)}`, RESET, EOL);
293
+ return lines;
294
+ }
295
+ function printMemo(memo, key, lines = [], depth = 0) {
296
+ const _dirty = isDirtyMemo(memo);
297
+ lines.push(`${''.padStart(depth * 2, ' ')}${_dirty ? '❌' : '✅'} `, _dirty ? RED : GREEN, `<memo> ${String(key)}`, RESET, `: (consumes ${memo.signals.size} signals)`, EOL);
298
+ for (const signal of memo.signals) {
299
+ if (isMemo(signal)) continue;
300
+ printSignal(signal, signal.key, lines, depth + 1);
301
+ }
302
+ for (const signal of memo.signals) {
303
+ if (isMemo(signal)) {
304
+ printMemo(signal, signal.key, lines, depth + 1);
305
+ }
306
+ }
307
+ return lines;
308
+ }
136
309
  function entangleSignal(signals, obj, key, initialValue) {
137
310
  let internalSignal = peekInternalSignal(signals, key);
138
311
  if (!internalSignal) {
@@ -141,13 +314,24 @@ function entangleSignal(signals, obj, key, initialValue) {
141
314
  consumeInternalSignal(internalSignal);
142
315
  return internalSignal;
143
316
  }
317
+ function entangleInitiallyStaleSignal(signals, obj, key, initialValue) {
318
+ let internalSignal = peekInternalSignal(signals, key);
319
+ if (!internalSignal) {
320
+ internalSignal = createInternalSignal(signals, obj, key, initialValue);
321
+ internalSignal.isStale = true; // mark it as stale
322
+ }
323
+ consumeInternalSignal(internalSignal);
324
+ return internalSignal;
325
+ }
144
326
  function createSignalDescriptor(key, intialValue) {
145
327
  return {
146
328
  enumerable: true,
147
329
  configurable: false,
148
330
  get() {
149
331
  const signals = withSignalStore(this);
150
- return entangleSignal(signals, this, key, intialValue).value;
332
+ const internalSignal = entangleSignal(signals, this, key, intialValue);
333
+ internalSignal.isStale = false; // reset stale state
334
+ return internalSignal.value;
151
335
  },
152
336
  set(value) {
153
337
  const signals = withSignalStore(this);
@@ -229,8 +413,7 @@ function memoized(target, key, descriptor) {
229
413
  const signals = withSignalStore(this);
230
414
  let memoSignal = signals.get(key);
231
415
  if (!memoSignal) {
232
- memoSignal = createMemo(this, key, getter.bind(this));
233
- signals.set(key, memoSignal);
416
+ memoSignal = createInternalMemo(signals, this, key, getter.bind(this));
234
417
  }
235
418
  return memoSignal();
236
419
  };
@@ -1191,7 +1374,7 @@ function setArrayField(context) {
1191
1374
  return true;
1192
1375
  }
1193
1376
  function getAttributeField(context) {
1194
- entangleSignal(context.signals, context.record, context.path.at(-1), null);
1377
+ entangleInitiallyStaleSignal(context.signals, context.record, context.path.at(-1), null);
1195
1378
  const {
1196
1379
  cache
1197
1380
  } = context.store;
@@ -1284,7 +1467,12 @@ function setDerivedField(context) {
1284
1467
  return false;
1285
1468
  }
1286
1469
  function getGenericField(context) {
1287
- entangleSignal(context.signals, context.record, context.path.at(-1), null);
1470
+ const signal = entangleInitiallyStaleSignal(context.signals, context.record, context.path.at(-1), null);
1471
+ // FIXME we should be able to cache the computation here, but some tests fail.
1472
+ // if (!signal.isStale) {
1473
+ // return signal.value;
1474
+ // }
1475
+ signal.isStale = false;
1288
1476
  const {
1289
1477
  cache,
1290
1478
  schema
@@ -1294,9 +1482,12 @@ function getGenericField(context) {
1294
1482
  field
1295
1483
  } = context;
1296
1484
  if (!field.type) {
1485
+ // signal.value = rawValue;
1297
1486
  return rawValue;
1298
1487
  }
1299
1488
  const transform = schema.transformation(field);
1489
+ // signal.value = transform.hydrate(rawValue, field.options ?? null, context.record);
1490
+ // return signal.value;
1300
1491
  return transform.hydrate(rawValue, field.options ?? null, context.record);
1301
1492
  }
1302
1493
  function setGenericField(context) {
@@ -2745,6 +2936,9 @@ function badge(isLight, color, bgColor, border) {
2745
2936
  return [`color: ${correctColor(isLight, color)}; background-color: ${correctColor(isLight, bgColor)}; padding: ${border}px ${2 * border}px; border-radius: ${border}px;`, `color: ${TEXT_COLORS.TEXT}; background-color: ${BG_COLORS.TEXT};`];
2746
2937
  }
2747
2938
  function colorForBucket(isLight, scope, bucket) {
2939
+ if (scope === 'request') {
2940
+ return bucket === 'blocking' ? badge(isLight, 'red', 'transparent', 0) : bucket === 'cached' ? badge(isLight, 'lightgreen', 'transparent', 0) : bucket === 'non-blocking' ? badge(isLight, 'orange', 'transparent', 0) : badge(isLight, 'gray', 'transparent', 0);
2941
+ }
2748
2942
  if (scope === 'notify') {
2749
2943
  return bucket === 'added' ? badge(isLight, 'lightgreen', 'transparent', 0) : bucket === 'removed' ? badge(isLight, 'red', 'transparent', 0) : badge(isLight, TEXT_COLORS[scope][2], BG_COLORS[scope][2], NOTIFY_BORDER[scope][2]);
2750
2944
  }
@@ -2779,6 +2973,7 @@ function isLightMode() {
2779
2973
  function _log(scope, prefix, subScop1, subScop2, subScop3, subScop4) {
2780
2974
  const isLight = isLightMode();
2781
2975
  switch (scope) {
2976
+ case 'request':
2782
2977
  case 'reactive-ui':
2783
2978
  case 'notify':
2784
2979
  {
@@ -8397,8 +8592,18 @@ const CacheHandler = {
8397
8592
  activeRequest.priority = {
8398
8593
  blocking: true
8399
8594
  };
8595
+ if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_REQUESTS)) {
8596
+ if (getGlobalConfig().WarpDrive.debug.LOG_REQUESTS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_REQUESTS) {
8597
+ log('request', '', 'DEDUPED', identifier.lid, 'blocking', '');
8598
+ }
8599
+ }
8400
8600
  return activeRequest.promise;
8401
8601
  }
8602
+ if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_REQUESTS)) {
8603
+ if (getGlobalConfig().WarpDrive.debug.LOG_REQUESTS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_REQUESTS) {
8604
+ log('request', '', 'ISSUED', identifier?.lid ?? context.request.url ?? context.request.op ?? '<unknown request>', 'blocking', '');
8605
+ }
8606
+ }
8402
8607
  let promise = fetchContentAndHydrate(next, context, identifier, {
8403
8608
  blocking: true
8404
8609
  });
@@ -8413,7 +8618,9 @@ const CacheHandler = {
8413
8618
  },
8414
8619
  promise
8415
8620
  });
8416
- store.notifications.notify(identifier, 'state', null);
8621
+ queueMicrotask(() => {
8622
+ store.notifications.notify(identifier, 'state', null);
8623
+ });
8417
8624
  }
8418
8625
  store.requestManager._pending.set(context.id, promise);
8419
8626
  return promise;
@@ -8435,10 +8642,26 @@ const CacheHandler = {
8435
8642
  },
8436
8643
  promise
8437
8644
  });
8438
- store.notifications.notify(identifier, 'state', null);
8645
+ queueMicrotask(() => {
8646
+ store.notifications.notify(identifier, 'state', null);
8647
+ });
8648
+ }
8649
+ if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_REQUESTS)) {
8650
+ if (getGlobalConfig().WarpDrive.debug.LOG_REQUESTS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_REQUESTS) {
8651
+ if (activeRequest && identifier) {
8652
+ log('request', '', 'DEDUPED', identifier.lid, activeRequest.priority.blocking ? 'blocking' : 'non-blocking', '');
8653
+ } else {
8654
+ log('request', '', 'ISSUED', identifier?.lid ?? context.request.url ?? context.request.op ?? '<unknown request>', 'non-blocking', '');
8655
+ }
8656
+ }
8439
8657
  }
8440
8658
  store.requestManager._pending.set(context.id, promise);
8441
8659
  }
8660
+ if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_REQUESTS)) {
8661
+ if (getGlobalConfig().WarpDrive.debug.LOG_REQUESTS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_REQUESTS) {
8662
+ log('request', '', 'CACHE-HIT', identifier?.lid ?? context.request.url ?? context.request.op ?? '<unknown request>', 'cached', '');
8663
+ }
8664
+ }
8442
8665
  macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
8443
8666
  if (!test) {
8444
8667
  throw new Error(`Expected a peeked request to be present`);
@@ -9233,6 +9456,8 @@ function isNeverString(val) {
9233
9456
  * Utilities to assist in recovering from the error.
9234
9457
  */
9235
9458
 
9459
+ /** @deprecated use {@link RecoveryFeatures} */
9460
+
9236
9461
  /**
9237
9462
  * Utilities for keeping the request fresh
9238
9463
  */
@@ -10276,4 +10501,4 @@ function getRequestState(future) {
10276
10501
  }
10277
10502
  return state;
10278
10503
  }
10279
- export { defineNonEnumerableSignal as A, Signals as B, CacheHandler as C, DISPOSE as D, peekInternalSignal as E, withSignalStore as F, notifyInternalSignal as G, consumeInternalSignal as H, getOrCreateInternalSignal as I, ReactiveResource as J, isNonIdentityCacheableField as K, getFieldCacheKeyStrict as L, checkout as M, commit as N, setIdentifierGenerationMethod as O, setIdentifierUpdateMethod as P, setIdentifierForgetMethod as Q, RecordArrayManager as R, Store as S, setIdentifierResetMethod as T, setKeyInfoForResource as U, _clearCaches as _, isRequestKey as a, coerceId as b, constructResource as c, assertPrivateStore as d, ensureStringId as e, fastPush as f, isPrivateStore as g, assertPrivateCapabilities as h, isResourceKey as i, setRecordIdentifier as j, StoreMap as k, createLegacyManyArray as l, log as m, normalizeModelName as n, logGroup as o, getPromiseState as p, createRequestSubscription as q, recordIdentifierFor as r, storeFor as s, getRequestState as t, signal as u, memoized as v, gate as w, entangleSignal as x, defineSignal as y, defineGate as z };
10504
+ export { defineGate as A, defineNonEnumerableSignal as B, CacheHandler as C, DISPOSE as D, Signals as E, peekInternalSignal as F, createInternalMemo as G, withSignalStore as H, notifyInternalSignal as I, consumeInternalSignal as J, getOrCreateInternalSignal as K, ReactiveResource as L, isNonIdentityCacheableField as M, getFieldCacheKeyStrict as N, checkout as O, commit as P, setIdentifierGenerationMethod as Q, RecordArrayManager as R, Store as S, setIdentifierUpdateMethod as T, setIdentifierForgetMethod as U, setIdentifierResetMethod as V, setKeyInfoForResource as W, _clearCaches as _, isRequestKey as a, coerceId as b, constructResource as c, assertPrivateStore as d, ensureStringId as e, fastPush as f, isPrivateStore as g, assertPrivateCapabilities as h, isResourceKey as i, setRecordIdentifier as j, StoreMap as k, createLegacyManyArray as l, log as m, normalizeModelName as n, logGroup as o, getPromiseState as p, createRequestSubscription as q, recordIdentifierFor as r, storeFor as s, getRequestState as t, signal as u, memoized as v, gate as w, entangleSignal as x, entangleInitiallyStaleSignal as y, defineSignal as z };
@@ -1,2 +1,2 @@
1
- export { C as CacheHandler, D as DISPOSE, R as RecordArrayManager, B as Signals, S as Store, k as StoreMap, _ as _clearCaches, n as _deprecatingNormalize, h as assertPrivateCapabilities, d as assertPrivateStore, b as coerceId, c as constructResource, H as consumeInternalSignal, l as createLegacyManyArray, q as createRequestSubscription, z as defineGate, A as defineNonEnumerableSignal, y as defineSignal, e as ensureStringId, x as entangleSignal, f as fastPush, w as gate, I as getOrCreateInternalSignal, p as getPromiseState, t as getRequestState, g as isPrivateStore, a as isRequestKey, i as isResourceKey, m as log, o as logGroup, v as memoized, G as notifyInternalSignal, E as peekInternalSignal, r as recordIdentifierFor, j as setRecordIdentifier, u as signal, s as storeFor, F as withSignalStore } from "../request-state-B908BvPK.js";
2
- export { A as ARRAY_SIGNAL, O as OBJECT_SIGNAL, c as createMemo, w as waitFor } from "../configure-CiFDHArV.js";
1
+ export { C as CacheHandler, D as DISPOSE, R as RecordArrayManager, E as Signals, S as Store, k as StoreMap, _ as _clearCaches, n as _deprecatingNormalize, h as assertPrivateCapabilities, d as assertPrivateStore, b as coerceId, c as constructResource, J as consumeInternalSignal, G as createInternalMemo, l as createLegacyManyArray, q as createRequestSubscription, A as defineGate, B as defineNonEnumerableSignal, z as defineSignal, e as ensureStringId, y as entangleInitiallyStaleSignal, x as entangleSignal, f as fastPush, w as gate, K as getOrCreateInternalSignal, p as getPromiseState, t as getRequestState, g as isPrivateStore, a as isRequestKey, i as isResourceKey, m as log, o as logGroup, v as memoized, I as notifyInternalSignal, F as peekInternalSignal, r as recordIdentifierFor, j as setRecordIdentifier, u as signal, s as storeFor, H as withSignalStore } from "../request-state-DGyt5EV8.js";
2
+ export { A as ARRAY_SIGNAL, O as OBJECT_SIGNAL, w as waitFor } from "../configure-C3x8YXzL.js";
@@ -1,6 +1,6 @@
1
1
  import { macroCondition, getGlobalConfig } from '@embroider/macros';
2
2
  const name = "@warp-drive/core";
3
- const version = "5.7.0-alpha.30";
3
+ const version = "5.7.0-alpha.31";
4
4
 
5
5
  // in testing mode, we utilize globals to ensure only one copy exists of
6
6
  // these maps, due to bugs in ember-auto-import
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warp-drive/core",
3
- "version": "5.7.0-alpha.30",
3
+ "version": "5.7.0-alpha.31",
4
4
  "description": "Core package for WarpDrive | All the Universal Basics",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -37,13 +37,13 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@embroider/macros": "^1.18.1",
40
- "@warp-drive/build-config": "5.7.0-alpha.30"
40
+ "@warp-drive/build-config": "5.7.0-alpha.31"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@babel/core": "^7.28.0",
44
44
  "@babel/plugin-transform-typescript": "^7.28.0",
45
45
  "@babel/preset-typescript": "^7.27.1",
46
- "@warp-drive/internal-config": "5.7.0-alpha.30",
46
+ "@warp-drive/internal-config": "5.7.0-alpha.31",
47
47
  "decorator-transforms": "^2.3.0",
48
48
  "ember-source": "~6.6.0",
49
49
  "expect-type": "^1.2.1",