@warp-drive/core 5.8.0-alpha.9 → 5.8.0-beta.1
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/README.md +22 -38
- package/declarations/configure.d.ts +1 -1
- package/declarations/graph/-private/-edge-definition.d.ts +12 -2
- package/declarations/index.d.ts +14 -9
- 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/-private/record.d.ts +10 -1
- package/declarations/reactive/-private.d.ts +1 -0
- package/declarations/reactive.d.ts +11 -7
- package/declarations/request/-private/types.d.ts +1 -1
- 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 +6 -6
- 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/caches/instance-cache.d.ts +1 -1
- package/declarations/store/-private/managers/cache-manager.d.ts +1 -14
- package/declarations/store/-private/managers/notification-manager.d.ts +1 -1
- 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/store-service.d.ts +2 -2
- package/declarations/store/-private.d.ts +0 -6
- package/declarations/store/deprecated/-private.d.ts +2 -2
- package/declarations/store/deprecated/store.d.ts +1 -1
- package/declarations/store.d.ts +1 -0
- package/declarations/types/cache.d.ts +2 -2
- package/declarations/types/record.d.ts +132 -0
- package/declarations/types/request.d.ts +22 -8
- package/declarations/types/schema/fields.d.ts +26 -13
- package/declarations/types/schema/schema-service.d.ts +4 -4
- package/declarations/types/spec/document.d.ts +34 -0
- 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 +15 -5
- package/dist/{index-B1cSRj-N.js → index-CQP2NSqg.js} +63 -1812
- 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/symbols-3C1OkYtZ.js +39 -0
- package/dist/types/-private.js +1 -1
- package/dist/types/record.js +127 -0
- package/dist/types/request.js +11 -7
- package/dist/unpkg/dev/-leaked-Co0EI6Go.js +1939 -0
- package/dist/unpkg/dev/build-config/babel-macros.js +1 -0
- package/dist/unpkg/dev/build-config/canary-features.js +1 -0
- package/dist/unpkg/dev/build-config/debugging.js +1 -0
- package/dist/unpkg/dev/build-config/deprecations.js +1 -0
- package/dist/unpkg/dev/build-config/env.js +1 -0
- package/dist/unpkg/dev/build-config/macros.js +1 -0
- package/dist/unpkg/dev/build-config.js +1 -0
- package/dist/unpkg/dev/configure.js +1 -0
- package/dist/unpkg/dev/future-DFfOzSoe.js +672 -0
- package/dist/unpkg/dev/graph/-private.js +3132 -0
- package/dist/unpkg/dev/index-BzcBOnw9.js +9392 -0
- package/dist/unpkg/dev/index.js +6 -0
- package/dist/unpkg/dev/reactive/-private.js +1 -0
- package/dist/unpkg/dev/reactive.js +3 -0
- package/dist/unpkg/dev/request.js +49 -0
- package/dist/unpkg/dev/runtime-E1M51_-O.js +135 -0
- package/dist/unpkg/dev/signals/-leaked.js +1 -0
- package/dist/unpkg/dev/store/-private.js +55 -0
- package/dist/unpkg/dev/store.js +558 -0
- package/dist/unpkg/dev/types/-private.js +69 -0
- package/dist/unpkg/dev/types/cache/aliases.js +0 -0
- package/dist/unpkg/dev/types/cache/change.js +0 -0
- package/dist/unpkg/dev/types/cache/mutations.js +0 -0
- package/dist/unpkg/dev/types/cache/operations.js +0 -0
- package/dist/unpkg/dev/types/cache/relationship.js +0 -0
- package/dist/unpkg/dev/types/cache.js +0 -0
- package/dist/unpkg/dev/types/graph.js +0 -0
- package/dist/unpkg/dev/types/identifier.js +61 -0
- package/dist/unpkg/dev/types/json/raw.js +0 -0
- package/dist/unpkg/dev/types/params.js +0 -0
- package/dist/unpkg/dev/types/record.js +191 -0
- package/dist/unpkg/dev/types/request.js +77 -0
- package/dist/unpkg/dev/types/runtime.js +34 -0
- package/dist/unpkg/dev/types/schema/concepts.js +0 -0
- package/dist/unpkg/dev/types/schema/fields.js +505 -0
- package/dist/unpkg/dev/types/schema/fields.type-test.js +0 -0
- package/dist/unpkg/dev/types/schema/schema-service.js +0 -0
- package/dist/unpkg/dev/types/spec/document.js +0 -0
- package/dist/unpkg/dev/types/spec/error.js +0 -0
- package/dist/unpkg/dev/types/spec/json-api-raw.js +0 -0
- package/dist/unpkg/dev/types/symbols.js +84 -0
- package/dist/unpkg/dev/types/utils.js +0 -0
- package/dist/unpkg/dev/types.js +0 -0
- package/dist/unpkg/dev/utils/string.js +91 -0
- package/dist/unpkg/dev-deprecated/-leaked-DjMeRqdU.js +1939 -0
- package/dist/unpkg/dev-deprecated/-private-3C1OkYtZ.js +39 -0
- package/dist/unpkg/dev-deprecated/build-config/babel-macros.js +1 -0
- package/dist/unpkg/dev-deprecated/build-config/canary-features.js +1 -0
- package/dist/unpkg/dev-deprecated/build-config/debugging.js +1 -0
- package/dist/unpkg/dev-deprecated/build-config/deprecations.js +1 -0
- package/dist/unpkg/dev-deprecated/build-config/env.js +1 -0
- package/dist/unpkg/dev-deprecated/build-config/macros.js +1 -0
- package/dist/unpkg/dev-deprecated/build-config.js +1 -0
- package/dist/unpkg/dev-deprecated/configure.js +1 -0
- package/dist/unpkg/dev-deprecated/future-DFfOzSoe.js +672 -0
- package/dist/unpkg/dev-deprecated/graph/-private.js +3327 -0
- package/dist/unpkg/dev-deprecated/index-6TnTv-WG.js +10007 -0
- package/dist/unpkg/dev-deprecated/index.js +5 -0
- package/dist/unpkg/dev-deprecated/reactive/-private.js +1 -0
- package/dist/unpkg/dev-deprecated/reactive.js +3 -0
- package/dist/unpkg/dev-deprecated/request.js +49 -0
- package/dist/unpkg/dev-deprecated/runtime-DAu5b0IR.js +135 -0
- package/dist/unpkg/dev-deprecated/signals/-leaked.js +1 -0
- package/dist/unpkg/dev-deprecated/store/-private.js +1 -0
- package/dist/unpkg/dev-deprecated/store.js +558 -0
- package/dist/unpkg/dev-deprecated/types/-private.js +69 -0
- package/dist/unpkg/dev-deprecated/types/cache/aliases.js +0 -0
- package/dist/unpkg/dev-deprecated/types/cache/change.js +0 -0
- package/dist/unpkg/dev-deprecated/types/cache/mutations.js +0 -0
- package/dist/unpkg/dev-deprecated/types/cache/operations.js +0 -0
- package/dist/unpkg/dev-deprecated/types/cache/relationship.js +0 -0
- package/dist/unpkg/dev-deprecated/types/cache.js +0 -0
- package/dist/unpkg/dev-deprecated/types/graph.js +0 -0
- package/dist/unpkg/dev-deprecated/types/identifier.js +61 -0
- package/dist/unpkg/dev-deprecated/types/json/raw.js +0 -0
- package/dist/unpkg/dev-deprecated/types/params.js +0 -0
- package/dist/unpkg/dev-deprecated/types/record.js +191 -0
- package/dist/unpkg/dev-deprecated/types/request.js +77 -0
- package/dist/unpkg/dev-deprecated/types/runtime.js +34 -0
- package/dist/unpkg/dev-deprecated/types/schema/concepts.js +0 -0
- package/dist/unpkg/dev-deprecated/types/schema/fields.js +505 -0
- package/dist/unpkg/dev-deprecated/types/schema/fields.type-test.js +0 -0
- package/dist/unpkg/dev-deprecated/types/schema/schema-service.js +0 -0
- package/dist/unpkg/dev-deprecated/types/spec/document.js +0 -0
- package/dist/unpkg/dev-deprecated/types/spec/error.js +0 -0
- package/dist/unpkg/dev-deprecated/types/spec/json-api-raw.js +0 -0
- package/dist/unpkg/dev-deprecated/types/symbols.js +84 -0
- package/dist/unpkg/dev-deprecated/types/utils.js +0 -0
- package/dist/unpkg/dev-deprecated/types.js +0 -0
- package/dist/unpkg/dev-deprecated/utils/string.js +91 -0
- package/dist/unpkg/prod/-leaked-DUONXQDB.js +1676 -0
- package/dist/unpkg/prod/-private-sql1_mdx.js +39 -0
- package/dist/unpkg/prod/build-config/babel-macros.js +1 -0
- package/dist/unpkg/prod/build-config/canary-features.js +1 -0
- package/dist/unpkg/prod/build-config/debugging.js +1 -0
- package/dist/unpkg/prod/build-config/deprecations.js +1 -0
- package/dist/unpkg/prod/build-config/env.js +1 -0
- package/dist/unpkg/prod/build-config/macros.js +1 -0
- package/dist/unpkg/prod/build-config.js +1 -0
- package/dist/unpkg/prod/configure.js +2 -0
- package/dist/unpkg/prod/graph/-private.js +2235 -0
- package/dist/unpkg/prod/handler-EU_8ncB2.js +1619 -0
- package/dist/unpkg/prod/index.js +483 -0
- package/dist/unpkg/prod/promise-cache-DIT8Ypjq.js +19 -0
- package/dist/unpkg/prod/reactive/-private.js +1 -0
- package/dist/unpkg/prod/reactive.js +30 -0
- package/dist/unpkg/prod/request-BrJSCG6r.js +421 -0
- package/dist/unpkg/prod/request.js +2 -0
- package/dist/unpkg/prod/schema-BSkHyoWz.js +5219 -0
- package/dist/unpkg/prod/signals/-leaked.js +1 -0
- package/dist/unpkg/prod/store/-private.js +126 -0
- package/dist/unpkg/prod/store.js +437 -0
- package/dist/unpkg/prod/types/-private.js +49 -0
- package/dist/unpkg/prod/types/cache/aliases.js +0 -0
- package/dist/unpkg/prod/types/cache/change.js +0 -0
- package/dist/unpkg/prod/types/cache/mutations.js +0 -0
- package/dist/unpkg/prod/types/cache/operations.js +0 -0
- package/dist/unpkg/prod/types/cache/relationship.js +0 -0
- package/dist/unpkg/prod/types/cache.js +0 -0
- package/dist/unpkg/prod/types/graph.js +0 -0
- package/dist/unpkg/prod/types/identifier.js +61 -0
- package/dist/unpkg/prod/types/json/raw.js +0 -0
- package/dist/unpkg/prod/types/params.js +0 -0
- package/dist/unpkg/prod/types/record.js +191 -0
- package/dist/unpkg/prod/types/request.js +77 -0
- package/dist/unpkg/prod/types/runtime.js +34 -0
- package/dist/unpkg/prod/types/schema/concepts.js +0 -0
- package/dist/unpkg/prod/types/schema/fields.js +505 -0
- package/dist/unpkg/prod/types/schema/fields.type-test.js +0 -0
- package/dist/unpkg/prod/types/schema/schema-service.js +0 -0
- package/dist/unpkg/prod/types/spec/document.js +0 -0
- package/dist/unpkg/prod/types/spec/error.js +0 -0
- package/dist/unpkg/prod/types/spec/json-api-raw.js +0 -0
- package/dist/unpkg/prod/types/symbols.js +84 -0
- package/dist/unpkg/prod/types/utils.js +0 -0
- package/dist/unpkg/prod/types.js +0 -0
- package/dist/unpkg/prod/utils/string.js +72 -0
- package/dist/unpkg/prod-deprecated/-leaked-DRNv9VIX.js +1676 -0
- package/dist/unpkg/prod-deprecated/-private-3C1OkYtZ.js +39 -0
- package/dist/unpkg/prod-deprecated/build-config/babel-macros.js +1 -0
- package/dist/unpkg/prod-deprecated/build-config/canary-features.js +1 -0
- package/dist/unpkg/prod-deprecated/build-config/debugging.js +1 -0
- package/dist/unpkg/prod-deprecated/build-config/deprecations.js +1 -0
- package/dist/unpkg/prod-deprecated/build-config/env.js +1 -0
- package/dist/unpkg/prod-deprecated/build-config/macros.js +1 -0
- package/dist/unpkg/prod-deprecated/build-config.js +1 -0
- package/dist/unpkg/prod-deprecated/configure.js +2 -0
- package/dist/unpkg/prod-deprecated/graph/-private.js +2408 -0
- package/dist/unpkg/prod-deprecated/handler-CCIu4sQ3.js +334 -0
- package/dist/unpkg/prod-deprecated/hooks-Dv4Np0MY.js +26 -0
- package/dist/unpkg/prod-deprecated/index.js +483 -0
- package/dist/unpkg/prod-deprecated/promise-cache-DIT8Ypjq.js +19 -0
- package/dist/unpkg/prod-deprecated/reactive/-private.js +1 -0
- package/dist/unpkg/prod-deprecated/reactive.js +5 -0
- package/dist/unpkg/prod-deprecated/request-BrJSCG6r.js +421 -0
- package/dist/unpkg/prod-deprecated/request.js +2 -0
- package/dist/unpkg/prod-deprecated/schema-CJcjHv0E.js +6939 -0
- package/dist/unpkg/prod-deprecated/signals/-leaked.js +1 -0
- package/dist/unpkg/prod-deprecated/store/-private.js +88 -0
- package/dist/unpkg/prod-deprecated/store.js +437 -0
- package/dist/unpkg/prod-deprecated/types/-private.js +49 -0
- package/dist/unpkg/prod-deprecated/types/cache/aliases.js +0 -0
- package/dist/unpkg/prod-deprecated/types/cache/change.js +0 -0
- package/dist/unpkg/prod-deprecated/types/cache/mutations.js +0 -0
- package/dist/unpkg/prod-deprecated/types/cache/operations.js +0 -0
- package/dist/unpkg/prod-deprecated/types/cache/relationship.js +0 -0
- package/dist/unpkg/prod-deprecated/types/cache.js +0 -0
- package/dist/unpkg/prod-deprecated/types/graph.js +0 -0
- package/dist/unpkg/prod-deprecated/types/identifier.js +61 -0
- package/dist/unpkg/prod-deprecated/types/json/raw.js +0 -0
- package/dist/unpkg/prod-deprecated/types/params.js +0 -0
- package/dist/unpkg/prod-deprecated/types/record.js +191 -0
- package/dist/unpkg/prod-deprecated/types/request.js +77 -0
- package/dist/unpkg/prod-deprecated/types/runtime.js +34 -0
- package/dist/unpkg/prod-deprecated/types/schema/concepts.js +0 -0
- package/dist/unpkg/prod-deprecated/types/schema/fields.js +505 -0
- package/dist/unpkg/prod-deprecated/types/schema/fields.type-test.js +0 -0
- package/dist/unpkg/prod-deprecated/types/schema/schema-service.js +0 -0
- package/dist/unpkg/prod-deprecated/types/spec/document.js +0 -0
- package/dist/unpkg/prod-deprecated/types/spec/error.js +0 -0
- package/dist/unpkg/prod-deprecated/types/spec/json-api-raw.js +0 -0
- package/dist/unpkg/prod-deprecated/types/symbols.js +84 -0
- package/dist/unpkg/prod-deprecated/types/utils.js +0 -0
- package/dist/unpkg/prod-deprecated/types.js +0 -0
- package/dist/unpkg/prod-deprecated/utils/string.js +72 -0
- package/logos/README.md +2 -2
- package/logos/logo-yellow-slab.svg +1 -0
- package/logos/word-mark-black.svg +1 -0
- package/logos/word-mark-white.svg +1 -0
- package/package.json +11 -3
- package/declarations/store/-private/new-core-tmp/expensive-subscription.d.ts +0 -24
- package/dist/configure-C3x8YXzL.js +0 -181
- package/logos/NCC-1701-a-blue.svg +0 -4
- package/logos/NCC-1701-a-gold.svg +0 -4
- package/logos/NCC-1701-a-gold_100.svg +0 -1
- package/logos/NCC-1701-a-gold_base-64.txt +0 -1
- package/logos/NCC-1701-a.svg +0 -4
- package/logos/docs-badge.svg +0 -2
- package/logos/ember-data-logo-dark.svg +0 -12
- package/logos/ember-data-logo-light.svg +0 -12
- package/logos/social1.png +0 -0
- package/logos/social2.png +0 -0
- package/logos/warp-drive-logo-dark.svg +0 -4
- package/logos/warp-drive-logo-gold.svg +0 -4
- /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/{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,
|
|
2
|
-
import "./symbols-
|
|
3
|
-
import
|
|
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 {
|
|
1
|
+
export { a as Context } from "../symbols-3C1OkYtZ.js";
|
package/dist/reactive.js
CHANGED
|
@@ -1,129 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
|
|
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 {
|
|
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";
|
package/dist/store/-private.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { C as CacheHandler,
|
|
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";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { getOrSetGlobal } from './types/-private.js';
|
|
2
|
+
|
|
3
|
+
///////////////////
|
|
4
|
+
///// WARNING /////
|
|
5
|
+
///////////////////
|
|
6
|
+
|
|
7
|
+
// Great, got your attention with that warning didn't we?
|
|
8
|
+
// Good. Here's the deal: typescript treats symbols as unique types.
|
|
9
|
+
// If by accident a module creating a symbol is processed more than
|
|
10
|
+
// once, the symbol will be different in each processing. This will
|
|
11
|
+
// cause a type error.
|
|
12
|
+
// It could also cause a runtime error if the symbol is used innapropriately.
|
|
13
|
+
// However, this case is extremely hard to hit and would require other things
|
|
14
|
+
// to go wrong first.
|
|
15
|
+
//
|
|
16
|
+
// So, why do the warning? And why do we lie about the types of the symbols?
|
|
17
|
+
//
|
|
18
|
+
// Because we intentionally create multiple copies of them within the types
|
|
19
|
+
// at build time. This is because we rollup our d.ts files in order to give
|
|
20
|
+
// our consumers a better experience.
|
|
21
|
+
//
|
|
22
|
+
// However, no tool today supports rolling up d.ts files with multiple entry
|
|
23
|
+
// points correctly. The tool we use currently (vite-plugin-dts) uses @microsoft/api-extractor
|
|
24
|
+
// which creates a fully unique stand-alone types file per-entry-point. Thus
|
|
25
|
+
// every entry point that uses one of these symbols somewhere will have accidentally
|
|
26
|
+
// created a new symbol type.
|
|
27
|
+
//
|
|
28
|
+
// This cast allows us to rollup these types using this tool while not encountering
|
|
29
|
+
// the unique symbol type issue.
|
|
30
|
+
//
|
|
31
|
+
// Note that none of these symbols are part of the public API, these are used for
|
|
32
|
+
// debugging DX and as a safe way to provide an intimate contract on public objects.
|
|
33
|
+
|
|
34
|
+
const SOURCE = getOrSetGlobal('SOURCE', Symbol('#source'));
|
|
35
|
+
const Destroy = getOrSetGlobal('Destroy', Symbol.dispose || Symbol.for('Dispose'));
|
|
36
|
+
const Checkout = getOrSetGlobal('Checkout', Symbol('Checkout'));
|
|
37
|
+
const Commit = getOrSetGlobal('Commit', Symbol('Commit'));
|
|
38
|
+
const Context = getOrSetGlobal('Context', Symbol('Context'));
|
|
39
|
+
export { Checkout as C, Destroy as D, SOURCE as S, Context as a, Commit as b };
|
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.8.0-
|
|
3
|
+
const version = "5.8.0-beta.1";
|
|
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/record.js
CHANGED
|
@@ -61,4 +61,131 @@ function createIncludeValidator() {
|
|
|
61
61
|
return includes;
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* A utility that takes two types, K and T, and produces a new type that is a "mask" of T based on K.
|
|
67
|
+
*
|
|
68
|
+
* That's a mouthful, so let's break it down:
|
|
69
|
+
*
|
|
70
|
+
* Let's say you have a User type and an Address type.
|
|
71
|
+
*
|
|
72
|
+
* ```ts
|
|
73
|
+
* interface Address {
|
|
74
|
+
* street: string;
|
|
75
|
+
* city: string;
|
|
76
|
+
* state: string;
|
|
77
|
+
* zip: string;
|
|
78
|
+
* }
|
|
79
|
+
*
|
|
80
|
+
* interface User {
|
|
81
|
+
* name: string;
|
|
82
|
+
* title: string;
|
|
83
|
+
* address: Address;
|
|
84
|
+
* }
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* Now, imagine you want to load a preview of the user with some information about their address,
|
|
88
|
+
* but you don't want to load the entire user or address. You probably want to still ensure
|
|
89
|
+
* the type of the data you do load matches the underlying Address and User types, but doesn't
|
|
90
|
+
* include everything.
|
|
91
|
+
*
|
|
92
|
+
* If you did this manually, you might do something like this:
|
|
93
|
+
*
|
|
94
|
+
* ```ts
|
|
95
|
+
* interface UserPreview {
|
|
96
|
+
* name: string;
|
|
97
|
+
* address: AddressPreview;
|
|
98
|
+
* }
|
|
99
|
+
*
|
|
100
|
+
* interface AddressPreview {
|
|
101
|
+
* city: string;
|
|
102
|
+
* }
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* From a TypeScript performance perspective, this is the best way to approach these preview
|
|
106
|
+
* types, but this is also tedious and error-prone, especially if the User or Address types change.
|
|
107
|
+
*
|
|
108
|
+
* For Address, we could create a validated type using `Pick`:
|
|
109
|
+
*
|
|
110
|
+
* ```ts
|
|
111
|
+
* type AddressPreview = Pick<Address, 'city'>;
|
|
112
|
+
* ```
|
|
113
|
+
*
|
|
114
|
+
* This ensures that if the Address type changes, our AddressPreview will still be valid.
|
|
115
|
+
* However, for UserPreview, we can't just use `Pick` because the `address` property is of type `Address`,
|
|
116
|
+
* not `AddressPreview`. This is where the `Mask` type comes in.
|
|
117
|
+
*
|
|
118
|
+
* With `Mask`, we define the `UserPreview` in two parts
|
|
119
|
+
* - first, we define the subset of fields we want to include from `User`, using `Pick` or an interface.
|
|
120
|
+
* - then, we use `Mask` to replace the related types of fields like Address with their more limited subset.
|
|
121
|
+
*
|
|
122
|
+
* Here's how we can do it:
|
|
123
|
+
*
|
|
124
|
+
* ```ts
|
|
125
|
+
* // First, we define the base of UserPreview with Pick
|
|
126
|
+
* type UserPreviewBase = Pick<User, 'name' | 'address'>;
|
|
127
|
+
* // Then, we use Mask to replace Address with AddressPreview
|
|
128
|
+
* type UserPreview = Mask<{ address: AddressPreview }, UserPreviewBase>;
|
|
129
|
+
* ```
|
|
130
|
+
*
|
|
131
|
+
* Now, `UserPreview` will have the `name` field from `User` and the `address` field will be of type `AddressPreview`.
|
|
132
|
+
* This way, if the `User` or `Address` types change, TypeScript will ensure that our `UserPreview` and `AddressPreview`
|
|
133
|
+
* types remain valid and consistent with the underlying types.
|
|
134
|
+
*
|
|
135
|
+
* But what if your app has data with massive interfaces such that the TypeScript performance of this
|
|
136
|
+
* approach becomes a problem? In that case, see {@link Validate}
|
|
137
|
+
*/
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* A utility that takes two types, K and T, and ensures that K is a valid subset of T.
|
|
141
|
+
*
|
|
142
|
+
* That's a mouthful, so let's break it down:
|
|
143
|
+
*
|
|
144
|
+
* Let's say you have a User type and an Address type.
|
|
145
|
+
*
|
|
146
|
+
* ```ts
|
|
147
|
+
* interface Address {
|
|
148
|
+
* street: string;
|
|
149
|
+
* city: string;
|
|
150
|
+
* state: string;
|
|
151
|
+
* zip: string;
|
|
152
|
+
* }
|
|
153
|
+
*
|
|
154
|
+
* interface User {
|
|
155
|
+
* name: string;
|
|
156
|
+
* title: string;
|
|
157
|
+
* address: Address;
|
|
158
|
+
* }
|
|
159
|
+
* ```
|
|
160
|
+
*
|
|
161
|
+
* Now, imagine you want to load a preview of the user with some information about their address,
|
|
162
|
+
* but you don't want to load the entire user or address. You probably want to still ensure
|
|
163
|
+
* the type of the data you do load matches the underlying Address and User types, but doesn't
|
|
164
|
+
* include everything.
|
|
165
|
+
*
|
|
166
|
+
* You might do something like this:
|
|
167
|
+
*
|
|
168
|
+
* ```ts
|
|
169
|
+
* interface UserPreview {
|
|
170
|
+
* name: string;
|
|
171
|
+
* address: AddressPreview;
|
|
172
|
+
* }
|
|
173
|
+
*
|
|
174
|
+
* interface AddressPreview {
|
|
175
|
+
* city: string;
|
|
176
|
+
* }
|
|
177
|
+
* ```
|
|
178
|
+
*
|
|
179
|
+
* From a TypeScript performance perspective, this is the best way to approach these preview
|
|
180
|
+
* types, but this is also error-prone, especially if the User or Address types change.
|
|
181
|
+
*
|
|
182
|
+
* Validate can help ensure that your preview types remain valid.
|
|
183
|
+
*
|
|
184
|
+
* ```ts
|
|
185
|
+
* type IsValidUserPreview = Validate<UserPreview, User>; // This will be valid
|
|
186
|
+
* ```
|
|
187
|
+
*
|
|
188
|
+
* For help creating subsets of types, see {@link Mask}
|
|
189
|
+
*/
|
|
190
|
+
|
|
64
191
|
export { createIncludeValidator };
|
package/dist/types/request.js
CHANGED
|
@@ -14,14 +14,16 @@ const STRUCTURED = getOrSetGlobal('DOC', Symbol('DOC'));
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* When a
|
|
18
|
-
* containing the original
|
|
19
|
-
* chain (if any), and
|
|
17
|
+
* When a {@link Future} resolves, it returns an object
|
|
18
|
+
* containing the original {@link RequestInfo | request},
|
|
19
|
+
* the {@link Response | response} set by the handler chain (if any), and
|
|
20
|
+
* the processed content.
|
|
20
21
|
*/
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
|
-
* When a
|
|
24
|
-
*
|
|
24
|
+
* When a {@link Future} rejects, it throws either an {@link Error}
|
|
25
|
+
* an {@link AggregateError} or a {@link DOMException} that maintains
|
|
26
|
+
* the `{ request, response, content }` shape but is also an Error instance
|
|
25
27
|
* itself.
|
|
26
28
|
*
|
|
27
29
|
* If using the error originates from the {@link Fetch | Fetch Handler}
|
|
@@ -29,10 +31,12 @@ const STRUCTURED = getOrSetGlobal('DOC', Symbol('DOC'));
|
|
|
29
31
|
*/
|
|
30
32
|
|
|
31
33
|
/**
|
|
32
|
-
* A union of the resolve/reject data types for
|
|
34
|
+
* A union of the resolve/reject data types for the {@link Future}
|
|
35
|
+
* returned by {@link Store.request | request}
|
|
33
36
|
*
|
|
34
|
-
* See the docs for:
|
|
37
|
+
* See also the docs for:
|
|
35
38
|
*
|
|
39
|
+
* - {@link Future}
|
|
36
40
|
* - {@link StructuredDataDocument} (resolved/successful requests)
|
|
37
41
|
* - {@link StructuredErrorDocument} (rejected/failed requests)
|
|
38
42
|
*/
|