@warp-drive/core 5.8.0-alpha.40 → 5.8.0-alpha.42

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.
Files changed (95) hide show
  1. package/declarations/configure.d.ts +1 -1
  2. package/declarations/reactive/-private/default-mode.d.ts +1 -1
  3. package/declarations/reactive/-private/fields/extension.d.ts +1 -1
  4. package/declarations/reactive/-private/fields/managed-array.d.ts +2 -2
  5. package/declarations/reactive/-private/fields/managed-object.d.ts +1 -1
  6. package/declarations/reactive.d.ts +2 -3
  7. package/declarations/signals/-leaked.d.ts +2 -0
  8. package/declarations/signals/-private.d.ts +6 -0
  9. package/declarations/{store/-private/new-core-tmp → signals}/promise-state.d.ts +1 -1
  10. package/declarations/{store/-private/new-core-tmp → signals}/request-state.d.ts +5 -5
  11. package/declarations/{store/-private/new-core-tmp → signals}/request-subscription.d.ts +4 -4
  12. package/declarations/store/-private/cache-handler/types.d.ts +2 -16
  13. package/declarations/store/-private/managers/cache-manager.d.ts +1 -14
  14. package/declarations/store/-private/record-arrays/legacy-many-array.d.ts +1 -1
  15. package/declarations/store/-private/record-arrays/resource-array.d.ts +1 -1
  16. package/declarations/store/-private.d.ts +0 -5
  17. package/declarations/store/deprecated/-private.d.ts +1 -1
  18. package/declarations/types/schema/fields.d.ts +4 -4
  19. package/dist/configure-DPUFCemT.js +1940 -0
  20. package/dist/configure.js +2 -1
  21. package/dist/{request-oqoLC9rz.js → future-BKkJJkj7.js} +1 -48
  22. package/dist/graph/-private.js +3 -2
  23. package/dist/{index-BKcD4JZK.js → index-CQP2NSqg.js} +58 -1826
  24. package/dist/index.js +5 -5
  25. package/dist/reactive/-private.js +1 -1
  26. package/dist/reactive.js +4 -129
  27. package/dist/request.js +49 -1
  28. package/dist/signals/-leaked.js +1 -0
  29. package/dist/store/-private.js +1 -2
  30. package/dist/types/-private.js +1 -1
  31. package/dist/unpkg/dev/-leaked-Co0EI6Go.js +1939 -0
  32. package/dist/unpkg/dev/configure.js +1 -1
  33. package/dist/unpkg/dev/{request-CA9K0gXq.js → future-DFfOzSoe.js} +1 -48
  34. package/dist/unpkg/dev/graph/-private.js +3 -2
  35. package/dist/unpkg/dev/{index-DqhXrNZ_.js → index-CepUPZlc.js} +57 -1825
  36. package/dist/unpkg/dev/index.js +4 -4
  37. package/dist/unpkg/dev/reactive/-private.js +1 -1
  38. package/dist/unpkg/dev/reactive.js +3 -127
  39. package/dist/unpkg/dev/request.js +49 -1
  40. package/dist/unpkg/dev/signals/-leaked.js +1 -0
  41. package/dist/unpkg/dev/store/-private.js +2 -3
  42. package/dist/unpkg/dev/types/-private.js +1 -1
  43. package/dist/unpkg/dev-deprecated/-leaked-DjMeRqdU.js +1939 -0
  44. package/dist/unpkg/dev-deprecated/configure.js +1 -1
  45. package/dist/unpkg/dev-deprecated/{request-CA9K0gXq.js → future-DFfOzSoe.js} +1 -48
  46. package/dist/unpkg/dev-deprecated/graph/-private.js +3 -2
  47. package/dist/unpkg/dev-deprecated/{index-BBlq5is_.js → index-C_EEmn_3.js} +56 -1824
  48. package/dist/unpkg/dev-deprecated/index.js +2 -2
  49. package/dist/unpkg/dev-deprecated/reactive.js +2 -126
  50. package/dist/unpkg/dev-deprecated/request.js +49 -1
  51. package/dist/unpkg/dev-deprecated/signals/-leaked.js +1 -0
  52. package/dist/unpkg/dev-deprecated/store/-private.js +1 -2
  53. package/dist/unpkg/dev-deprecated/types/-private.js +1 -1
  54. package/dist/unpkg/prod/-leaked-DUONXQDB.js +1676 -0
  55. package/dist/unpkg/prod/{-private-3C1OkYtZ.js → -private-sql1_mdx.js} +1 -1
  56. package/dist/unpkg/prod/configure.js +2 -1
  57. package/dist/unpkg/prod/graph/-private.js +3 -2
  58. package/dist/unpkg/prod/{handler-LAyD1Y5l.js → handler-EU_8ncB2.js} +2 -2
  59. package/dist/unpkg/prod/index.js +7 -5
  60. package/dist/unpkg/prod/promise-cache-DIT8Ypjq.js +19 -0
  61. package/dist/unpkg/prod/reactive/-private.js +1 -1
  62. package/dist/unpkg/prod/reactive.js +26 -123
  63. package/dist/unpkg/prod/{request-CN2LxbYX.js → request-BrJSCG6r.js} +3 -19
  64. package/dist/unpkg/prod/request.js +2 -1
  65. package/dist/unpkg/prod/{promise-state-ipG60SdD.js → schema-BSkHyoWz.js} +53 -1572
  66. package/dist/unpkg/prod/signals/-leaked.js +1 -0
  67. package/dist/unpkg/prod/store/-private.js +3 -4
  68. package/dist/unpkg/prod/types/-private.js +1 -1
  69. package/dist/unpkg/prod-deprecated/-leaked-DRNv9VIX.js +1676 -0
  70. package/dist/unpkg/prod-deprecated/configure.js +2 -1
  71. package/dist/unpkg/prod-deprecated/graph/-private.js +3 -2
  72. package/dist/unpkg/prod-deprecated/{handler-D639oFvl.js → handler-CCIu4sQ3.js} +1 -1
  73. package/dist/unpkg/prod-deprecated/{hooks-DGvi9teJ.js → hooks-Dv4Np0MY.js} +1 -1
  74. package/dist/unpkg/prod-deprecated/index.js +7 -5
  75. package/dist/unpkg/prod-deprecated/promise-cache-DIT8Ypjq.js +19 -0
  76. package/dist/unpkg/prod-deprecated/reactive.js +4 -125
  77. package/dist/unpkg/prod-deprecated/{request-CN2LxbYX.js → request-BrJSCG6r.js} +3 -19
  78. package/dist/unpkg/prod-deprecated/request.js +2 -1
  79. package/dist/unpkg/prod-deprecated/{promise-state-CYvoIPna.js → schema-CJcjHv0E.js} +52 -1571
  80. package/dist/unpkg/prod-deprecated/signals/-leaked.js +1 -0
  81. package/dist/unpkg/prod-deprecated/store/-private.js +2 -3
  82. package/dist/unpkg/prod-deprecated/types/-private.js +1 -1
  83. package/package.json +3 -3
  84. package/declarations/store/-private/new-core-tmp/expensive-subscription.d.ts +0 -24
  85. package/dist/configure-C3x8YXzL.js +0 -181
  86. package/dist/unpkg/dev/configure-BC66sfNO.js +0 -183
  87. package/dist/unpkg/dev-deprecated/configure-BC66sfNO.js +0 -183
  88. package/dist/unpkg/prod/configure-C0C1LpG6.js +0 -158
  89. package/dist/unpkg/prod/hooks-BfiqDg3O.js +0 -26
  90. package/dist/unpkg/prod-deprecated/configure-BQ8CpIcW.js +0 -158
  91. /package/declarations/{store/-private/new-core-tmp → signals}/reactivity/configure.d.ts +0 -0
  92. /package/declarations/{store/-private/new-core-tmp → signals}/reactivity/internal.d.ts +0 -0
  93. /package/declarations/{store/-private/new-core-tmp → signals}/reactivity/signal.d.ts +0 -0
  94. /package/dist/{unpkg/dev/-private-3C1OkYtZ.js → symbols-3C1OkYtZ.js} +0 -0
  95. /package/dist/{symbols-sql1_mdx.js → unpkg/dev/-private-sql1_mdx.js} +0 -0
