unwrapped 0.1.9 → 0.1.11
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/CHANGELOG.md +12 -0
- package/dist/core/index.d.mts +74 -18
- package/dist/core/index.d.ts +74 -18
- package/dist/core/index.js +88 -16
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +88 -16
- package/dist/core/index.mjs.map +1 -1
- package/dist/vue/index.d.mts +120 -96
- package/dist/vue/index.d.ts +120 -96
- package/package.json +1 -1
package/dist/vue/index.d.mts
CHANGED
|
@@ -13,13 +13,13 @@ interface ReactiveProcessOptions {
|
|
|
13
13
|
* @param asyncResult the result to make reactive
|
|
14
14
|
* @returns the ref to the result
|
|
15
15
|
*/
|
|
16
|
-
declare function useAsyncResultRef<T, E extends ErrorBase = ErrorBase>(asyncResult?: AsyncResult<T, E>): Ref<AsyncResult<T, E>, AsyncResult<T, E>>;
|
|
16
|
+
declare function useAsyncResultRef<T, E extends ErrorBase = ErrorBase>(asyncResult?: AsyncResult<T, E>): Ref<AsyncResult<T, E, unknown>, AsyncResult<T, E, unknown>>;
|
|
17
17
|
/**
|
|
18
18
|
* Creates an AsyncResult ref from a promise returning a Result.
|
|
19
19
|
* @param promise the promise returning a Result
|
|
20
20
|
* @returns the ref to the AsyncResult
|
|
21
21
|
*/
|
|
22
|
-
declare function useAsyncResultRefFromPromise<T, E extends ErrorBase = ErrorBase>(promise: Promise<Result<T, E>>): Ref<AsyncResult<T, E>, AsyncResult<T, E>>;
|
|
22
|
+
declare function useAsyncResultRefFromPromise<T, E extends ErrorBase = ErrorBase>(promise: Promise<Result<T, E>>): Ref<AsyncResult<T, E, unknown>, AsyncResult<T, E, unknown>>;
|
|
23
23
|
/**
|
|
24
24
|
* Watches a source, gives it as inputs to the function provided, and updates the result contained in the ref accordingly.
|
|
25
25
|
*
|
|
@@ -101,6 +101,7 @@ declare function useAsyncResultCollection<T = any, E extends ErrorBase = ErrorBa
|
|
|
101
101
|
finally: (onfinally?: (() => void) | null | undefined) => Promise<Result<T, E>>;
|
|
102
102
|
readonly [Symbol.toStringTag]: string;
|
|
103
103
|
};
|
|
104
|
+
progress?: unknown;
|
|
104
105
|
} | {
|
|
105
106
|
status: "success";
|
|
106
107
|
value: vue.UnwrapRef<T>;
|
|
@@ -115,28 +116,31 @@ declare function useAsyncResultCollection<T = any, E extends ErrorBase = ErrorBa
|
|
|
115
116
|
unwrapOrNull: () => T | null;
|
|
116
117
|
unwrapOrThrow: () => T;
|
|
117
118
|
unwrapErrorOrNull: () => E | null;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
getProgressOrNull: () => unknown;
|
|
120
|
+
updateFromValue: (value: T) => AsyncResult<T, E, unknown>;
|
|
121
|
+
updateFromError: (error: E) => AsyncResult<T, E, unknown>;
|
|
122
|
+
updateProgress: (progress: unknown) => AsyncResult<T, E, unknown>;
|
|
123
|
+
updateFromValuePromise: (promise: Promise<T>) => AsyncResult<T, E, unknown>;
|
|
124
|
+
waitForSettled: () => Promise<AsyncResult<T, E, unknown>>;
|
|
122
125
|
toResultPromise: () => Promise<Result<T, E>>;
|
|
123
126
|
toValueOrThrowPromise: () => Promise<T>;
|
|
124
127
|
toValueOrNullPromise: () => Promise<T | null>;
|
|
125
|
-
updateFromResultPromise: (promise: Promise<Result<T, E>>) => AsyncResult<T, E>;
|
|
126
|
-
listen: (listener: unwrapped_core.AsyncResultListener<T, E>,
|
|
127
|
-
listenUntilSettled: (listener: unwrapped_core.AsyncResultListener<T, E>,
|
|
128
|
+
updateFromResultPromise: (promise: Promise<Result<T, E>>) => AsyncResult<T, E, unknown>;
|
|
129
|
+
listen: (listener: unwrapped_core.AsyncResultListener<T, E, unknown>, options?: unwrapped_core.AsyncResultListenerOptions) => () => void;
|
|
130
|
+
listenUntilSettled: (listener: unwrapped_core.AsyncResultListener<T, E, unknown>, options?: unwrapped_core.AsyncResultListenerOptions) => () => void;
|
|
128
131
|
onSuccessOnce: (callback: (value: T) => void) => () => void;
|
|
129
132
|
onSuccessPerpetual: (callback: (value: T) => void) => () => void;
|
|
130
133
|
onErrorOnce: (callback: (error: E) => void) => () => void;
|
|
131
134
|
onErrorPerpetual: (callback: (error: E) => void) => () => void;
|
|
132
|
-
mirror: (other: AsyncResult<T, E
|
|
133
|
-
mirrorUntilSettled: (other: AsyncResult<T, E
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
mirror: (other: AsyncResult<T, E, unknown>, options?: unwrapped_core.AsyncResultListenerOptions) => () => void;
|
|
136
|
+
mirrorUntilSettled: (other: AsyncResult<T, E, unknown>, options?: unwrapped_core.AsyncResultListenerOptions) => () => void;
|
|
137
|
+
updateFromAction: (action: Action<T, E, unknown>) => AsyncResult<T, E, unknown>;
|
|
138
|
+
chain: <O, E2 extends ErrorBase = ErrorBase>(fn: unwrapped_core.ChainStep<T, O, E | E2>) => AsyncResult<O, E | E2, unknown>;
|
|
139
|
+
flatChain: <O, E2 extends ErrorBase = ErrorBase>(fn: FlatChainStep<T, O, E | E2, unknown>) => AsyncResult<O, E | E2, unknown>;
|
|
140
|
+
runInPlace: (generatorFunc: () => AsyncResultGenerator<T>) => AsyncResult<T, E, unknown>;
|
|
137
141
|
log: (name?: string) => void;
|
|
138
142
|
debug: (name?: string) => () => void;
|
|
139
|
-
[Symbol.iterator]: () => Generator<AsyncResult<T, E>, T, any>;
|
|
143
|
+
[Symbol.iterator]: () => Generator<AsyncResult<T, E, unknown>, T, any>;
|
|
140
144
|
};
|
|
141
145
|
unsub: () => void;
|
|
142
146
|
}> & Omit<Map<string, unwrapped_core.AsyncResultCollectionItem<T, E>>, keyof Map<any, any>>;
|
|
@@ -152,6 +156,7 @@ declare function useAsyncResultCollection<T = any, E extends ErrorBase = ErrorBa
|
|
|
152
156
|
finally: (onfinally?: (() => void) | null | undefined) => Promise<Result<T, E>>;
|
|
153
157
|
readonly [Symbol.toStringTag]: string;
|
|
154
158
|
};
|
|
159
|
+
progress?: unknown;
|
|
155
160
|
} | {
|
|
156
161
|
status: "success";
|
|
157
162
|
value: vue.UnwrapRef<T>;
|
|
@@ -166,28 +171,31 @@ declare function useAsyncResultCollection<T = any, E extends ErrorBase = ErrorBa
|
|
|
166
171
|
unwrapOrNull: () => T | null;
|
|
167
172
|
unwrapOrThrow: () => T;
|
|
168
173
|
unwrapErrorOrNull: () => E | null;
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
174
|
+
getProgressOrNull: () => unknown;
|
|
175
|
+
updateFromValue: (value: T) => AsyncResult<T, E, unknown>;
|
|
176
|
+
updateFromError: (error: E) => AsyncResult<T, E, unknown>;
|
|
177
|
+
updateProgress: (progress: unknown) => AsyncResult<T, E, unknown>;
|
|
178
|
+
updateFromValuePromise: (promise: Promise<T>) => AsyncResult<T, E, unknown>;
|
|
179
|
+
waitForSettled: () => Promise<AsyncResult<T, E, unknown>>;
|
|
173
180
|
toResultPromise: () => Promise<Result<T, E>>;
|
|
174
181
|
toValueOrThrowPromise: () => Promise<T>;
|
|
175
182
|
toValueOrNullPromise: () => Promise<T | null>;
|
|
176
|
-
updateFromResultPromise: (promise: Promise<Result<T, E>>) => AsyncResult<T, E>;
|
|
177
|
-
listen: (listener: unwrapped_core.AsyncResultListener<T, E>,
|
|
178
|
-
listenUntilSettled: (listener: unwrapped_core.AsyncResultListener<T, E>,
|
|
183
|
+
updateFromResultPromise: (promise: Promise<Result<T, E>>) => AsyncResult<T, E, unknown>;
|
|
184
|
+
listen: (listener: unwrapped_core.AsyncResultListener<T, E, unknown>, options?: unwrapped_core.AsyncResultListenerOptions) => () => void;
|
|
185
|
+
listenUntilSettled: (listener: unwrapped_core.AsyncResultListener<T, E, unknown>, options?: unwrapped_core.AsyncResultListenerOptions) => () => void;
|
|
179
186
|
onSuccessOnce: (callback: (value: T) => void) => () => void;
|
|
180
187
|
onSuccessPerpetual: (callback: (value: T) => void) => () => void;
|
|
181
188
|
onErrorOnce: (callback: (error: E) => void) => () => void;
|
|
182
189
|
onErrorPerpetual: (callback: (error: E) => void) => () => void;
|
|
183
|
-
mirror: (other: AsyncResult<T, E
|
|
184
|
-
mirrorUntilSettled: (other: AsyncResult<T, E
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
190
|
+
mirror: (other: AsyncResult<T, E, unknown>, options?: unwrapped_core.AsyncResultListenerOptions) => () => void;
|
|
191
|
+
mirrorUntilSettled: (other: AsyncResult<T, E, unknown>, options?: unwrapped_core.AsyncResultListenerOptions) => () => void;
|
|
192
|
+
updateFromAction: (action: Action<T, E, unknown>) => AsyncResult<T, E, unknown>;
|
|
193
|
+
chain: <O, E2 extends ErrorBase = ErrorBase>(fn: unwrapped_core.ChainStep<T, O, E | E2>) => AsyncResult<O, E | E2, unknown>;
|
|
194
|
+
flatChain: <O, E2 extends ErrorBase = ErrorBase>(fn: FlatChainStep<T, O, E | E2, unknown>) => AsyncResult<O, E | E2, unknown>;
|
|
195
|
+
runInPlace: (generatorFunc: () => AsyncResultGenerator<T>) => AsyncResult<T, E, unknown>;
|
|
188
196
|
log: (name?: string) => void;
|
|
189
197
|
debug: (name?: string) => () => void;
|
|
190
|
-
[Symbol.iterator]: () => Generator<AsyncResult<T, E>, T, any>;
|
|
198
|
+
[Symbol.iterator]: () => Generator<AsyncResult<T, E, unknown>, T, any>;
|
|
191
199
|
}[];
|
|
192
200
|
readonly entries: [string, {
|
|
193
201
|
state: {
|
|
@@ -200,6 +208,7 @@ declare function useAsyncResultCollection<T = any, E extends ErrorBase = ErrorBa
|
|
|
200
208
|
finally: (onfinally?: (() => void) | null | undefined) => Promise<Result<T, E>>;
|
|
201
209
|
readonly [Symbol.toStringTag]: string;
|
|
202
210
|
};
|
|
211
|
+
progress?: unknown;
|
|
203
212
|
} | {
|
|
204
213
|
status: "success";
|
|
205
214
|
value: vue.UnwrapRef<T>;
|
|
@@ -214,44 +223,47 @@ declare function useAsyncResultCollection<T = any, E extends ErrorBase = ErrorBa
|
|
|
214
223
|
unwrapOrNull: () => T | null;
|
|
215
224
|
unwrapOrThrow: () => T;
|
|
216
225
|
unwrapErrorOrNull: () => E | null;
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
226
|
+
getProgressOrNull: () => unknown;
|
|
227
|
+
updateFromValue: (value: T) => AsyncResult<T, E, unknown>;
|
|
228
|
+
updateFromError: (error: E) => AsyncResult<T, E, unknown>;
|
|
229
|
+
updateProgress: (progress: unknown) => AsyncResult<T, E, unknown>;
|
|
230
|
+
updateFromValuePromise: (promise: Promise<T>) => AsyncResult<T, E, unknown>;
|
|
231
|
+
waitForSettled: () => Promise<AsyncResult<T, E, unknown>>;
|
|
221
232
|
toResultPromise: () => Promise<Result<T, E>>;
|
|
222
233
|
toValueOrThrowPromise: () => Promise<T>;
|
|
223
234
|
toValueOrNullPromise: () => Promise<T | null>;
|
|
224
|
-
updateFromResultPromise: (promise: Promise<Result<T, E>>) => AsyncResult<T, E>;
|
|
225
|
-
listen: (listener: unwrapped_core.AsyncResultListener<T, E>,
|
|
226
|
-
listenUntilSettled: (listener: unwrapped_core.AsyncResultListener<T, E>,
|
|
235
|
+
updateFromResultPromise: (promise: Promise<Result<T, E>>) => AsyncResult<T, E, unknown>;
|
|
236
|
+
listen: (listener: unwrapped_core.AsyncResultListener<T, E, unknown>, options?: unwrapped_core.AsyncResultListenerOptions) => () => void;
|
|
237
|
+
listenUntilSettled: (listener: unwrapped_core.AsyncResultListener<T, E, unknown>, options?: unwrapped_core.AsyncResultListenerOptions) => () => void;
|
|
227
238
|
onSuccessOnce: (callback: (value: T) => void) => () => void;
|
|
228
239
|
onSuccessPerpetual: (callback: (value: T) => void) => () => void;
|
|
229
240
|
onErrorOnce: (callback: (error: E) => void) => () => void;
|
|
230
241
|
onErrorPerpetual: (callback: (error: E) => void) => () => void;
|
|
231
|
-
mirror: (other: AsyncResult<T, E
|
|
232
|
-
mirrorUntilSettled: (other: AsyncResult<T, E
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
242
|
+
mirror: (other: AsyncResult<T, E, unknown>, options?: unwrapped_core.AsyncResultListenerOptions) => () => void;
|
|
243
|
+
mirrorUntilSettled: (other: AsyncResult<T, E, unknown>, options?: unwrapped_core.AsyncResultListenerOptions) => () => void;
|
|
244
|
+
updateFromAction: (action: Action<T, E, unknown>) => AsyncResult<T, E, unknown>;
|
|
245
|
+
chain: <O, E2 extends ErrorBase = ErrorBase>(fn: unwrapped_core.ChainStep<T, O, E | E2>) => AsyncResult<O, E | E2, unknown>;
|
|
246
|
+
flatChain: <O, E2 extends ErrorBase = ErrorBase>(fn: FlatChainStep<T, O, E | E2, unknown>) => AsyncResult<O, E | E2, unknown>;
|
|
247
|
+
runInPlace: (generatorFunc: () => AsyncResultGenerator<T>) => AsyncResult<T, E, unknown>;
|
|
236
248
|
log: (name?: string) => void;
|
|
237
249
|
debug: (name?: string) => () => void;
|
|
238
|
-
[Symbol.iterator]: () => Generator<AsyncResult<T, E>, T, any>;
|
|
250
|
+
[Symbol.iterator]: () => Generator<AsyncResult<T, E, unknown>, T, any>;
|
|
239
251
|
}][];
|
|
240
252
|
state: unwrapped_core.AsyncResultCollectionState;
|
|
241
253
|
listen: (listener: (taskQueue: AsyncResultCollection<T, E>) => void) => () => void;
|
|
242
|
-
onItemSuccess: (listener: (task: AsyncResult<T, E>, key: string) => void) => () => void;
|
|
243
|
-
onItemError: (listener: (task: AsyncResult<T, E>, key: string) => void) => () => void;
|
|
244
|
-
add: (key: string, task: AsyncResult<T, E>, removeOnSettle?: boolean) => AsyncResult<T, E>;
|
|
254
|
+
onItemSuccess: (listener: (task: AsyncResult<T, E, unknown>, key: string) => void) => () => void;
|
|
255
|
+
onItemError: (listener: (task: AsyncResult<T, E, unknown>, key: string) => void) => () => void;
|
|
256
|
+
add: (key: string, task: AsyncResult<T, E, unknown>, removeOnSettle?: boolean) => AsyncResult<T, E, unknown>;
|
|
245
257
|
remove: (key: string) => boolean;
|
|
246
258
|
clear: () => void;
|
|
247
259
|
anyLoading: () => boolean;
|
|
248
|
-
getAllFiltered: (predicate: (task: AsyncResult<T, E>) => boolean) => AsyncResult<T, E>[];
|
|
249
|
-
getAllFilteredAndMap: <U>(filterPredicate: (task: AsyncResult<T, E>) => boolean, mapFunc: (task: AsyncResult<T, E>) => U) => U[];
|
|
250
|
-
getAllSuccess: () => AsyncResult<T, E>[];
|
|
260
|
+
getAllFiltered: (predicate: (task: AsyncResult<T, E, unknown>) => boolean) => AsyncResult<T, E, unknown>[];
|
|
261
|
+
getAllFilteredAndMap: <U>(filterPredicate: (task: AsyncResult<T, E, unknown>) => boolean, mapFunc: (task: AsyncResult<T, E, unknown>) => U) => U[];
|
|
262
|
+
getAllSuccess: () => AsyncResult<T, E, unknown>[];
|
|
251
263
|
getAllSuccessValues: () => T[];
|
|
252
|
-
getAllErrors: () => AsyncResult<T, E>[];
|
|
264
|
+
getAllErrors: () => AsyncResult<T, E, unknown>[];
|
|
253
265
|
getAllErrorValues: () => E[];
|
|
254
|
-
getAllLoading: () => AsyncResult<T, E>[];
|
|
266
|
+
getAllLoading: () => AsyncResult<T, E, unknown>[];
|
|
255
267
|
getAllLoadingPromises: () => Promise<Result<T, E>>[];
|
|
256
268
|
log: (name?: string) => void;
|
|
257
269
|
debug: (name?: string) => () => void;
|
|
@@ -269,6 +281,7 @@ declare function useAsyncResultCollection<T = any, E extends ErrorBase = ErrorBa
|
|
|
269
281
|
finally: (onfinally?: (() => void) | null | undefined) => Promise<Result<T, E>>;
|
|
270
282
|
readonly [Symbol.toStringTag]: string;
|
|
271
283
|
};
|
|
284
|
+
progress?: unknown;
|
|
272
285
|
} | {
|
|
273
286
|
status: "success";
|
|
274
287
|
value: vue.UnwrapRef<T>;
|
|
@@ -283,28 +296,31 @@ declare function useAsyncResultCollection<T = any, E extends ErrorBase = ErrorBa
|
|
|
283
296
|
unwrapOrNull: () => T | null;
|
|
284
297
|
unwrapOrThrow: () => T;
|
|
285
298
|
unwrapErrorOrNull: () => E | null;
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
299
|
+
getProgressOrNull: () => unknown;
|
|
300
|
+
updateFromValue: (value: T) => AsyncResult<T, E, unknown>;
|
|
301
|
+
updateFromError: (error: E) => AsyncResult<T, E, unknown>;
|
|
302
|
+
updateProgress: (progress: unknown) => AsyncResult<T, E, unknown>;
|
|
303
|
+
updateFromValuePromise: (promise: Promise<T>) => AsyncResult<T, E, unknown>;
|
|
304
|
+
waitForSettled: () => Promise<AsyncResult<T, E, unknown>>;
|
|
290
305
|
toResultPromise: () => Promise<Result<T, E>>;
|
|
291
306
|
toValueOrThrowPromise: () => Promise<T>;
|
|
292
307
|
toValueOrNullPromise: () => Promise<T | null>;
|
|
293
|
-
updateFromResultPromise: (promise: Promise<Result<T, E>>) => AsyncResult<T, E>;
|
|
294
|
-
listen: (listener: unwrapped_core.AsyncResultListener<T, E>,
|
|
295
|
-
listenUntilSettled: (listener: unwrapped_core.AsyncResultListener<T, E>,
|
|
308
|
+
updateFromResultPromise: (promise: Promise<Result<T, E>>) => AsyncResult<T, E, unknown>;
|
|
309
|
+
listen: (listener: unwrapped_core.AsyncResultListener<T, E, unknown>, options?: unwrapped_core.AsyncResultListenerOptions) => () => void;
|
|
310
|
+
listenUntilSettled: (listener: unwrapped_core.AsyncResultListener<T, E, unknown>, options?: unwrapped_core.AsyncResultListenerOptions) => () => void;
|
|
296
311
|
onSuccessOnce: (callback: (value: T) => void) => () => void;
|
|
297
312
|
onSuccessPerpetual: (callback: (value: T) => void) => () => void;
|
|
298
313
|
onErrorOnce: (callback: (error: E) => void) => () => void;
|
|
299
314
|
onErrorPerpetual: (callback: (error: E) => void) => () => void;
|
|
300
|
-
mirror: (other: AsyncResult<T, E
|
|
301
|
-
mirrorUntilSettled: (other: AsyncResult<T, E
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
315
|
+
mirror: (other: AsyncResult<T, E, unknown>, options?: unwrapped_core.AsyncResultListenerOptions) => () => void;
|
|
316
|
+
mirrorUntilSettled: (other: AsyncResult<T, E, unknown>, options?: unwrapped_core.AsyncResultListenerOptions) => () => void;
|
|
317
|
+
updateFromAction: (action: Action<T, E, unknown>) => AsyncResult<T, E, unknown>;
|
|
318
|
+
chain: <O, E2 extends ErrorBase = ErrorBase>(fn: unwrapped_core.ChainStep<T, O, E | E2>) => AsyncResult<O, E | E2, unknown>;
|
|
319
|
+
flatChain: <O, E2 extends ErrorBase = ErrorBase>(fn: FlatChainStep<T, O, E | E2, unknown>) => AsyncResult<O, E | E2, unknown>;
|
|
320
|
+
runInPlace: (generatorFunc: () => AsyncResultGenerator<T>) => AsyncResult<T, E, unknown>;
|
|
305
321
|
log: (name?: string) => void;
|
|
306
322
|
debug: (name?: string) => () => void;
|
|
307
|
-
[Symbol.iterator]: () => Generator<AsyncResult<T, E>, T, any>;
|
|
323
|
+
[Symbol.iterator]: () => Generator<AsyncResult<T, E, unknown>, T, any>;
|
|
308
324
|
};
|
|
309
325
|
unsub: () => void;
|
|
310
326
|
}> & Omit<Map<string, unwrapped_core.AsyncResultCollectionItem<T, E>>, keyof Map<any, any>>;
|
|
@@ -320,6 +336,7 @@ declare function useAsyncResultCollection<T = any, E extends ErrorBase = ErrorBa
|
|
|
320
336
|
finally: (onfinally?: (() => void) | null | undefined) => Promise<Result<T, E>>;
|
|
321
337
|
readonly [Symbol.toStringTag]: string;
|
|
322
338
|
};
|
|
339
|
+
progress?: unknown;
|
|
323
340
|
} | {
|
|
324
341
|
status: "success";
|
|
325
342
|
value: vue.UnwrapRef<T>;
|
|
@@ -334,28 +351,31 @@ declare function useAsyncResultCollection<T = any, E extends ErrorBase = ErrorBa
|
|
|
334
351
|
unwrapOrNull: () => T | null;
|
|
335
352
|
unwrapOrThrow: () => T;
|
|
336
353
|
unwrapErrorOrNull: () => E | null;
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
354
|
+
getProgressOrNull: () => unknown;
|
|
355
|
+
updateFromValue: (value: T) => AsyncResult<T, E, unknown>;
|
|
356
|
+
updateFromError: (error: E) => AsyncResult<T, E, unknown>;
|
|
357
|
+
updateProgress: (progress: unknown) => AsyncResult<T, E, unknown>;
|
|
358
|
+
updateFromValuePromise: (promise: Promise<T>) => AsyncResult<T, E, unknown>;
|
|
359
|
+
waitForSettled: () => Promise<AsyncResult<T, E, unknown>>;
|
|
341
360
|
toResultPromise: () => Promise<Result<T, E>>;
|
|
342
361
|
toValueOrThrowPromise: () => Promise<T>;
|
|
343
362
|
toValueOrNullPromise: () => Promise<T | null>;
|
|
344
|
-
updateFromResultPromise: (promise: Promise<Result<T, E>>) => AsyncResult<T, E>;
|
|
345
|
-
listen: (listener: unwrapped_core.AsyncResultListener<T, E>,
|
|
346
|
-
listenUntilSettled: (listener: unwrapped_core.AsyncResultListener<T, E>,
|
|
363
|
+
updateFromResultPromise: (promise: Promise<Result<T, E>>) => AsyncResult<T, E, unknown>;
|
|
364
|
+
listen: (listener: unwrapped_core.AsyncResultListener<T, E, unknown>, options?: unwrapped_core.AsyncResultListenerOptions) => () => void;
|
|
365
|
+
listenUntilSettled: (listener: unwrapped_core.AsyncResultListener<T, E, unknown>, options?: unwrapped_core.AsyncResultListenerOptions) => () => void;
|
|
347
366
|
onSuccessOnce: (callback: (value: T) => void) => () => void;
|
|
348
367
|
onSuccessPerpetual: (callback: (value: T) => void) => () => void;
|
|
349
368
|
onErrorOnce: (callback: (error: E) => void) => () => void;
|
|
350
369
|
onErrorPerpetual: (callback: (error: E) => void) => () => void;
|
|
351
|
-
mirror: (other: AsyncResult<T, E
|
|
352
|
-
mirrorUntilSettled: (other: AsyncResult<T, E
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
370
|
+
mirror: (other: AsyncResult<T, E, unknown>, options?: unwrapped_core.AsyncResultListenerOptions) => () => void;
|
|
371
|
+
mirrorUntilSettled: (other: AsyncResult<T, E, unknown>, options?: unwrapped_core.AsyncResultListenerOptions) => () => void;
|
|
372
|
+
updateFromAction: (action: Action<T, E, unknown>) => AsyncResult<T, E, unknown>;
|
|
373
|
+
chain: <O, E2 extends ErrorBase = ErrorBase>(fn: unwrapped_core.ChainStep<T, O, E | E2>) => AsyncResult<O, E | E2, unknown>;
|
|
374
|
+
flatChain: <O, E2 extends ErrorBase = ErrorBase>(fn: FlatChainStep<T, O, E | E2, unknown>) => AsyncResult<O, E | E2, unknown>;
|
|
375
|
+
runInPlace: (generatorFunc: () => AsyncResultGenerator<T>) => AsyncResult<T, E, unknown>;
|
|
356
376
|
log: (name?: string) => void;
|
|
357
377
|
debug: (name?: string) => () => void;
|
|
358
|
-
[Symbol.iterator]: () => Generator<AsyncResult<T, E>, T, any>;
|
|
378
|
+
[Symbol.iterator]: () => Generator<AsyncResult<T, E, unknown>, T, any>;
|
|
359
379
|
}[];
|
|
360
380
|
readonly entries: [string, {
|
|
361
381
|
state: {
|
|
@@ -368,6 +388,7 @@ declare function useAsyncResultCollection<T = any, E extends ErrorBase = ErrorBa
|
|
|
368
388
|
finally: (onfinally?: (() => void) | null | undefined) => Promise<Result<T, E>>;
|
|
369
389
|
readonly [Symbol.toStringTag]: string;
|
|
370
390
|
};
|
|
391
|
+
progress?: unknown;
|
|
371
392
|
} | {
|
|
372
393
|
status: "success";
|
|
373
394
|
value: vue.UnwrapRef<T>;
|
|
@@ -382,44 +403,47 @@ declare function useAsyncResultCollection<T = any, E extends ErrorBase = ErrorBa
|
|
|
382
403
|
unwrapOrNull: () => T | null;
|
|
383
404
|
unwrapOrThrow: () => T;
|
|
384
405
|
unwrapErrorOrNull: () => E | null;
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
406
|
+
getProgressOrNull: () => unknown;
|
|
407
|
+
updateFromValue: (value: T) => AsyncResult<T, E, unknown>;
|
|
408
|
+
updateFromError: (error: E) => AsyncResult<T, E, unknown>;
|
|
409
|
+
updateProgress: (progress: unknown) => AsyncResult<T, E, unknown>;
|
|
410
|
+
updateFromValuePromise: (promise: Promise<T>) => AsyncResult<T, E, unknown>;
|
|
411
|
+
waitForSettled: () => Promise<AsyncResult<T, E, unknown>>;
|
|
389
412
|
toResultPromise: () => Promise<Result<T, E>>;
|
|
390
413
|
toValueOrThrowPromise: () => Promise<T>;
|
|
391
414
|
toValueOrNullPromise: () => Promise<T | null>;
|
|
392
|
-
updateFromResultPromise: (promise: Promise<Result<T, E>>) => AsyncResult<T, E>;
|
|
393
|
-
listen: (listener: unwrapped_core.AsyncResultListener<T, E>,
|
|
394
|
-
listenUntilSettled: (listener: unwrapped_core.AsyncResultListener<T, E>,
|
|
415
|
+
updateFromResultPromise: (promise: Promise<Result<T, E>>) => AsyncResult<T, E, unknown>;
|
|
416
|
+
listen: (listener: unwrapped_core.AsyncResultListener<T, E, unknown>, options?: unwrapped_core.AsyncResultListenerOptions) => () => void;
|
|
417
|
+
listenUntilSettled: (listener: unwrapped_core.AsyncResultListener<T, E, unknown>, options?: unwrapped_core.AsyncResultListenerOptions) => () => void;
|
|
395
418
|
onSuccessOnce: (callback: (value: T) => void) => () => void;
|
|
396
419
|
onSuccessPerpetual: (callback: (value: T) => void) => () => void;
|
|
397
420
|
onErrorOnce: (callback: (error: E) => void) => () => void;
|
|
398
421
|
onErrorPerpetual: (callback: (error: E) => void) => () => void;
|
|
399
|
-
mirror: (other: AsyncResult<T, E
|
|
400
|
-
mirrorUntilSettled: (other: AsyncResult<T, E
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
422
|
+
mirror: (other: AsyncResult<T, E, unknown>, options?: unwrapped_core.AsyncResultListenerOptions) => () => void;
|
|
423
|
+
mirrorUntilSettled: (other: AsyncResult<T, E, unknown>, options?: unwrapped_core.AsyncResultListenerOptions) => () => void;
|
|
424
|
+
updateFromAction: (action: Action<T, E, unknown>) => AsyncResult<T, E, unknown>;
|
|
425
|
+
chain: <O, E2 extends ErrorBase = ErrorBase>(fn: unwrapped_core.ChainStep<T, O, E | E2>) => AsyncResult<O, E | E2, unknown>;
|
|
426
|
+
flatChain: <O, E2 extends ErrorBase = ErrorBase>(fn: FlatChainStep<T, O, E | E2, unknown>) => AsyncResult<O, E | E2, unknown>;
|
|
427
|
+
runInPlace: (generatorFunc: () => AsyncResultGenerator<T>) => AsyncResult<T, E, unknown>;
|
|
404
428
|
log: (name?: string) => void;
|
|
405
429
|
debug: (name?: string) => () => void;
|
|
406
|
-
[Symbol.iterator]: () => Generator<AsyncResult<T, E>, T, any>;
|
|
430
|
+
[Symbol.iterator]: () => Generator<AsyncResult<T, E, unknown>, T, any>;
|
|
407
431
|
}][];
|
|
408
432
|
state: unwrapped_core.AsyncResultCollectionState;
|
|
409
433
|
listen: (listener: (taskQueue: AsyncResultCollection<T, E>) => void) => () => void;
|
|
410
|
-
onItemSuccess: (listener: (task: AsyncResult<T, E>, key: string) => void) => () => void;
|
|
411
|
-
onItemError: (listener: (task: AsyncResult<T, E>, key: string) => void) => () => void;
|
|
412
|
-
add: (key: string, task: AsyncResult<T, E>, removeOnSettle?: boolean) => AsyncResult<T, E>;
|
|
434
|
+
onItemSuccess: (listener: (task: AsyncResult<T, E, unknown>, key: string) => void) => () => void;
|
|
435
|
+
onItemError: (listener: (task: AsyncResult<T, E, unknown>, key: string) => void) => () => void;
|
|
436
|
+
add: (key: string, task: AsyncResult<T, E, unknown>, removeOnSettle?: boolean) => AsyncResult<T, E, unknown>;
|
|
413
437
|
remove: (key: string) => boolean;
|
|
414
438
|
clear: () => void;
|
|
415
439
|
anyLoading: () => boolean;
|
|
416
|
-
getAllFiltered: (predicate: (task: AsyncResult<T, E>) => boolean) => AsyncResult<T, E>[];
|
|
417
|
-
getAllFilteredAndMap: <U>(filterPredicate: (task: AsyncResult<T, E>) => boolean, mapFunc: (task: AsyncResult<T, E>) => U) => U[];
|
|
418
|
-
getAllSuccess: () => AsyncResult<T, E>[];
|
|
440
|
+
getAllFiltered: (predicate: (task: AsyncResult<T, E, unknown>) => boolean) => AsyncResult<T, E, unknown>[];
|
|
441
|
+
getAllFilteredAndMap: <U>(filterPredicate: (task: AsyncResult<T, E, unknown>) => boolean, mapFunc: (task: AsyncResult<T, E, unknown>) => U) => U[];
|
|
442
|
+
getAllSuccess: () => AsyncResult<T, E, unknown>[];
|
|
419
443
|
getAllSuccessValues: () => T[];
|
|
420
|
-
getAllErrors: () => AsyncResult<T, E>[];
|
|
444
|
+
getAllErrors: () => AsyncResult<T, E, unknown>[];
|
|
421
445
|
getAllErrorValues: () => E[];
|
|
422
|
-
getAllLoading: () => AsyncResult<T, E>[];
|
|
446
|
+
getAllLoading: () => AsyncResult<T, E, unknown>[];
|
|
423
447
|
getAllLoadingPromises: () => Promise<Result<T, E>>[];
|
|
424
448
|
log: (name?: string) => void;
|
|
425
449
|
debug: (name?: string) => () => void;
|