effective-progress 0.10.0 → 0.11.0
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 +116 -11
- package/dist/chunk-DQk6qfdC.mjs +18 -0
- package/dist/index.d.mts +163 -14
- package/dist/index.mjs +462 -546
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -75,23 +75,59 @@ Effect.runPromise(program);
|
|
|
75
75
|
|
|
76
76
|
### Effect.all modes
|
|
77
77
|
|
|
78
|
-
Support for `either`/`validate` modes of `Effect.all` and render the amount of
|
|
78
|
+
Support for `either`/`validate` modes of `Effect.all` and render the amount of successes/failures.
|
|
79
79
|
|
|
80
80
|
<img alt="Mixed outcomes modes output" src="docs/images/mixedOutcomes.gif" width="600" />
|
|
81
81
|
|
|
82
82
|
- `Progress.all` in default mode (`mode: "default"`) remains fail-fast.
|
|
83
83
|
- In fail-fast runs, unresolved units remain unprocessed.
|
|
84
84
|
- `mode: "either"` and `mode: "validate"` run all effects and keep mixed outcomes in the task counters.
|
|
85
|
-
- Mixed outcomes can
|
|
85
|
+
- Mixed outcomes can finalize as `done` when all units are accounted for.
|
|
86
86
|
- Empty collections are valid inputs for `Progress.all` / `Progress.forEach` and render as `0/0` instead of failing.
|
|
87
87
|
|
|
88
|
+
### Single task with a typed handle
|
|
89
|
+
|
|
90
|
+
Use `Progress.task(...)` when you want one progress bar around a custom effect. The callback form gives you a task-local handle, so you can update counts, descriptions, and metadata without fetching the current task ID first.
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
import { Console, Effect } from "effect";
|
|
94
|
+
import * as Progress from "effective-progress";
|
|
95
|
+
|
|
96
|
+
const program = Progress.task(
|
|
97
|
+
(task) =>
|
|
98
|
+
Effect.gen(function* () {
|
|
99
|
+
yield* Console.log("Starting deployment");
|
|
100
|
+
yield* task.incrementSucceeded();
|
|
101
|
+
yield* task.update({
|
|
102
|
+
description: "Uploading release bundle",
|
|
103
|
+
});
|
|
104
|
+
yield* Effect.sleep("1 second");
|
|
105
|
+
yield* task.incrementSucceeded(2);
|
|
106
|
+
}),
|
|
107
|
+
{
|
|
108
|
+
description: "Deploy release",
|
|
109
|
+
total: 3,
|
|
110
|
+
},
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
Effect.runPromise(program);
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
- The plain `Progress.task(effect, options)` form auto-finalizes from the effect exit.
|
|
117
|
+
- The callback form also auto-finalizes from the callback exit unless you explicitly `yield* task.complete` or `yield* task.fail` first.
|
|
118
|
+
- `yield* Progress.Task` exposes the current task ID when you need it.
|
|
119
|
+
|
|
88
120
|
### Other examples
|
|
89
121
|
|
|
90
122
|
- `examples/simpleExample.ts` - low-boilerplate real-world flow
|
|
91
|
-
- `examples/advancedExample.ts` -
|
|
123
|
+
- `examples/advancedExample.ts` - mixed high-level and low-level Progress service usage
|
|
124
|
+
- `examples/basic.ts` - minimal `Progress.all` usage
|
|
125
|
+
- `examples/nesting.ts` - nested tree rendering with parent and child tasks
|
|
92
126
|
- `examples/mixedOutcomes.ts` - fail-fast vs `either`/`validate` with mixed success/failure counters
|
|
93
127
|
- `examples/cliProgressSemantics.ts` - zero totals, negative totals clearing to unknown totals, overflow counts, and empty `all` / `forEach`
|
|
94
128
|
- `examples/unknownTotalCounting.ts` - count successes/failures without a known total and render `processed/?`
|
|
129
|
+
- `examples/typedMetadata.ts` - typed task metadata rendered through custom columns
|
|
130
|
+
- `examples/mixedNestedColumns.ts` - different column sets aligned across mixed task types
|
|
95
131
|
- `examples/showcase.ts` - nested concurrent tasks, spinner workloads, and mixed Effect/Console logging
|
|
96
132
|
- `examples/performance.ts` - stress-style run with high log volume and deeply nested progress updates
|
|
97
133
|
- `examples/performanceLong.ts` - longer-running stress run with roughly 10x the work of `performance.ts`
|
|
@@ -109,21 +145,40 @@ Support for `either`/`validate` modes of `Effect.all` and render the amount of s
|
|
|
109
145
|
### Ink renderer behavior
|
|
110
146
|
|
|
111
147
|
- Rendering is powered by [Ink](https://github.com/vadimdemedes/ink).
|
|
112
|
-
- Built-in columns are
|
|
148
|
+
- Built-in columns are exposed as `Progress.Columns.description()`, `bar()`, `amount()`, `elapsed()`, `eta()`, `spacer()`, and `defaults()`.
|
|
113
149
|
- Determinate bars are segmented by outcome: succeeded (green), failed (red), and remaining (neutral).
|
|
114
150
|
- Determinate amount text shows counters without prefixes: `<succeeded> <failed> <processed>/<total>`.
|
|
115
151
|
- Counts can exceed `total`; the amount text keeps those raw values (for example `12/10`) while the bar stays visually clamped at full.
|
|
116
152
|
- `total: 0` is valid for determinate tasks and renders as a full bar by default.
|
|
117
|
-
- Column widths are
|
|
118
|
-
-
|
|
119
|
-
- Sticky width can keep selected columns stable until the frame empties.
|
|
153
|
+
- Column widths are resolved per visual column index, so rows with different column definitions can still align with each other.
|
|
154
|
+
- Column `prepare(...)` functions can compute shared layout data once for all rows using the same column definition at a given index.
|
|
120
155
|
- On narrow terminals, layout compacts to fit available width and tree prefixes are suppressed when description space is too tight.
|
|
121
156
|
|
|
122
|
-
##
|
|
157
|
+
## Task API
|
|
158
|
+
|
|
159
|
+
`Progress.task(...)` supports two styles:
|
|
160
|
+
|
|
161
|
+
- `Progress.task(effect, options)` for the simple "wrap this effect in a task" case.
|
|
162
|
+
- `Progress.task((task) => effect, options)` when you want a typed handle for task-local control.
|
|
163
|
+
|
|
164
|
+
The handle exposes:
|
|
165
|
+
|
|
166
|
+
- `incrementSucceeded(amount?)`
|
|
167
|
+
- `incrementFailed(amount?)`
|
|
168
|
+
- `update({ description, total, countDisplay, transient, succeeded, failed })`
|
|
169
|
+
- `getMetadata`, `setMetadata`, `updateMetadata`
|
|
170
|
+
- `getSnapshot`
|
|
171
|
+
- `complete`
|
|
172
|
+
- `fail`
|
|
123
173
|
|
|
124
|
-
|
|
174
|
+
When you need lower-level control, the `Progress` service is available inside the effect and exposes APIs like `addTask`, `updateTask`, `incrementSucceeded(taskId, amount)`, and `completeTask(taskId)`.
|
|
175
|
+
|
|
176
|
+
Example using the lower-level service API:
|
|
125
177
|
|
|
126
178
|
```ts
|
|
179
|
+
import { Console, Effect } from "effect";
|
|
180
|
+
import * as Progress from "effective-progress";
|
|
181
|
+
|
|
127
182
|
const program = Progress.task(
|
|
128
183
|
Effect.gen(function* () {
|
|
129
184
|
const progress = yield* Progress.Progress;
|
|
@@ -145,9 +200,59 @@ Manual total behavior:
|
|
|
145
200
|
- negative totals on later `updateTask` calls also clear the total
|
|
146
201
|
- explicit `total: undefined` on `updateTask` clears the total and switches back to indeterminate rendering
|
|
147
202
|
|
|
148
|
-
##
|
|
203
|
+
## Typed metadata and custom columns
|
|
204
|
+
|
|
205
|
+
Tasks can carry typed metadata, and that metadata type flows into custom column renderers.
|
|
206
|
+
|
|
207
|
+
```ts
|
|
208
|
+
import { Effect } from "effect";
|
|
209
|
+
import * as Progress from "effective-progress";
|
|
210
|
+
|
|
211
|
+
interface EvalMeta {
|
|
212
|
+
readonly model: string;
|
|
213
|
+
readonly score: number;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const scoreColumn = (): Progress.ColumnDef<EvalMeta> => ({
|
|
217
|
+
align: "right",
|
|
218
|
+
flexShrink: 0,
|
|
219
|
+
minWidth: 5,
|
|
220
|
+
render: ({ task }) => `${task.metadata.score}%`,
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
const program = Progress.task(
|
|
224
|
+
(task) =>
|
|
225
|
+
Effect.gen(function* () {
|
|
226
|
+
yield* task.setMetadata({ model: "gpt-5.4", score: 91 });
|
|
227
|
+
yield* task.incrementSucceeded();
|
|
228
|
+
}),
|
|
229
|
+
{
|
|
230
|
+
description: "Run evaluation",
|
|
231
|
+
total: 1,
|
|
232
|
+
metadata: { model: "gpt-5.4", score: 0 },
|
|
233
|
+
columns: [
|
|
234
|
+
Progress.Columns.description(),
|
|
235
|
+
Progress.Columns.bar(),
|
|
236
|
+
{
|
|
237
|
+
flexShrink: 0,
|
|
238
|
+
minWidth: 10,
|
|
239
|
+
render: ({ task }) => task.metadata.model,
|
|
240
|
+
},
|
|
241
|
+
scoreColumn(),
|
|
242
|
+
Progress.Columns.elapsed(),
|
|
243
|
+
],
|
|
244
|
+
},
|
|
245
|
+
);
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
`ColumnDef<M, P>` supports:
|
|
249
|
+
|
|
250
|
+
- `prepare(rows)` to derive shared data for all matching rows at that column index
|
|
251
|
+
- `render(cell, ctx)` to render the cell
|
|
252
|
+
- sizing hints with `flexGrow`, `flexShrink`, `flexBasis`, and `minWidth`
|
|
253
|
+
- `align` with `"left"`, `"center"`, or `"right"`
|
|
149
254
|
|
|
150
|
-
|
|
255
|
+
If a task does not provide `columns`, the renderer falls back to `Progress.Columns.defaults()`.
|
|
151
256
|
|
|
152
257
|
## Notes
|
|
153
258
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __exportAll = (all, no_symbols) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) {
|
|
6
|
+
__defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
if (!no_symbols) {
|
|
12
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
13
|
+
}
|
|
14
|
+
return target;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { __exportAll as t };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { Brand, Context, Effect, Layer, Option, Schema } from "effect";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import "react/jsx-runtime";
|
|
4
|
+
import "cli-spinners";
|
|
2
5
|
import { Concurrency } from "effect/Types";
|
|
3
6
|
import * as effect_SchemaAST0 from "effect/SchemaAST";
|
|
4
7
|
|
|
@@ -10,12 +13,84 @@ declare const TaskStatusSchema: Schema.Literal<["running", "done", "failed"]>;
|
|
|
10
13
|
type TaskStatus = typeof TaskStatusSchema.Type;
|
|
11
14
|
declare const TaskCountDisplaySchema: Schema.Literal<["processedOnly", "detailed"]>;
|
|
12
15
|
type TaskCountDisplay = typeof TaskCountDisplaySchema.Type;
|
|
13
|
-
|
|
16
|
+
type ColumnAlign = "left" | "center" | "right";
|
|
17
|
+
interface TaskTreeInfo {
|
|
18
|
+
readonly depth: number;
|
|
19
|
+
readonly hasNextSibling: boolean;
|
|
20
|
+
readonly hasChildren: boolean;
|
|
21
|
+
readonly ancestorHasNextSibling: ReadonlyArray<boolean>;
|
|
22
|
+
}
|
|
23
|
+
interface TaskRowDerived {
|
|
24
|
+
readonly treePrefix: string;
|
|
25
|
+
readonly treePrefixWidth: number;
|
|
26
|
+
readonly descriptionWidth: number;
|
|
27
|
+
readonly treePrefixedDescriptionWidth: number;
|
|
28
|
+
readonly hasRenderableProgress: boolean;
|
|
29
|
+
readonly isDeterminate: boolean;
|
|
30
|
+
}
|
|
31
|
+
/** All data available to a column cell. */
|
|
32
|
+
interface CellInfo<M = unknown> {
|
|
33
|
+
readonly task: TaskSnapshot & {
|
|
34
|
+
readonly metadata: M;
|
|
35
|
+
};
|
|
36
|
+
readonly tree: TaskTreeInfo;
|
|
37
|
+
readonly derived: TaskRowDerived;
|
|
38
|
+
}
|
|
39
|
+
interface ColumnRenderContext<P = void> {
|
|
40
|
+
readonly width?: number;
|
|
41
|
+
readonly now: number;
|
|
42
|
+
readonly spinnerTick: number;
|
|
43
|
+
readonly prepared: P;
|
|
44
|
+
}
|
|
45
|
+
type ColumnSizeValue<P = void> = number | ((prepared: P) => number | undefined);
|
|
46
|
+
type BivariantCallback<Args extends ReadonlyArray<unknown>, R> = {
|
|
47
|
+
bivarianceHack: (...args: Args) => R;
|
|
48
|
+
}["bivarianceHack"];
|
|
49
|
+
interface ColumnDef<M = unknown, P = void> {
|
|
50
|
+
readonly prepare?: BivariantCallback<[rows: ReadonlyArray<CellInfo<M>>], P>;
|
|
51
|
+
readonly render: BivariantCallback<[cell: CellInfo<M>, ctx: ColumnRenderContext<P>], ReactNode>;
|
|
52
|
+
readonly align?: ColumnAlign;
|
|
53
|
+
readonly flexGrow?: ColumnSizeValue<P>;
|
|
54
|
+
readonly flexShrink?: ColumnSizeValue<P>;
|
|
55
|
+
readonly flexBasis?: ColumnSizeValue<P>;
|
|
56
|
+
readonly minWidth?: ColumnSizeValue<P>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* A typed facade over a single task created through the callback form of `task(...)`.
|
|
60
|
+
*
|
|
61
|
+
* Use this handle to update counts, metadata, description, or to explicitly finalize the task
|
|
62
|
+
* before the callback exits. If the callback returns or fails while the task is still `running`,
|
|
63
|
+
* the library auto-finalizes it from the callback exit status instead.
|
|
64
|
+
*/
|
|
65
|
+
interface TaskHandle<M> {
|
|
66
|
+
readonly id: TaskId;
|
|
67
|
+
/** Reads the current metadata value for the task using the metadata type inferred at creation. */
|
|
68
|
+
readonly getMetadata: Effect.Effect<M>;
|
|
69
|
+
/** Replaces the task metadata. */
|
|
70
|
+
readonly setMetadata: (metadata: M) => Effect.Effect<void>;
|
|
71
|
+
/** Updates the current metadata value atomically. */
|
|
72
|
+
readonly updateMetadata: (f: (m: M) => M) => Effect.Effect<void>;
|
|
73
|
+
/** Increments the succeeded counter for the task. */
|
|
74
|
+
readonly incrementSucceeded: (amount?: number) => Effect.Effect<void>;
|
|
75
|
+
/** Increments the failed counter for the task. */
|
|
76
|
+
readonly incrementFailed: (amount?: number) => Effect.Effect<void>;
|
|
77
|
+
/** Updates mutable task fields such as description, totals, and count display. */
|
|
78
|
+
readonly update: (options: UpdateTaskOptions) => Effect.Effect<void>;
|
|
79
|
+
/** Marks the task as done immediately. Finalization is terminal once the task leaves `running`. */
|
|
80
|
+
readonly complete: Effect.Effect<void>;
|
|
81
|
+
/** Marks the task as failed immediately. Finalization is terminal once the task leaves `running`. */
|
|
82
|
+
readonly fail: Effect.Effect<void>;
|
|
83
|
+
/** Reads the latest task snapshot. */
|
|
84
|
+
readonly getSnapshot: Effect.Effect<TaskSnapshot>;
|
|
85
|
+
}
|
|
86
|
+
interface AddTaskOptions<M = void> {
|
|
14
87
|
readonly description: string;
|
|
15
88
|
readonly total?: number;
|
|
16
89
|
readonly transient?: boolean;
|
|
17
90
|
readonly parentId?: TaskId;
|
|
18
91
|
readonly countDisplay?: TaskCountDisplay;
|
|
92
|
+
readonly metadata?: M;
|
|
93
|
+
readonly columns?: ReadonlyArray<ColumnDef<M, any>>;
|
|
19
94
|
}
|
|
20
95
|
interface UpdateTaskOptions {
|
|
21
96
|
readonly description?: string;
|
|
@@ -25,7 +100,7 @@ interface UpdateTaskOptions {
|
|
|
25
100
|
readonly transient?: boolean;
|
|
26
101
|
readonly countDisplay?: TaskCountDisplay;
|
|
27
102
|
}
|
|
28
|
-
type TrackOptions =
|
|
103
|
+
type TrackOptions = Omit<AddTaskOptions, "parentId">;
|
|
29
104
|
declare const TaskUnitsSchema: Schema.Struct<{
|
|
30
105
|
succeeded: typeof Schema.Number;
|
|
31
106
|
failed: typeof Schema.Number;
|
|
@@ -48,6 +123,7 @@ declare const TaskSnapshotSchema: Schema.Struct<{
|
|
|
48
123
|
}>;
|
|
49
124
|
startedAt: typeof Schema.Number;
|
|
50
125
|
completedAt: Schema.NullOr<typeof Schema.Number>;
|
|
126
|
+
metadata: typeof Schema.Unknown;
|
|
51
127
|
}>;
|
|
52
128
|
type TaskSnapshot = typeof TaskSnapshotSchema.Type;
|
|
53
129
|
declare const TaskSnapshot: (snapshot: TaskSnapshot) => TaskSnapshot;
|
|
@@ -58,9 +134,10 @@ interface RenderRow {
|
|
|
58
134
|
interface TaskStore {
|
|
59
135
|
readonly tasks: Map<TaskId, TaskSnapshot>;
|
|
60
136
|
readonly renderOrder: ReadonlyArray<RenderRow>;
|
|
137
|
+
readonly columns: Map<TaskId, ReadonlyArray<ColumnDef<any, any>>>;
|
|
61
138
|
}
|
|
62
139
|
interface ProgressService {
|
|
63
|
-
readonly addTask: (options: AddTaskOptions) => Effect.Effect<TaskId>;
|
|
140
|
+
readonly addTask: (options: AddTaskOptions<any>) => Effect.Effect<TaskId>;
|
|
64
141
|
readonly updateTask: (taskId: TaskId, options: UpdateTaskOptions) => Effect.Effect<void>;
|
|
65
142
|
readonly incrementSucceeded: (taskId: TaskId, amount?: number) => Effect.Effect<void>;
|
|
66
143
|
readonly incrementFailed: (taskId: TaskId, amount?: number) => Effect.Effect<void>;
|
|
@@ -69,13 +146,24 @@ interface ProgressService {
|
|
|
69
146
|
readonly log: (...args: ReadonlyArray<unknown>) => Effect.Effect<void>;
|
|
70
147
|
readonly getTask: (taskId: TaskId) => Effect.Effect<Option.Option<TaskSnapshot>>;
|
|
71
148
|
readonly listTasks: Effect.Effect<ReadonlyArray<TaskSnapshot>>;
|
|
72
|
-
readonly
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
149
|
+
readonly setMetadata: (taskId: TaskId, metadata: unknown) => Effect.Effect<void>;
|
|
150
|
+
readonly getMetadata: (taskId: TaskId) => Effect.Effect<unknown>;
|
|
151
|
+
/**
|
|
152
|
+
* Runs an effect inside a newly created task scope.
|
|
153
|
+
*
|
|
154
|
+
* The plain effect form auto-finalizes from the effect exit if the task is still `running`.
|
|
155
|
+
* The callback form exposes a typed `TaskHandle` for metadata and explicit lifecycle control, and
|
|
156
|
+
* also auto-finalizes from the callback exit if the handle did not already finalize the task.
|
|
157
|
+
*
|
|
158
|
+
* Use `Progress.task(...)` from `src/api.ts` when you want the service to be created automatically if needed.
|
|
159
|
+
*/
|
|
160
|
+
readonly task: {
|
|
77
161
|
<A, E, R>(effect: Effect.Effect<A, E, R>, options: AddTaskOptions): Effect.Effect<A, E, Exclude<R, Task>>;
|
|
78
162
|
<A, E, R>(options: AddTaskOptions): (effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Task>>;
|
|
163
|
+
<A, E, R>(f: (handle: TaskHandle<void>) => Effect.Effect<A, E, R>, options: AddTaskOptions<void>): Effect.Effect<A, E, Exclude<R, Task>>;
|
|
164
|
+
<M, A, E, R>(f: (handle: TaskHandle<M>) => Effect.Effect<A, E, R>, options: AddTaskOptions<M> & {
|
|
165
|
+
readonly metadata: M;
|
|
166
|
+
}): Effect.Effect<A, E, Exclude<R, Task>>;
|
|
79
167
|
};
|
|
80
168
|
}
|
|
81
169
|
declare const Task_base: Context.TagClass<Task, "stromseng.dev/effective-progress/Task", number & Brand.Brand<"TaskId">>;
|
|
@@ -141,6 +229,14 @@ declare class Progress extends Progress_base {
|
|
|
141
229
|
}
|
|
142
230
|
//#endregion
|
|
143
231
|
//#region src/api.d.ts
|
|
232
|
+
interface PublicTaskApi {
|
|
233
|
+
<A, E, R>(effect: Effect.Effect<A, E, R>, options: AddTaskOptions): Effect.Effect<A, E, Exclude<R, Progress | Task>>;
|
|
234
|
+
<A, E, R>(options: AddTaskOptions): (effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Progress | Task>>;
|
|
235
|
+
<A, E, R>(f: (handle: TaskHandle<void>) => Effect.Effect<A, E, R>, options: AddTaskOptions<void>): Effect.Effect<A, E, Exclude<R, Progress | Task>>;
|
|
236
|
+
<M, A, E, R>(f: (handle: TaskHandle<M>) => Effect.Effect<A, E, R>, options: AddTaskOptions<M> & {
|
|
237
|
+
readonly metadata: M;
|
|
238
|
+
}): Effect.Effect<A, E, Exclude<R, Progress | Task>>;
|
|
239
|
+
}
|
|
144
240
|
interface EffectExecutionOptions {
|
|
145
241
|
readonly concurrency?: Concurrency;
|
|
146
242
|
readonly batching?: boolean | "inherit";
|
|
@@ -156,21 +252,74 @@ interface ForEachExecutionOptions extends EffectExecutionOptions {
|
|
|
156
252
|
readonly discard?: false | undefined;
|
|
157
253
|
}
|
|
158
254
|
type ForEachOptions = Omit<TrackOptions, "countDisplay"> & ForEachExecutionOptions;
|
|
159
|
-
type TaskOptions = AddTaskOptions
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
255
|
+
type TaskOptions<M = void> = AddTaskOptions<M>;
|
|
256
|
+
/**
|
|
257
|
+
* Runs an effect inside a task, creating and providing a `Progress` service automatically when one
|
|
258
|
+
* is not already present in the environment.
|
|
259
|
+
*
|
|
260
|
+
* The effect form tracks success and failure from the effect exit. The callback form exposes a
|
|
261
|
+
* typed `TaskHandle` for task-local updates, typed metadata, and explicit completion or failure,
|
|
262
|
+
* and otherwise auto-finalizes from the callback exit if the task is still `running`.
|
|
263
|
+
*/
|
|
264
|
+
declare const task$1: PublicTaskApi;
|
|
164
265
|
type AllArg = ReadonlyArray<Effect.Effect<any, any, any>> | Record<string, Effect.Effect<any, any, any>>;
|
|
266
|
+
/**
|
|
267
|
+
* Runs multiple effects under a single parent task and keeps the task counters in sync with the
|
|
268
|
+
* child effect outcomes.
|
|
269
|
+
*/
|
|
165
270
|
declare const all: {
|
|
166
271
|
<const Arg extends AllArg, O extends EffectAllExecutionOptions>(effects: Arg, options: Omit<TrackOptions, "total" | "countDisplay"> & O): AllReturn<Arg, O>;
|
|
167
272
|
<O extends EffectAllExecutionOptions>(options: Omit<TrackOptions, "total" | "countDisplay"> & O): <const Arg extends AllArg>(effects: Arg) => AllReturn<Arg, O>;
|
|
168
273
|
};
|
|
274
|
+
/**
|
|
275
|
+
* Runs `Effect.forEach` under a single parent task and advances the task counters as items finish.
|
|
276
|
+
*/
|
|
169
277
|
declare const forEach: {
|
|
170
278
|
<A, B, E, R>(iterable: Iterable<A>, f: (item: A, index: number) => Effect.Effect<B, E, R>, options: ForEachOptions): Effect.Effect<ReadonlyArray<B>, E, Exclude<R, Progress | Task>>;
|
|
171
279
|
<A, B, E, R>(f: (item: A, index: number) => Effect.Effect<B, E, R>, options: ForEachOptions): (iterable: Iterable<A>) => Effect.Effect<ReadonlyArray<B>, E, Exclude<R, Progress | Task>>;
|
|
172
280
|
};
|
|
173
281
|
//#endregion
|
|
282
|
+
//#region src/renderer/columns/amount-column.d.ts
|
|
283
|
+
interface AmountLayout {
|
|
284
|
+
readonly hasDetailedRows: boolean;
|
|
285
|
+
readonly countWidth: number;
|
|
286
|
+
readonly processedWidth: number;
|
|
287
|
+
readonly totalWidth: number;
|
|
288
|
+
readonly preferredWidth: number;
|
|
289
|
+
}
|
|
290
|
+
//#endregion
|
|
291
|
+
//#region src/renderer/columns/bar-column.d.ts
|
|
292
|
+
interface BarPrepared {
|
|
293
|
+
readonly hasDeterminateRows: boolean;
|
|
294
|
+
}
|
|
295
|
+
//#endregion
|
|
296
|
+
//#region src/renderer/columns/description-column.d.ts
|
|
297
|
+
interface DescriptionPrepared {
|
|
298
|
+
readonly minTreeWidth: number;
|
|
299
|
+
}
|
|
300
|
+
declare namespace columns_d_exports {
|
|
301
|
+
export { AmountLayout, BarPrepared, DescriptionPrepared, SpacerOptions, amount, bar, defaults, description, elapsed, eta, resolveColumnSizeValue, spacer };
|
|
302
|
+
}
|
|
303
|
+
interface SpacerOptions {
|
|
304
|
+
readonly flexGrow?: number;
|
|
305
|
+
readonly flexShrink?: number;
|
|
306
|
+
readonly flexBasis?: number;
|
|
307
|
+
readonly minWidth?: number;
|
|
308
|
+
}
|
|
309
|
+
declare const spacer: <M = unknown>({
|
|
310
|
+
flexGrow,
|
|
311
|
+
flexShrink,
|
|
312
|
+
flexBasis,
|
|
313
|
+
minWidth
|
|
314
|
+
}?: SpacerOptions) => ColumnDef<M>;
|
|
315
|
+
declare const description: () => ColumnDef<any, DescriptionPrepared>;
|
|
316
|
+
declare const bar: () => ColumnDef<any, BarPrepared>;
|
|
317
|
+
declare const amount: () => ColumnDef<any, AmountLayout>;
|
|
318
|
+
declare const elapsed: () => ColumnDef<any>;
|
|
319
|
+
declare const eta: () => ColumnDef<any>;
|
|
320
|
+
declare const defaults: () => ReadonlyArray<ColumnDef<any, any>>;
|
|
321
|
+
declare const resolveColumnSizeValue: <P>(value: ColumnSizeValue<P> | undefined, prepared: P) => number | undefined;
|
|
322
|
+
//#endregion
|
|
174
323
|
//#region src/services/stdio.d.ts
|
|
175
324
|
interface ProgressStdioService {
|
|
176
325
|
readonly stdout: NodeJS.WriteStream;
|
|
@@ -181,4 +330,4 @@ declare class ProgressStdio extends ProgressStdio_base {
|
|
|
181
330
|
static readonly Default: Layer.Layer<ProgressStdio, never, never>;
|
|
182
331
|
}
|
|
183
332
|
//#endregion
|
|
184
|
-
export { AddTaskOptions, AllOptions, AllReturn, EffectAllExecutionOptions, EffectExecutionOptions, ForEachExecutionOptions, ForEachOptions, Progress, ProgressService, ProgressStdio, ProgressStdioService, ProgressTaskEvent, ProgressTaskEventSchema, RenderRow, Task, TaskAddedEvent, TaskAdvancedEvent, TaskCompletedEvent, TaskCountDisplay, TaskCountDisplaySchema, TaskFailedEvent, TaskId, TaskOptions, TaskRemovedEvent, TaskSnapshot, TaskSnapshotSchema, TaskStatus, TaskStatusSchema, TaskStore, TaskUnits, TaskUnitsSchema, TaskUpdatedEvent, TrackOptions, UpdateTaskOptions, all, decodeProgressTaskEvent, forEach, task };
|
|
333
|
+
export { AddTaskOptions, AllOptions, AllReturn, CellInfo, ColumnAlign, ColumnDef, ColumnRenderContext, ColumnSizeValue, columns_d_exports as Columns, EffectAllExecutionOptions, EffectExecutionOptions, ForEachExecutionOptions, ForEachOptions, Progress, ProgressService, ProgressStdio, ProgressStdioService, ProgressTaskEvent, ProgressTaskEventSchema, RenderRow, Task, TaskAddedEvent, TaskAdvancedEvent, TaskCompletedEvent, TaskCountDisplay, TaskCountDisplaySchema, TaskFailedEvent, TaskHandle, TaskId, TaskOptions, TaskRemovedEvent, TaskRowDerived, TaskSnapshot, TaskSnapshotSchema, TaskStatus, TaskStatusSchema, TaskStore, TaskTreeInfo, TaskUnits, TaskUnitsSchema, TaskUpdatedEvent, TrackOptions, UpdateTaskOptions, all, decodeProgressTaskEvent, forEach, task$1 as task };
|