@warp-drive/core 5.8.0-alpha.4 → 5.8.0-alpha.6

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/request.js CHANGED
@@ -1 +1 @@
1
- export { c as createDeferred, g as getPromiseResult, s as setPromiseResult } from "./context-C_7OLieY.js";
1
+ export { c as createDeferred, g as getPromiseResult, s as setPromiseResult } from "./future-BKkJJkj7.js";
@@ -1,2 +1,2 @@
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-CUuZzgvE.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 "../index-Cg2akouS.js";
2
2
  export { A as ARRAY_SIGNAL, O as OBJECT_SIGNAL, w as waitFor } from "../configure-C3x8YXzL.js";
package/dist/store.js CHANGED
@@ -1,533 +1 @@
1
- import { deprecate } from '@ember/debug';
2
- import { LRUCache } from './utils/string.js';
3
- import { macroCondition, getGlobalConfig } from '@embroider/macros';
4
- const NUMERIC_KEYS = new Set(['max-age', 's-maxage', 'stale-if-error', 'stale-while-revalidate']);
5
-
6
- /**
7
- * Parses a string Cache-Control header value into an object with the following structure:
8
- *
9
- * ```ts
10
- * interface CacheControlValue {
11
- * immutable?: boolean;
12
- * 'max-age'?: number;
13
- * 'must-revalidate'?: boolean;
14
- * 'must-understand'?: boolean;
15
- * 'no-cache'?: boolean;
16
- * 'no-store'?: boolean;
17
- * 'no-transform'?: boolean;
18
- * 'only-if-cached'?: boolean;
19
- * private?: boolean;
20
- * 'proxy-revalidate'?: boolean;
21
- * public?: boolean;
22
- * 's-maxage'?: number;
23
- * 'stale-if-error'?: number;
24
- * 'stale-while-revalidate'?: number;
25
- * }
26
- * ```
27
- *
28
- * @public
29
- * @param {String} header
30
- * @return {CacheControlValue}
31
- */
32
- function parseCacheControl(header) {
33
- return CACHE_CONTROL_CACHE.get(header);
34
- }
35
- const CACHE_CONTROL_CACHE = new LRUCache(header => {
36
- let key = '';
37
- let value = '';
38
- let isParsingKey = true;
39
- const cacheControlValue = {};
40
- for (let i = 0; i < header.length; i++) {
41
- const char = header.charAt(i);
42
- if (char === ',') {
43
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
44
- if (!test) {
45
- throw new Error(`Invalid Cache-Control value, expected a value`);
46
- }
47
- })(!isParsingKey || !NUMERIC_KEYS.has(key)) : {};
48
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
49
- if (!test) {
50
- throw new Error(`Invalid Cache-Control value, expected a value after "=" but got ","`);
51
- }
52
- })(i === 0 || header.charAt(i - 1) !== '=') : {};
53
- isParsingKey = true;
54
- // @ts-expect-error TS incorrectly thinks that optional keys must have a type that includes undefined
55
- cacheControlValue[key] = NUMERIC_KEYS.has(key) ? parseCacheControlValue(value) : true;
56
- key = '';
57
- value = '';
58
- continue;
59
- } else if (char === '=') {
60
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
61
- if (!test) {
62
- throw new Error(`Invalid Cache-Control value, expected a value after "="`);
63
- }
64
- })(i + 1 !== header.length) : {};
65
- isParsingKey = false;
66
- } else if (char === ' ' || char === `\t` || char === `\n`) {
67
- continue;
68
- } else if (isParsingKey) {
69
- key += char;
70
- } else {
71
- value += char;
72
- }
73
- if (i === header.length - 1) {
74
- // @ts-expect-error TS incorrectly thinks that optional keys must have a type that includes undefined
75
- cacheControlValue[key] = NUMERIC_KEYS.has(key) ? parseCacheControlValue(value) : true;
76
- }
77
- }
78
- return cacheControlValue;
79
- }, 200);
80
- function parseCacheControlValue(stringToParse) {
81
- const parsedValue = Number.parseInt(stringToParse);
82
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
83
- if (!test) {
84
- throw new Error(`Invalid Cache-Control value, expected a number but got - ${stringToParse}`);
85
- }
86
- })(!Number.isNaN(parsedValue)) : {};
87
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
88
- if (!test) {
89
- throw new Error(`Invalid Cache-Control value, expected a number greater than 0 but got - ${stringToParse}`);
90
- }
91
- })(parsedValue >= 0) : {};
92
- if (Number.isNaN(parsedValue) || parsedValue < 0) {
93
- return 0;
94
- }
95
- return parsedValue;
96
- }
97
- function isExpired(cacheKey, request, config) {
98
- const {
99
- constraints
100
- } = config;
101
- if (constraints?.isExpired) {
102
- const result = constraints.isExpired(request);
103
- if (result !== null) {
104
- if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_CACHE_POLICY)) {
105
- if (getGlobalConfig().WarpDrive.debug.LOG_CACHE_POLICY || globalThis.getWarpDriveRuntimeConfig().debug.LOG_CACHE_POLICY) {
106
- // eslint-disable-next-line no-console
107
- console.log(`CachePolicy: ${cacheKey.lid} is ${result ? 'EXPIRED' : 'NOT expired'} because constraints.isExpired returned ${result}`);
108
- }
109
- }
110
- return result;
111
- }
112
- }
113
- const {
114
- headers
115
- } = request.response;
116
- if (!headers) {
117
- if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_CACHE_POLICY)) {
118
- if (getGlobalConfig().WarpDrive.debug.LOG_CACHE_POLICY || globalThis.getWarpDriveRuntimeConfig().debug.LOG_CACHE_POLICY) {
119
- // eslint-disable-next-line no-console
120
- console.log(`CachePolicy: ${cacheKey.lid} is EXPIRED because no headers were provided`);
121
- }
122
- }
123
-
124
- // if we have no headers then both the headers based expiration
125
- // and the time based expiration will be considered expired
126
- return true;
127
- }
128
-
129
- // check for X-WarpDrive-Expires
130
- const now = Date.now();
131
- const date = headers.get('Date');
132
- if (constraints?.headers) {
133
- if (constraints.headers['X-WarpDrive-Expires']) {
134
- const xWarpDriveExpires = headers.get('X-WarpDrive-Expires');
135
- if (xWarpDriveExpires) {
136
- const expirationTime = new Date(xWarpDriveExpires).getTime();
137
- const result = now >= expirationTime;
138
- if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_CACHE_POLICY)) {
139
- if (getGlobalConfig().WarpDrive.debug.LOG_CACHE_POLICY || globalThis.getWarpDriveRuntimeConfig().debug.LOG_CACHE_POLICY) {
140
- // eslint-disable-next-line no-console
141
- console.log(`CachePolicy: ${cacheKey.lid} is ${result ? 'EXPIRED' : 'NOT expired'} because the time set by X-WarpDrive-Expires header is ${result ? 'in the past' : 'in the future'}`);
142
- }
143
- }
144
- return result;
145
- }
146
- }
147
-
148
- // check for Cache-Control
149
- if (constraints.headers['Cache-Control']) {
150
- const cacheControl = headers.get('Cache-Control');
151
- const age = headers.get('Age');
152
- if (cacheControl && age && date) {
153
- const cacheControlValue = parseCacheControl(cacheControl);
154
-
155
- // max-age and s-maxage are stored in
156
- const maxAge = cacheControlValue['max-age'] || cacheControlValue['s-maxage'];
157
- if (maxAge) {
158
- // age is stored in seconds
159
- const ageValue = parseInt(age, 10);
160
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
161
- if (!test) {
162
- throw new Error(`Invalid Cache-Control value, expected a number but got - ${age}`);
163
- }
164
- })(!Number.isNaN(ageValue)) : {};
165
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
166
- if (!test) {
167
- throw new Error(`Invalid Cache-Control value, expected a number greater than 0 but got - ${age}`);
168
- }
169
- })(ageValue >= 0) : {};
170
- if (!Number.isNaN(ageValue) && ageValue >= 0) {
171
- const dateValue = new Date(date).getTime();
172
- const expirationTime = dateValue + (maxAge - ageValue) * 1000;
173
- const result = now >= expirationTime;
174
- if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_CACHE_POLICY)) {
175
- if (getGlobalConfig().WarpDrive.debug.LOG_CACHE_POLICY || globalThis.getWarpDriveRuntimeConfig().debug.LOG_CACHE_POLICY) {
176
- // eslint-disable-next-line no-console
177
- console.log(`CachePolicy: ${cacheKey.lid} is ${result ? 'EXPIRED' : 'NOT expired'} because the time set by Cache-Control header is ${result ? 'in the past' : 'in the future'}`);
178
- }
179
- }
180
- return result;
181
- }
182
- }
183
- }
184
- }
185
-
186
- // check for Expires
187
- if (constraints.headers.Expires) {
188
- const expires = headers.get('Expires');
189
- if (expires) {
190
- const expirationTime = new Date(expires).getTime();
191
- const result = now >= expirationTime;
192
- if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_CACHE_POLICY)) {
193
- if (getGlobalConfig().WarpDrive.debug.LOG_CACHE_POLICY || globalThis.getWarpDriveRuntimeConfig().debug.LOG_CACHE_POLICY) {
194
- // eslint-disable-next-line no-console
195
- console.log(`CachePolicy: ${cacheKey.lid} is ${result ? 'EXPIRED' : 'NOT expired'} because the time set by Expires header is ${result ? 'in the past' : 'in the future'}`);
196
- }
197
- }
198
- return result;
199
- }
200
- }
201
- }
202
-
203
- // check for Date
204
- if (!date) {
205
- if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_CACHE_POLICY)) {
206
- if (getGlobalConfig().WarpDrive.debug.LOG_CACHE_POLICY || globalThis.getWarpDriveRuntimeConfig().debug.LOG_CACHE_POLICY) {
207
- // eslint-disable-next-line no-console
208
- console.log(`CachePolicy: ${cacheKey.lid} is EXPIRED because no Date header was provided`);
209
- }
210
- }
211
- return true;
212
- }
213
- let expirationTime = config.apiCacheHardExpires;
214
- if (macroCondition(getGlobalConfig().WarpDrive.env.TESTING)) {
215
- if (!config.disableTestOptimization) {
216
- expirationTime = config.apiCacheSoftExpires;
217
- }
218
- }
219
- const time = new Date(date).getTime();
220
- const deadline = time + expirationTime;
221
- const result = now >= deadline;
222
- if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_CACHE_POLICY)) {
223
- if (getGlobalConfig().WarpDrive.debug.LOG_CACHE_POLICY || globalThis.getWarpDriveRuntimeConfig().debug.LOG_CACHE_POLICY) {
224
- // eslint-disable-next-line no-console
225
- console.log(`CachePolicy: ${cacheKey.lid} is ${result ? 'EXPIRED' : 'NOT expired'} because the apiCacheHardExpires time since the response's Date header is ${result ? 'in the past' : 'in the future'}`);
226
- }
227
- }
228
- return result;
229
- }
230
-
231
- /**
232
- * The configuration options for the {@link DefaultCachePolicy}
233
- *
234
- * ```ts
235
- * import { DefaultCachePolicy } from '@warp-drive/core/store';
236
- *
237
- * new DefaultCachePolicy({
238
- * // ... PolicyConfig Settings ... //
239
- * });
240
- * ```
241
- *
242
- */
243
-
244
- /**
245
- * A basic CachePolicy that can be added to the Store service.
246
- *
247
- * Determines staleness based on time since the request was last received from the API
248
- * using the `date` header.
249
- *
250
- * Determines expiration based on configured constraints as well as a time based
251
- * expiration strategy based on the `date` header.
252
- *
253
- * In order expiration is determined by:
254
- *
255
- * - Is explicitly invalidated
256
- * - ↳ (if null) isExpired function \<IF Constraint Active>
257
- * - ↳ (if null) X-WarpDrive-Expires header \<IF Constraint Active>
258
- * - ↳ (if null) Cache-Control header \<IF Constraint Active>
259
- * - ↳ (if null) Expires header \<IF Constraint Active>
260
- * - ↳ (if null) Date header + apiCacheHardExpires \< current time
261
- *
262
- * Invalidates any request for which `cacheOptions.types` was provided when a createRecord
263
- * request for that type is successful.
264
- *
265
- * For this to work, the `createRecord` request must include the `cacheOptions.types` array
266
- * with the types that should be invalidated, or its request should specify the ResourceKeys
267
- * of the records that are being created via `records`. Providing both is valid.
268
- *
269
- * > [!NOTE]
270
- * > only requests that had specified `cacheOptions.types` and occurred prior to the
271
- * > createRecord request will be invalidated. This means that a given request should always
272
- * > specify the types that would invalidate it to opt into this behavior. Abstracting this
273
- * > behavior via builders is recommended to ensure consistency.
274
- *
275
- * This allows the Store's CacheHandler to determine if a request is expired and
276
- * should be refetched upon next request.
277
- *
278
- * The `Fetch` handler provided by `@warp-drive/core` will automatically
279
- * add the `date` header to responses if it is not present.
280
- *
281
- * > [!NOTE]
282
- * > Date headers do not have millisecond precision, so expiration times should
283
- * > generally be larger than 1000ms.
284
- *
285
- * Usage:
286
- *
287
- * ```ts
288
- * import { Store } from '@warp-drive/core';
289
- * import { DefaultCachePolicy } from '@warp-drive/core/store';
290
- *
291
- * export class AppStore extends Store {
292
- * lifetimes = new DefaultCachePolicy({
293
- * apiCacheSoftExpires: 30_000,
294
- * apiCacheHardExpires: 60_000
295
- * });
296
- * }
297
- * ```
298
- *
299
- * In Testing environments, the `apiCacheSoftExpires` will always be `false`
300
- * and `apiCacheHardExpires` will use the `apiCacheSoftExpires` value.
301
- *
302
- * This helps reduce flakiness and produce predictably rendered results in test suites.
303
- *
304
- * Requests that specifically set `cacheOptions.backgroundReload = true` will
305
- * still be background reloaded in tests.
306
- *
307
- * This behavior can be opted out of by setting `disableTestOptimization = true`
308
- * in the policy config.
309
- *
310
- * @public
311
- */
312
- class DefaultCachePolicy {
313
- _getStore(store) {
314
- let set = this._stores.get(store);
315
- if (!set) {
316
- set = {
317
- invalidated: new Set(),
318
- types: new Map()
319
- };
320
- this._stores.set(store, set);
321
- }
322
- return set;
323
- }
324
- constructor(config) {
325
- this._stores = new WeakMap();
326
- const _config = arguments.length === 1 ? config : arguments[1];
327
- deprecate(`Passing a Store to the CachePolicy is deprecated, please pass only a config instead.`, arguments.length === 1, {
328
- id: 'ember-data:request-utils:lifetimes-service-store-arg',
329
- since: {
330
- enabled: '5.4',
331
- available: '4.13'
332
- },
333
- for: '@ember-data/request-utils',
334
- until: '6.0'
335
- });
336
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
337
- if (!test) {
338
- throw new Error(`You must pass a config to the CachePolicy`);
339
- }
340
- })(_config) : {};
341
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
342
- if (!test) {
343
- throw new Error(`You must pass a apiCacheSoftExpires to the CachePolicy`);
344
- }
345
- })(typeof _config.apiCacheSoftExpires === 'number') : {};
346
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
347
- if (!test) {
348
- throw new Error(`You must pass a apiCacheHardExpires to the CachePolicy`);
349
- }
350
- })(typeof _config.apiCacheHardExpires === 'number') : {};
351
- this.config = _config;
352
- }
353
-
354
- /**
355
- * Invalidate a request by its CacheKey for the given store instance.
356
- *
357
- * While the store argument may seem redundant, the CachePolicy
358
- * is designed to be shared across multiple stores / forks
359
- * of the store.
360
- *
361
- * ```ts
362
- * store.lifetimes.invalidateRequest(store, cacheKey);
363
- * ```
364
- *
365
- * @public
366
- */
367
- invalidateRequest(cacheKey, store) {
368
- this._getStore(store).invalidated.add(cacheKey);
369
- }
370
-
371
- /**
372
- * Invalidate all requests associated to a specific type
373
- * for a given store instance.
374
- *
375
- * While the store argument may seem redundant, the CachePolicy
376
- * is designed to be shared across multiple stores / forks
377
- * of the store.
378
- *
379
- * This invalidation is done automatically when using this service
380
- * for both the CacheHandler and the LegacyNetworkHandler.
381
- *
382
- * ```ts
383
- * store.lifetimes.invalidateRequestsForType(store, 'person');
384
- * ```
385
- *
386
- * @public
387
- */
388
- invalidateRequestsForType(type, store) {
389
- const storeCache = this._getStore(store);
390
- const set = storeCache.types.get(type);
391
- const notifications = store.notifications;
392
- if (set) {
393
- // TODO batch notifications
394
- set.forEach(id => {
395
- storeCache.invalidated.add(id);
396
- // @ts-expect-error
397
- notifications.notify(id, 'invalidated', null);
398
- });
399
- }
400
- }
401
-
402
- /**
403
- * Invoked when a request has been fulfilled from the configured request handlers.
404
- * This is invoked by the CacheHandler for both foreground and background requests
405
- * once the cache has been updated.
406
- *
407
- * Note, this is invoked by the CacheHandler regardless of whether
408
- * the request has a cache-key.
409
- *
410
- * This method should not be invoked directly by consumers.
411
- *
412
- * @public
413
- */
414
- didRequest(request, response, cacheKey, store) {
415
- // if this is a successful createRecord request, invalidate the cacheKey for the type
416
- if (request.op === 'createRecord') {
417
- const statusNumber = response?.status ?? 0;
418
- if (statusNumber >= 200 && statusNumber < 400) {
419
- const types = new Set(request.records?.map(r => r.type));
420
- const additionalTypes = request.cacheOptions?.types;
421
- additionalTypes?.forEach(type => {
422
- types.add(type);
423
- });
424
- types.forEach(type => {
425
- this.invalidateRequestsForType(type, store);
426
- });
427
- }
428
-
429
- // add this document's cacheKey to a map for all associated types
430
- // it is recommended to only use this for queries
431
- } else if (cacheKey && request.cacheOptions?.types?.length) {
432
- const storeCache = this._getStore(store);
433
- request.cacheOptions?.types.forEach(type => {
434
- const set = storeCache.types.get(type);
435
- if (set) {
436
- set.add(cacheKey);
437
- storeCache.invalidated.delete(cacheKey);
438
- } else {
439
- storeCache.types.set(type, new Set([cacheKey]));
440
- }
441
- });
442
- }
443
- }
444
-
445
- /**
446
- * Invoked to determine if the request may be fulfilled from cache
447
- * if possible.
448
- *
449
- * Note, this is only invoked by the CacheHandler if the request has
450
- * a cache-key.
451
- *
452
- * If no cache entry is found or the entry is hard expired,
453
- * the request will be fulfilled from the configured request handlers
454
- * and the cache will be updated before returning the response.
455
- *
456
- * @public
457
- * @return true if the request is considered hard expired
458
- */
459
- isHardExpired(cacheKey, store) {
460
- // if we are explicitly invalidated, we are hard expired
461
- const storeCache = this._getStore(store);
462
- if (storeCache.invalidated.has(cacheKey)) {
463
- return true;
464
- }
465
- const cache = store.cache;
466
- const cached = cache.peekRequest(cacheKey);
467
- if (!cached?.response) {
468
- if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_CACHE_POLICY)) {
469
- if (getGlobalConfig().WarpDrive.debug.LOG_CACHE_POLICY || globalThis.getWarpDriveRuntimeConfig().debug.LOG_CACHE_POLICY) {
470
- // eslint-disable-next-line no-console
471
- console.log(`CachePolicy: ${cacheKey.lid} is EXPIRED because no cache entry was found`);
472
- }
473
- }
474
- return true;
475
- }
476
- return isExpired(cacheKey, cached, this.config);
477
- }
478
-
479
- /**
480
- * Invoked if `isHardExpired` is false to determine if the request
481
- * should be update behind the scenes if cache data is already available.
482
- *
483
- * Note, this is only invoked by the CacheHandler if the request has
484
- * a cache-key.
485
- *
486
- * If true, the request will be fulfilled from cache while a backgrounded
487
- * request is made to update the cache via the configured request handlers.
488
- *
489
- * @public
490
- * @return true if the request is considered soft expired
491
- */
492
- isSoftExpired(cacheKey, store) {
493
- if (macroCondition(getGlobalConfig().WarpDrive.env.TESTING)) {
494
- if (!this.config.disableTestOptimization) {
495
- return false;
496
- }
497
- }
498
- const cache = store.cache;
499
- const cached = cache.peekRequest(cacheKey);
500
- if (cached?.response) {
501
- const date = cached.response.headers.get('date');
502
- if (!date) {
503
- if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_CACHE_POLICY)) {
504
- if (getGlobalConfig().WarpDrive.debug.LOG_CACHE_POLICY || globalThis.getWarpDriveRuntimeConfig().debug.LOG_CACHE_POLICY) {
505
- // eslint-disable-next-line no-console
506
- console.log(`CachePolicy: ${cacheKey.lid} is STALE because no date header was found`);
507
- }
508
- }
509
- return true;
510
- } else {
511
- const time = new Date(date).getTime();
512
- const now = Date.now();
513
- const deadline = time + this.config.apiCacheSoftExpires;
514
- const result = now >= deadline;
515
- if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_CACHE_POLICY)) {
516
- if (getGlobalConfig().WarpDrive.debug.LOG_CACHE_POLICY || globalThis.getWarpDriveRuntimeConfig().debug.LOG_CACHE_POLICY) {
517
- // eslint-disable-next-line no-console
518
- console.log(`CachePolicy: ${cacheKey.lid} is ${result ? 'STALE' : 'NOT stale'}. Expiration time: ${deadline}, now: ${now}`);
519
- }
520
- }
521
- return result;
522
- }
523
- }
524
- if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_CACHE_POLICY)) {
525
- if (getGlobalConfig().WarpDrive.debug.LOG_CACHE_POLICY || globalThis.getWarpDriveRuntimeConfig().debug.LOG_CACHE_POLICY) {
526
- // eslint-disable-next-line no-console
527
- console.log(`CachePolicy: ${cacheKey.lid} is STALE because no cache entry was found`);
528
- }
529
- }
530
- return true;
531
- }
532
- }
533
- export { DefaultCachePolicy, parseCacheControl };
1
+ export { D as DefaultCachePolicy, p as parseCacheControl } from "./default-cache-policy-D7_u4YRH.js";
@@ -1,6 +1,6 @@
1
1
  import { macroCondition, getGlobalConfig } from '@embroider/macros';