@@ -1 +1,2 @@
1
- export { s as setupSignals } from "./configure-BQ8CpIcW.js";
1
+ export { s as setupSignals } from "./-leaked-DRNv9VIX.js";
2
+ import './types/-private.js';
@@ -1399,6 +1399,7 @@ function createCollectionEdge(definition, identifier) {
1399
1399
  _diff: undefined
1400
1400
  };
1401
1401
  }
1402
+ const cp = structuredClone;
1402
1403
  function legacyGetCollectionRelationshipData(source, getRemoteState) {
1403
1404
  source.accessed = true;
1404
1405
  const payload = {};
@@ -1406,10 +1407,10 @@ function legacyGetCollectionRelationshipData(source, getRemoteState) {
1406
1407
  payload.data = getRemoteState ? source.remoteState.slice() : computeLocalState(source);
1407
1408
  }
1408
1409
  if (source.links) {
1409
- payload.links = source.links;
1410
+ payload.links = cp(source.links);
1410
1411
  }
1411
1412
  if (source.meta) {
1412
- payload.meta = source.meta;
1413
+ payload.meta = cp(source.meta);
1413
1414
  }
1414
1415
  return payload;
1415
1416
  }
@@ -1,4 +1,4 @@
1
- import { P as createReactiveDocument } from "./promise-state-CYvoIPna.js";
1
+ import { v as createReactiveDocument } from "./schema-CJcjHv0E.js";
2
2
  import { SkipCache, EnableHydration } from './types/request.js';
