@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.
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
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- export { C as CacheHandler, V as Fetch, W as RequestManager, S as Store, r as cacheKeyFor, r as recordIdentifierFor, $ as setIdentifierForgetMethod, Y as setIdentifierGenerationMethod, a0 as setIdentifierResetMethod, Z as setIdentifierUpdateMethod, a1 as setKeyInfoForResource, s as storeFor, X as useRecommendedStore } from "./index-BKcD4JZK.js";
2
- import "./symbols-sql1_mdx.js";
3
- import '@ember/debug';
1
+ export { C as CacheHandler, F as Fetch, z as RequestManager, S as Store, r as cacheKeyFor, r as recordIdentifierFor, E as setIdentifierForgetMethod, B as setIdentifierGenerationMethod, G as setIdentifierResetMethod, D as setIdentifierUpdateMethod, H as setKeyInfoForResource, s as storeFor, A as useRecommendedStore } from "./index-CQP2NSqg.js";
2
+ import "./symbols-3C1OkYtZ.js";
3
+ import "./configure-DPUFCemT.js";
4
4
  import '@embroider/macros';
5
- import './utils/string.js';
6
- import "./configure-C3x8YXzL.js";
7
5
  import "./default-cache-policy-D7_u4YRH.js";
6
+ import '@ember/debug';
7
+ import './utils/string.js';
8
8
  import './types/runtime.js';
