@warp-drive/core 5.6.0-alpha.14 → 5.6.0-alpha.17
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/build-config/babel-macros.d.ts +1 -2
- package/declarations/build-config/canary-features.d.ts +1 -2
- package/declarations/build-config/debugging.d.ts +1 -2
- package/declarations/build-config/deprecations.d.ts +1 -2
- package/declarations/build-config/env.d.ts +1 -2
- package/declarations/build-config/macros.d.ts +1 -2
- package/declarations/build-config.d.ts +1 -2
- package/declarations/configure.d.ts +6 -7
- package/declarations/graph/-private/-diff.d.ts +21 -22
- package/declarations/graph/-private/-edge-definition.d.ts +134 -135
- package/declarations/graph/-private/-state.d.ts +93 -7
- package/declarations/graph/-private/-utils.d.ts +18 -13
- package/declarations/graph/-private/coerce-id.d.ts +6 -1
- package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +15 -4
- package/declarations/graph/-private/edges/collection.d.ts +35 -36
- package/declarations/graph/-private/edges/implicit.d.ts +28 -29
- package/declarations/graph/-private/edges/resource.d.ts +19 -20
- package/declarations/graph/-private/graph.d.ts +83 -48
- package/declarations/graph/-private/normalize-link.d.ts +7 -2
- package/declarations/graph/-private/operations/add-to-related-records.d.ts +3 -4
- package/declarations/graph/-private/operations/merge-identifier.d.ts +2 -3
- package/declarations/graph/-private/operations/remove-from-related-records.d.ts +3 -4
- package/declarations/graph/-private/operations/replace-related-record.d.ts +2 -3
- package/declarations/graph/-private/operations/replace-related-records.d.ts +58 -4
- package/declarations/graph/-private/operations/update-relationship.d.ts +11 -9
- package/declarations/graph/-private.d.ts +9 -10
- package/declarations/index.d.ts +11 -12
- package/declarations/reactive/-private/document.d.ts +143 -144
- package/declarations/reactive/-private/fields/compute.d.ts +31 -28
- package/declarations/reactive/-private/fields/extension.d.ts +8 -0
- package/declarations/reactive/-private/fields/managed-array.d.ts +19 -20
- package/declarations/reactive/-private/fields/managed-object.d.ts +16 -16
- package/declarations/reactive/-private/fields/many-array-manager.d.ts +15 -16
- package/declarations/reactive/-private/hooks.d.ts +3 -4
- package/declarations/reactive/-private/record.d.ts +61 -58
- package/declarations/reactive/-private/schema.d.ts +256 -165
- package/declarations/reactive/-private/symbols.d.ts +27 -2
- package/declarations/reactive/-private.d.ts +1 -2
- package/declarations/reactive.d.ts +4 -5
- package/declarations/request/-private/context.d.ts +34 -35
- package/declarations/request/-private/debug.d.ts +2 -3
- package/declarations/request/-private/fetch.d.ts +23 -24
- package/declarations/request/-private/future.d.ts +3 -4
- package/declarations/request/-private/manager.d.ts +159 -157
- package/declarations/request/-private/promise-cache.d.ts +21 -13
- package/declarations/request/-private/types.d.ts +124 -124
- package/declarations/request/-private/utils.d.ts +8 -9
- package/declarations/request.d.ts +5 -6
- package/declarations/store/-private/cache-handler/handler.d.ts +57 -52
- package/declarations/store/-private/cache-handler/types.d.ts +95 -96
- package/declarations/store/-private/cache-handler/utils.d.ts +16 -16
- package/declarations/store/-private/caches/cache-utils.d.ts +7 -4
- package/declarations/store/-private/caches/identifier-cache.d.ts +234 -246
- package/declarations/store/-private/caches/instance-cache.d.ts +47 -47
- package/declarations/store/-private/caches/resource-utils.d.ts +3 -4
- package/declarations/store/-private/debug/utils.d.ts +6 -7
- package/declarations/store/-private/default-cache-policy.d.ts +362 -361
- package/declarations/store/-private/legacy-model-support/record-reference.d.ts +154 -159
- package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts +14 -14
- package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +21 -22
- package/declarations/store/-private/managers/cache-manager.d.ts +440 -425
- package/declarations/store/-private/managers/notification-manager.d.ts +88 -83
- package/declarations/store/-private/managers/record-array-manager.d.ts +89 -90
- package/declarations/store/-private/network/request-cache.d.ts +86 -83
- package/declarations/store/-private/new-core-tmp/promise-state.d.ts +252 -244
- package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts +155 -72
- package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts +148 -149
- package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +28 -23
- package/declarations/store/-private/new-core-tmp/request-state.d.ts +263 -241
- package/declarations/store/-private/new-core-tmp/request-subscription.d.ts +261 -0
- package/declarations/store/-private/record-arrays/identifier-array.d.ts +125 -119
- package/declarations/store/-private/record-arrays/many-array.d.ts +180 -182
- package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +120 -110
- package/declarations/store/-private/store-service.d.ts +1594 -1586
- package/declarations/store/-private/utils/coerce-id.d.ts +6 -1
- package/declarations/store/-private/utils/construct-resource.d.ts +1 -2
- package/declarations/store/-private/utils/is-non-empty-string.d.ts +0 -1
- package/declarations/store/-private/utils/normalize-model-name.d.ts +0 -1
- package/declarations/store/-private/utils/uuid-polyfill.d.ts +0 -1
- package/declarations/store/-private.d.ts +31 -27
- package/declarations/store/-types/q/cache-capabilities-manager.d.ts +96 -97
- package/declarations/store/-types/q/ds-model.d.ts +17 -18
- package/declarations/store/-types/q/identifier.d.ts +11 -12
- package/declarations/store/-types/q/record-instance.d.ts +16 -17
- package/declarations/store/-types/q/schema-service.d.ts +346 -323
- package/declarations/store/-types/q/store.d.ts +25 -28
- package/declarations/store.d.ts +1 -2
- package/declarations/types/-private.d.ts +16 -8
- package/declarations/types/cache/aliases.d.ts +11 -1
- package/declarations/types/cache/change.d.ts +4 -5
- package/declarations/types/cache/mutations.d.ts +51 -28
- package/declarations/types/cache/operations.d.ts +60 -47
- package/declarations/types/cache/relationship.d.ts +11 -9
- package/declarations/types/cache.d.ts +495 -484
- package/declarations/types/graph.d.ts +31 -32
- package/declarations/types/identifier.d.ts +83 -82
- package/declarations/types/json/raw.d.ts +1 -2
- package/declarations/types/params.d.ts +4 -5
- package/declarations/types/record.d.ts +117 -76
- package/declarations/types/request.d.ts +289 -266
- package/declarations/types/runtime.d.ts +8 -9
- package/declarations/types/schema/concepts.d.ts +19 -13
- package/declarations/types/schema/fields.d.ts +1712 -1587
- package/declarations/types/schema/fields.type-test.d.ts +0 -1
- package/declarations/types/spec/document.d.ts +28 -22
- package/declarations/types/spec/error.d.ts +16 -17
- package/declarations/types/spec/json-api-raw.d.ts +102 -102
- package/declarations/types/symbols.d.ts +74 -75
- package/declarations/types/utils.d.ts +5 -5
- package/declarations/types.d.ts +10 -11
- package/declarations/utils/string.d.ts +43 -40
- package/dist/{configure-BgaZESRo.js → configure-B48bFHOl.js} +38 -2
- package/dist/configure.js +1 -1
- package/dist/graph/-private.js +2 -2
- package/dist/{handler-cHghx9Y9.js → handler-C2T-IyJK.js} +1 -1
- package/dist/index.js +3 -3
- package/dist/reactive/-private.js +1 -1
- package/dist/reactive.js +287 -101
- package/dist/{request-state-DgwTEXLU.js → request-state-CjLph1LP.js} +1030 -249
- package/dist/store/-private.js +3 -3
- package/dist/{symbols-BmDcn6hS.js → symbols-SIstXMLI.js} +3 -3
- package/dist/types/-private.js +1 -1
- package/dist/types/schema/fields.js +4 -4
- package/package.json +4 -4
- package/declarations/build-config/babel-macros.d.ts.map +0 -1
- package/declarations/build-config/canary-features.d.ts.map +0 -1
- package/declarations/build-config/debugging.d.ts.map +0 -1
- package/declarations/build-config/deprecations.d.ts.map +0 -1
- package/declarations/build-config/env.d.ts.map +0 -1
- package/declarations/build-config/macros.d.ts.map +0 -1
- package/declarations/build-config.d.ts.map +0 -1
- package/declarations/configure.d.ts.map +0 -1
- package/declarations/graph/-private/-diff.d.ts.map +0 -1
- package/declarations/graph/-private/-edge-definition.d.ts.map +0 -1
- package/declarations/graph/-private/-state.d.ts.map +0 -1
- package/declarations/graph/-private/-utils.d.ts.map +0 -1
- package/declarations/graph/-private/coerce-id.d.ts.map +0 -1
- package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts.map +0 -1
- package/declarations/graph/-private/edges/collection.d.ts.map +0 -1
- package/declarations/graph/-private/edges/implicit.d.ts.map +0 -1
- package/declarations/graph/-private/edges/resource.d.ts.map +0 -1
- package/declarations/graph/-private/graph.d.ts.map +0 -1
- package/declarations/graph/-private/normalize-link.d.ts.map +0 -1
- package/declarations/graph/-private/operations/add-to-related-records.d.ts.map +0 -1
- package/declarations/graph/-private/operations/merge-identifier.d.ts.map +0 -1
- package/declarations/graph/-private/operations/remove-from-related-records.d.ts.map +0 -1
- package/declarations/graph/-private/operations/replace-related-record.d.ts.map +0 -1
- package/declarations/graph/-private/operations/replace-related-records.d.ts.map +0 -1
- package/declarations/graph/-private/operations/update-relationship.d.ts.map +0 -1
- package/declarations/graph/-private.d.ts.map +0 -1
- package/declarations/index.d.ts.map +0 -1
- package/declarations/reactive/-private/document.d.ts.map +0 -1
- package/declarations/reactive/-private/fields/compute.d.ts.map +0 -1
- package/declarations/reactive/-private/fields/managed-array.d.ts.map +0 -1
- package/declarations/reactive/-private/fields/managed-object.d.ts.map +0 -1
- package/declarations/reactive/-private/fields/many-array-manager.d.ts.map +0 -1
- package/declarations/reactive/-private/hooks.d.ts.map +0 -1
- package/declarations/reactive/-private/record.d.ts.map +0 -1
- package/declarations/reactive/-private/schema.d.ts.map +0 -1
- package/declarations/reactive/-private/symbols.d.ts.map +0 -1
- package/declarations/reactive/-private.d.ts.map +0 -1
- package/declarations/reactive.d.ts.map +0 -1
- package/declarations/request/-private/context.d.ts.map +0 -1
- package/declarations/request/-private/debug.d.ts.map +0 -1
- package/declarations/request/-private/fetch.d.ts.map +0 -1
- package/declarations/request/-private/future.d.ts.map +0 -1
- package/declarations/request/-private/manager.d.ts.map +0 -1
- package/declarations/request/-private/promise-cache.d.ts.map +0 -1
- package/declarations/request/-private/types.d.ts.map +0 -1
- package/declarations/request/-private/utils.d.ts.map +0 -1
- package/declarations/request.d.ts.map +0 -1
- package/declarations/store/-private/cache-handler/handler.d.ts.map +0 -1
- package/declarations/store/-private/cache-handler/types.d.ts.map +0 -1
- package/declarations/store/-private/cache-handler/utils.d.ts.map +0 -1
- package/declarations/store/-private/caches/cache-utils.d.ts.map +0 -1
- package/declarations/store/-private/caches/identifier-cache.d.ts.map +0 -1
- package/declarations/store/-private/caches/instance-cache.d.ts.map +0 -1
- package/declarations/store/-private/caches/resource-utils.d.ts.map +0 -1
- package/declarations/store/-private/debug/utils.d.ts.map +0 -1
- package/declarations/store/-private/default-cache-policy.d.ts.map +0 -1
- package/declarations/store/-private/legacy-model-support/record-reference.d.ts.map +0 -1
- package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts.map +0 -1
- package/declarations/store/-private/managers/cache-capabilities-manager.d.ts.map +0 -1
- package/declarations/store/-private/managers/cache-manager.d.ts.map +0 -1
- package/declarations/store/-private/managers/notification-manager.d.ts.map +0 -1
- package/declarations/store/-private/managers/record-array-manager.d.ts.map +0 -1
- package/declarations/store/-private/network/request-cache.d.ts.map +0 -1
- package/declarations/store/-private/new-core-tmp/promise-state.d.ts.map +0 -1
- package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts.map +0 -1
- package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts.map +0 -1
- package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts.map +0 -1
- package/declarations/store/-private/new-core-tmp/request-state.d.ts.map +0 -1
- package/declarations/store/-private/record-arrays/identifier-array.d.ts.map +0 -1
- package/declarations/store/-private/record-arrays/many-array.d.ts.map +0 -1
- package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts.map +0 -1
- package/declarations/store/-private/store-service.d.ts.map +0 -1
- package/declarations/store/-private/store-service.type-test.d.ts +0 -2
- package/declarations/store/-private/store-service.type-test.d.ts.map +0 -1
- package/declarations/store/-private/utils/coerce-id.d.ts.map +0 -1
- package/declarations/store/-private/utils/construct-resource.d.ts.map +0 -1
- package/declarations/store/-private/utils/is-non-empty-string.d.ts.map +0 -1
- package/declarations/store/-private/utils/normalize-model-name.d.ts.map +0 -1
- package/declarations/store/-private/utils/uuid-polyfill.d.ts.map +0 -1
- package/declarations/store/-private.d.ts.map +0 -1
- package/declarations/store/-types/q/cache-capabilities-manager.d.ts.map +0 -1
- package/declarations/store/-types/q/ds-model.d.ts.map +0 -1
- package/declarations/store/-types/q/identifier.d.ts.map +0 -1
- package/declarations/store/-types/q/promise-proxies.d.ts +0 -2
- package/declarations/store/-types/q/promise-proxies.d.ts.map +0 -1
- package/declarations/store/-types/q/record-data-json-api.d.ts +0 -31
- package/declarations/store/-types/q/record-data-json-api.d.ts.map +0 -1
- package/declarations/store/-types/q/record-instance.d.ts.map +0 -1
- package/declarations/store/-types/q/schema-service.d.ts.map +0 -1
- package/declarations/store/-types/q/store.d.ts.map +0 -1
- package/declarations/store.d.ts.map +0 -1
- package/declarations/types/-private.d.ts.map +0 -1
- package/declarations/types/cache/aliases.d.ts.map +0 -1
- package/declarations/types/cache/change.d.ts.map +0 -1
- package/declarations/types/cache/mutations.d.ts.map +0 -1
- package/declarations/types/cache/operations.d.ts.map +0 -1
- package/declarations/types/cache/relationship.d.ts.map +0 -1
- package/declarations/types/cache.d.ts.map +0 -1
- package/declarations/types/graph.d.ts.map +0 -1
- package/declarations/types/identifier.d.ts.map +0 -1
- package/declarations/types/json/raw.d.ts.map +0 -1
- package/declarations/types/params.d.ts.map +0 -1
- package/declarations/types/record.d.ts.map +0 -1
- package/declarations/types/record.type-test.d.ts +0 -2
- package/declarations/types/record.type-test.d.ts.map +0 -1
- package/declarations/types/request.d.ts.map +0 -1
- package/declarations/types/request.type-test.d.ts +0 -2
- package/declarations/types/request.type-test.d.ts.map +0 -1
- package/declarations/types/runtime.d.ts.map +0 -1
- package/declarations/types/schema/concepts.d.ts.map +0 -1
- package/declarations/types/schema/fields.d.ts.map +0 -1
- package/declarations/types/schema/fields.type-test.d.ts.map +0 -1
- package/declarations/types/spec/document.d.ts.map +0 -1
- package/declarations/types/spec/error.d.ts.map +0 -1
- package/declarations/types/spec/json-api-raw.d.ts.map +0 -1
- package/declarations/types/symbols.d.ts.map +0 -1
- package/declarations/types/utils.d.ts.map +0 -1
- package/declarations/types.d.ts.map +0 -1
- package/declarations/utils/string.d.ts.map +0 -1
- package/dist/build-config/babel-macros.js.map +0 -1
- package/dist/build-config/canary-features.js.map +0 -1
- package/dist/build-config/debugging.js.map +0 -1
- package/dist/build-config/deprecations.js.map +0 -1
- package/dist/build-config/env.js.map +0 -1
- package/dist/build-config/macros.js.map +0 -1
- package/dist/build-config.js.map +0 -1
- package/dist/configure-BgaZESRo.js.map +0 -1
- package/dist/configure.js.map +0 -1
- package/dist/context-COmAnXUQ.js.map +0 -1
- package/dist/graph/-private.js.map +0 -1
- package/dist/handler-cHghx9Y9.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/reactive/-private.js.map +0 -1
- package/dist/reactive.js.map +0 -1
- package/dist/request-state-DgwTEXLU.js.map +0 -1
- package/dist/request.js.map +0 -1
- package/dist/store/-private.js.map +0 -1
- package/dist/store.js.map +0 -1
- package/dist/symbols-BmDcn6hS.js.map +0 -1
- package/dist/types/-private.js.map +0 -1
- package/dist/types/cache/aliases.js.map +0 -1
- package/dist/types/cache/change.js.map +0 -1
- package/dist/types/cache/mutations.js.map +0 -1
- package/dist/types/cache/operations.js.map +0 -1
- package/dist/types/cache/relationship.js.map +0 -1
- package/dist/types/cache.js.map +0 -1
- package/dist/types/graph.js.map +0 -1
- package/dist/types/identifier.js.map +0 -1
- package/dist/types/json/raw.js.map +0 -1
- package/dist/types/params.js.map +0 -1
- package/dist/types/record.js.map +0 -1
- package/dist/types/request.js.map +0 -1
- package/dist/types/runtime.js.map +0 -1
- package/dist/types/schema/concepts.js.map +0 -1
- package/dist/types/schema/fields.js.map +0 -1
- package/dist/types/schema/fields.type-test.js.map +0 -1
- package/dist/types/spec/document.js.map +0 -1
- package/dist/types/spec/error.js.map +0 -1
- package/dist/types/spec/json-api-raw.js.map +0 -1
- package/dist/types/symbols.js.map +0 -1
- package/dist/types/utils.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/string.js.map +0 -1
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import type { RequestManager, Store, StoreRequestInput } from "../../../index.js";
|
|
2
|
+
import type { Future } from "../../../request.js";
|
|
3
|
+
import type { StructuredErrorDocument } from "../../../types/request.js";
|
|
4
|
+
import type { RequestState } from "../../-private.js";
|
|
5
|
+
export declare const DISPOSE: "(symbol) dispose";
|
|
6
|
+
interface ErrorFeatures {
|
|
7
|
+
isHidden: boolean;
|
|
8
|
+
isOnline: boolean;
|
|
9
|
+
retry: () => Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
type AutorefreshBehaviorType = "online" | "interval" | "invalid";
|
|
12
|
+
type AutorefreshBehaviorCombos = boolean | AutorefreshBehaviorType | `${AutorefreshBehaviorType},${AutorefreshBehaviorType}` | `${AutorefreshBehaviorType},${AutorefreshBehaviorType},${AutorefreshBehaviorType}`;
|
|
13
|
+
type ContentFeatures<RT> = {
|
|
14
|
+
isOnline: boolean;
|
|
15
|
+
isHidden: boolean;
|
|
16
|
+
isRefreshing: boolean;
|
|
17
|
+
refresh: () => Promise<void>;
|
|
18
|
+
reload: () => Promise<void>;
|
|
19
|
+
abort?: () => void;
|
|
20
|
+
latestRequest?: Future<RT>;
|
|
21
|
+
};
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
23
|
+
export interface SubscriptionArgs<
|
|
24
|
+
RT,
|
|
25
|
+
T,
|
|
26
|
+
E
|
|
27
|
+
> {
|
|
28
|
+
/**
|
|
29
|
+
* The request to monitor. This should be a `Future` instance returned
|
|
30
|
+
* by either the `store.request` or `store.requestManager.request` methods.
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
request?: Future<RT>;
|
|
34
|
+
/**
|
|
35
|
+
* A query to use for the request. This should be an object that can be
|
|
36
|
+
* passed to `store.request`. Use this in place of `@request` if you would
|
|
37
|
+
* like the component to also initiate the request.
|
|
38
|
+
*
|
|
39
|
+
*/
|
|
40
|
+
query?: StoreRequestInput<RT, T>;
|
|
41
|
+
/**
|
|
42
|
+
* The autorefresh behavior for the request. This can be a boolean, or any
|
|
43
|
+
* combination of the following values: `'online'`, `'interval'`, `'invalid'`.
|
|
44
|
+
*
|
|
45
|
+
* - `'online'`: Refresh the request when the browser comes back online
|
|
46
|
+
* - `'interval'`: Refresh the request at a specified interval
|
|
47
|
+
* - `'invalid'`: Refresh the request when the store emits an invalidation
|
|
48
|
+
*
|
|
49
|
+
* If `true`, this is equivalent to `'online,invalid'`.
|
|
50
|
+
*
|
|
51
|
+
* Defaults to `false`.
|
|
52
|
+
*
|
|
53
|
+
*/
|
|
54
|
+
autorefresh?: AutorefreshBehaviorCombos;
|
|
55
|
+
/**
|
|
56
|
+
* The number of milliseconds to wait before refreshing the request when the
|
|
57
|
+
* browser comes back online or the network becomes available.
|
|
58
|
+
*
|
|
59
|
+
* This also controls the interval at which the request will be refreshed if
|
|
60
|
+
* the `interval` autorefresh type is enabled.
|
|
61
|
+
*
|
|
62
|
+
* Defaults to `30_000` (30 seconds).
|
|
63
|
+
*
|
|
64
|
+
*/
|
|
65
|
+
autorefreshThreshold?: number;
|
|
66
|
+
/**
|
|
67
|
+
* The behavior of the request initiated by autorefresh. This can be one of
|
|
68
|
+
* the following values:
|
|
69
|
+
*
|
|
70
|
+
* - `'refresh'`: Refresh the request in the background
|
|
71
|
+
* - `'reload'`: Force a reload of the request
|
|
72
|
+
* - `'policy'` (**default**): Let the store's configured CachePolicy decide whether to
|
|
73
|
+
* reload, refresh, or do nothing.
|
|
74
|
+
*
|
|
75
|
+
* Defaults to `'policy'`.
|
|
76
|
+
*
|
|
77
|
+
*/
|
|
78
|
+
autorefreshBehavior?: "refresh" | "reload" | "policy";
|
|
79
|
+
}
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
81
|
+
export interface RequestSubscription<
|
|
82
|
+
RT,
|
|
83
|
+
T,
|
|
84
|
+
E
|
|
85
|
+
> {
|
|
86
|
+
/**
|
|
87
|
+
* The method to call when the component this subscription is attached to
|
|
88
|
+
* unmounts.
|
|
89
|
+
*/
|
|
90
|
+
[DISPOSE](): void;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* A reactive class
|
|
94
|
+
*
|
|
95
|
+
* @hideconstructor
|
|
96
|
+
*/
|
|
97
|
+
export declare class RequestSubscription<
|
|
98
|
+
RT,
|
|
99
|
+
T,
|
|
100
|
+
E
|
|
101
|
+
> {
|
|
102
|
+
/**
|
|
103
|
+
* Whether the browser reports that the network is online.
|
|
104
|
+
*/
|
|
105
|
+
isOnline: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Whether the browser reports that the tab is hidden.
|
|
108
|
+
*/
|
|
109
|
+
isHidden: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Whether the component is currently refreshing the request.
|
|
112
|
+
*/
|
|
113
|
+
isRefreshing: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* The most recent blocking request that was made, typically
|
|
116
|
+
* the result of a reload.
|
|
117
|
+
*
|
|
118
|
+
* This will never be the original request passed as an arg to
|
|
119
|
+
* the component.
|
|
120
|
+
*
|
|
121
|
+
* @internal
|
|
122
|
+
*/
|
|
123
|
+
private _localRequest;
|
|
124
|
+
/**
|
|
125
|
+
* The most recent request that was made, typically due to either a
|
|
126
|
+
* reload or a refresh.
|
|
127
|
+
*
|
|
128
|
+
* This will never be the original request passed as an arg to
|
|
129
|
+
* the component.
|
|
130
|
+
*
|
|
131
|
+
* @internal
|
|
132
|
+
*/
|
|
133
|
+
private _latestRequest;
|
|
134
|
+
/**
|
|
135
|
+
* The time at which the network was reported as offline.
|
|
136
|
+
*
|
|
137
|
+
* @internal
|
|
138
|
+
*/
|
|
139
|
+
private _unavailableStart;
|
|
140
|
+
/** @internal */
|
|
141
|
+
private _intervalStart;
|
|
142
|
+
/** @internal */
|
|
143
|
+
private _nextInterval;
|
|
144
|
+
/** @internal */
|
|
145
|
+
private _invalidated;
|
|
146
|
+
/** @internal */
|
|
147
|
+
private _isUpdating;
|
|
148
|
+
/** @internal */
|
|
149
|
+
private isDestroyed;
|
|
150
|
+
/**
|
|
151
|
+
* The event listener for network status changes,
|
|
152
|
+
* cached to use the reference for removal.
|
|
153
|
+
*
|
|
154
|
+
* @internal
|
|
155
|
+
*/
|
|
156
|
+
private _onlineChanged;
|
|
157
|
+
/**
|
|
158
|
+
* The event listener for visibility status changes,
|
|
159
|
+
* cached to use the reference for removal.
|
|
160
|
+
*
|
|
161
|
+
* @internal
|
|
162
|
+
*/
|
|
163
|
+
private _backgroundChanged;
|
|
164
|
+
/**
|
|
165
|
+
* The last request passed as an arg to the component,
|
|
166
|
+
* cached for comparison.
|
|
167
|
+
*
|
|
168
|
+
* @internal
|
|
169
|
+
*/
|
|
170
|
+
private _originalRequest;
|
|
171
|
+
/**
|
|
172
|
+
* The last query passed as an arg to the component,
|
|
173
|
+
* cached for comparison.
|
|
174
|
+
*
|
|
175
|
+
* @internal
|
|
176
|
+
*/
|
|
177
|
+
private _originalQuery;
|
|
178
|
+
/** @internal */
|
|
179
|
+
private _subscription;
|
|
180
|
+
/** @internal */
|
|
181
|
+
private _subscribedTo;
|
|
182
|
+
/** @internal */
|
|
183
|
+
private _args;
|
|
184
|
+
/** @internal */
|
|
185
|
+
store: Store | RequestManager;
|
|
186
|
+
constructor(store: Store | RequestManager, args: SubscriptionArgs<RT, T, E>);
|
|
187
|
+
/**
|
|
188
|
+
* @internal
|
|
189
|
+
*/
|
|
190
|
+
private _beginPolling;
|
|
191
|
+
get isIdle(): boolean;
|
|
192
|
+
get autorefreshTypes(): Set<AutorefreshBehaviorType>;
|
|
193
|
+
// we only run this function on component creation
|
|
194
|
+
// and when an update is triggered, so it does not
|
|
195
|
+
// react to changes in the autorefreshThreshold
|
|
196
|
+
// or autorefresh args.
|
|
197
|
+
//
|
|
198
|
+
// if we need to react to those changes, we can
|
|
199
|
+
// use a modifier or internal component or some
|
|
200
|
+
// such to trigger a re-run of this function.
|
|
201
|
+
private _scheduleInterval;
|
|
202
|
+
private _clearInterval;
|
|
203
|
+
/**
|
|
204
|
+
* @internal
|
|
205
|
+
*/
|
|
206
|
+
private _updateSubscriptions;
|
|
207
|
+
/**
|
|
208
|
+
* @internal
|
|
209
|
+
*/
|
|
210
|
+
private _removeSubscriptions;
|
|
211
|
+
/**
|
|
212
|
+
* Install the event listeners for network and visibility changes.
|
|
213
|
+
* This is only done in browser environments with a global `window`.
|
|
214
|
+
*
|
|
215
|
+
* @internal
|
|
216
|
+
*/
|
|
217
|
+
private _installListeners;
|
|
218
|
+
/**
|
|
219
|
+
* If the network is online and the tab is visible, either reload or refresh the request
|
|
220
|
+
* based on the component's configuration and the requested update mode.
|
|
221
|
+
*
|
|
222
|
+
* Valid modes are:
|
|
223
|
+
*
|
|
224
|
+
* - `'reload'`: Force a reload of the request.
|
|
225
|
+
* - `'refresh'`: Refresh the request in the background.
|
|
226
|
+
* - `'policy'`: Make the request, letting the store's configured CachePolicy decide whether to reload, refresh, or do nothing.
|
|
227
|
+
* - `undefined`: Make the request using the component's autorefreshBehavior setting if the autorefreshThreshold has passed.
|
|
228
|
+
*
|
|
229
|
+
* @internal
|
|
230
|
+
*/
|
|
231
|
+
private _maybeUpdate;
|
|
232
|
+
/**
|
|
233
|
+
* Retry the request, reloading it from the server.
|
|
234
|
+
*/
|
|
235
|
+
retry: () => Promise<void>;
|
|
236
|
+
/**
|
|
237
|
+
* Refresh the request, updating it in the background.
|
|
238
|
+
*/
|
|
239
|
+
refresh: () => Promise<void>;
|
|
240
|
+
/**
|
|
241
|
+
* features to yield to the error slot of a component
|
|
242
|
+
*/
|
|
243
|
+
get errorFeatures(): ErrorFeatures;
|
|
244
|
+
/**
|
|
245
|
+
* features to yield to the content slot of a component
|
|
246
|
+
*/
|
|
247
|
+
get contentFeatures(): ContentFeatures<RT>;
|
|
248
|
+
/**
|
|
249
|
+
* @internal
|
|
250
|
+
*/
|
|
251
|
+
get _request(): Future<RT>;
|
|
252
|
+
get request(): Future<RT>;
|
|
253
|
+
get reqState(): RequestState<RT, T, StructuredErrorDocument<E>>;
|
|
254
|
+
get result(): RT;
|
|
255
|
+
}
|
|
256
|
+
export declare function createRequestSubscription<
|
|
257
|
+
RT,
|
|
258
|
+
T,
|
|
259
|
+
E
|
|
260
|
+
>(store: Store | RequestManager, args: SubscriptionArgs<RT, T, E>): RequestSubscription<RT, T, E>;
|
|
261
|
+
export {};
|
|
@@ -1,141 +1,147 @@
|
|
|
1
|
-
import type { BaseFinderOptions } from
|
|
2
|
-
import type { LocalRelationshipOperation } from
|
|
3
|
-
import type { StableDocumentIdentifier, StableRecordIdentifier } from
|
|
4
|
-
import type { TypeFromInstanceOrString } from
|
|
5
|
-
import type { ImmutableRequestInfo } from
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
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";
|
|
12
13
|
export declare const SOURCE: "___(unique) Symbol(#source)";
|
|
13
14
|
export declare const MUTATE: "___(unique) Symbol(#update)";
|
|
14
15
|
declare const IS_COLLECTION: "___(unique) Symbol(IS_COLLECTION)";
|
|
15
16
|
export type IdentifierArrayCreateOptions<T = unknown> = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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;
|
|
24
27
|
};
|
|
25
28
|
type PromiseTo<T> = Omit<Promise<T>, typeof Symbol.toStringTag>;
|
|
26
29
|
type PromiseManyArray<T> = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
length: number;
|
|
31
|
+
content: IdentifierArray<T> | null;
|
|
32
|
+
promise: Promise<IdentifierArray<T>> | null;
|
|
30
33
|
} & PromiseTo<IdentifierArray<T>>;
|
|
31
34
|
export type MinimumManager = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
_syncArray: (array: IdentifierArray) => void;
|
|
36
|
+
mutate?(mutation: LocalRelationshipOperation): void;
|
|
37
|
+
reloadHasMany?<T>(key: string, options?: BaseFinderOptions): Promise<IdentifierArray<T>> | PromiseManyArray<T>;
|
|
35
38
|
};
|
|
36
39
|
/**
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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.
|
|
42
45
|
|
|
43
|
-
|
|
46
|
+
This class should not be imported and instantiated by consuming applications.
|
|
44
47
|
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
@class RecordArray
|
|
49
|
+
@public
|
|
47
50
|
*/
|
|
48
|
-
export interface IdentifierArray<T = unknown> extends Omit<Array<T>,
|
|
49
|
-
|
|
51
|
+
export interface IdentifierArray<T = unknown> extends Omit<Array<T>, "[]"> {
|
|
52
|
+
[IS_COLLECTION]: boolean;
|
|
53
|
+
[ARRAY_SIGNAL]: WarpDriveSignal;
|
|
54
|
+
[SOURCE]: StableRecordIdentifier[];
|
|
50
55
|
}
|
|
51
56
|
export declare class IdentifierArray<T = unknown> {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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>;
|
|
127
134
|
}
|
|
128
135
|
export type CollectionCreateOptions = IdentifierArrayCreateOptions & {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
136
|
+
manager: RecordArrayManager;
|
|
137
|
+
query: ImmutableRequestInfo | Record<string, unknown> | null;
|
|
138
|
+
isLoaded: boolean;
|
|
132
139
|
};
|
|
133
140
|
export declare class Collection<T = unknown> extends IdentifierArray<T> {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
141
|
+
query: ImmutableRequestInfo | Record<string, unknown> | null;
|
|
142
|
+
_manager: RecordArrayManager;
|
|
143
|
+
constructor(options: CollectionCreateOptions);
|
|
144
|
+
_update(): Promise<Collection<T>>;
|
|
145
|
+
destroy(clear: boolean): void;
|
|
139
146
|
}
|
|
140
147
|
export {};
|
|
141
|
-
//# sourceMappingURL=identifier-array.d.ts.map
|