2
2
  const name = "@warp-drive/core";
3
- const version = "5.8.0-alpha.4";
3
+ const version = "5.8.0-alpha.6";
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
@@ -8,7 +8,8 @@ const IS_FUTURE = getOrSetGlobal('IS_FUTURE', Symbol('IS_FUTURE'));
8
8
  const STRUCTURED = getOrSetGlobal('DOC', Symbol('DOC'));
9
9
 
10
10
  /**
11
- * Use these options to adjust CacheHandler behavior for a request.
11
+ * Use these options to adjust {@link CacheHandler} behavior for a request
12
+ * via {@link RequestInfo.cacheOptions}.
12
13
  *
13
14
  */
14
15
 
@@ -443,6 +443,20 @@
443
443
  * @public
444
444
  */
445
445
 
446
+ /**
447
+ * A trait for use on a PolarisMode record
448
+ */
449
+
450
+ /**
451
+ * A trait for use on a LegacyMode record
452
+ */
453
+
454
+ /**
455
+ * A union of
456
+ * - {@link LegacyTrait}
457
+ * - {@link PolarisTrait}
458
+ */
459
+
446
460
  /**
447
461
  * A no-op type utility that enables type-checking resource schema
448
462
  * definitions.
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warp-drive/core",
3
- "version": "5.8.0-alpha.4",
3
+ "version": "5.8.0-alpha.6",
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.8.0-alpha.4"
40
+ "@warp-drive/build-config": "5.8.0-alpha.6"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@babel/core": "^7.28.3",
44
44
  "@babel/plugin-transform-typescript": "^7.28.0",
45
45
  "@babel/preset-typescript": "^7.27.1",
46
- "@warp-drive/internal-config": "5.8.0-alpha.4",
46
+ "@warp-drive/internal-config": "5.8.0-alpha.6",
47
47
  "decorator-transforms": "^2.3.0",
48
48
  "ember-source": "~6.6.0",
49
49
  "expect-type": "^1.2.2",