@@ -1 +1 @@
1
- export { C as Context } from "../symbols-sql1_mdx.js";
1
+ export { a as Context } from "../symbols-3C1OkYtZ.js";
package/dist/reactive.js CHANGED
@@ -1,129 +1,4 @@
1
- export { N as SchemaService, K as checkout, T as commit, p as createRequestSubscription, P as fromIdentity, U as getPromiseState, q as getRequestState, L as instantiateRecord, Q as registerDerivations, M as teardownRecord, O as withDefaults } from "./index-BKcD4JZK.js";
2
- export { a as Checkout } from "./symbols-sql1_mdx.js";
3
- import './types/request.js';
4
- import '@embroider/macros';
5
- import '@ember/debug';
6
- import './utils/string.js';
7
- import "./configure-C3x8YXzL.js";
8
- const Subscriptions = new WeakMap();
9
-
10
- /**
11
- * `ExpensiveSubscription` is a mechanism for non-reactive
12
- * frameworks such as `react` to integrate with WarpDrive.
13
- *
14
- * This mechanism should never be used by frameworks or libraries
15
- * that support fine-grained reactivity.
16
- *
17
- * ExpensiveSubscription is expensive *because* it doubles the number
18
- * of notification callbacks required for each resource contained in
19
- * the request being subscribed to. The more requests in-use, the more
20
- * this cost adds up.
21
- */
22
- class ExpensiveSubscription {
23
- constructor(store, request) {
24
- this._store = store;
25
- this._request = request;
26
- this._callbacks = new Set();
27
- this._resources = new Map();
28
- this._subscription = store.notifications.subscribe(request, this._notifyRequestChange);
29
- this._updateResourceCallbacks();
30
- }
31
- _updateResourceCallbacks() {
32
- const request = this._request;
33
- const store = this._store;
34
- const {
35
- notifications
36
- } = store;
37
- const req = store.cache.peek(request);
38
- const resources = this._resources;
39
- const isInitialSubscription = resources.size === 0;
40
- if (req && 'data' in req) {
41
- if (Array.isArray(req.data)) {
42
- for (const resourceKey of req.data) {
43
- if (isInitialSubscription || !resources.has(resourceKey)) {
44
- resources.set(resourceKey, notifications.subscribe(resourceKey, this._scheduleNotify));
45
- }
46
- }
47
- } else if (req.data) {
48
- if (isInitialSubscription || !resources.has(req.data)) {
49
- resources.set(req.data, notifications.subscribe(req.data, this._scheduleNotify));
50
- }
51
- }
52
- }
53
- if (req && 'included' in req && Array.isArray(req.included)) {
54
- for (const resourceKey of req.included) {
55
- if (isInitialSubscription || !resources.has(resourceKey)) {
56
- resources.set(resourceKey, notifications.subscribe(resourceKey, this._scheduleNotify));
57
- }
58
- }
59
- }
60
- }
61
- _notifyRequestChange = () => {
62
- this._updateResourceCallbacks();
63
- this._scheduleNotify();
64
- };
65
- _scheduleNotify = () => {
66
- this._notify = this._notify || Promise.resolve().then(() => {
67
- for (const callback of this._callbacks) {
68
- callback();
69
- }
70
- this._notify = null;
71
- });
72
- };
73
- addWatcher(callback) {
74
- this._callbacks.add(callback);
75
- }
76
- removeWatcher(callback) {
77
- this._callbacks.delete(callback);
78
- if (this._callbacks.size === 0) {
79
- this.destroy();
80
- }
81
- }
82
- destroy() {
83
- Subscriptions.delete(this._request);
84
- const {
85
- notifications
86
- } = this._store;
87
- if (this._subscription) {
88
- notifications.unsubscribe(this._subscription);
89
- }
90
- for (const token of this._resources.values()) {
91
- notifications.unsubscribe(token);
92
- }
93
- this._callbacks.clear();
94
- this._resources.clear();
95
- }
96
- }
97
-
98
- /**
99
- * Creates an {@link ExpensiveSubscription} for the {@link RequestKey}
100
- * if one does not already exist and adds a watcher to it.
101
- *
102
- * Returns a cleanup function. This should be called on-mount by a component
103
- * that wants to subscribe to a request and cleanup should be called on dismount.
104
- *
105
- * ::: warning ⚠️ Avoid Using If Your App Supports Fine-grained Reactivity
106
- * This mechanism should never be used by frameworks or libraries
107
- * that support fine-grained reactivity.
108
- * :::
109
- *
110
- * `ExpensiveSubscription` is a mechanism for non-reactive
111
- * frameworks such as `react` to integrate with WarpDrive, for instance
112
- * by treating a request as an [external store](https://react.dev/reference/react/useSyncExternalStore)
113
- *
114
- * `ExpensiveSubscription` is expensive *because* it doubles the number
115
- * of notification callbacks required for each resource contained in
116
- * the request being subscribed to. The more requests in-use, the more
117
- * this cost adds up.
118
- */
119
- function getExpensiveRequestSubscription(store, requestKey, callback) {
120
- let subscription = Subscriptions.get(requestKey);
121
- if (!subscription) {
122
- subscription = new ExpensiveSubscription(store, requestKey);
123
- }
124
- subscription.addWatcher(callback);
125
- return () => {
126
- subscription.removeWatcher(callback);
127
- };
128
- }
129
- export { getExpensiveRequestSubscription };
1
+ export { u as SchemaService, p as checkout, y as commit, v as fromIdentity, q as instantiateRecord, x as registerDerivations, t as teardownRecord, w as withDefaults } from "./index-CQP2NSqg.js";
2
+ export { C as Checkout } from "./symbols-3C1OkYtZ.js";
3
+ export { f as createRequestSubscription, i as getPromiseState, h as getRequestState } from "./configure-DPUFCemT.js";
4
+ import '@embroider/macros';
package/dist/request.js CHANGED
@@ -1 +1,49 @@
1
- export { i as createDeferred, g as getPromiseResult, s as setPromiseResult, w as withBrand, h as withReactiveResponse, f as withResponseType } from "./request-oqoLC9rz.js";
1
+ export { c as createDeferred, g as getPromiseResult, s as setPromiseResult } from "./future-BKkJJkj7.js";
2
+
3
+ /**
4
+ * Brands the supplied object with the supplied response type.
5
+ *
6
+ * ```ts
7
+ * import type { ReactiveDataDocument } from '@warp-drive/core/reactive';
8
+ * import { withResponseType } from '@warp-drive/core/request';
9
+ * import type { User } from '#/data/user.ts'
10
+ *
11
+ * const result = await store.request(
12
+ * withResponseType<ReactiveDataDocument<User>>({ url: '/users/1' })
13
+ * );
14
+ *
15
+ * result.content.data; // will have type User
16
+ * ```
17
+ *
18
+ */
19
+ function withResponseType(obj) {
20
+ return obj;
21
+ }
22
+
23
+ /**
24
+ * Brands the supplied object with the supplied response type
25
+ * wrapped in {@link ReactiveDataDocument}. This is a convenience for
26
+ * the common case of using {@link withResponseType} with `ReactiveDataDocument`.
27
+ *
28
+ * ```ts
29
+ * import { withReactiveResponse } from '@warp-drive/core/request';
30
+ * import type { User } from '#/data/user.ts'
31
+ *
32
+ * const result = await store.request(
33
+ * withReactiveResponse<User>({ url: '/users/1' })
34
+ * );
35
+ *
36
+ * result.content.data; // will have type User
37
+ * ```
38
+ *
39
+ * @public
40
+ */
41
+ function withReactiveResponse(obj) {
42
+ return obj;
43
+ }
44
+
45
+ /**
46
+ * @deprecated use {@link withResponseType} instead
47
+ */
48
+ const withBrand = withResponseType;
49
+ export { withBrand, withReactiveResponse, withResponseType };
@@ -0,0 +1 @@
1
+ export { D as DISPOSE, a as defineGate, d as defineNonEnumerableSignal, b as defineSignal, e as entangleSignal, g as gate, m as memoized, n as notifyInternalSignal, p as peekInternalSignal, s as signal, w as waitFor, c as withSignalStore } from "../configure-DPUFCemT.js";
@@ -1,2 +1 @@
1
- export { C as CacheHandler, D as DISPOSE, R as RecordArrayManager, B as Signals, S as Store, k as StoreMap, _ as _clearCaches, n as _deprecatingNormalize, h as assertPrivateCapabilities, d as assertPrivateStore, b as coerceId, c as constructResource, I as consumeInternalSignal, F as createInternalMemo, l as createLegacyManyArray, p as createRequestSubscription, z as defineGate, A as defineNonEnumerableSignal, y as defineSignal, e as ensureStringId, x as entangleInitiallyStaleSignal, w as entangleSignal, f as fastPush, v as gate, J as getOrCreateInternalSignal, q as getRequestState, g as isPrivateStore, a as isRequestKey, i as isResourceKey, m as log, o as logGroup, u as memoized, H as notifyInternalSignal, E as peekInternalSignal, r as recordIdentifierFor, j as setRecordIdentifier, t as signal, s as storeFor, G as withSignalStore } from "../index-BKcD4JZK.js";
2
- export { A as ARRAY_SIGNAL, O as OBJECT_SIGNAL, w as waitFor } from "../configure-C3x8YXzL.js";
1
+ export { C as CacheHandler, R as RecordArrayManager, S as Store, k as StoreMap, _ as _clearCaches, n as _deprecatingNormalize, h as assertPrivateCapabilities, d as assertPrivateStore, b as coerceId, c as constructResource, l as createLegacyManyArray, e as ensureStringId, f as fastPush, g as isPrivateStore, a as isRequestKey, i as isResourceKey, m as log, o as logGroup, r as recordIdentifierFor, j as setRecordIdentifier, s as storeFor } from "../index-CQP2NSqg.js";
@@ -1,6 +1,6 @@
1
1
  import { macroCondition, getGlobalConfig } from '@embroider/macros';
2
2
  const name = "@warp-drive/core";
3
- const version = "5.8.0-alpha.40";
3
+ const version = "5.8.0-alpha.41";
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