@warp-drive/core 5.8.0-alpha.40 → 5.8.0-alpha.41
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/configure.d.ts +1 -1
- package/declarations/reactive/-private/default-mode.d.ts +1 -1
- package/declarations/reactive/-private/fields/extension.d.ts +1 -1
- package/declarations/reactive/-private/fields/managed-array.d.ts +2 -2
- package/declarations/reactive/-private/fields/managed-object.d.ts +1 -1
- package/declarations/reactive.d.ts +2 -3
- package/declarations/signals/-leaked.d.ts +2 -0
- package/declarations/signals/-private.d.ts +6 -0
- package/declarations/{store/-private/new-core-tmp → signals}/promise-state.d.ts +1 -1
- package/declarations/{store/-private/new-core-tmp → signals}/request-state.d.ts +5 -5
- package/declarations/{store/-private/new-core-tmp → signals}/request-subscription.d.ts +4 -4
- package/declarations/store/-private/cache-handler/types.d.ts +2 -16
- package/declarations/store/-private/managers/cache-manager.d.ts +1 -14
- package/declarations/store/-private/record-arrays/legacy-many-array.d.ts +1 -1
- package/declarations/store/-private/record-arrays/resource-array.d.ts +1 -1
- package/declarations/store/-private.d.ts +0 -5
- package/declarations/store/deprecated/-private.d.ts +1 -1
- package/declarations/types/schema/fields.d.ts +4 -4
- package/dist/configure-DPUFCemT.js +1940 -0
- package/dist/configure.js +2 -1
- package/dist/{request-oqoLC9rz.js → future-BKkJJkj7.js} +1 -48
- package/dist/graph/-private.js +3 -2
- package/dist/{index-BKcD4JZK.js → index-CQP2NSqg.js} +58 -1826
- package/dist/index.js +5 -5
- package/dist/reactive/-private.js +1 -1
- package/dist/reactive.js +4 -129
- package/dist/request.js +49 -1
- package/dist/signals/-leaked.js +1 -0
- package/dist/store/-private.js +1 -2
- package/dist/types/-private.js +1 -1
- package/dist/unpkg/dev/-leaked-Co0EI6Go.js +1939 -0
- package/dist/unpkg/dev/configure.js +1 -1
- package/dist/unpkg/dev/{request-CA9K0gXq.js → future-DFfOzSoe.js} +1 -48
- package/dist/unpkg/dev/graph/-private.js +3 -2
- package/dist/unpkg/dev/{index-DqhXrNZ_.js → index-CepUPZlc.js} +57 -1825
- package/dist/unpkg/dev/index.js +4 -4
- package/dist/unpkg/dev/reactive/-private.js +1 -1
- package/dist/unpkg/dev/reactive.js +3 -127
- package/dist/unpkg/dev/request.js +49 -1
- package/dist/unpkg/dev/signals/-leaked.js +1 -0
- package/dist/unpkg/dev/store/-private.js +2 -3
- package/dist/unpkg/dev/types/-private.js +1 -1
- package/dist/unpkg/dev-deprecated/-leaked-DjMeRqdU.js +1939 -0
- package/dist/unpkg/dev-deprecated/configure.js +1 -1
- package/dist/unpkg/dev-deprecated/{request-CA9K0gXq.js → future-DFfOzSoe.js} +1 -48
- package/dist/unpkg/dev-deprecated/graph/-private.js +3 -2
- package/dist/unpkg/dev-deprecated/{index-BBlq5is_.js → index-C_EEmn_3.js} +56 -1824
- package/dist/unpkg/dev-deprecated/index.js +2 -2
- package/dist/unpkg/dev-deprecated/reactive.js +2 -126
- package/dist/unpkg/dev-deprecated/request.js +49 -1
- package/dist/unpkg/dev-deprecated/signals/-leaked.js +1 -0
- package/dist/unpkg/dev-deprecated/store/-private.js +1 -2
- package/dist/unpkg/dev-deprecated/types/-private.js +1 -1
- package/dist/unpkg/prod/-leaked-DUONXQDB.js +1676 -0
- package/dist/unpkg/prod/{-private-3C1OkYtZ.js → -private-sql1_mdx.js} +1 -1
- package/dist/unpkg/prod/configure.js +2 -1
- package/dist/unpkg/prod/graph/-private.js +3 -2
- package/dist/unpkg/prod/{handler-LAyD1Y5l.js → handler-EU_8ncB2.js} +2 -2
- package/dist/unpkg/prod/index.js +7 -5
- package/dist/unpkg/prod/promise-cache-DIT8Ypjq.js +19 -0
- package/dist/unpkg/prod/reactive/-private.js +1 -1
- package/dist/unpkg/prod/reactive.js +26 -123
- package/dist/unpkg/prod/{request-CN2LxbYX.js → request-BrJSCG6r.js} +3 -19
- package/dist/unpkg/prod/request.js +2 -1
- package/dist/unpkg/prod/{promise-state-ipG60SdD.js → schema-BSkHyoWz.js} +53 -1572
- package/dist/unpkg/prod/signals/-leaked.js +1 -0
- package/dist/unpkg/prod/store/-private.js +3 -4
- package/dist/unpkg/prod/types/-private.js +1 -1
- package/dist/unpkg/prod-deprecated/-leaked-DRNv9VIX.js +1676 -0
- package/dist/unpkg/prod-deprecated/configure.js +2 -1
- package/dist/unpkg/prod-deprecated/graph/-private.js +3 -2
- package/dist/unpkg/prod-deprecated/{handler-D639oFvl.js → handler-CCIu4sQ3.js} +1 -1
- package/dist/unpkg/prod-deprecated/{hooks-DGvi9teJ.js → hooks-Dv4Np0MY.js} +1 -1
- package/dist/unpkg/prod-deprecated/index.js +7 -5
- package/dist/unpkg/prod-deprecated/promise-cache-DIT8Ypjq.js +19 -0
- package/dist/unpkg/prod-deprecated/reactive.js +4 -125
- package/dist/unpkg/prod-deprecated/{request-CN2LxbYX.js → request-BrJSCG6r.js} +3 -19
- package/dist/unpkg/prod-deprecated/request.js +2 -1
- package/dist/unpkg/prod-deprecated/{promise-state-CYvoIPna.js → schema-CJcjHv0E.js} +52 -1571
- package/dist/unpkg/prod-deprecated/signals/-leaked.js +1 -0
- package/dist/unpkg/prod-deprecated/store/-private.js +2 -3
- package/dist/unpkg/prod-deprecated/types/-private.js +1 -1
- package/package.json +3 -3
- package/declarations/store/-private/new-core-tmp/expensive-subscription.d.ts +0 -24
- package/dist/configure-C3x8YXzL.js +0 -181
- package/dist/unpkg/dev/configure-BC66sfNO.js +0 -183
- package/dist/unpkg/dev-deprecated/configure-BC66sfNO.js +0 -183
- package/dist/unpkg/prod/configure-C0C1LpG6.js +0 -158
- package/dist/unpkg/prod/hooks-BfiqDg3O.js +0 -26
- package/dist/unpkg/prod-deprecated/configure-BQ8CpIcW.js +0 -158
- /package/declarations/{store/-private/new-core-tmp → signals}/reactivity/configure.d.ts +0 -0
- /package/declarations/{store/-private/new-core-tmp → signals}/reactivity/internal.d.ts +0 -0
- /package/declarations/{store/-private/new-core-tmp → signals}/reactivity/signal.d.ts +0 -0
- /package/dist/{unpkg/dev/-private-3C1OkYtZ.js → symbols-3C1OkYtZ.js} +0 -0
- /package/dist/{symbols-sql1_mdx.js → unpkg/dev/-private-sql1_mdx.js} +0 -0
|
@@ -36,4 +36,4 @@ const Destroy = getOrSetGlobal('Destroy', Symbol.dispose || Symbol.for('Dispose'
|
|
|
36
36
|
const Checkout = getOrSetGlobal('Checkout', Symbol('Checkout'));
|
|
37
37
|
const Commit = getOrSetGlobal('Commit', Symbol('Commit'));
|
|
38
38
|
const Context = getOrSetGlobal('Context', Symbol('Context'));
|
|
39
|
-
export {
|
|
39
|
+
export { Context as C, Destroy as D, SOURCE as S, Checkout as a, Commit as b };
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { s as setupSignals } from "
|
|
1
|
+
export { s as setupSignals } from "./-leaked-DUONXQDB.js";
|
|
2
|
+
import './types/-private.js';
|
|
@@ -1226,6 +1226,7 @@ function createCollectionEdge(definition, identifier) {
|
|
|
1226
1226
|
_diff: undefined
|
|
1227
1227
|
};
|
|
1228
1228
|
}
|
|
1229
|
+
const cp = structuredClone;
|
|
1229
1230
|
function legacyGetCollectionRelationshipData(source, getRemoteState) {
|
|
1230
1231
|
source.accessed = true;
|
|
1231
1232
|
const payload = {};
|
|
@@ -1233,10 +1234,10 @@ function legacyGetCollectionRelationshipData(source, getRemoteState) {
|
|
|
1233
1234
|
payload.data = getRemoteState ? source.remoteState.slice() : computeLocalState(source);
|
|
1234
1235
|
}
|
|
1235
1236
|
if (source.links) {
|
|
1236
|
-
payload.links = source.links;
|
|
1237
|
+
payload.links = cp(source.links);
|
|
1237
1238
|
}
|
|
1238
1239
|
if (source.meta) {
|
|
1239
|
-
payload.meta = source.meta;
|
|
1240
|
+
payload.meta = cp(source.meta);
|
|
1240
1241
|
}
|
|
1241
1242
|
return payload;
|
|
1242
1243
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as isResourceKey, h as isRequestKey, C as CacheKeyManager, R as RecordArrayManager, I as InstanceCache, o as normalizeModelName, g as coerceId, q as getNewRecord, t as peekResourceKey, j as ensureStringId, a as recordIdentifierFor, u as createReactiveDocument } from "./schema-BSkHyoWz.js";
|
|
2
2
|
import { getOrSetGlobal } from './types/-private.js';
|
|
3
|
+
import { w as willSyncFlushWatchers } from "./-leaked-DUONXQDB.js";
|
|
3
4
|
import { EnableHydration, SkipCache } from './types/request.js';
|
|
4
5
|
import './types/runtime.js';
|
|
5
|
-
import { a as willSyncFlushWatchers } from "./configure-C0C1LpG6.js";
|
|
6
6
|
function isCacheOperationValue(value) {
|
|
7
7
|
return value === 'added' || value === 'state' || value === 'updated' || value === 'removed' || value === 'invalidated';
|
|
8
8
|
}
|
package/dist/unpkg/prod/index.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { r as registerDerivations, S as SchemaService } from "./
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
1
|
+
import { r as registerDerivations, S as SchemaService } from "./schema-BSkHyoWz.js";
|
|
2
|
+
export { a as cacheKeyFor, a as recordIdentifierFor, d as setIdentifierForgetMethod, b as setIdentifierGenerationMethod, e as setIdentifierResetMethod, c as setIdentifierUpdateMethod, f as setKeyInfoForResource, s as storeFor } from "./schema-BSkHyoWz.js";
|
|
3
|
+
import { instantiateRecord, teardownRecord } from './reactive.js';
|
|
4
4
|
import { peekUniversalTransient, setUniversalTransient } from './types/-private.js';
|
|
5
|
-
import
|
|
6
|
-
import { c as cloneResponseProperties, I as IS_CACHE_HANDLER, e as executeNextHandler,
|
|
5
|
+
import "./-leaked-DUONXQDB.js";
|
|
6
|
+
import { c as cloneResponseProperties, I as IS_CACHE_HANDLER, e as executeNextHandler, u as upgradePromise } from "./request-BrJSCG6r.js";
|
|
7
7
|
import { EnableHydration } from './types/request.js';
|
|
8
|
+
import { g as getRequestResult, s as setPromiseResult, c as clearRequestResult } from "./promise-cache-DIT8Ypjq.js";
|
|
8
9
|
import { DefaultCachePolicy } from './store.js';
|
|
10
|
+
import { S as Store, C as CacheHandler } from "./handler-EU_8ncB2.js";
|
|
9
11
|
import './types/runtime.js';
|
|
10
12
|
|
|
11
13
|
// Lazily close over fetch to avoid breaking Mirage
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getOrSetUniversal } from './types/-private.js';
|
|
2
|
+
const PromiseCache = getOrSetUniversal('PromiseCache', new WeakMap());
|
|
3
|
+
const RequestMap = getOrSetUniversal('RequestMap', new Map());
|
|
4
|
+
function setRequestResult(requestId, result) {
|
|
5
|
+
RequestMap.set(requestId, result);
|
|
6
|
+
}
|
|
7
|
+
function clearRequestResult(requestId) {
|
|
8
|
+
RequestMap.delete(requestId);
|
|
9
|
+
}
|
|
10
|
+
function getRequestResult(requestId) {
|
|
11
|
+
return RequestMap.get(requestId);
|
|
12
|
+
}
|
|
13
|
+
function setPromiseResult(promise, result) {
|
|
14
|
+
PromiseCache.set(promise, result);
|
|
15
|
+
}
|
|
16
|
+
function getPromiseResult(promise) {
|
|
17
|
+
return PromiseCache.get(promise);
|
|
18
|
+
}
|
|
19
|
+
export { setRequestResult as a, getPromiseResult as b, clearRequestResult as c, getRequestResult as g, setPromiseResult as s };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { C as Context } from "../-private-sql1_mdx.js";
|
|
@@ -1,127 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
|
|
1
|
+
import { v as ReactiveResource } from "./schema-BSkHyoWz.js";
|
|
2
|
+
export { S as SchemaService, w as checkout, z as commit, y as fromIdentity, r as registerDerivations, x as withDefaults } from "./schema-BSkHyoWz.js";
|
|
3
|
+
import { D as Destroy } from "./-private-sql1_mdx.js";
|
|
4
|
+
export { a as Checkout } from "./-private-sql1_mdx.js";
|
|
5
|
+
export { k as createRequestSubscription, m as getPromiseState, l as getRequestState } from "./-leaked-DUONXQDB.js";
|
|
4
6
|
import './types/-private.js';
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
this._store = store;
|
|
23
|
-
this._request = request;
|
|
24
|
-
this._callbacks = new Set();
|
|
25
|
-
this._resources = new Map();
|
|
26
|
-
this._subscription = store.notifications.subscribe(request, this._notifyRequestChange);
|
|
27
|
-
this._updateResourceCallbacks();
|
|
28
|
-
}
|
|
29
|
-
_updateResourceCallbacks() {
|
|
30
|
-
const request = this._request;
|
|
31
|
-
const store = this._store;
|
|
32
|
-
const {
|
|
33
|
-
notifications
|
|
34
|
-
} = store;
|
|
35
|
-
const req = store.cache.peek(request);
|
|
36
|
-
const resources = this._resources;
|
|
37
|
-
const isInitialSubscription = resources.size === 0;
|
|
38
|
-
if (req && 'data' in req) {
|
|
39
|
-
if (Array.isArray(req.data)) {
|
|
40
|
-
for (const resourceKey of req.data) {
|
|
41
|
-
if (isInitialSubscription || !resources.has(resourceKey)) {
|
|
42
|
-
resources.set(resourceKey, notifications.subscribe(resourceKey, this._scheduleNotify));
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
} else if (req.data) {
|
|
46
|
-
if (isInitialSubscription || !resources.has(req.data)) {
|
|
47
|
-
resources.set(req.data, notifications.subscribe(req.data, this._scheduleNotify));
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
if (req && 'included' in req && Array.isArray(req.included)) {
|
|
52
|
-
for (const resourceKey of req.included) {
|
|
53
|
-
if (isInitialSubscription || !resources.has(resourceKey)) {
|
|
54
|
-
resources.set(resourceKey, notifications.subscribe(resourceKey, this._scheduleNotify));
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
_notifyRequestChange = () => {
|
|
60
|
-
this._updateResourceCallbacks();
|
|
61
|
-
this._scheduleNotify();
|
|
62
|
-
};
|
|
63
|
-
_scheduleNotify = () => {
|
|
64
|
-
this._notify = this._notify || Promise.resolve().then(() => {
|
|
65
|
-
for (const callback of this._callbacks) {
|
|
66
|
-
callback();
|
|
67
|
-
}
|
|
68
|
-
this._notify = null;
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
addWatcher(callback) {
|
|
72
|
-
this._callbacks.add(callback);
|
|
73
|
-
}
|
|
74
|
-
removeWatcher(callback) {
|
|
75
|
-
this._callbacks.delete(callback);
|
|
76
|
-
if (this._callbacks.size === 0) {
|
|
77
|
-
this.destroy();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
destroy() {
|
|
81
|
-
Subscriptions.delete(this._request);
|
|
82
|
-
const {
|
|
83
|
-
notifications
|
|
84
|
-
} = this._store;
|
|
85
|
-
if (this._subscription) {
|
|
86
|
-
notifications.unsubscribe(this._subscription);
|
|
87
|
-
}
|
|
88
|
-
for (const token of this._resources.values()) {
|
|
89
|
-
notifications.unsubscribe(token);
|
|
90
|
-
}
|
|
91
|
-
this._callbacks.clear();
|
|
92
|
-
this._resources.clear();
|
|
7
|
+
function instantiateRecord(store, identifier, createArgs) {
|
|
8
|
+
const schema = store.schema;
|
|
9
|
+
const resourceSchema = schema.resource(identifier);
|
|
10
|
+
const legacy = resourceSchema?.legacy ?? false;
|
|
11
|
+
const editable = legacy;
|
|
12
|
+
const record = new ReactiveResource({
|
|
13
|
+
store,
|
|
14
|
+
resourceKey: identifier,
|
|
15
|
+
modeName: legacy ? 'legacy' : 'polaris',
|
|
16
|
+
legacy: legacy,
|
|
17
|
+
editable: editable,
|
|
18
|
+
path: null,
|
|
19
|
+
field: null,
|
|
20
|
+
value: null
|
|
21
|
+
});
|
|
22
|
+
if (createArgs && editable) {
|
|
23
|
+
Object.assign(record, createArgs);
|
|
93
24
|
}
|
|
25
|
+
return record;
|
|
94
26
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
* Creates an {@link ExpensiveSubscription} for the {@link RequestKey}
|
|
98
|
-
* if one does not already exist and adds a watcher to it.
|
|
99
|
-
*
|
|
100
|
-
* Returns a cleanup function. This should be called on-mount by a component
|
|
101
|
-
* that wants to subscribe to a request and cleanup should be called on dismount.
|
|
102
|
-
*
|
|
103
|
-
* ::: warning ⚠️ Avoid Using If Your App Supports Fine-grained Reactivity
|
|
104
|
-
* This mechanism should never be used by frameworks or libraries
|
|
105
|
-
* that support fine-grained reactivity.
|
|
106
|
-
* :::
|
|
107
|
-
*
|
|
108
|
-
* `ExpensiveSubscription` is a mechanism for non-reactive
|
|
109
|
-
* frameworks such as `react` to integrate with WarpDrive, for instance
|
|
110
|
-
* by treating a request as an [external store](https://react.dev/reference/react/useSyncExternalStore)
|
|
111
|
-
*
|
|
112
|
-
* `ExpensiveSubscription` is expensive *because* it doubles the number
|
|
113
|
-
* of notification callbacks required for each resource contained in
|
|
114
|
-
* the request being subscribed to. The more requests in-use, the more
|
|
115
|
-
* this cost adds up.
|
|
116
|
-
*/
|
|
117
|
-
function getExpensiveRequestSubscription(store, requestKey, callback) {
|
|
118
|
-
let subscription = Subscriptions.get(requestKey);
|
|
119
|
-
if (!subscription) {
|
|
120
|
-
subscription = new ExpensiveSubscription(store, requestKey);
|
|
121
|
-
}
|
|
122
|
-
subscription.addWatcher(callback);
|
|
123
|
-
return () => {
|
|
124
|
-
subscription.removeWatcher(callback);
|
|
125
|
-
};
|
|
27
|
+
function teardownRecord(record) {
|
|
28
|
+
record[Destroy]();
|
|
126
29
|
}
|
|
127
|
-
export {
|
|
30
|
+
export { instantiateRecord, teardownRecord };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { STRUCTURED, IS_FUTURE } from './types/request.js';
|
|
2
|
-
import {
|
|
2
|
+
import { getOrSetGlobal } from './types/-private.js';
|
|
3
|
+
import { a as setRequestResult } from "./promise-cache-DIT8Ypjq.js";
|
|
3
4
|
function upgradeHeaders(headers) {
|
|
4
5
|
headers.clone = () => {
|
|
5
6
|
return new Headers(headers);
|
|
@@ -157,23 +158,6 @@ class Context {
|
|
|
157
158
|
this._finalized = true;
|
|
158
159
|
}
|
|
159
160
|
}
|
|
160
|
-
const PromiseCache = getOrSetUniversal('PromiseCache', new WeakMap());
|
|
161
|
-
const RequestMap = getOrSetUniversal('RequestMap', new Map());
|
|
162
|
-
function setRequestResult(requestId, result) {
|
|
163
|
-
RequestMap.set(requestId, result);
|
|
164
|
-
}
|
|
165
|
-
function clearRequestResult(requestId) {
|
|
166
|
-
RequestMap.delete(requestId);
|
|
167
|
-
}
|
|
168
|
-
function getRequestResult(requestId) {
|
|
169
|
-
return RequestMap.get(requestId);
|
|
170
|
-
}
|
|
171
|
-
function setPromiseResult(promise, result) {
|
|
172
|
-
PromiseCache.set(promise, result);
|
|
173
|
-
}
|
|
174
|
-
function getPromiseResult(promise) {
|
|
175
|
-
return PromiseCache.get(promise);
|
|
176
|
-
}
|
|
177
161
|
const IS_CACHE_HANDLER = getOrSetGlobal('IS_CACHE_HANDLER', Symbol('IS_CACHE_HANDLER'));
|
|
178
162
|
function curryFuture(owner, inbound, outbound) {
|
|
179
163
|
owner.setStream(inbound.getStream());
|
|
@@ -434,4 +418,4 @@ function withReactiveResponse(obj) {
|
|
|
434
418
|
* @deprecated use {@link withResponseType} instead
|
|
435
419
|
*/
|
|
436
420
|
const withBrand = withResponseType;
|
|
437
|
-
export { IS_CACHE_HANDLER as I,
|
|
421
|
+
export { IS_CACHE_HANDLER as I, withResponseType as a, withReactiveResponse as b, cloneResponseProperties as c, createDeferred as d, executeNextHandler as e, upgradePromise as u, withBrand as w };
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { d as createDeferred, w as withBrand, b as withReactiveResponse, a as withResponseType } from "./request-BrJSCG6r.js";
|
|
2
|
+
export { b as getPromiseResult, s as setPromiseResult } from "./promise-cache-DIT8Ypjq.js";
|