@warp-drive/ember 5.7.0-alpha.24 → 5.7.0-alpha.26

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.
@@ -1,99 +1,27 @@
1
1
  import Component from "@glimmer/component";
2
2
  import type { ComponentLike } from "@glint/template";
3
- import type { Store, StoreRequestInput } from "@warp-drive/core";
4
- import type { Future } from "@warp-drive/core/request";
5
- import type { RequestLoadingState, RequestState, RequestSubscription } from "@warp-drive/core/store/-private";
3
+ import type { RequestManager, Store } from "@warp-drive/core";
4
+ import type { ContentFeatures, RecoveryFeatures, RequestArgs, RequestLoadingState, RequestState, RequestSubscription } from "@warp-drive/core/store/-private";
6
5
  import type { StructuredErrorDocument } from "@warp-drive/core/types/request";
7
- type AutorefreshBehaviorType = "online" | "interval" | "invalid";
8
- type AutorefreshBehaviorCombos = boolean | AutorefreshBehaviorType | `${AutorefreshBehaviorType},${AutorefreshBehaviorType}` | `${AutorefreshBehaviorType},${AutorefreshBehaviorType},${AutorefreshBehaviorType}`;
9
- /**
10
- * Utilities to assist in recovering from the error.
11
- */ export interface RecoveryFeatures {
12
- isOnline: boolean;
13
- isHidden: boolean;
14
- retry: () => Promise<void>;
15
- }
16
- /**
17
- * Utilities for keeping the request fresh
18
- */ export interface ContentFeatures<RT> {
19
- isOnline: boolean;
20
- isHidden: boolean;
21
- isRefreshing: boolean;
22
- refresh: () => Promise<void>;
23
- reload: () => Promise<void>;
24
- abort?: () => void;
25
- latestRequest?: Future<RT>;
6
+ export interface EmberRequestArgs<
7
+ RT,
8
+ E
9
+ > extends RequestArgs<RT, E> {
10
+ chrome?: ComponentLike<{
11
+ Blocks: {
12
+ default: [];
13
+ };
14
+ Args: {
15
+ state: RequestState | null;
16
+ features: ContentFeatures<RT>;
17
+ };
18
+ }>;
26
19
  }
27
20
  interface RequestSignature<
28
21
  RT,
29
22
  E
30
23
  > {
31
- Args: {
32
- chrome?: ComponentLike<{
33
- Blocks: {
34
- default: [];
35
- };
36
- Args: {
37
- state: RequestState | null;
38
- features: ContentFeatures<RT>;
39
- };
40
- }>;
41
- subscription?: RequestSubscription<RT, E>;
42
- /**
43
- * The request to monitor. This should be a `Future` instance returned
44
- * by either the `store.request` or `store.requestManager.request` methods.
45
- *
46
- */ request?: Future<RT>;
47
- /**
48
- * A query to use for the request. This should be an object that can be
49
- * passed to `store.request`. Use this in place of `@request` if you would
50
- * like the component to also initiate the request.
51
- *
52
- */ query?: StoreRequestInput<RT>;
53
- /**
54
- * The store instance to use for making requests. If contexts are available,
55
- * the component will default to using the `store` on the context.
56
- *
57
- * This is required if the store is not available via context or should be
58
- * different from the store provided via context.
59
- *
60
- */ store?: Store;
61
- /**
62
- * The autorefresh behavior for the request. This can be a boolean, or any
63
- * combination of the following values: `'online'`, `'interval'`, `'invalid'`.
64
- *
65
- * - `'online'`: Refresh the request when the browser comes back online
66
- * - `'interval'`: Refresh the request at a specified interval
67
- * - `'invalid'`: Refresh the request when the store emits an invalidation
68
- *
69
- * If `true`, this is equivalent to `'online,invalid'`.
70
- *
71
- * Defaults to `false`.
72
- *
73
- */ autorefresh?: AutorefreshBehaviorCombos;
74
- /**
75
- * The number of milliseconds to wait before refreshing the request when the
76
- * browser comes back online or the network becomes available.
77
- *
78
- * This also controls the interval at which the request will be refreshed if
79
- * the `interval` autorefresh type is enabled.
80
- *
81
- * Defaults to `30_000` (30 seconds).
82
- *
83
- */ autorefreshThreshold?: number;
84
- /**
85
- * The behavior of the request initiated by autorefresh. This can be one of
86
- * the following values:
87
- *
88
- * - `'refresh'`: Refresh the request in the background
89
- * - `'reload'`: Force a reload of the request
90
- * - `'policy'` (**default**): Let the store's configured CachePolicy decide whether to
91
- * reload, refresh, or do nothing.
92
- *
93
- * Defaults to `'policy'`.
94
- *
95
- */ autorefreshBehavior?: "refresh" | "reload" | "policy";
96
- };
24
+ Args: EmberRequestArgs<RT, E>;
97
25
  Blocks: {
98
26
  /**
99
27
  * The block to render when the component is idle and waiting to be given a request.
@@ -335,7 +263,6 @@ interface RequestSignature<
335
263
  * same, only one actual request will be made.
336
264
  *
337
265
  *
338
- * @class <Request />
339
266
  * @public
340
267
  */ export declare class Request<
341
268
  RT,
@@ -347,7 +274,7 @@ interface RequestSignature<
347
274
  *
348
275
  * @internal
349
276
  */ _store: Store;
350
- get store(): Store;
277
+ get store(): Store | RequestManager;
351
278
  _state: RequestSubscription<RT, E> | null;
352
279
  get state(): RequestSubscription<RT, E>;
353
280
  /**
package/dist/index.js CHANGED
@@ -174,15 +174,6 @@ if (macroCondition(moduleExists('ember-provide-consume-context'))) {
174
174
  } = importSync('ember-provide-consume-context');
175
175
  consume = contextConsume;
176
176
  }
177
-
178
- /**
179
- * Utilities to assist in recovering from the error.
180
- */
181
-
182
- /**
183
- * Utilities for keeping the request fresh
184
- */
185
-
186
177
  const DefaultChrome = setComponentTemplate(precompileTemplate("{{yield}}", {
187
178
  strictMode: true
188
179
  }), templateOnly());
@@ -400,7 +391,6 @@ const DefaultChrome = setComponentTemplate(precompileTemplate("{{yield}}", {
400
391
  * same, only one actual request will be made.
401
392
  *
402
393
  *
403
- * @class <Request />
404
394
  * @public
405
395
  */
406
396
  class Request extends Component {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@warp-drive/ember",
3
3
  "description": "Data bindings and utilities for Ember applications using WarpDrive",
4
- "version": "5.7.0-alpha.24",
4
+ "version": "5.7.0-alpha.26",
5
5
  "license": "MIT",
6
6
  "author": "Chris Thoburn <runspired@users.noreply.github.com>",
7
7
  "repository": {
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@embroider/macros": "^1.16.12",
41
- "@warp-drive/core": "5.7.0-alpha.24"
41
+ "@warp-drive/core": "5.7.0-alpha.26"
42
42
  },
43
43
  "peerDependenciesMeta": {
44
44
  "ember-provide-consume-context": {
@@ -60,8 +60,8 @@
60
60
  "@embroider/addon-dev": "^7.1.3",
61
61
  "@ember/test-helpers": "5.2.0",
62
62
  "@ember/test-waiters": "^4.1.0",
63
- "@warp-drive/internal-config": "5.7.0-alpha.24",
64
- "@warp-drive/core": "5.7.0-alpha.24",
63
+ "@warp-drive/internal-config": "5.7.0-alpha.26",
64
+ "@warp-drive/core": "5.7.0-alpha.26",
65
65
  "babel-plugin-ember-template-compilation": "^2.4.1",
66
66
  "ember-template-imports": "^4.3.0",
67
67
  "ember-source": "~6.3.0",