@warp-drive/core 5.7.0-alpha.13 → 5.7.0-alpha.14
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/reactive/-private/symbols.d.ts +0 -1
- package/declarations/request/-private/fetch.d.ts +2 -2
- package/declarations/request/-private/utils.d.ts +44 -2
- package/declarations/store/-private/cache-handler/types.d.ts +1 -1
- package/declarations/store/-private/managers/notification-manager.d.ts +4 -7
- package/declarations/store/-private/managers/record-array-manager.d.ts +72 -21
- package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +1 -0
- package/declarations/store/-private/record-arrays/-utils.d.ts +82 -0
- package/declarations/store/-private/record-arrays/legacy-live-array.d.ts +89 -0
- package/declarations/store/-private/record-arrays/{many-array.d.ts → legacy-many-array.d.ts} +43 -101
- package/declarations/store/-private/record-arrays/legacy-query.d.ts +103 -0
- package/declarations/store/-private/record-arrays/resource-array.d.ts +82 -0
- package/declarations/store/-private/store-service.d.ts +3 -3
- package/declarations/store/-private.d.ts +4 -2
- package/declarations/store/deprecated/store.d.ts +8 -9
- package/declarations/types/-private.d.ts +1 -1
- package/declarations/types/cache/operations.d.ts +97 -14
- package/declarations/types/request.d.ts +21 -0
- package/declarations/types/schema/fields.d.ts +1 -1
- package/dist/{context-COmAnXUQ.js → context-kQXhkeBj.js} +13 -0
- package/dist/graph/-private.js +4 -4
- package/dist/index.js +6 -2
- package/dist/reactive/-private.js +1 -1
- package/dist/reactive.js +3 -3
- package/dist/{request-state-BWYju5O9.js → request-state-CCrTjb0Z.js} +861 -799
- package/dist/request.js +1 -1
- package/dist/store/-private.js +1 -1
- package/dist/store.js +2 -1
- package/dist/{symbols-BoONANuz.js → symbols-C5p2hcy9.js} +0 -1
- package/dist/types/-private.js +1 -1
- package/dist/types/request.js +27 -0
- package/dist/types/schema/fields.js +2 -0
- package/package.json +3 -3
- package/declarations/store/-private/record-arrays/identifier-array.d.ts +0 -147
package/dist/request.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { c as createDeferred, g as getPromiseResult, s as setPromiseResult } from "./context-
|
|
1
|
+
export { c as createDeferred, g as getPromiseResult, s as setPromiseResult } from "./context-kQXhkeBj.js";
|
package/dist/store/-private.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { C as CacheHandler,
|
|
1
|
+
export { C as CacheHandler, D as DISPOSE, R as RecordArrayManager, x as Signals, S as Store, g as StoreMap, _ as _clearCaches, n as _deprecatingNormalize, b as coerceId, c as constructResource, B as consumeInternalSignal, h as createLegacyManyArray, m as createRequestSubscription, v as defineGate, w as defineNonEnumerableSignal, u as defineSignal, e as ensureStringId, t as entangleSignal, f as fastPush, q as gate, E as getOrCreateInternalSignal, k as getPromiseState, o as getRequestState, a as isDocumentIdentifier, i as isStableIdentifier, l as log, j as logGroup, p as memoized, A as notifyInternalSignal, y as peekInternalSignal, r as recordIdentifierFor, d as setRecordIdentifier, s as storeFor, z as withSignalStore } from "../request-state-CCrTjb0Z.js";
|
|
2
2
|
export { A as ARRAY_SIGNAL, O as OBJECT_SIGNAL, c as createMemo, w as waitFor } from "../configure-B48bFHOl.js";
|
package/dist/store.js
CHANGED
|
@@ -397,7 +397,8 @@ class DefaultCachePolicy {
|
|
|
397
397
|
// TODO batch notifications
|
|
398
398
|
set.forEach(id => {
|
|
399
399
|
storeCache.invalidated.add(id);
|
|
400
|
-
|
|
400
|
+
// @ts-expect-error
|
|
401
|
+
notifications.notify(id, 'invalidated', null);
|
|
401
402
|
});
|
|
402
403
|
}
|
|
403
404
|
}
|
|
@@ -32,7 +32,6 @@ import { getOrSetGlobal } from './types/-private.js';
|
|
|
32
32
|
// debugging DX and as a safe way to provide an intimate contract on public objects.
|
|
33
33
|
|
|
34
34
|
const SOURCE = getOrSetGlobal('SOURCE', Symbol('#source'));
|
|
35
|
-
getOrSetGlobal('MUTATE', Symbol('#update'));
|
|
36
35
|
const Destroy = getOrSetGlobal('Destroy', Symbol.dispose || Symbol.for('Dispose'));
|
|
37
36
|
const Checkout = getOrSetGlobal('Checkout', Symbol('Checkout'));
|
|
38
37
|
const Context = getOrSetGlobal('Context', Symbol('Context'));
|
package/dist/types/-private.js
CHANGED
|
@@ -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.
|
|
3
|
+
const version = "5.7.0-alpha.14";
|
|
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/dist/types/request.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { getOrSetUniversal, getOrSetGlobal } from './-private.js';
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4
|
+
|
|
2
5
|
const SkipCache = getOrSetUniversal('SkipCache', Symbol.for('wd:skip-cache'));
|
|
3
6
|
const EnableHydration = getOrSetUniversal('EnableHydration', Symbol.for('wd:enable-hydration'));
|
|
4
7
|
const IS_FUTURE = getOrSetGlobal('IS_FUTURE', Symbol('IS_FUTURE'));
|
|
@@ -9,6 +12,30 @@ const STRUCTURED = getOrSetGlobal('DOC', Symbol('DOC'));
|
|
|
9
12
|
*
|
|
10
13
|
*/
|
|
11
14
|
|
|
15
|
+
/**
|
|
16
|
+
* When a handler chain resolves, it returns an object
|
|
17
|
+
* containing the original request, the response set by the handler
|
|
18
|
+
* chain (if any), and the processed content.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* When a handler chain rejects, it throws an Error that maintains the
|
|
23
|
+
* `{ request, response, content }` shape but is also an Error instance
|
|
24
|
+
* itself.
|
|
25
|
+
*
|
|
26
|
+
* If using the error originates from the {@link Fetch | Fetch Handler}
|
|
27
|
+
* the error will be a {@link FetchError}
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A union of the resolve/reject data types for a request.
|
|
32
|
+
*
|
|
33
|
+
* See the docs for:
|
|
34
|
+
*
|
|
35
|
+
* - {@link StructuredDataDocument} (resolved/successful requests)
|
|
36
|
+
* - {@link StructuredErrorDocument} (rejected/failed requests)
|
|
37
|
+
*/
|
|
38
|
+
|
|
12
39
|
/**
|
|
13
40
|
* JavaScript's native Request class.
|
|
14
41
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warp-drive/core",
|
|
3
|
-
"version": "5.7.0-alpha.
|
|
3
|
+
"version": "5.7.0-alpha.14",
|
|
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.
|
|
40
|
+
"@warp-drive/build-config": "5.7.0-alpha.14"
|
|
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.
|
|
46
|
+
"@warp-drive/internal-config": "5.7.0-alpha.14",
|
|
47
47
|
"decorator-transforms": "^2.3.0",
|
|
48
48
|
"ember-source": "~6.3.0",
|
|
49
49
|
"expect-type": "^1.2.1",
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import type { BaseFinderOptions } from "../../../types.js";
|
|
2
|
-
import type { LocalRelationshipOperation } from "../../../types/graph.js";
|
|
3
|
-
import type { StableDocumentIdentifier, StableRecordIdentifier } from "../../../types/identifier.js";
|
|
4
|
-
import type { TypeFromInstanceOrString } from "../../../types/record.js";
|
|
5
|
-
import type { ImmutableRequestInfo } from "../../../types/request.js";
|
|
6
|
-
import type { LegacyHasManyField, LinksModeHasManyField } from "../../../types/schema/fields.js";
|
|
7
|
-
import type { Links, PaginationLinks } from "../../../types/spec/json-api-raw.js";
|
|
8
|
-
import type { RecordArrayManager } from "../managers/record-array-manager.js";
|
|
9
|
-
import type { WarpDriveSignal } from "../new-core-tmp/reactivity/internal.js";
|
|
10
|
-
import { ARRAY_SIGNAL } from "../new-core-tmp/reactivity/internal.js";
|
|
11
|
-
import type { Store } from "../store-service.js";
|
|
12
|
-
import { NativeProxy } from "./native-proxy-type-fix.js";
|
|
13
|
-
export declare const SOURCE: "___(unique) Symbol(#source)";
|
|
14
|
-
export declare const MUTATE: "___(unique) Symbol(#update)";
|
|
15
|
-
declare const IS_COLLECTION: "___(unique) Symbol(IS_COLLECTION)";
|
|
16
|
-
export type IdentifierArrayCreateOptions<T = unknown> = {
|
|
17
|
-
identifiers: StableRecordIdentifier<TypeFromInstanceOrString<T>>[];
|
|
18
|
-
type?: TypeFromInstanceOrString<T>;
|
|
19
|
-
store: Store;
|
|
20
|
-
allowMutation: boolean;
|
|
21
|
-
manager: MinimumManager;
|
|
22
|
-
field?: LegacyHasManyField | LinksModeHasManyField;
|
|
23
|
-
links?: Links | PaginationLinks | null;
|
|
24
|
-
meta?: Record<string, unknown> | null;
|
|
25
|
-
identifier?: StableDocumentIdentifier | null;
|
|
26
|
-
[MUTATE]?(target: StableRecordIdentifier[], receiver: typeof NativeProxy<StableRecordIdentifier[], T[]>, prop: string, args: unknown[], _SIGNAL: WarpDriveSignal): unknown;
|
|
27
|
-
};
|
|
28
|
-
type PromiseTo<T> = Omit<Promise<T>, typeof Symbol.toStringTag>;
|
|
29
|
-
type PromiseManyArray<T> = {
|
|
30
|
-
length: number;
|
|
31
|
-
content: IdentifierArray<T> | null;
|
|
32
|
-
promise: Promise<IdentifierArray<T>> | null;
|
|
33
|
-
} & PromiseTo<IdentifierArray<T>>;
|
|
34
|
-
export type MinimumManager = {
|
|
35
|
-
_syncArray: (array: IdentifierArray) => void;
|
|
36
|
-
mutate?(mutation: LocalRelationshipOperation): void;
|
|
37
|
-
reloadHasMany?<T>(key: string, options?: BaseFinderOptions): Promise<IdentifierArray<T>> | PromiseManyArray<T>;
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
A record array is an array that contains records of a certain type (or modelName).
|
|
41
|
-
The record array materializes records as needed when they are retrieved for the first
|
|
42
|
-
time. You should not create record arrays yourself. Instead, an instance of
|
|
43
|
-
`RecordArray` or its subclasses will be returned by your application's store
|
|
44
|
-
in response to queries.
|
|
45
|
-
|
|
46
|
-
This class should not be imported and instantiated by consuming applications.
|
|
47
|
-
|
|
48
|
-
@class RecordArray
|
|
49
|
-
@public
|
|
50
|
-
*/
|
|
51
|
-
export interface IdentifierArray<T = unknown> extends Omit<Array<T>, "[]"> {
|
|
52
|
-
[IS_COLLECTION]: boolean;
|
|
53
|
-
[ARRAY_SIGNAL]: WarpDriveSignal;
|
|
54
|
-
[SOURCE]: StableRecordIdentifier[];
|
|
55
|
-
}
|
|
56
|
-
export declare class IdentifierArray<T = unknown> {
|
|
57
|
-
DEPRECATED_CLASS_NAME: string;
|
|
58
|
-
/**
|
|
59
|
-
The flag to signal a `RecordArray` is currently loading data.
|
|
60
|
-
Example
|
|
61
|
-
```javascript
|
|
62
|
-
let people = store.peekAll('person');
|
|
63
|
-
people.isUpdating; // false
|
|
64
|
-
people.update();
|
|
65
|
-
people.isUpdating; // true
|
|
66
|
-
```
|
|
67
|
-
@property isUpdating
|
|
68
|
-
@public
|
|
69
|
-
@type Boolean
|
|
70
|
-
*/
|
|
71
|
-
isUpdating: boolean;
|
|
72
|
-
isLoaded: boolean;
|
|
73
|
-
isDestroying: boolean;
|
|
74
|
-
isDestroyed: boolean;
|
|
75
|
-
_updatingPromise: Promise<IdentifierArray<T>> | null;
|
|
76
|
-
readonly identifier: StableDocumentIdentifier | null;
|
|
77
|
-
links: Links | PaginationLinks | null;
|
|
78
|
-
meta: Record<string, unknown> | null;
|
|
79
|
-
modelName?: TypeFromInstanceOrString<T>;
|
|
80
|
-
/**
|
|
81
|
-
The store that created this record array.
|
|
82
|
-
|
|
83
|
-
@property store
|
|
84
|
-
@private
|
|
85
|
-
@type Store
|
|
86
|
-
*/
|
|
87
|
-
store: Store;
|
|
88
|
-
_manager: MinimumManager;
|
|
89
|
-
destroy(clear: boolean): void;
|
|
90
|
-
constructor(options: IdentifierArrayCreateOptions<T>);
|
|
91
|
-
/**
|
|
92
|
-
Used to get the latest version of all of the records in this array
|
|
93
|
-
from the adapter.
|
|
94
|
-
|
|
95
|
-
Example
|
|
96
|
-
|
|
97
|
-
```javascript
|
|
98
|
-
let people = store.peekAll('person');
|
|
99
|
-
people.isUpdating; // false
|
|
100
|
-
|
|
101
|
-
people.update().then(function() {
|
|
102
|
-
people.isUpdating; // false
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
people.isUpdating; // true
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
@public
|
|
109
|
-
*/
|
|
110
|
-
update(): Promise<IdentifierArray<T>>;
|
|
111
|
-
/*
|
|
112
|
-
Update this Array and return a promise which resolves once the update
|
|
113
|
-
is finished.
|
|
114
|
-
*/
|
|
115
|
-
_update(): Promise<IdentifierArray<T>>;
|
|
116
|
-
// TODO deprecate
|
|
117
|
-
/**
|
|
118
|
-
Saves all of the records in the `RecordArray`.
|
|
119
|
-
|
|
120
|
-
Example
|
|
121
|
-
|
|
122
|
-
```javascript
|
|
123
|
-
let messages = store.peekAll('message');
|
|
124
|
-
messages.forEach(function(message) {
|
|
125
|
-
message.hasBeenSeen = true;
|
|
126
|
-
});
|
|
127
|
-
messages.save();
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
@public
|
|
131
|
-
@return {Promise<IdentifierArray>} promise
|
|
132
|
-
*/
|
|
133
|
-
save(): Promise<IdentifierArray>;
|
|
134
|
-
}
|
|
135
|
-
export type CollectionCreateOptions = IdentifierArrayCreateOptions & {
|
|
136
|
-
manager: RecordArrayManager;
|
|
137
|
-
query: ImmutableRequestInfo | Record<string, unknown> | null;
|
|
138
|
-
isLoaded: boolean;
|
|
139
|
-
};
|
|
140
|
-
export declare class Collection<T = unknown> extends IdentifierArray<T> {
|
|
141
|
-
query: ImmutableRequestInfo | Record<string, unknown> | null;
|
|
142
|
-
_manager: RecordArrayManager;
|
|
143
|
-
constructor(options: CollectionCreateOptions);
|
|
144
|
-
_update(): Promise<Collection<T>>;
|
|
145
|
-
destroy(clear: boolean): void;
|
|
146
|
-
}
|
|
147
|
-
export {};
|