@warp-drive/core 5.7.0-alpha.26 → 5.7.0-alpha.27

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.
@@ -26,7 +26,7 @@ export declare class ContextOwner {
26
26
  setResponse(response: ResponseInfo | Response | null): void;
27
27
  }
28
28
  export declare class Context {
29
- #private;
29
+ private ___owner;
30
30
  request: ImmutableRequestInfo;
31
31
  id: number;
32
32
  private _isCacheHandler;
@@ -94,7 +94,8 @@ import { IS_CACHE_HANDLER } from "./utils.js";
94
94
  * @public
95
95
  */
96
96
  export declare class RequestManager {
97
- #private;
97
+ /** @internal */
98
+ private _handlers;
98
99
  /** @internal */
99
100
  _hasCacheHandler: boolean;
100
101
  /**
@@ -28,8 +28,8 @@ import type { StoreRequestContext } from "../cache-handler/handler.js";
28
28
  * @public
29
29
  */
30
30
  export declare class CacheManager implements Cache {
31
- #private;
32
31
  version: "2";
32
+ private ___cache;
33
33
  constructor(cache: Cache);
34
34
  // Cache Management
35
35
  // ================
@@ -43,7 +43,7 @@ export interface RequestArgs<
43
43
  * different from the store provided via context.
44
44
  *
45
45
  */
46
- store?: Store;
46
+ store?: Store | RequestManager;
47
47
  }
48
48
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
49
49
  export interface SubscriptionArgs<
@@ -639,19 +639,18 @@ class ContextOwner {
639
639
  }
640
640
  }
641
641
  class Context {
642
- #owner;
643
642
  constructor(owner, isCacheHandler) {
644
643
  this.id = owner.requestId;
645
- this.#owner = owner;
644
+ this.___owner = owner;
646
645
  this.request = owner.enhancedRequest;
647
646
  this._isCacheHandler = isCacheHandler;
648
647
  this._finalized = false;
649
648
  }
650
649
  setStream(stream) {
651
- this.#owner.setStream(stream);
650
+ this.___owner.setStream(stream);
652
651
  }
653
652
  setResponse(response) {
654
- this.#owner.setResponse(response);
653
+ this.___owner.setResponse(response);
655
654
  }
656
655
  setIdentifier(identifier) {
657
656
  macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
@@ -659,10 +658,10 @@ class Context {
659
658
  throw new Error(`setIdentifier may only be used synchronously from a CacheHandler`);
660
659
  }
661
660
  })(identifier && this._isCacheHandler && !this._finalized) : {};
662
- this.#owner.god.identifier = identifier;
661
+ this.___owner.god.identifier = identifier;
663
662
  }
664
663
  get hasRequestedStream() {
665
- return this.#owner.hasRequestedStream;
664
+ return this.___owner.hasRequestedStream;
666
665
  }
