@warp-drive/ember 5.7.0-alpha.2 → 5.7.0-alpha.21
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 +1 -1
- package/declarations/-private/request.d.ts +18 -20
- package/declarations/index.d.ts +2 -2
- package/dist/index.js +9 -0
- package/package.json +10 -5
package/README.md
CHANGED
|
@@ -5,7 +5,16 @@ import type { RequestLoadingState, RequestState, RequestSubscription } from "@wa
|
|
|
5
5
|
import type { StructuredErrorDocument } from "@warp-drive/core/types/request";
|
|
6
6
|
type AutorefreshBehaviorType = "online" | "interval" | "invalid";
|
|
7
7
|
type AutorefreshBehaviorCombos = boolean | AutorefreshBehaviorType | `${AutorefreshBehaviorType},${AutorefreshBehaviorType}` | `${AutorefreshBehaviorType},${AutorefreshBehaviorType},${AutorefreshBehaviorType}`;
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Utilities to assist in recovering from the error.
|
|
10
|
+
*/ export interface RecoveryFeatures {
|
|
11
|
+
isOnline: boolean;
|
|
12
|
+
isHidden: boolean;
|
|
13
|
+
retry: () => Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Utilities for keeping the request fresh
|
|
17
|
+
*/ export interface ContentFeatures<RT> {
|
|
9
18
|
isOnline: boolean;
|
|
10
19
|
isHidden: boolean;
|
|
11
20
|
isRefreshing: boolean;
|
|
@@ -13,10 +22,9 @@ type ContentFeatures<RT> = {
|
|
|
13
22
|
reload: () => Promise<void>;
|
|
14
23
|
abort?: () => void;
|
|
15
24
|
latestRequest?: Future<RT>;
|
|
16
|
-
}
|
|
25
|
+
}
|
|
17
26
|
interface RequestSignature<
|
|
18
27
|
RT,
|
|
19
|
-
T,
|
|
20
28
|
E
|
|
21
29
|
> {
|
|
22
30
|
Args: {
|
|
@@ -30,7 +38,7 @@ interface RequestSignature<
|
|
|
30
38
|
* passed to `store.request`. Use this in place of `@request` if you would
|
|
31
39
|
* like the component to also initiate the request.
|
|
32
40
|
*
|
|
33
|
-
*/ query?: StoreRequestInput<RT
|
|
41
|
+
*/ query?: StoreRequestInput<RT>;
|
|
34
42
|
/**
|
|
35
43
|
* The store instance to use for making requests. If contexts are available,
|
|
36
44
|
* the component will default to using the `store` on the context.
|
|
@@ -87,28 +95,19 @@ interface RequestSignature<
|
|
|
87
95
|
/**
|
|
88
96
|
* The block to render when the request was cancelled.
|
|
89
97
|
*
|
|
90
|
-
*/ cancelled: [error: StructuredErrorDocument<E>, features:
|
|
91
|
-
isOnline: boolean;
|
|
92
|
-
isHidden: boolean;
|
|
93
|
-
retry: () => Promise<void>;
|
|
94
|
-
}];
|
|
98
|
+
*/ cancelled: [error: StructuredErrorDocument<E>, features: RecoveryFeatures];
|
|
95
99
|
/**
|
|
96
100
|
* The block to render when the request failed. If this block is not provided,
|
|
97
101
|
* the error will be rethrown.
|
|
98
102
|
*
|
|
99
103
|
* Thus it is required to provide an error block and proper error handling if
|
|
100
104
|
* you do not want the error to crash the application.
|
|
101
|
-
|
|
102
|
-
*/ error: [error: StructuredErrorDocument<E>, features: {
|
|
103
|
-
isOnline: boolean;
|
|
104
|
-
isHidden: boolean;
|
|
105
|
-
retry: () => Promise<void>;
|
|
106
|
-
}];
|
|
105
|
+
*/ error: [error: StructuredErrorDocument<E>, features: RecoveryFeatures];
|
|
107
106
|
/**
|
|
108
107
|
* The block to render when the request succeeded.
|
|
109
108
|
*
|
|
110
109
|
*/ content: [value: RT, features: ContentFeatures<RT>];
|
|
111
|
-
always: [state: RequestState<RT,
|
|
110
|
+
always: [state: RequestState<RT, StructuredErrorDocument<E>>];
|
|
112
111
|
};
|
|
113
112
|
}
|
|
114
113
|
/**
|
|
@@ -329,9 +328,8 @@ interface RequestSignature<
|
|
|
329
328
|
* @public
|
|
330
329
|
*/ export declare class Request<
|
|
331
330
|
RT,
|
|
332
|
-
T,
|
|
333
331
|
E
|
|
334
|
-
> extends Component<RequestSignature<RT,
|
|
332
|
+
> extends Component<RequestSignature<RT, E>> {
|
|
335
333
|
/**
|
|
336
334
|
* The store instance to use for making requests. If contexts are available, this
|
|
337
335
|
* will be the `store` on the context, else it will be the store service.
|
|
@@ -339,8 +337,8 @@ interface RequestSignature<
|
|
|
339
337
|
* @internal
|
|
340
338
|
*/ _store: Store;
|
|
341
339
|
get store(): Store;
|
|
342
|
-
_state: RequestSubscription<RT,
|
|
343
|
-
get state(): RequestSubscription<RT,
|
|
340
|
+
_state: RequestSubscription<RT, E> | null;
|
|
341
|
+
get state(): RequestSubscription<RT, E>;
|
|
344
342
|
willDestroy(): void;
|
|
345
343
|
}
|
|
346
344
|
export {};
|
package/declarations/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* ## Installation
|
|
5
5
|
*
|
|
6
|
-
* ```
|
|
6
|
+
* ```sh
|
|
7
7
|
* pnpm install @warp-drive/ember
|
|
8
8
|
* ```
|
|
9
9
|
*
|
|
@@ -146,7 +146,7 @@ export { getPromiseState } from "@warp-drive/core/store/-private";
|
|
|
146
146
|
* interface Future<T> extends Promise<T>> {
|
|
147
147
|
* getStream(): Promise<ReadableStream>;
|
|
148
148
|
* abort(): void;
|
|
149
|
-
* lid:
|
|
149
|
+
* lid: RequestKey | null;
|
|
150
150
|
* }
|
|
151
151
|
* ```
|
|
152
152
|
*
|
package/dist/index.js
CHANGED
|
@@ -158,6 +158,15 @@ if (macroCondition(moduleExists('ember-provide-consume-context'))) {
|
|
|
158
158
|
} = importSync('ember-provide-consume-context');
|
|
159
159
|
consume = contextConsume;
|
|
160
160
|
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Utilities to assist in recovering from the error.
|
|
164
|
+
*/
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Utilities for keeping the request fresh
|
|
168
|
+
*/
|
|
169
|
+
|
|
161
170
|
/**
|
|
162
171
|
* The `<Request />` component is a powerful tool for managing data fetching and
|
|
163
172
|
* state in your Ember application. It provides a declarative approach to reactive
|
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.
|
|
4
|
+
"version": "5.7.0-alpha.21",
|
|
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.
|
|
41
|
+
"@warp-drive/core": "5.7.0-alpha.21"
|
|
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.
|
|
64
|
-
"@warp-drive/core": "5.7.0-alpha.
|
|
63
|
+
"@warp-drive/internal-config": "5.7.0-alpha.21",
|
|
64
|
+
"@warp-drive/core": "5.7.0-alpha.21",
|
|
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",
|
|
@@ -76,7 +76,12 @@
|
|
|
76
76
|
"ember-addon": {
|
|
77
77
|
"main": "addon-main.cjs",
|
|
78
78
|
"type": "addon",
|
|
79
|
-
"version": 2
|
|
79
|
+
"version": 2,
|
|
80
|
+
"externals": [
|
|
81
|
+
"@ember/-internals",
|
|
82
|
+
"@ember/-internals/metal",
|
|
83
|
+
"@glimmer/validator"
|
|
84
|
+
]
|
|
80
85
|
},
|
|
81
86
|
"ember": {
|
|
82
87
|
"edition": "octane"
|