@warp-drive/core 5.7.0-alpha.9 → 5.7.0-beta.0
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 +7 -20
- package/declarations/graph/-private/-edge-definition.d.ts +3 -12
- package/declarations/graph/-private/-state.d.ts +0 -87
- package/declarations/graph/-private/-utils.d.ts +5 -11
- package/declarations/graph/-private/coerce-id.d.ts +0 -6
- package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +2 -14
- package/declarations/graph/-private/edges/collection.d.ts +10 -10
- package/declarations/graph/-private/edges/implicit.d.ts +5 -5
- package/declarations/graph/-private/edges/resource.d.ts +6 -7
- package/declarations/graph/-private/graph.d.ts +17 -51
- package/declarations/graph/-private/normalize-link.d.ts +0 -6
- package/declarations/graph/-private/operations/replace-related-records.d.ts +4 -59
- package/declarations/graph/-private/operations/update-relationship.d.ts +3 -7
- package/declarations/index.d.ts +1 -1
- package/declarations/reactive/-private/default-mode.d.ts +2 -2
- package/declarations/reactive/-private/document.d.ts +11 -27
- package/declarations/reactive/-private/fields/managed-array.d.ts +4 -6
- package/declarations/reactive/-private/fields/managed-object.d.ts +2 -8
- package/declarations/reactive/-private/fields/many-array-manager.d.ts +2 -2
- package/declarations/reactive/-private/hooks.d.ts +2 -2
- package/declarations/reactive/-private/record.d.ts +42 -30
- package/declarations/reactive/-private/schema.d.ts +11 -73
- package/declarations/reactive/-private/symbols.d.ts +2 -33
- package/declarations/reactive/-private.d.ts +1 -1
- package/declarations/reactive.d.ts +277 -1
- package/declarations/request/-private/context.d.ts +3 -5
- package/declarations/request/-private/fetch.d.ts +2 -2
- package/declarations/request/-private/manager.d.ts +24 -28
- package/declarations/request/-private/types.d.ts +22 -24
- package/declarations/request/-private/utils.d.ts +44 -2
- package/declarations/store/-private/cache-handler/handler.d.ts +2 -8
- package/declarations/store/-private/cache-handler/types.d.ts +10 -10
- package/declarations/store/-private/cache-handler/utils.d.ts +4 -5
- package/declarations/store/-private/caches/instance-cache.d.ts +21 -20
- package/declarations/store/-private/debug/utils.d.ts +1 -0
- package/declarations/store/-private/default-cache-policy.d.ts +25 -40
- package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +24 -15
- package/declarations/store/-private/{caches/identifier-cache.d.ts → managers/cache-key-manager.d.ts} +35 -53
- package/declarations/store/-private/managers/cache-manager.d.ts +46 -111
- package/declarations/store/-private/managers/notification-manager.d.ts +30 -45
- package/declarations/store/-private/managers/record-array-manager.d.ts +44 -41
- package/declarations/store/-private/network/request-cache.d.ts +21 -25
- package/declarations/store/-private/new-core-tmp/expensive-subscription.d.ts +24 -0
- package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts +3 -41
- package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts +14 -29
- package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +24 -3
- package/declarations/store/-private/new-core-tmp/request-state.d.ts +132 -37
- package/declarations/store/-private/new-core-tmp/request-subscription.d.ts +51 -135
- package/declarations/store/-private/record-arrays/-utils.d.ts +80 -0
- package/declarations/store/-private/record-arrays/legacy-live-array.d.ts +81 -0
- package/declarations/store/-private/record-arrays/legacy-many-array.d.ts +133 -0
- package/declarations/store/-private/record-arrays/legacy-query.d.ts +81 -0
- package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +1 -124
- package/declarations/store/-private/record-arrays/resource-array.d.ts +67 -0
- package/declarations/store/-private/store-service.d.ts +156 -106
- package/declarations/store/-private/utils/coerce-id.d.ts +0 -6
- package/declarations/store/-private.d.ts +11 -13
- package/declarations/store/-types/q/cache-capabilities-manager.d.ts +15 -24
- package/declarations/store/-types/q/identifier.d.ts +9 -6
- package/declarations/store/-types/q/record-instance.d.ts +0 -1
- package/declarations/store/-types/q/schema-service.d.ts +9 -9
- package/declarations/store/-types/q/store.d.ts +6 -7
- package/declarations/store/deprecated/-private.d.ts +12 -24
- package/declarations/store/deprecated/store.d.ts +11 -16
- package/declarations/types/-private.d.ts +1 -1
- package/declarations/types/cache/aliases.d.ts +0 -11
- package/declarations/types/cache/change.d.ts +2 -2
- package/declarations/types/cache/mutations.d.ts +13 -37
- package/declarations/types/cache/operations.d.ts +115 -32
- package/declarations/types/cache/relationship.d.ts +4 -7
- package/declarations/types/cache.d.ts +51 -125
- package/declarations/types/graph.d.ts +12 -12
- package/declarations/types/identifier.d.ts +52 -78
- package/declarations/types/params.d.ts +2 -3
- package/declarations/types/request.d.ts +66 -42
- package/declarations/types/schema/concepts.d.ts +2 -2
- package/declarations/types/schema/fields.d.ts +30 -3
- package/declarations/types/spec/document.d.ts +6 -10
- package/declarations/types/spec/json-api-raw.d.ts +6 -9
- package/declarations/types.d.ts +0 -1
- package/declarations/utils/string.d.ts +2 -3
- package/dist/{configure-B48bFHOl.js → configure-C3x8YXzL.js} +5 -5
- package/dist/configure.js +1 -1
- package/dist/{context-COmAnXUQ.js → context-C_7OLieY.js} +48 -6
- package/dist/graph/-private.js +137 -144
- package/dist/index.js +25 -14
- package/dist/reactive/-private.js +1 -1
- package/dist/reactive.js +144 -1926
- package/dist/{request-state-CeN66aML.js → request-state-C955e0AL.js} +5968 -3033
- package/dist/request.js +1 -1
- package/dist/store/-private.js +2 -3
- package/dist/store.js +32 -44
- package/dist/{symbols-SIstXMLI.js → symbols-sql1_mdx.js} +3 -8
- package/dist/types/-private.js +1 -1
- package/dist/types/identifier.js +19 -45
- package/dist/types/request.js +45 -3
- package/dist/types/schema/fields.js +6 -0
- package/dist/utils/string.js +2 -2
- package/package.json +11 -11
- package/declarations/store/-private/caches/cache-utils.d.ts +0 -12
- package/declarations/store/-private/record-arrays/identifier-array.d.ts +0 -147
- package/declarations/store/-private/record-arrays/many-array.d.ts +0 -197
- package/dist/handler-SdXlte1w.js +0 -339
|
@@ -23,7 +23,8 @@ export interface PaginationLinks extends Links {
|
|
|
23
23
|
* to address data that may not be available synchronously.
|
|
24
24
|
*
|
|
25
25
|
* [JSON:API Spec](https://jsonapi.org/format/#document-resource-identifier-objects)
|
|
26
|
-
*
|
|
26
|
+
*
|
|
27
|
+
* @private
|
|
27
28
|
*/
|
|
28
29
|
export interface ExistingResourceIdentifierObject<T extends string = string> {
|
|
29
30
|
id: string;
|
|
@@ -42,7 +43,7 @@ export interface ExistingResourceIdentifierObject<T extends string = string> {
|
|
|
42
43
|
* is `lid` considered optional.
|
|
43
44
|
*
|
|
44
45
|
* [Identifiers RFC](https://github.com/emberjs/rfcs/blob/main/text/0403-ember-data-identifiers.md#ember-data--identifiers)
|
|
45
|
-
*
|
|
46
|
+
*
|
|
46
47
|
*/
|
|
47
48
|
lid?: string;
|
|
48
49
|
/**
|
|
@@ -50,7 +51,7 @@ export interface ExistingResourceIdentifierObject<T extends string = string> {
|
|
|
50
51
|
* `ember-data` ignores `meta` on `ResourceIdentifierObjects`
|
|
51
52
|
*
|
|
52
53
|
* @ignored this property goes un-utilized and will be lost
|
|
53
|
-
* @
|
|
54
|
+
* @private
|
|
54
55
|
*/
|
|
55
56
|
meta?: Meta;
|
|
56
57
|
}
|
|
@@ -58,7 +59,7 @@ export interface ExistingResourceIdentifierObject<T extends string = string> {
|
|
|
58
59
|
* Serves as a reference to a resource created on the client
|
|
59
60
|
* but not yet persisted.
|
|
60
61
|
*
|
|
61
|
-
* @
|
|
62
|
+
* @private
|
|
62
63
|
*/
|
|
63
64
|
export interface NewResourceIdentifierObject<T extends string = string> {
|
|
64
65
|
/**
|
|
@@ -68,14 +69,12 @@ export interface NewResourceIdentifierObject<T extends string = string> {
|
|
|
68
69
|
*
|
|
69
70
|
* `id` will be `null` in this case.
|
|
70
71
|
*
|
|
71
|
-
* @internal
|
|
72
72
|
*/
|
|
73
73
|
id: string | null;
|
|
74
74
|
type: T;
|
|
75
75
|
/**
|
|
76
76
|
* Resources newly created on the client _will always_
|
|
77
77
|
* have an `lid` assigned immediately and available.
|
|
78
|
-
* @internal
|
|
79
78
|
*/
|
|
80
79
|
lid: string;
|
|
81
80
|
}
|
|
@@ -83,7 +82,6 @@ export interface ResourceIdentifier {
|
|
|
83
82
|
lid: string;
|
|
84
83
|
}
|
|
85
84
|
export type ResourceIdentifierObject<T extends string = string> = ResourceIdentifier | ExistingResourceIdentifierObject<T> | NewResourceIdentifierObject<T>;
|
|
86
|
-
// TODO disallow NewResource, make narrowable
|
|
87
85
|
export interface SingleResourceRelationship<T = ExistingResourceIdentifierObject | NewResourceIdentifierObject> {
|
|
88
86
|
data?: T | null;
|
|
89
87
|
meta?: Meta;
|
|
@@ -98,7 +96,6 @@ export type InnerRelationshipDocument<T = ExistingResourceIdentifierObject | New
|
|
|
98
96
|
export type ResourceRelationshipsObject<T = ExistingResourceIdentifierObject | NewResourceIdentifierObject> = Record<string, InnerRelationshipDocument<T>>;
|
|
99
97
|
/**
|
|
100
98
|
* Contains the data for an existing resource in JSON:API format
|
|
101
|
-
* @internal
|
|
102
99
|
*/
|
|
103
100
|
export interface ExistingResourceObject<T extends string = string> extends ExistingResourceIdentifierObject<T> {
|
|
104
101
|
meta?: Meta;
|
|
@@ -136,7 +133,7 @@ export type CollectionResourceDocument<T extends string = string> = Document & {
|
|
|
136
133
|
* These documents should follow the JSON:API spec but do not
|
|
137
134
|
* have the same level of guarantees as their `spec` counterparts.
|
|
138
135
|
*
|
|
139
|
-
* @
|
|
136
|
+
* @private
|
|
140
137
|
*/
|
|
141
138
|
export type JsonApiDocument<T extends string = string> = EmptyResourceDocument | SingleResourceDocument<T> | CollectionResourceDocument<T>;
|
|
142
139
|
export {};
|
package/declarations/types.d.ts
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export type { StableRecordIdentifier, ResourceKey } from "./types/identifier.js";
|
|
8
8
|
export type { CacheCapabilitiesManager } from "./store/-types/q/cache-capabilities-manager.js";
|
|
9
|
-
// FIXME this should come from somewhere more intelligent
|
|
10
9
|
export type { ModelSchema } from "./store/deprecated/-private.js";
|
|
11
10
|
export type { SchemaService } from "./store/-types/q/schema-service.js";
|
|
12
11
|
export type { BaseFinderOptions, FindRecordOptions, LegacyResourceQuery, QueryOptions, FindAllOptions } from "./store/-types/q/store.js";
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* and by `@warp-drive/utilities/string`. It is not intended
|
|
17
17
|
* for use outside of these modules at this time.
|
|
18
18
|
*
|
|
19
|
-
* @
|
|
19
|
+
* @private
|
|
20
20
|
*/
|
|
21
21
|
export declare class LRUCache<
|
|
22
22
|
T,
|
|
@@ -25,7 +25,6 @@ export declare class LRUCache<
|
|
|
25
25
|
size: number;
|
|
26
26
|
state: Map<T, V>;
|
|
27
27
|
doWork: (k: T) => V;
|
|
28
|
-
// debug stats
|
|
29
28
|
_hits: number;
|
|
30
29
|
_misses: number;
|
|
31
30
|
_ejected: number;
|
|
@@ -43,6 +42,6 @@ export declare const STRING_DASHERIZE_CACHE: LRUCache<string, string>;
|
|
|
43
42
|
* This version is only in this location to support a deprecated
|
|
44
43
|
* behavior in the core package and will be removed in a future.
|
|
45
44
|
*
|
|
46
|
-
* @
|
|
45
|
+
* @private
|
|
47
46
|
*/
|
|
48
47
|
export declare function dasherize(str: string): string;
|
|
@@ -39,7 +39,7 @@ const OBJECT_SIGNAL = getOrSetGlobal('#{}', Symbol('#{}'));
|
|
|
39
39
|
*
|
|
40
40
|
* It may be an array of signals or a single signal.
|
|
41
41
|
*
|
|
42
|
-
* @
|
|
42
|
+
* @private
|
|
43
43
|
*/
|
|
44
44
|
|
|
45
45
|
/**
|
|
@@ -112,7 +112,7 @@ function setupSignals(buildConfig) {
|
|
|
112
112
|
/**
|
|
113
113
|
* Internal method for consuming the configured `createSignal` hook
|
|
114
114
|
*
|
|
115
|
-
* @
|
|
115
|
+
* @private
|
|
116
116
|
*/
|
|
117
117
|
function createSignal(obj, key) {
|
|
118
118
|
const signalHooks = peekTransient('signalHooks');
|
|
@@ -127,7 +127,7 @@ function createSignal(obj, key) {
|
|
|
127
127
|
/**
|
|
128
128
|
* Internal method for consuming the configured `consumeSignal` hook
|
|
129
129
|
*
|
|
130
|
-
* @
|
|
130
|
+
* @private
|
|
131
131
|
*/
|
|
132
132
|
function consumeSignal(signal) {
|
|
133
133
|
const signalHooks = peekTransient('signalHooks');
|
|
@@ -142,7 +142,7 @@ function consumeSignal(signal) {
|
|
|
142
142
|
/**
|
|
143
143
|
* Internal method for consuming the configured `notifySignal` hook
|
|
144
144
|
*
|
|
145
|
-
* @
|
|
145
|
+
* @private
|
|
146
146
|
*/
|
|
147
147
|
function notifySignal(signal) {
|
|
148
148
|
const signalHooks = peekTransient('signalHooks');
|
|
@@ -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,
|
|
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-
|
|
1
|
+
export { s as setupSignals } from "./configure-C3x8YXzL.js";
|
|
@@ -306,6 +306,19 @@ function ensureDoc(owner, content, isError) {
|
|
|
306
306
|
content: content
|
|
307
307
|
};
|
|
308
308
|
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Additional properties exposed on errors thrown by the
|
|
312
|
+
* {@link Fetch | Fetch Handler}.
|
|
313
|
+
*
|
|
314
|
+
* In the case of an Abort or system/browser level issue,
|
|
315
|
+
* this extends {@link DOMException}.
|
|
316
|
+
*
|
|
317
|
+
* Else it extends from {@link AggregateError} if the
|
|
318
|
+
* response includes an array of errors, falling back
|
|
319
|
+
* to {@link Error} as its base.
|
|
320
|
+
*/
|
|
321
|
+
|
|
309
322
|
function enhanceReason(reason) {
|
|
310
323
|
return new DOMException(reason || 'The user aborted a request.', 'AbortError');
|
|
311
324
|
}
|
|
@@ -437,6 +450,17 @@ function upgradePromise(promise, future) {
|
|
|
437
450
|
promise.onFinalize = future.onFinalize;
|
|
438
451
|
promise.id = future.id;
|
|
439
452
|
promise.lid = future.lid;
|
|
453
|
+
promise.requester = future.requester;
|
|
454
|
+
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
455
|
+
// @ts-expect-error
|
|
456
|
+
promise.toJSON = () => {
|
|
457
|
+
const id = 'Future<' + promise.id + '>';
|
|
458
|
+
if (promise.lid) {
|
|
459
|
+
return `${id} (${promise.lid.lid})`;
|
|
460
|
+
}
|
|
461
|
+
return id;
|
|
462
|
+
};
|
|
463
|
+
}
|
|
440
464
|
return promise;
|
|
441
465
|
}
|
|
442
466
|
function createFuture(owner) {
|
|
@@ -464,6 +488,17 @@ function createFuture(owner) {
|
|
|
464
488
|
};
|
|
465
489
|
promise.id = owner.requestId;
|
|
466
490
|
promise.lid = owner.god.identifier;
|
|
491
|
+
promise.requester = owner.god.requester;
|
|
492
|
+
if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
|
|
493
|
+
// @ts-expect-error
|
|
494
|
+
promise.toJSON = () => {
|
|
495
|
+
const id = 'Future<' + promise.id + '>';
|
|
496
|
+
if (promise.lid) {
|
|
497
|
+
return `${id} (${promise.lid.lid})`;
|
|
498
|
+
}
|
|
499
|
+
return id;
|
|
500
|
+
};
|
|
501
|
+
}
|
|
467
502
|
deferred.promise = promise;
|
|
468
503
|
return deferred;
|
|
469
504
|
}
|
|
@@ -604,19 +639,24 @@ class ContextOwner {
|
|
|
604
639
|
}
|
|
605
640
|
}
|
|
606
641
|
class Context {
|
|
607
|
-
|
|
642
|
+
/** @internal */
|
|
643
|
+
|
|
644
|
+
/** @internal */
|
|
645
|
+
|
|
646
|
+
/** @internal */
|
|
647
|
+
|
|
608
648
|
constructor(owner, isCacheHandler) {
|
|
609
649
|
this.id = owner.requestId;
|
|
610
|
-
this
|
|
650
|
+
this.___owner = owner;
|
|
611
651
|
this.request = owner.enhancedRequest;
|
|
612
652
|
this._isCacheHandler = isCacheHandler;
|
|
613
653
|
this._finalized = false;
|
|
614
654
|
}
|
|
615
655
|
setStream(stream) {
|
|
616
|
-
this
|
|
656
|
+
this.___owner.setStream(stream);
|
|
617
657
|
}
|
|
618
658
|
setResponse(response) {
|
|
619
|
-
this
|
|
659
|
+
this.___owner.setResponse(response);
|
|
620
660
|
}
|
|
621
661
|
setIdentifier(identifier) {
|
|
622
662
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
@@ -624,11 +664,13 @@ class Context {
|
|
|
624
664
|
throw new Error(`setIdentifier may only be used synchronously from a CacheHandler`);
|
|
625
665
|
}
|
|
626
666
|
})(identifier && this._isCacheHandler && !this._finalized) : {};
|
|
627
|
-
this
|
|
667
|
+
this.___owner.god.identifier = identifier;
|
|
628
668
|
}
|
|
629
669
|
get hasRequestedStream() {
|
|
630
|
-
return this
|
|
670
|
+
return this.___owner.hasRequestedStream;
|
|
631
671
|
}
|
|
672
|
+
|
|
673
|
+
/** @private */
|
|
632
674
|
_finalize() {
|
|
633
675
|
this._finalized = true;
|
|
634
676
|
}
|