@warp-drive/core 5.7.0-alpha.26 → 5.7.0-alpha.28
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/declarations/graph/-private/-diff.d.ts +0 -13
- package/declarations/graph/-private/-edge-definition.d.ts +1 -10
- package/declarations/graph/-private/edges/resource.d.ts +1 -2
- package/declarations/reactive/-private/record.d.ts +2 -16
- package/declarations/reactive/-private/schema.d.ts +1 -67
- package/declarations/request/-private/context.d.ts +1 -1
- package/declarations/request/-private/manager.d.ts +21 -18
- package/declarations/request/-private/types.d.ts +1 -3
- package/declarations/store/-private/caches/instance-cache.d.ts +1 -1
- package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +13 -6
- package/declarations/store/-private/managers/cache-key-manager.d.ts +18 -35
- package/declarations/store/-private/managers/cache-manager.d.ts +1 -1
- package/declarations/store/-private/managers/notification-manager.d.ts +9 -17
- package/declarations/store/-private/managers/record-array-manager.d.ts +21 -68
- package/declarations/store/-private/network/request-cache.d.ts +12 -12
- package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts +3 -41
- package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts +8 -29
- package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +5 -3
- package/declarations/store/-private/new-core-tmp/request-subscription.d.ts +3 -111
- package/declarations/store/-private/record-arrays/-utils.d.ts +0 -2
- package/declarations/store/-private/record-arrays/legacy-live-array.d.ts +1 -9
- package/declarations/store/-private/record-arrays/legacy-many-array.d.ts +5 -11
- package/declarations/store/-private/record-arrays/legacy-query.d.ts +1 -23
- package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +1 -124
- package/declarations/store/-private/record-arrays/resource-array.d.ts +3 -10
- package/declarations/store/-private/store-service.d.ts +77 -65
- package/declarations/store/-private.d.ts +4 -1
- package/declarations/store/-types/q/record-instance.d.ts +0 -1
- package/declarations/store/deprecated/-private.d.ts +0 -11
- package/declarations/types/identifier.d.ts +0 -8
- package/declarations/types/spec/json-api-raw.d.ts +6 -8
- package/declarations/utils/string.d.ts +2 -2
- package/dist/{configure-B48bFHOl.js → configure-CiFDHArV.js} +4 -4
- package/dist/configure.js +1 -1
- package/dist/{context-DbdT1mON.js → context-Bh-MA_tH.js} +5 -6
- package/dist/graph/-private.js +2 -5
- package/dist/index.js +17 -8
- package/dist/reactive.js +5 -5
- package/dist/{request-state-CqVrgUM0.js → request-state-B908BvPK.js} +219 -73
- package/dist/request.js +1 -1
- package/dist/store/-private.js +2 -2
- package/dist/types/-private.js +1 -1
- package/dist/utils/string.js +2 -2
- package/package.json +3 -3
|
@@ -6,8 +6,8 @@ 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-
|
|
10
|
-
import { g as getPromiseResult, s as setPromiseResult } from "./context-
|
|
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";
|
|
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
|
|
@@ -49,7 +49,7 @@ function isInitializer(obj) {
|
|
|
49
49
|
* - the "key" or "name" of the signal
|
|
50
50
|
* - the "object identity" or "context" to which the signal is attached
|
|
51
51
|
*
|
|
52
|
-
* @
|
|
52
|
+
* @private
|
|
53
53
|
*/
|
|
54
54
|
|
|
55
55
|
/**
|
|
@@ -68,7 +68,7 @@ function isInitializer(obj) {
|
|
|
68
68
|
* initializeSignalStore(obj);
|
|
69
69
|
* ```
|
|
70
70
|
*
|
|
71
|
-
* @
|
|
71
|
+
* @private
|
|
72
72
|
*/
|
|
73
73
|
const Signals = getOrSetGlobal('Signals', Symbol('Signals'));
|
|
74
74
|
|
|
@@ -77,7 +77,7 @@ const Signals = getOrSetGlobal('Signals', Symbol('Signals'));
|
|
|
77
77
|
* if it does not already exist and returns the associated
|
|
78
78
|
* signal store.
|
|
79
79
|
*
|
|
80
|
-
* @
|
|
80
|
+
* @private
|
|
81
81
|
*/
|
|
82
82
|
function withSignalStore(obj) {
|
|
83
83
|
if (!obj[Signals]) {
|
|
@@ -93,7 +93,7 @@ function withSignalStore(obj) {
|
|
|
93
93
|
* Useful for pre-warming the shape of an object to ensure
|
|
94
94
|
* a key-transition to add it is not required later.
|
|
95
95
|
*
|
|
96
|
-
* @
|
|
96
|
+
* @private
|
|
97
97
|
*/
|
|
98
98
|
function initializeSignalStore(obj) {
|
|
99
99
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
@@ -168,7 +168,7 @@ function createSignalDescriptor(key, intialValue) {
|
|
|
168
168
|
* The signal will be lazily created when accessed and scoped to the
|
|
169
169
|
* instance of the object.
|
|
170
170
|
*
|
|
171
|
-
* @
|
|
171
|
+
* @private
|
|
172
172
|
*/
|
|
173
173
|
function defineSignal(obj, key, v) {
|
|
174
174
|
Object.defineProperty(obj, key, createSignalDescriptor(key, v));
|
|
@@ -177,7 +177,7 @@ function defineSignal(obj, key, v) {
|
|
|
177
177
|
/**
|
|
178
178
|
* Define a non-enumerable signal property.
|
|
179
179
|
*
|
|
180
|
-
* @
|
|
180
|
+
* @private
|
|
181
181
|
*/
|
|
182
182
|
function defineNonEnumerableSignal(obj, key, v) {
|
|
183
183
|
const desc = createSignalDescriptor(key, v);
|
|
@@ -239,6 +239,8 @@ function memoized(target, key, descriptor) {
|
|
|
239
239
|
|
|
240
240
|
/**
|
|
241
241
|
* Decorator version of creating a gate.
|
|
242
|
+
*
|
|
243
|
+
* @private
|
|
242
244
|
*/
|
|
243
245
|
function gate(_target, key, desc) {
|
|
244
246
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
@@ -3198,6 +3200,20 @@ if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
|
3198
3200
|
* @public
|
|
3199
3201
|
*/
|
|
3200
3202
|
class CacheKeyManager {
|
|
3203
|
+
/** @internal */
|
|
3204
|
+
_cache;
|
|
3205
|
+
/** @internal */
|
|
3206
|
+
|
|
3207
|
+
/** @internal */
|
|
3208
|
+
|
|
3209
|
+
/** @internal */
|
|
3210
|
+
|
|
3211
|
+
/** @internal */
|
|
3212
|
+
|
|
3213
|
+
/** @internal */
|
|
3214
|
+
|
|
3215
|
+
/** @internal */
|
|
3216
|
+
|
|
3201
3217
|
/** @internal */
|
|
3202
3218
|
|
|
3203
3219
|
constructor() {
|
|
@@ -3224,7 +3240,7 @@ class CacheKeyManager {
|
|
|
3224
3240
|
* we allow late binding of this private internal merge so that
|
|
3225
3241
|
* the cache can insert itself here to handle elimination of duplicates
|
|
3226
3242
|
*
|
|
3227
|
-
* @
|
|
3243
|
+
* @internal
|
|
3228
3244
|
*/
|
|
3229
3245
|
__configureMerge(method) {
|
|
3230
3246
|
this._merge = method || defaultMergeMethod;
|
|
@@ -3235,10 +3251,13 @@ class CacheKeyManager {
|
|
|
3235
3251
|
return this._getRecordIdentifier(resource, 2);
|
|
3236
3252
|
}
|
|
3237
3253
|
|
|
3238
|
-
/**
|
|
3239
|
-
|
|
3240
|
-
|
|
3254
|
+
/** @internal */
|
|
3255
|
+
|
|
3256
|
+
/** @internal */
|
|
3257
|
+
|
|
3258
|
+
/** @internal */
|
|
3241
3259
|
|
|
3260
|
+
/** @internal */
|
|
3242
3261
|
_getRecordIdentifier(resource, shouldGenerate) {
|
|
3243
3262
|
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_IDENTIFIERS)) {
|
|
3244
3263
|
if (getGlobalConfig().WarpDrive.debug.LOG_IDENTIFIERS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_IDENTIFIERS) {
|
|
@@ -3481,7 +3500,7 @@ class CacheKeyManager {
|
|
|
3481
3500
|
}
|
|
3482
3501
|
|
|
3483
3502
|
/**
|
|
3484
|
-
* @
|
|
3503
|
+
* @internal
|
|
3485
3504
|
*/
|
|
3486
3505
|
_mergeRecordIdentifiers(keyInfo, identifier, existingIdentifier, data) {
|
|
3487
3506
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
@@ -3570,6 +3589,15 @@ class CacheKeyManager {
|
|
|
3570
3589
|
this._reset();
|
|
3571
3590
|
}
|
|
3572
3591
|
}
|
|
3592
|
+
|
|
3593
|
+
/**
|
|
3594
|
+
* This type exists for internal use only for
|
|
3595
|
+
* where intimate contracts still exist either for
|
|
3596
|
+
* the Test Suite or for Legacy code.
|
|
3597
|
+
*
|
|
3598
|
+
* @private
|
|
3599
|
+
*/
|
|
3600
|
+
|
|
3573
3601
|
function makeResourceKey(recordIdentifier, bucket, clientOriginated) {
|
|
3574
3602
|
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
3575
3603
|
// we enforce immutability in dev
|
|
@@ -3734,6 +3762,12 @@ function addResourceToCache(cache, identifier) {
|
|
|
3734
3762
|
}
|
|
3735
3763
|
}
|
|
3736
3764
|
class CacheCapabilitiesManager {
|
|
3765
|
+
/** @internal */
|
|
3766
|
+
|
|
3767
|
+
/** @internal */
|
|
3768
|
+
|
|
3769
|
+
/** @internal */
|
|
3770
|
+
|
|
3737
3771
|
constructor(_store) {
|
|
3738
3772
|
this._store = _store;
|
|
3739
3773
|
this._willNotify = false;
|
|
@@ -3747,6 +3781,8 @@ class CacheCapabilitiesManager {
|
|
|
3747
3781
|
get identifierCache() {
|
|
3748
3782
|
return this.cacheKeyManager;
|
|
3749
3783
|
}
|
|
3784
|
+
|
|
3785
|
+
/** @internal */
|
|
3750
3786
|
_scheduleNotification(identifier, key) {
|
|
3751
3787
|
let pending = this._pendingNotifies.get(identifier);
|
|
3752
3788
|
if (!pending) {
|
|
@@ -3768,6 +3804,8 @@ class CacheCapabilitiesManager {
|
|
|
3768
3804
|
this._flushNotifications();
|
|
3769
3805
|
}
|
|
3770
3806
|
}
|
|
3807
|
+
|
|
3808
|
+
/** @internal */
|
|
3771
3809
|
_flushNotifications() {
|
|
3772
3810
|
if (this._willNotify === false) {
|
|
3773
3811
|
return;
|
|
@@ -3821,12 +3859,22 @@ class CacheCapabilitiesManager {
|
|
|
3821
3859
|
this._pendingNotifies.delete(identifier);
|
|
3822
3860
|
}
|
|
3823
3861
|
}
|
|
3862
|
+
|
|
3863
|
+
/**
|
|
3864
|
+
* This type exists for internal use only for
|
|
3865
|
+
* where intimate contracts still exist either for
|
|
3866
|
+
* the Test Suite or for Legacy code.
|
|
3867
|
+
*
|
|
3868
|
+
* @private
|
|
3869
|
+
*/
|
|
3870
|
+
|
|
3824
3871
|
if (macroCondition(getGlobalConfig().WarpDrive.deprecations.ENABLE_LEGACY_SCHEMA_SERVICE)) {
|
|
3825
3872
|
CacheCapabilitiesManager.prototype.getSchemaDefinitionService = function () {
|
|
3826
3873
|
// FIXME add deprecation for this
|
|
3827
|
-
return this.
|
|
3874
|
+
return this.schema;
|
|
3828
3875
|
};
|
|
3829
3876
|
}
|
|
3877
|
+
function assertPrivateCapabilities(manager) {}
|
|
3830
3878
|
function isDestroyable(record) {
|
|
3831
3879
|
return Boolean(record && typeof record === 'object' && typeof record.destroy === 'function');
|
|
3832
3880
|
}
|
|
@@ -3891,7 +3939,7 @@ const StoreMap = getOrSetGlobal('StoreMap', new Map());
|
|
|
3891
3939
|
|
|
3892
3940
|
/**
|
|
3893
3941
|
* We may eventually make this public, but its likely better for this to be killed off
|
|
3894
|
-
* @
|
|
3942
|
+
* @private
|
|
3895
3943
|
*/
|
|
3896
3944
|
function storeFor(record, ignoreMissing) {
|
|
3897
3945
|
const store = StoreMap.get(record);
|
|
@@ -4219,9 +4267,8 @@ function unloadRecord(instances, identifier) {
|
|
|
4219
4267
|
*/
|
|
4220
4268
|
class CacheManager {
|
|
4221
4269
|
version = '2';
|
|
4222
|
-
#cache;
|
|
4223
4270
|
constructor(cache) {
|
|
4224
|
-
this
|
|
4271
|
+
this.___cache = cache;
|
|
4225
4272
|
}
|
|
4226
4273
|
|
|
4227
4274
|
// Cache Management
|
|
@@ -4250,7 +4297,7 @@ class CacheManager {
|
|
|
4250
4297
|
* @public
|
|
4251
4298
|
*/
|
|
4252
4299
|
put(doc) {
|
|
4253
|
-
return this
|
|
4300
|
+
return this.___cache.put(doc);
|
|
4254
4301
|
}
|
|
4255
4302
|
|
|
4256
4303
|
/**
|
|
@@ -4261,7 +4308,7 @@ class CacheManager {
|
|
|
4261
4308
|
* @return {void}
|
|
4262
4309
|
*/
|
|
4263
4310
|
patch(op) {
|
|
4264
|
-
this
|
|
4311
|
+
this.___cache.patch(op);
|
|
4265
4312
|
}
|
|
4266
4313
|
|
|
4267
4314
|
/**
|
|
@@ -4272,7 +4319,7 @@ class CacheManager {
|
|
|
4272
4319
|
* @param mutation
|
|
4273
4320
|
*/
|
|
4274
4321
|
mutate(mutation) {
|
|
4275
|
-
this
|
|
4322
|
+
this.___cache.mutate(mutation);
|
|
4276
4323
|
}
|
|
4277
4324
|
|
|
4278
4325
|
/**
|
|
@@ -4308,10 +4355,10 @@ class CacheManager {
|
|
|
4308
4355
|
*/
|
|
4309
4356
|
|
|
4310
4357
|
peek(cacheKey) {
|
|
4311
|
-
return this
|
|
4358
|
+
return this.___cache.peek(cacheKey);
|
|
4312
4359
|
}
|
|
4313
4360
|
peekRemoteState(cacheKey) {
|
|
4314
|
-
return this
|
|
4361
|
+
return this.___cache.peekRemoteState(cacheKey);
|
|
4315
4362
|
}
|
|
4316
4363
|
/**
|
|
4317
4364
|
* Peek the Cache for the existing request data associated with
|
|
@@ -4322,7 +4369,7 @@ class CacheManager {
|
|
|
4322
4369
|
* @public
|
|
4323
4370
|
*/
|
|
4324
4371
|
peekRequest(key) {
|
|
4325
|
-
return this
|
|
4372
|
+
return this.___cache.peekRequest(key);
|
|
4326
4373
|
}
|
|
4327
4374
|
|
|
4328
4375
|
/**
|
|
@@ -4332,7 +4379,7 @@ class CacheManager {
|
|
|
4332
4379
|
* @return if `hasRecord` is true then calculated key changes should be returned
|
|
4333
4380
|
*/
|
|
4334
4381
|
upsert(key, data, hasRecord) {
|
|
4335
|
-
return this
|
|
4382
|
+
return this.___cache.upsert(key, data, hasRecord);
|
|
4336
4383
|
}
|
|
4337
4384
|
|
|
4338
4385
|
// Cache Forking Support
|
|
@@ -4349,7 +4396,7 @@ class CacheManager {
|
|
|
4349
4396
|
* @return {Promise<Cache>}
|
|
4350
4397
|
*/
|
|
4351
4398
|
fork() {
|
|
4352
|
-
return this
|
|
4399
|
+
return this.___cache.fork();
|
|
4353
4400
|
}
|
|
4354
4401
|
|
|
4355
4402
|
/**
|
|
@@ -4364,7 +4411,7 @@ class CacheManager {
|
|
|
4364
4411
|
* @return {Promise<void>}
|
|
4365
4412
|
*/
|
|
4366
4413
|
merge(cache) {
|
|
4367
|
-
return this
|
|
4414
|
+
return this.___cache.merge(cache);
|
|
4368
4415
|
}
|
|
4369
4416
|
|
|
4370
4417
|
/**
|
|
@@ -4400,7 +4447,7 @@ class CacheManager {
|
|
|
4400
4447
|
* @public
|
|
4401
4448
|
*/
|
|
4402
4449
|
diff() {
|
|
4403
|
-
return this
|
|
4450
|
+
return this.___cache.diff();
|
|
4404
4451
|
}
|
|
4405
4452
|
|
|
4406
4453
|
// SSR Support
|
|
@@ -4415,7 +4462,7 @@ class CacheManager {
|
|
|
4415
4462
|
* @public
|
|
4416
4463
|
*/
|
|
4417
4464
|
dump() {
|
|
4418
|
-
return this
|
|
4465
|
+
return this.___cache.dump();
|
|
4419
4466
|
}
|
|
4420
4467
|
|
|
4421
4468
|
/**
|
|
@@ -4435,7 +4482,7 @@ class CacheManager {
|
|
|
4435
4482
|
* @public
|
|
4436
4483
|
*/
|
|
4437
4484
|
hydrate(stream) {
|
|
4438
|
-
return this
|
|
4485
|
+
return this.___cache.hydrate(stream);
|
|
4439
4486
|
}
|
|
4440
4487
|
|
|
4441
4488
|
// Cache
|
|
@@ -4453,7 +4500,7 @@ class CacheManager {
|
|
|
4453
4500
|
* @public
|
|
4454
4501
|
*/
|
|
4455
4502
|
clientDidCreate(key, options) {
|
|
4456
|
-
return this
|
|
4503
|
+
return this.___cache.clientDidCreate(key, options);
|
|
4457
4504
|
}
|
|
4458
4505
|
|
|
4459
4506
|
/**
|
|
@@ -4464,7 +4511,7 @@ class CacheManager {
|
|
|
4464
4511
|
* @param key
|
|
4465
4512
|
*/
|
|
4466
4513
|
willCommit(key, context) {
|
|
4467
|
-
this
|
|
4514
|
+
this.___cache.willCommit(key, context);
|
|
4468
4515
|
}
|
|
4469
4516
|
|
|
4470
4517
|
/**
|
|
@@ -4474,7 +4521,7 @@ class CacheManager {
|
|
|
4474
4521
|
* @public
|
|
4475
4522
|
*/
|
|
4476
4523
|
didCommit(key, result) {
|
|
4477
|
-
return this
|
|
4524
|
+
return this.___cache.didCommit(key, result);
|
|
4478
4525
|
}
|
|
4479
4526
|
|
|
4480
4527
|
/**
|
|
@@ -4484,7 +4531,7 @@ class CacheManager {
|
|
|
4484
4531
|
* @public
|
|
4485
4532
|
*/
|
|
4486
4533
|
commitWasRejected(key, errors) {
|
|
4487
|
-
this
|
|
4534
|
+
this.___cache.commitWasRejected(key, errors);
|
|
4488
4535
|
}
|
|
4489
4536
|
|
|
4490
4537
|
/**
|
|
@@ -4494,7 +4541,7 @@ class CacheManager {
|
|
|
4494
4541
|
* @public
|
|
4495
4542
|
*/
|
|
4496
4543
|
unloadRecord(key) {
|
|
4497
|
-
this
|
|
4544
|
+
this.___cache.unloadRecord(key);
|
|
4498
4545
|
}
|
|
4499
4546
|
|
|
4500
4547
|
// Granular Resource Data APIs
|
|
@@ -4506,7 +4553,7 @@ class CacheManager {
|
|
|
4506
4553
|
* @public
|
|
4507
4554
|
*/
|
|
4508
4555
|
getAttr(key, propertyName) {
|
|
4509
|
-
return this
|
|
4556
|
+
return this.___cache.getAttr(key, propertyName);
|
|
4510
4557
|
}
|
|
4511
4558
|
|
|
4512
4559
|
/**
|
|
@@ -4515,7 +4562,7 @@ class CacheManager {
|
|
|
4515
4562
|
* @public
|
|
4516
4563
|
*/
|
|
4517
4564
|
getRemoteAttr(key, propertyName) {
|
|
4518
|
-
return this
|
|
4565
|
+
return this.___cache.getRemoteAttr(key, propertyName);
|
|
4519
4566
|
}
|
|
4520
4567
|
|
|
4521
4568
|
/**
|
|
@@ -4524,7 +4571,7 @@ class CacheManager {
|
|
|
4524
4571
|
* @public
|
|
4525
4572
|
*/
|
|
4526
4573
|
setAttr(key, propertyName, value) {
|
|
4527
|
-
this
|
|
4574
|
+
this.___cache.setAttr(key, propertyName, value);
|
|
4528
4575
|
}
|
|
4529
4576
|
|
|
4530
4577
|
/**
|
|
@@ -4533,7 +4580,7 @@ class CacheManager {
|
|
|
4533
4580
|
* @public
|
|
4534
4581
|
*/
|
|
4535
4582
|
changedAttrs(key) {
|
|
4536
|
-
return this
|
|
4583
|
+
return this.___cache.changedAttrs(key);
|
|
4537
4584
|
}
|
|
4538
4585
|
|
|
4539
4586
|
/**
|
|
@@ -4542,7 +4589,7 @@ class CacheManager {
|
|
|
4542
4589
|
* @public
|
|
4543
4590
|
*/
|
|
4544
4591
|
hasChangedAttrs(key) {
|
|
4545
|
-
return this
|
|
4592
|
+
return this.___cache.hasChangedAttrs(key);
|
|
4546
4593
|
}
|
|
4547
4594
|
|
|
4548
4595
|
/**
|
|
@@ -4552,7 +4599,7 @@ class CacheManager {
|
|
|
4552
4599
|
* @return the names of attributes that were restored
|
|
4553
4600
|
*/
|
|
4554
4601
|
rollbackAttrs(key) {
|
|
4555
|
-
return this
|
|
4602
|
+
return this.___cache.rollbackAttrs(key);
|
|
4556
4603
|
}
|
|
4557
4604
|
|
|
4558
4605
|
// Relationships
|
|
@@ -4583,7 +4630,7 @@ class CacheManager {
|
|
|
4583
4630
|
* @public
|
|
4584
4631
|
*/
|
|
4585
4632
|
changedRelationships(key) {
|
|
4586
|
-
return this
|
|
4633
|
+
return this.___cache.changedRelationships(key);
|
|
4587
4634
|
}
|
|
4588
4635
|
|
|
4589
4636
|
/**
|
|
@@ -4592,7 +4639,7 @@ class CacheManager {
|
|
|
4592
4639
|
* @public
|
|
4593
4640
|
*/
|
|
4594
4641
|
hasChangedRelationships(key) {
|
|
4595
|
-
return this
|
|
4642
|
+
return this.___cache.hasChangedRelationships(key);
|
|
4596
4643
|
}
|
|
4597
4644
|
|
|
4598
4645
|
/**
|
|
@@ -4606,7 +4653,7 @@ class CacheManager {
|
|
|
4606
4653
|
* @return the names of relationships that were restored
|
|
4607
4654
|
*/
|
|
4608
4655
|
rollbackRelationships(key) {
|
|
4609
|
-
return this
|
|
4656
|
+
return this.___cache.rollbackRelationships(key);
|
|
4610
4657
|
}
|
|
4611
4658
|
|
|
4612
4659
|
/**
|
|
@@ -4616,7 +4663,7 @@ class CacheManager {
|
|
|
4616
4663
|
* @return resource relationship object
|
|
4617
4664
|
*/
|
|
4618
4665
|
getRelationship(key, propertyName) {
|
|
4619
|
-
return this
|
|
4666
|
+
return this.___cache.getRelationship(key, propertyName);
|
|
4620
4667
|
}
|
|
4621
4668
|
|
|
4622
4669
|
/**
|
|
@@ -4626,7 +4673,7 @@ class CacheManager {
|
|
|
4626
4673
|
* @return resource relationship object
|
|
4627
4674
|
*/
|
|
4628
4675
|
getRemoteRelationship(key, propertyName) {
|
|
4629
|
-
return this
|
|
4676
|
+
return this.___cache.getRemoteRelationship(key, propertyName);
|
|
4630
4677
|
}
|
|
4631
4678
|
|
|
4632
4679
|
// Resource State
|
|
@@ -4639,7 +4686,7 @@ class CacheManager {
|
|
|
4639
4686
|
* @public
|
|
4640
4687
|
*/
|
|
4641
4688
|
setIsDeleted(key, isDeleted) {
|
|
4642
|
-
this
|
|
4689
|
+
this.___cache.setIsDeleted(key, isDeleted);
|
|
4643
4690
|
}
|
|
4644
4691
|
|
|
4645
4692
|
/**
|
|
@@ -4648,7 +4695,7 @@ class CacheManager {
|
|
|
4648
4695
|
* @public
|
|
4649
4696
|
*/
|
|
4650
4697
|
getErrors(key) {
|
|
4651
|
-
return this
|
|
4698
|
+
return this.___cache.getErrors(key);
|
|
4652
4699
|
}
|
|
4653
4700
|
|
|
4654
4701
|
/**
|
|
@@ -4657,7 +4704,7 @@ class CacheManager {
|
|
|
4657
4704
|
* @public
|
|
4658
4705
|
*/
|
|
4659
4706
|
isEmpty(key) {
|
|
4660
|
-
return this
|
|
4707
|
+
return this.___cache.isEmpty(key);
|
|
4661
4708
|
}
|
|
4662
4709
|
|
|
4663
4710
|
/**
|
|
@@ -4667,7 +4714,7 @@ class CacheManager {
|
|
|
4667
4714
|
* @public
|
|
4668
4715
|
*/
|
|
4669
4716
|
isNew(key) {
|
|
4670
|
-
return this
|
|
4717
|
+
return this.___cache.isNew(key);
|
|
4671
4718
|
}
|
|
4672
4719
|
|
|
4673
4720
|
/**
|
|
@@ -4677,7 +4724,7 @@ class CacheManager {
|
|
|
4677
4724
|
* @public
|
|
4678
4725
|
*/
|
|
4679
4726
|
isDeleted(key) {
|
|
4680
|
-
return this
|
|
4727
|
+
return this.___cache.isDeleted(key);
|
|
4681
4728
|
}
|
|
4682
4729
|
|
|
4683
4730
|
/**
|
|
@@ -4687,7 +4734,7 @@ class CacheManager {
|
|
|
4687
4734
|
* @public
|
|
4688
4735
|
*/
|
|
4689
4736
|
isDeletionCommitted(key) {
|
|
4690
|
-
return this
|
|
4737
|
+
return this.___cache.isDeletionCommitted(key);
|
|
4691
4738
|
}
|
|
4692
4739
|
}
|
|
4693
4740
|
function isCacheOperationValue(value) {
|
|
@@ -4936,6 +4983,15 @@ class NotificationManager {
|
|
|
4936
4983
|
this._cache.clear();
|
|
4937
4984
|
}
|
|
4938
4985
|
}
|
|
4986
|
+
|
|
4987
|
+
/**
|
|
4988
|
+
* This type exists for internal use only for
|
|
4989
|
+
* where intimate contracts still exist either for
|
|
4990
|
+
* the Test Suite or for Legacy code.
|
|
4991
|
+
*
|
|
4992
|
+
* @private
|
|
4993
|
+
*/
|
|
4994
|
+
|
|
4939
4995
|
function _flushNotification(cache, cacheKey, value, key) {
|
|
4940
4996
|
if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_NOTIFICATIONS)) {
|
|
4941
4997
|
if (getGlobalConfig().WarpDrive.debug.LOG_NOTIFICATIONS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_NOTIFICATIONS) {
|
|
@@ -5410,7 +5466,7 @@ function createRequestCollection(config) {
|
|
|
5410
5466
|
/**
|
|
5411
5467
|
* The options for {@link createLegacyLiveArray}
|
|
5412
5468
|
*
|
|
5413
|
-
* @
|
|
5469
|
+
* @private
|
|
5414
5470
|
*/
|
|
5415
5471
|
/**
|
|
5416
5472
|
* Creates a {@link LegacyLiveArray}
|
|
@@ -5565,7 +5621,7 @@ const SLICE_BATCH_SIZE = 4761;
|
|
|
5565
5621
|
* Sincerely,
|
|
5566
5622
|
* - runspired (Chris Thoburn) 08/21/2022
|
|
5567
5623
|
*
|
|
5568
|
-
* @
|
|
5624
|
+
* @private
|
|
5569
5625
|
* @param target the array to push into
|
|
5570
5626
|
* @param source the items to push into target
|
|
5571
5627
|
*/
|
|
@@ -5578,32 +5634,40 @@ function fastPush(target, source) {
|
|
|
5578
5634
|
target.push(...source);
|
|
5579
5635
|
}
|
|
5580
5636
|
/**
|
|
5581
|
-
@
|
|
5582
|
-
@
|
|
5637
|
+
@hideconstructor
|
|
5638
|
+
@private
|
|
5583
5639
|
*/
|
|
5584
5640
|
class RecordArrayManager {
|
|
5585
|
-
/**
|
|
5586
|
-
|
|
5587
|
-
|
|
5641
|
+
/** @internal */
|
|
5642
|
+
|
|
5643
|
+
/** @internal */
|
|
5644
|
+
|
|
5645
|
+
/** @internal */
|
|
5646
|
+
|
|
5647
|
+
/** @internal */
|
|
5588
5648
|
|
|
5589
5649
|
/**
|
|
5590
5650
|
* LiveArray (peekAll/findAll) array instances
|
|
5591
5651
|
* keyed by their ResourceType.
|
|
5592
|
-
*/
|
|
5593
|
-
|
|
5594
|
-
/**
|
|
5595
5652
|
*
|
|
5653
|
+
* @internal
|
|
5596
5654
|
*/
|
|
5597
5655
|
|
|
5656
|
+
/** @internal */
|
|
5657
|
+
|
|
5598
5658
|
/**
|
|
5599
5659
|
* Buffered changes to apply keyed by the array to
|
|
5600
5660
|
* which to apply them to.
|
|
5661
|
+
*
|
|
5662
|
+
* @internal
|
|
5601
5663
|
*/
|
|
5602
5664
|
|
|
5603
5665
|
/**
|
|
5604
5666
|
* An inverse map from ResourceKey to the list
|
|
5605
5667
|
* of arrays it can be found in, useful for fast updates
|
|
5606
5668
|
* when state changes to a resource occur.
|
|
5669
|
+
*
|
|
5670
|
+
* @internal
|
|
5607
5671
|
*/
|
|
5608
5672
|
|
|
5609
5673
|
/**
|
|
@@ -5613,10 +5677,17 @@ class RecordArrayManager {
|
|
|
5613
5677
|
*
|
|
5614
5678
|
* It's possible that using a Set and only storing additions instead of
|
|
5615
5679
|
* additions and deletes would be more efficient.
|
|
5680
|
+
*
|
|
5681
|
+
* @internal
|
|
5616
5682
|
*/
|
|
5617
5683
|
|
|
5684
|
+
/** @internal */
|
|
5685
|
+
|
|
5686
|
+
/** @internal */
|
|
5687
|
+
|
|
5618
5688
|
/**
|
|
5619
5689
|
* KeyedArrays are arrays associated to a specific RequestKey.
|
|
5690
|
+
* @internal
|
|
5620
5691
|
*/
|
|
5621
5692
|
|
|
5622
5693
|
/**
|
|
@@ -5628,6 +5699,7 @@ class RecordArrayManager {
|
|
|
5628
5699
|
* reduce its size by instead migrating to it functioning as
|
|
5629
5700
|
* an exclusion list. Any entry not in the list would be considered
|
|
5630
5701
|
* visible.
|
|
5702
|
+
* @internal
|
|
5631
5703
|
*/
|
|
5632
5704
|
|
|
5633
5705
|
constructor(options) {
|
|
@@ -5650,6 +5722,8 @@ class RecordArrayManager {
|
|
|
5650
5722
|
});
|
|
5651
5723
|
this._subscribeToResourceChanges();
|
|
5652
5724
|
}
|
|
5725
|
+
|
|
5726
|
+
/** @internal */
|
|
5653
5727
|
_subscribeToResourceChanges() {
|
|
5654
5728
|
this._subscription = this.store.notifications.subscribe('resource', (identifier, type) => {
|
|
5655
5729
|
const schema = this.store.schema.resource?.(identifier);
|
|
@@ -5672,6 +5746,8 @@ class RecordArrayManager {
|
|
|
5672
5746
|
}
|
|
5673
5747
|
});
|
|
5674
5748
|
}
|
|
5749
|
+
|
|
5750
|
+
/** @internal */
|
|
5675
5751
|
_syncArray(array) {
|
|
5676
5752
|
const pending = this._pending.get(array);
|
|
5677
5753
|
const isLegacyQuery = isLegacyQueryArray(array);
|
|
@@ -5715,9 +5791,7 @@ class RecordArrayManager {
|
|
|
5715
5791
|
/**
|
|
5716
5792
|
Get the `RecordArray` for a modelName, which contains all loaded records of
|
|
5717
5793
|
given modelName.
|
|
5718
|
-
@
|
|
5719
|
-
@param {String} modelName
|
|
5720
|
-
@return {RecordArray}
|
|
5794
|
+
@private
|
|
5721
5795
|
*/
|
|
5722
5796
|
liveArrayFor(type) {
|
|
5723
5797
|
let array = this._live.get(type);
|
|
@@ -5801,6 +5875,8 @@ class RecordArrayManager {
|
|
|
5801
5875
|
signal.value = shouldSyncFromCache ? 'cache-sync' : 'patch';
|
|
5802
5876
|
}
|
|
5803
5877
|
}
|
|
5878
|
+
|
|
5879
|
+
/** @internal */
|
|
5804
5880
|
_getPendingFor(identifier, includeManaged, isRemove) {
|
|
5805
5881
|
if (this.isDestroying || this.isDestroyed) {
|
|
5806
5882
|
return;
|
|
@@ -5849,6 +5925,10 @@ class RecordArrayManager {
|
|
|
5849
5925
|
}
|
|
5850
5926
|
return pending;
|
|
5851
5927
|
}
|
|
5928
|
+
|
|
5929
|
+
/**
|
|
5930
|
+
* @private
|
|
5931
|
+
*/
|
|
5852
5932
|
populateManagedArray(array, identifiers, payload) {
|
|
5853
5933
|
this._pending.delete(array);
|
|
5854
5934
|
const source = array[Context].source;
|
|
@@ -5870,6 +5950,8 @@ class RecordArrayManager {
|
|
|
5870
5950
|
disassociate(this._identifiers, array, old);
|
|
5871
5951
|
associate(this._identifiers, array, identifiers);
|
|
5872
5952
|
}
|
|
5953
|
+
|
|
5954
|
+
/** @internal */
|
|
5873
5955
|
identifierAdded(identifier) {
|
|
5874
5956
|
const changeSets = this._getPendingFor(identifier, false);
|
|
5875
5957
|
if (changeSets) {
|
|
@@ -5884,6 +5966,8 @@ class RecordArrayManager {
|
|
|
5884
5966
|
});
|
|
5885
5967
|
}
|
|
5886
5968
|
}
|
|
5969
|
+
|
|
5970
|
+
/** @internal */
|
|
5887
5971
|
identifierRemoved(identifier) {
|
|
5888
5972
|
const changeSets = this._getPendingFor(identifier, true, true);
|
|
5889
5973
|
if (changeSets) {
|
|
@@ -5898,6 +5982,8 @@ class RecordArrayManager {
|
|
|
5898
5982
|
});
|
|
5899
5983
|
}
|
|
5900
5984
|
}
|
|
5985
|
+
|
|
5986
|
+
/** @internal */
|
|
5901
5987
|
identifierChanged(identifier) {
|
|
5902
5988
|
const newState = this.store._instanceCache.recordIsLoaded(identifier, true);
|
|
5903
5989
|
|
|
@@ -5918,6 +6004,10 @@ class RecordArrayManager {
|
|
|
5918
6004
|
resume() {
|
|
5919
6005
|
this._subscribeToResourceChanges();
|
|
5920
6006
|
}
|
|
6007
|
+
|
|
6008
|
+
/**
|
|
6009
|
+
* @internal
|
|
6010
|
+
*/
|
|
5921
6011
|
clear(isClear = true) {
|
|
5922
6012
|
for (const array of this._live.values()) {
|
|
5923
6013
|
array.destroy(isClear);
|
|
@@ -5942,6 +6032,15 @@ class RecordArrayManager {
|
|
|
5942
6032
|
this.isDestroyed = true;
|
|
5943
6033
|
}
|
|
5944
6034
|
}
|
|
6035
|
+
|
|
6036
|
+
/**
|
|
6037
|
+
* This type exists for internal use only for
|
|
6038
|
+
* where intimate contracts still exist either for
|
|
6039
|
+
* the Test Suite or for Legacy code.
|
|
6040
|
+
*
|
|
6041
|
+
* @private
|
|
6042
|
+
*/
|
|
6043
|
+
|
|
5945
6044
|
function associate(ArraysCache, array, identifiers) {
|
|
5946
6045
|
for (let i = 0; i < identifiers.length; i++) {
|
|
5947
6046
|
const identifier = identifiers[i];
|
|
@@ -6036,9 +6135,13 @@ function hasRecordIdentifier(op) {
|
|
|
6036
6135
|
class RequestStateService {
|
|
6037
6136
|
/** @internal */
|
|
6038
6137
|
_pending = new Map();
|
|
6138
|
+
/** @internal */
|
|
6039
6139
|
_done = new Map();
|
|
6140
|
+
/** @internal */
|
|
6040
6141
|
_subscriptions = new Map();
|
|
6142
|
+
/** @internal */
|
|
6041
6143
|
_toFlush = [];
|
|
6144
|
+
/** @internal */
|
|
6042
6145
|
_store;
|
|
6043
6146
|
constructor(store) {
|
|
6044
6147
|
this._store = store;
|
|
@@ -6101,6 +6204,8 @@ class RequestStateService {
|
|
|
6101
6204
|
}
|
|
6102
6205
|
})() : {};
|
|
6103
6206
|
}
|
|
6207
|
+
|
|
6208
|
+
/** @internal */
|
|
6104
6209
|
_triggerSubscriptions(req) {
|
|
6105
6210
|
if (req.state === 'pending') {
|
|
6106
6211
|
this._flushRequest(req);
|
|
@@ -6113,6 +6218,8 @@ class RequestStateService {
|
|
|
6113
6218
|
});
|
|
6114
6219
|
}
|
|
6115
6220
|
}
|
|
6221
|
+
|
|
6222
|
+
/** @internal */
|
|
6116
6223
|
_flush() {
|
|
6117
6224
|
this._toFlush.forEach(req => {
|
|
6118
6225
|
this._flushRequest(req);
|
|
@@ -6218,6 +6325,14 @@ class RequestStateService {
|
|
|
6218
6325
|
}
|
|
6219
6326
|
}
|
|
6220
6327
|
|
|
6328
|
+
/**
|
|
6329
|
+
* This type exists for internal use only for
|
|
6330
|
+
* where intimate contracts still exist either for
|
|
6331
|
+
* the Test Suite or for Legacy code.
|
|
6332
|
+
*
|
|
6333
|
+
* @private
|
|
6334
|
+
*/
|
|
6335
|
+
|
|
6221
6336
|
// this import location is deprecated but breaks in 4.8 and older
|
|
6222
6337
|
// @ts-expect-error adding to globalThis
|
|
6223
6338
|
globalThis.setWarpDriveLogging = setLogging;
|
|
@@ -6520,14 +6635,16 @@ class Store extends BaseClass {
|
|
|
6520
6635
|
* @internal
|
|
6521
6636
|
*/
|
|
6522
6637
|
|
|
6523
|
-
|
|
6524
|
-
|
|
6638
|
+
/**
|
|
6639
|
+
* Available in DEBUG Only
|
|
6640
|
+
* @internal
|
|
6641
|
+
*/
|
|
6525
6642
|
|
|
6526
6643
|
/** @internal */
|
|
6527
6644
|
|
|
6528
6645
|
/** @internal */
|
|
6529
6646
|
|
|
6530
|
-
/** @
|
|
6647
|
+
/** @private */
|
|
6531
6648
|
get isDestroying() {
|
|
6532
6649
|
return this._isDestroying;
|
|
6533
6650
|
}
|
|
@@ -6535,7 +6652,7 @@ class Store extends BaseClass {
|
|
|
6535
6652
|
set isDestroying(value) {
|
|
6536
6653
|
this._isDestroying = value;
|
|
6537
6654
|
}
|
|
6538
|
-
/** @
|
|
6655
|
+
/** @private */
|
|
6539
6656
|
get isDestroyed() {
|
|
6540
6657
|
return this._isDestroyed;
|
|
6541
6658
|
}
|
|
@@ -7282,7 +7399,7 @@ class Store extends BaseClass {
|
|
|
7282
7399
|
return cache;
|
|
7283
7400
|
}
|
|
7284
7401
|
|
|
7285
|
-
/** @
|
|
7402
|
+
/** @private */
|
|
7286
7403
|
destroy() {
|
|
7287
7404
|
if (this.isDestroyed) {
|
|
7288
7405
|
// @ember/test-helpers will call destroy multiple times
|
|
@@ -7307,6 +7424,31 @@ class Store extends BaseClass {
|
|
|
7307
7424
|
return new this(args);
|
|
7308
7425
|
}
|
|
7309
7426
|
}
|
|
7427
|
+
|
|
7428
|
+
/**
|
|
7429
|
+
* This type exists for internal use only for
|
|
7430
|
+
* where intimate contracts still exist either for
|
|
7431
|
+
* the Test Suite or for Legacy code.
|
|
7432
|
+
*
|
|
7433
|
+
* @private
|
|
7434
|
+
*/
|
|
7435
|
+
|
|
7436
|
+
/**
|
|
7437
|
+
* Upgrade the type for Store to PrivateStore, which will also
|
|
7438
|
+
* upgrade any associated types to their private equivalents.
|
|
7439
|
+
*
|
|
7440
|
+
* @private
|
|
7441
|
+
*/
|
|
7442
|
+
function assertPrivateStore(store) {}
|
|
7443
|
+
/**
|
|
7444
|
+
* Upgrade the type for Store to PrivateStore, which will also
|
|
7445
|
+
* upgrade any associated types to their private equivalents.
|
|
7446
|
+
*
|
|
7447
|
+
* @private
|
|
7448
|
+
*/
|
|
7449
|
+
function isPrivateStore(store) {
|
|
7450
|
+
return store;
|
|
7451
|
+
}
|
|
7310
7452
|
if (macroCondition(getGlobalConfig().WarpDrive.deprecations.ENABLE_LEGACY_SCHEMA_SERVICE)) {
|
|
7311
7453
|
Store.prototype.getSchemaDefinitionService = function () {
|
|
7312
7454
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
@@ -8273,6 +8415,7 @@ const CacheHandler = {
|
|
|
8273
8415
|
});
|
|
8274
8416
|
store.notifications.notify(identifier, 'state', null);
|
|
8275
8417
|
}
|
|
8418
|
+
store.requestManager._pending.set(context.id, promise);
|
|
8276
8419
|
return promise;
|
|
8277
8420
|
}
|
|
8278
8421
|
|
|
@@ -8527,12 +8670,12 @@ function constructResource(type, id, lid) {
|
|
|
8527
8670
|
/**
|
|
8528
8671
|
* The options for {@link createLegacyManyArray}
|
|
8529
8672
|
*
|
|
8530
|
-
* @
|
|
8673
|
+
* @private
|
|
8531
8674
|
*/
|
|
8532
8675
|
/**
|
|
8533
8676
|
* Creates a {@link LegacyManyArray}
|
|
8534
8677
|
*
|
|
8535
|
-
* @
|
|
8678
|
+
* @private
|
|
8536
8679
|
*/
|
|
8537
8680
|
function createLegacyManyArray(options) {
|
|
8538
8681
|
const extensions = options.store.schema.CAUTION_MEGA_DANGER_ZONE_arrayExtensions ? options.store.schema.CAUTION_MEGA_DANGER_ZONE_arrayExtensions(options.field) : null;
|
|
@@ -9186,7 +9329,10 @@ class RequestSubscription {
|
|
|
9186
9329
|
|
|
9187
9330
|
/** @internal */
|
|
9188
9331
|
|
|
9189
|
-
/**
|
|
9332
|
+
/**
|
|
9333
|
+
* The Store this subscription subscribes to or the RequestManager
|
|
9334
|
+
* which issues this request.
|
|
9335
|
+
*/
|
|
9190
9336
|
|
|
9191
9337
|
constructor(store, args) {
|
|
9192
9338
|
this._args = args;
|
|
@@ -10130,4 +10276,4 @@ function getRequestState(future) {
|
|
|
10130
10276
|
}
|
|
10131
10277
|
return state;
|
|
10132
10278
|
}
|
|
10133
|
-
export {
|
|
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 };
|