3
3
  const MUTATION_OPS = new Set(['createRecord', 'updateRecord', 'deleteRecord']);
4
4
  function calcShouldFetch(store, request, hasCachedValue, identifier) {
@@ -1,4 +1,4 @@
1
- import { O as ReactiveResource } from "./promise-state-CYvoIPna.js";
1
+ import { u as ReactiveResource } from "./schema-CJcjHv0E.js";
2
2
  import { D as Destroy } from "./-private-3C1OkYtZ.js";
3
3
  function instantiateRecord(store, identifier, createArgs) {
4
4
  const schema = store.schema;
@@ -1,11 +1,13 @@
1
- import { S as Store, L as registerDerivations, I as SchemaService } from "./promise-state-CYvoIPna.js";
2
- export { r as cacheKeyFor, r as recordIdentifierFor, U as setIdentifierForgetMethod, Q as setIdentifierGenerationMethod, V as setIdentifierResetMethod, T as setIdentifierUpdateMethod, W as setKeyInfoForResource, s as storeFor } from "./promise-state-CYvoIPna.js";
3
- import { i as instantiateRecord, t as teardownRecord } from "./hooks-DGvi9teJ.js";
1
+ import { b as Store, r as registerDerivations, S as SchemaService } from "./schema-CJcjHv0E.js";
2
+ export { d as cacheKeyFor, d as recordIdentifierFor, z as setIdentifierForgetMethod, x as setIdentifierGenerationMethod, A as setIdentifierResetMethod, y as setIdentifierUpdateMethod, B as setKeyInfoForResource, s as storeFor } from "./schema-CJcjHv0E.js";
3
+ import { i as instantiateRecord, t as teardownRecord } from "./hooks-Dv4Np0MY.js";
4
4
  import { peekUniversalTransient, setUniversalTransient } from './types/-private.js';
5
- import { C as CacheHandler } from "./handler-D639oFvl.js";
6
- import { c as cloneResponseProperties, I as IS_CACHE_HANDLER, e as executeNextHandler, g as getRequestResult, u as upgradePromise, s as setPromiseResult, a as clearRequestResult } from "./request-CN2LxbYX.js";
5
+ import "./-leaked-DRNv9VIX.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 { C as CacheHandler } from "./handler-CCIu4sQ3.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,126 +1,5 @@
1
- export { I as SchemaService, H as checkout, M as commit, m as createRequestSubscription, K as fromIdentity, N as getPromiseState, o as getRequestState, L as registerDerivations, J as withDefaults } from "./promise-state-CYvoIPna.js";
2
- export { i as instantiateRecord, t as teardownRecord } from "./hooks-DGvi9teJ.js";
1
+ export { S as SchemaService, c as checkout, a as commit, f as fromIdentity, r as registerDerivations, w as withDefaults } from "./schema-CJcjHv0E.js";
2
+ export { i as instantiateRecord, t as teardownRecord } from "./hooks-Dv4Np0MY.js";
3
3
  export { C as Checkout } from "./-private-3C1OkYtZ.js";
4
- import './types/-private.js';
5
- const Subscriptions = new WeakMap();
6
-
7
- /**
8
- * `ExpensiveSubscription` is a mechanism for non-reactive
9
- * frameworks such as `react` to integrate with WarpDrive.
10
- *
11
- * This mechanism should never be used by frameworks or libraries
12
- * that support fine-grained reactivity.
13
- *
14
- * ExpensiveSubscription is expensive *because* it doubles the number
15
- * of notification callbacks required for each resource contained in
16
- * the request being subscribed to. The more requests in-use, the more
17
- * this cost adds up.
18
- */
19
- class ExpensiveSubscription {
20
- constructor(store, request) {
21
- this._store = store;
22
- this._request = request;
23
- this._callbacks = new Set();
24
- this._resources = new Map();
25
- this._subscription = store.notifications.subscribe(request, this._notifyRequestChange);
26
- this._updateResourceCallbacks();
27
- }
28
- _updateResourceCallbacks() {
29
- const request = this._request;
30
- const store = this._store;
31
- const {
32
- notifications
33
- } = store;
34
- const req = store.cache.peek(request);
35
- const resources = this._resources;
36
- const isInitialSubscription = resources.size === 0;
37
- if (req && 'data' in req) {
38
- if (Array.isArray(req.data)) {
39
- for (const resourceKey of req.data) {
40
- if (isInitialSubscription || !resources.has(resourceKey)) {
41
- resources.set(resourceKey, notifications.subscribe(resourceKey, this._scheduleNotify));
42
- }
43
- }
44
- } else if (req.data) {
45
- if (isInitialSubscription || !resources.has(req.data)) {
46
- resources.set(req.data, notifications.subscribe(req.data, this._scheduleNotify));
47
- }
48
- }
49
- }
50
- if (req && 'included' in req && Array.isArray(req.included)) {
51
- for (const resourceKey of req.included) {
52
- if (isInitialSubscription || !resources.has(resourceKey)) {
53
- resources.set(resourceKey, notifications.subscribe(resourceKey, this._scheduleNotify));
54
- }
55
- }
56
- }
57
- }
58
- _notifyRequestChange = () => {
59
- this._updateResourceCallbacks();
60
- this._scheduleNotify();
61
- };
62
- _scheduleNotify = () => {
63
- this._notify = this._notify || Promise.resolve().then(() => {
64
- for (const callback of this._callbacks) {
65
- callback();
66
- }
67
- this._notify = null;
68
- });
69
- };
70
- addWatcher(callback) {
71
- this._callbacks.add(callback);
72
- }
73
- removeWatcher(callback) {
74
- this._callbacks.delete(callback);
75
- if (this._callbacks.size === 0) {
76
- this.destroy();
77
- }
78
- }
79
- destroy() {
80
- Subscriptions.delete(this._request);
81
- const {
82
- notifications
83
- } = this._store;
84
- if (this._subscription) {
85
- notifications.unsubscribe(this._subscription);
86
- }
87
- for (const token of this._resources.values()) {
88
- notifications.unsubscribe(token);
89
- }
90
- this._callbacks.clear();
91
- this._resources.clear();
92
- }
93
- }
94
-
95
- /**
96
- * Creates an {@link ExpensiveSubscription} for the {@link RequestKey}
97
- * if one does not already exist and adds a watcher to it.
98
- *
99
- * Returns a cleanup function. This should be called on-mount by a component
100
- * that wants to subscribe to a request and cleanup should be called on dismount.
101
- *
102
- * ::: warning ⚠️ Avoid Using If Your App Supports Fine-grained Reactivity
103
- * This mechanism should never be used by frameworks or libraries
104
- * that support fine-grained reactivity.
105
- * :::
106
- *
107
- * `ExpensiveSubscription` is a mechanism for non-reactive
108
- * frameworks such as `react` to integrate with WarpDrive, for instance
109
- * by treating a request as an [external store](https://react.dev/reference/react/useSyncExternalStore)
110
- *
111
- * `ExpensiveSubscription` is expensive *because* it doubles the number
112
- * of notification callbacks required for each resource contained in
113
- * the request being subscribed to. The more requests in-use, the more
114
- * this cost adds up.
115
- */
116
- function getExpensiveRequestSubscription(store, requestKey, callback) {
117
- let subscription = Subscriptions.get(requestKey);
118
- if (!subscription) {
119
- subscription = new ExpensiveSubscription(store, requestKey);
120
- }
121
- subscription.addWatcher(callback);
122
- return () => {
123
- subscription.removeWatcher(callback);
124
- };
125
- }
126
- export { getExpensiveRequestSubscription };
4
+ export { c as createRequestSubscription, a as getPromiseState, g as getRequestState } from "./-leaked-DRNv9VIX.js";
5
+ import './types/-private.js';
@@ -1,5 +1,6 @@
1
1
  import { STRUCTURED, IS_FUTURE } from './types/request.js';
2
- import { getOrSetUniversal, getOrSetGlobal } from './types/-private.js';
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, clearRequestResult as a, getPromiseResult as b, cloneResponseProperties as c, withResponseType as d, executeNextHandler as e, withReactiveResponse as f, getRequestResult as g, createDeferred as h, setPromiseResult as s, upgradePromise as u, withBrand as w };
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 { h as createDeferred, b as getPromiseResult, s as setPromiseResult, w as withBrand, f as withReactiveResponse, d as withResponseType } from "./request-CN2LxbYX.js";
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";