667
666
  _finalize() {
668
667
  this._finalized = true;
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { setLogging, getRuntimeConfig } from './types/runtime.js';
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-DbdT1mON.js";
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
4
  import { w as waitFor } from "./configure-B48bFHOl.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, N as setIdentifierForgetMethod, L as setIdentifierGenerationMethod, O as setIdentifierResetMethod, M as setIdentifierUpdateMethod, P as setKeyInfoForResource, s as storeFor } from "./request-state-CqVrgUM0.js";
7
+ export { C as CacheHandler, S as Store, r as recordIdentifierFor, N as setIdentifierForgetMethod, L as setIdentifierGenerationMethod, O as setIdentifierResetMethod, M as setIdentifierUpdateMethod, P as setKeyInfoForResource, s as storeFor } from "./request-state-DAjbHWcs.js";
8
8
  import '@ember/debug';
9
9
  import './utils/string.js';
10
10
  import "./symbols-sql1_mdx.js";
@@ -189,7 +189,7 @@ function isDict(v) {
189
189
  }
190
190
  class RequestManager {
191
191
  /** @internal */
192
- #handlers = [];
192
+
193
193
  /** @internal */
194
194
 
195
195
  /**
@@ -207,6 +207,7 @@ class RequestManager {
207
207
  Object.assign(this, options);
208
208
  this._pending = new Map();
209
209
  this._deduped = new Map();
210
+ this._handlers = [];
210
211
  }
211
212
 
212
213
  /**
@@ -223,13 +224,13 @@ class RequestManager {
223
224
  if (this._hasCacheHandler) {
224
225
  throw new Error(`\`RequestManager.useCache(<handler>)\` May only be invoked once.`);
225
226
  }
226
- if (Object.isFrozen(this.#handlers)) {
227
+ if (Object.isFrozen(this._handlers)) {
227
228
  throw new Error(`\`RequestManager.useCache(<handler>)\` May only be invoked prior to any request having been made.`);
228
229
  }
229
230
  this._hasCacheHandler = true;
230
231
  }
231
232
  cacheHandler[IS_CACHE_HANDLER] = true;
232
- this.#handlers.unshift(cacheHandler);
233
+ this._handlers.unshift(cacheHandler);
233
234
  return this;
234
235
  }
235
236
 
@@ -243,7 +244,7 @@ class RequestManager {
243
244
  * @public
244
245
  */
245
246
  use(newHandlers) {
246
- const handlers = this.#handlers;
247
+ const handlers = this._handlers;
247
248
  if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
248
249
  if (Object.isFrozen(handlers)) {
249
250
  throw new Error(`Cannot add a Handler to a RequestManager after a request has been made`);
@@ -269,7 +270,7 @@ class RequestManager {
269
270
  * @public
270
271
  */
271
272
  request(request) {
272
- const handlers = this.#handlers;
273
+ const handlers = this._handlers;
273
274
  if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
274
275
  if (!Object.isFrozen(handlers)) {
275
276
  Object.freeze(handlers);
package/dist/reactive.js CHANGED
@@ -1,5 +1,5 @@
1
- import { G as ReactiveResource, H as isNonIdentityCacheableField, I as getFieldCacheKeyStrict, r as recordIdentifierFor, A as withSignalStore } from "./request-state-CqVrgUM0.js";
2
- export { J as checkout, K as commit } from "./request-state-CqVrgUM0.js";
1
+ import { G as ReactiveResource, H as isNonIdentityCacheableField, I as getFieldCacheKeyStrict, r as recordIdentifierFor, A as withSignalStore } from "./request-state-DAjbHWcs.js";
2
+ export { J as checkout, K as commit } from "./request-state-DAjbHWcs.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";
@@ -7,7 +7,7 @@ import { CACHE_OWNER, DEBUG_STALE_CACHE_OWNER, DEBUG_KEY_TYPE, DEBUG_CLIENT_ORIG
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
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-B48bFHOl.js";
10
- import { g as getPromiseResult, s as setPromiseResult } from "./context-DbdT1mON.js";
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 = {
13
13
  isInitializer: true
@@ -4219,9 +4219,8 @@ function unloadRecord(instances, identifier) {
4219
4219
  */
4220
4220
  class CacheManager {
4221
4221
  version = '2';
4222
- #cache;
4223
4222
  constructor(cache) {
4224
- this.#cache = cache;
4223
+ this.___cache = cache;
4225
4224
  }
4226
4225
 
4227
4226
  // Cache Management
@@ -4250,7 +4249,7 @@ class CacheManager {
4250
4249
  * @public
4251
4250
  */
4252
4251
  put(doc) {
4253
- return this.#cache.put(doc);
4252
+ return this.___cache.put(doc);
4254
4253
  }
4255
4254
 
4256
4255
  /**
@@ -4261,7 +4260,7 @@ class CacheManager {
4261
4260
  * @return {void}
4262
4261
  */
4263
4262
  patch(op) {
4264
- this.#cache.patch(op);
4263
+ this.___cache.patch(op);
4265
4264
  }
4266
4265
 
4267
4266
  /**
@@ -4272,7 +4271,7 @@ class CacheManager {
4272
4271
  * @param mutation
4273
4272
  */
4274
4273
  mutate(mutation) {
4275
- this.#cache.mutate(mutation);
4274
+ this.___cache.mutate(mutation);
4276
4275
  }
4277
4276
 
4278
4277
  /**
@@ -4308,10 +4307,10 @@ class CacheManager {
4308
4307
  */
4309
4308
 
4310
4309
  peek(cacheKey) {
4311
- return this.#cache.peek(cacheKey);
4310
+ return this.___cache.peek(cacheKey);
4312
4311
  }
4313
4312
  peekRemoteState(cacheKey) {
4314
- return this.#cache.peekRemoteState(cacheKey);
4313
+ return this.___cache.peekRemoteState(cacheKey);
4315
4314
  }
4316
4315
  /**
4317
4316
  * Peek the Cache for the existing request data associated with
@@ -4322,7 +4321,7 @@ class CacheManager {
4322
4321
  * @public
4323
4322
  */
4324
4323
  peekRequest(key) {
4325
- return this.#cache.peekRequest(key);
4324
+ return this.___cache.peekRequest(key);
4326
4325
  }
4327
4326
 
4328
4327
  /**
@@ -4332,7 +4331,7 @@ class CacheManager {
4332
4331
  * @return if `hasRecord` is true then calculated key changes should be returned
4333
4332
  */
4334
4333
  upsert(key, data, hasRecord) {
4335
- return this.#cache.upsert(key, data, hasRecord);
4334
+ return this.___cache.upsert(key, data, hasRecord);
4336
4335
  }
4337
4336
 
4338
4337
  // Cache Forking Support
@@ -4349,7 +4348,7 @@ class CacheManager {
4349
4348
  * @return {Promise<Cache>}
4350
4349
  */
4351
4350
  fork() {
4352
- return this.#cache.fork();
4351
+ return this.___cache.fork();
4353
4352
  }
4354
4353
 
4355
4354
  /**
@@ -4364,7 +4363,7 @@ class CacheManager {
4364
4363
  * @return {Promise<void>}
4365
4364
  */
4366
4365
  merge(cache) {
4367
- return this.#cache.merge(cache);
4366
+ return this.___cache.merge(cache);
4368
4367
  }
4369
4368
 
4370
4369
  /**
@@ -4400,7 +4399,7 @@ class CacheManager {
4400
4399
  * @public
4401
4400
  */
4402
4401
  diff() {
4403
- return this.#cache.diff();
4402
+ return this.___cache.diff();
4404
4403
  }
4405
4404
 
4406
4405
  // SSR Support
@@ -4415,7 +4414,7 @@ class CacheManager {
4415
4414
  * @public
4416
4415
  */
4417
4416
  dump() {
4418
- return this.#cache.dump();
4417
+ return this.___cache.dump();
4419
4418
  }
4420
4419
 
4421
4420
  /**
@@ -4435,7 +4434,7 @@ class CacheManager {
4435
4434
  * @public
4436
4435
  */
4437
4436
  hydrate(stream) {
4438
- return this.#cache.hydrate(stream);
4437
+ return this.___cache.hydrate(stream);
4439
4438
  }
4440
4439
 
4441
4440
  // Cache
@@ -4453,7 +4452,7 @@ class CacheManager {
4453
4452
  * @public
4454
4453
  */
4455
4454
  clientDidCreate(key, options) {
4456
- return this.#cache.clientDidCreate(key, options);
4455
+ return this.___cache.clientDidCreate(key, options);
4457
4456
  }
4458
4457
 
4459
4458
  /**
@@ -4464,7 +4463,7 @@ class CacheManager {
4464
4463
  * @param key
4465
4464
  */
4466
4465
  willCommit(key, context) {
4467
- this.#cache.willCommit(key, context);
4466
+ this.___cache.willCommit(key, context);
4468
4467
  }
4469
4468
 
4470
4469
  /**
@@ -4474,7 +4473,7 @@ class CacheManager {
4474
4473
  * @public
4475
4474
  */
4476
4475
  didCommit(key, result) {
4477
- return this.#cache.didCommit(key, result);
4476
+ return this.___cache.didCommit(key, result);
4478
4477
  }
4479
4478
 
4480
4479
  /**
@@ -4484,7 +4483,7 @@ class CacheManager {
4484
4483
  * @public
4485
4484
  */
4486
4485
  commitWasRejected(key, errors) {
4487
- this.#cache.commitWasRejected(key, errors);
4486
+ this.___cache.commitWasRejected(key, errors);
4488
4487
  }
4489
4488
 
4490
4489
  /**
@@ -4494,7 +4493,7 @@ class CacheManager {
4494
4493
  * @public
4495
4494
  */
4496
4495
  unloadRecord(key) {
4497
- this.#cache.unloadRecord(key);
4496
+ this.___cache.unloadRecord(key);
4498
4497
  }
4499
4498
 
4500
4499
  // Granular Resource Data APIs
@@ -4506,7 +4505,7 @@ class CacheManager {
4506
4505
  * @public
4507
4506
  */
4508
4507
  getAttr(key, propertyName) {
4509
- return this.#cache.getAttr(key, propertyName);
4508
+ return this.___cache.getAttr(key, propertyName);
4510
4509
  }
4511
4510
 
4512
4511
  /**
@@ -4515,7 +4514,7 @@ class CacheManager {
4515
4514
  * @public
4516
4515
  */
4517
4516
  getRemoteAttr(key, propertyName) {
4518
- return this.#cache.getRemoteAttr(key, propertyName);
4517
+ return this.___cache.getRemoteAttr(key, propertyName);
4519
4518
  }
4520
4519
 
4521
4520
  /**
@@ -4524,7 +4523,7 @@ class CacheManager {
4524
4523
  * @public
4525
4524
  */
4526
4525
  setAttr(key, propertyName, value) {
4527
- this.#cache.setAttr(key, propertyName, value);
4526
+ this.___cache.setAttr(key, propertyName, value);
4528
4527
  }
4529
4528
 
4530
4529
  /**
@@ -4533,7 +4532,7 @@ class CacheManager {
4533
4532
  * @public
4534
4533
  */
4535
4534
  changedAttrs(key) {
4536
- return this.#cache.changedAttrs(key);
4535
+ return this.___cache.changedAttrs(key);
4537
4536
  }
4538
4537
 
4539
4538
  /**
@@ -4542,7 +4541,7 @@ class CacheManager {
4542
4541
  * @public
4543
4542
  */
4544
4543
  hasChangedAttrs(key) {
4545
- return this.#cache.hasChangedAttrs(key);
4544
+ return this.___cache.hasChangedAttrs(key);
4546
4545
  }
4547
4546
 
4548
4547
  /**
@@ -4552,7 +4551,7 @@ class CacheManager {
4552
4551
  * @return the names of attributes that were restored
4553
4552
  */
4554
4553
  rollbackAttrs(key) {
4555
- return this.#cache.rollbackAttrs(key);
4554
+ return this.___cache.rollbackAttrs(key);
4556
4555
  }
4557
4556
 
4558
4557
  // Relationships
@@ -4583,7 +4582,7 @@ class CacheManager {
4583
4582
  * @public
4584
4583
  */
4585
4584
  changedRelationships(key) {
4586
- return this.#cache.changedRelationships(key);
4585
+ return this.___cache.changedRelationships(key);
4587
4586
  }
4588
4587
 
4589
4588
  /**
@@ -4592,7 +4591,7 @@ class CacheManager {
4592
4591
  * @public
4593
4592
  */
4594
4593
  hasChangedRelationships(key) {
4595
- return this.#cache.hasChangedRelationships(key);
4594
+ return this.___cache.hasChangedRelationships(key);
4596
4595
  }
4597
4596
 
4598
4597
  /**
@@ -4606,7 +4605,7 @@ class CacheManager {
4606
4605
  * @return the names of relationships that were restored
4607
4606
  */
4608
4607
  rollbackRelationships(key) {
4609
- return this.#cache.rollbackRelationships(key);
4608
+ return this.___cache.rollbackRelationships(key);
4610
4609
  }
4611
4610
 
4612
4611
  /**
@@ -4616,7 +4615,7 @@ class CacheManager {
4616
4615
  * @return resource relationship object
4617
4616
  */
4618
4617
  getRelationship(key, propertyName) {
4619
- return this.#cache.getRelationship(key, propertyName);
4618
+ return this.___cache.getRelationship(key, propertyName);
4620
4619
  }
4621
4620
 
4622
4621
  /**
@@ -4626,7 +4625,7 @@ class CacheManager {
4626
4625
  * @return resource relationship object
4627
4626
  */
4628
4627
  getRemoteRelationship(key, propertyName) {
4629
- return this.#cache.getRemoteRelationship(key, propertyName);
4628
+ return this.___cache.getRemoteRelationship(key, propertyName);
4630
4629
  }
4631
4630
 
4632
4631
  // Resource State
@@ -4639,7 +4638,7 @@ class CacheManager {
4639
4638
  * @public
4640
4639
  */
4641
4640
  setIsDeleted(key, isDeleted) {
4642
- this.#cache.setIsDeleted(key, isDeleted);
4641
+ this.___cache.setIsDeleted(key, isDeleted);
4643
4642
  }
4644
4643
 
4645
4644
  /**
@@ -4648,7 +4647,7 @@ class CacheManager {
4648
4647
  * @public
4649
4648
  */
4650
4649
  getErrors(key) {
4651
- return this.#cache.getErrors(key);
4650
+ return this.___cache.getErrors(key);
4652
4651
  }
4653
4652
 
4654
4653
  /**
@@ -4657,7 +4656,7 @@ class CacheManager {
4657
4656
  * @public
4658
4657
  */
4659
4658
  isEmpty(key) {
4660
- return this.#cache.isEmpty(key);
4659
+ return this.___cache.isEmpty(key);
4661
4660
  }
4662
4661
 
4663
4662
  /**
@@ -4667,7 +4666,7 @@ class CacheManager {
4667
4666
  * @public
4668
4667
  */
4669
4668
  isNew(key) {
4670
- return this.#cache.isNew(key);
4669
+ return this.___cache.isNew(key);
4671
4670
  }
4672
4671
 
4673
4672
  /**
@@ -4677,7 +4676,7 @@ class CacheManager {
4677
4676
  * @public
4678
4677
  */
4679
4678
  isDeleted(key) {
4680
- return this.#cache.isDeleted(key);
4679
+ return this.___cache.isDeleted(key);
4681
4680
  }
4682
4681
 
4683
4682
  /**
@@ -4687,7 +4686,7 @@ class CacheManager {
4687
4686
  * @public
4688
4687
  */
4689
4688
  isDeletionCommitted(key) {
4690
- return this.#cache.isDeletionCommitted(key);
4689
+ return this.___cache.isDeletionCommitted(key);
4691
4690
  }
4692
4691
  }
4693
4692
  function isCacheOperationValue(value) {
@@ -8273,6 +8272,7 @@ const CacheHandler = {
8273
8272
  });
8274
8273
  store.notifications.notify(identifier, 'state', null);
8275
8274
  }
8275
+ store.requestManager._pending.set(context.id, promise);
8276
8276
  return promise;
8277
8277
  }
8278
8278
 
package/dist/request.js CHANGED
@@ -1 +1 @@
1
- export { c as createDeferred, g as getPromiseResult, s as setPromiseResult } from "./context-DbdT1mON.js";
1
+ export { c as createDeferred, g as getPromiseResult, s as setPromiseResult } from "./context-Bh-MA_tH.js";
@@ -1,2 +1,2 @@
1
- export { C as CacheHandler, D as DISPOSE, R as RecordArrayManager, y as Signals, S as Store, g as StoreMap, _ as _clearCaches, n as _deprecatingNormalize, b as coerceId, c as constructResource, E as consumeInternalSignal, h as createLegacyManyArray, m as createRequestSubscription, w as defineGate, x as defineNonEnumerableSignal, v as defineSignal, e as ensureStringId, u as entangleSignal, f as fastPush, t as gate, F as getOrCreateInternalSignal, k as getPromiseState, o as getRequestState, a as isRequestKey, i as isResourceKey, l as log, j as logGroup, q as memoized, B as notifyInternalSignal, z as peekInternalSignal, r as recordIdentifierFor, d as setRecordIdentifier, p as signal, s as storeFor, A as withSignalStore } from "../request-state-CqVrgUM0.js";
1
+ export { C as CacheHandler, D as DISPOSE, R as RecordArrayManager, y as Signals, S as Store, g as StoreMap, _ as _clearCaches, n as _deprecatingNormalize, b as coerceId, c as constructResource, E as consumeInternalSignal, h as createLegacyManyArray, m as createRequestSubscription, w as defineGate, x as defineNonEnumerableSignal, v as defineSignal, e as ensureStringId, u as entangleSignal, f as fastPush, t as gate, F as getOrCreateInternalSignal, k as getPromiseState, o as getRequestState, a as isRequestKey, i as isResourceKey, l as log, j as logGroup, q as memoized, B as notifyInternalSignal, z as peekInternalSignal, r as recordIdentifierFor, d as setRecordIdentifier, p as signal, s as storeFor, A as withSignalStore } from "../request-state-DAjbHWcs.js";
2
2
  export { A as ARRAY_SIGNAL, O as OBJECT_SIGNAL, c as createMemo, w as waitFor } from "../configure-B48bFHOl.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.26";
3
+ const version = "5.7.0-alpha.27";
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.26",
3
+ "version": "5.7.0-alpha.27",
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.16.12",
40
- "@warp-drive/build-config": "5.7.0-alpha.26"
40
+ "@warp-drive/build-config": "5.7.0-alpha.27"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@babel/core": "^7.26.10",
44
44
  "@babel/plugin-transform-typescript": "^7.27.0",
45
45
  "@babel/preset-typescript": "^7.27.0",
46
- "@warp-drive/internal-config": "5.7.0-alpha.26",
46
+ "@warp-drive/internal-config": "5.7.0-alpha.27",
47
47
  "decorator-transforms": "^2.3.0",
48
48
  "ember-source": "~6.3.0",
49
49
  "expect-type": "^1.2.1",