effective-progress 0.9.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 +118 -11
- package/dist/chunk-DQk6qfdC.mjs +18 -0
- package/dist/index.d.mts +166 -18
- package/dist/index.mjs +824 -926
- package/package.json +9 -2
package/README.md
CHANGED
|
@@ -75,26 +75,64 @@ 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`
|
|
134
|
+
- `examples/performanceComparison.ts` - bare vs progress comparison for the `performance.ts` workload
|
|
135
|
+
- `examples/performanceComparisonLong.ts` - longer bare vs progress comparison for the `performanceLong.ts` workload
|
|
98
136
|
|
|
99
137
|
## Configuration
|
|
100
138
|
|
|
@@ -107,21 +145,40 @@ Support for `either`/`validate` modes of `Effect.all` and render the amount of s
|
|
|
107
145
|
### Ink renderer behavior
|
|
108
146
|
|
|
109
147
|
- Rendering is powered by [Ink](https://github.com/vadimdemedes/ink).
|
|
110
|
-
- Built-in columns are
|
|
148
|
+
- Built-in columns are exposed as `Progress.Columns.description()`, `bar()`, `amount()`, `elapsed()`, `eta()`, `spacer()`, and `defaults()`.
|
|
111
149
|
- Determinate bars are segmented by outcome: succeeded (green), failed (red), and remaining (neutral).
|
|
112
150
|
- Determinate amount text shows counters without prefixes: `<succeeded> <failed> <processed>/<total>`.
|
|
113
151
|
- Counts can exceed `total`; the amount text keeps those raw values (for example `12/10`) while the bar stays visually clamped at full.
|
|
114
152
|
- `total: 0` is valid for determinate tasks and renders as a full bar by default.
|
|
115
|
-
- Column widths are
|
|
116
|
-
-
|
|
117
|
-
- 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.
|
|
118
155
|
- On narrow terminals, layout compacts to fit available width and tree prefixes are suppressed when description space is too tight.
|
|
119
156
|
|
|
120
|
-
##
|
|
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`
|
|
121
173
|
|
|
122
|
-
|
|
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:
|
|
123
177
|
|
|
124
178
|
```ts
|
|
179
|
+
import { Console, Effect } from "effect";
|
|
180
|
+
import * as Progress from "effective-progress";
|
|
181
|
+
|
|
125
182
|
const program = Progress.task(
|
|
126
183
|
Effect.gen(function* () {
|
|
127
184
|
const progress = yield* Progress.Progress;
|
|
@@ -143,9 +200,59 @@ Manual total behavior:
|
|
|
143
200
|
- negative totals on later `updateTask` calls also clear the total
|
|
144
201
|
- explicit `total: undefined` on `updateTask` clears the total and switches back to indeterminate rendering
|
|
145
202
|
|
|
146
|
-
##
|
|
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"`
|
|
147
254
|
|
|
148
|
-
|
|
255
|
+
If a task does not provide `columns`, the renderer falls back to `Progress.Columns.defaults()`.
|
|
149
256
|
|
|
150
257
|
## Notes
|
|
151
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;
|
|
@@ -33,9 +108,7 @@ declare const TaskUnitsSchema: Schema.Struct<{
|
|
|
33
108
|
total: Schema.optional<typeof Schema.Number>;
|
|
34
109
|
}>;
|
|
35
110
|
type TaskUnits = typeof TaskUnitsSchema.Type;
|
|
36
|
-
declare const
|
|
37
|
-
readonly _tag: Schema.tag<"TaskSnapshot">;
|
|
38
|
-
} & {
|
|
111
|
+
declare const TaskSnapshotSchema: Schema.Struct<{
|
|
39
112
|
id: Schema.brand<typeof Schema.Number, "TaskId">;
|
|
40
113
|
parentId: Schema.NullOr<Schema.brand<typeof Schema.Number, "TaskId">>;
|
|
41
114
|
description: typeof Schema.String;
|
|
@@ -50,8 +123,10 @@ declare const TaskSnapshot_base: Schema.TaggedClass<TaskSnapshot, "TaskSnapshot"
|
|
|
50
123
|
}>;
|
|
51
124
|
startedAt: typeof Schema.Number;
|
|
52
125
|
completedAt: Schema.NullOr<typeof Schema.Number>;
|
|
126
|
+
metadata: typeof Schema.Unknown;
|
|
53
127
|
}>;
|
|
54
|
-
|
|
128
|
+
type TaskSnapshot = typeof TaskSnapshotSchema.Type;
|
|
129
|
+
declare const TaskSnapshot: (snapshot: TaskSnapshot) => TaskSnapshot;
|
|
55
130
|
interface RenderRow {
|
|
56
131
|
readonly id: TaskId;
|
|
57
132
|
readonly depth: number;
|
|
@@ -59,9 +134,10 @@ interface RenderRow {
|
|
|
59
134
|
interface TaskStore {
|
|
60
135
|
readonly tasks: Map<TaskId, TaskSnapshot>;
|
|
61
136
|
readonly renderOrder: ReadonlyArray<RenderRow>;
|
|
137
|
+
readonly columns: Map<TaskId, ReadonlyArray<ColumnDef<any, any>>>;
|
|
62
138
|
}
|
|
63
139
|
interface ProgressService {
|
|
64
|
-
readonly addTask: (options: AddTaskOptions) => Effect.Effect<TaskId>;
|
|
140
|
+
readonly addTask: (options: AddTaskOptions<any>) => Effect.Effect<TaskId>;
|
|
65
141
|
readonly updateTask: (taskId: TaskId, options: UpdateTaskOptions) => Effect.Effect<void>;
|
|
66
142
|
readonly incrementSucceeded: (taskId: TaskId, amount?: number) => Effect.Effect<void>;
|
|
67
143
|
readonly incrementFailed: (taskId: TaskId, amount?: number) => Effect.Effect<void>;
|
|
@@ -70,13 +146,24 @@ interface ProgressService {
|
|
|
70
146
|
readonly log: (...args: ReadonlyArray<unknown>) => Effect.Effect<void>;
|
|
71
147
|
readonly getTask: (taskId: TaskId) => Effect.Effect<Option.Option<TaskSnapshot>>;
|
|
72
148
|
readonly listTasks: Effect.Effect<ReadonlyArray<TaskSnapshot>>;
|
|
73
|
-
readonly
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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: {
|
|
78
161
|
<A, E, R>(effect: Effect.Effect<A, E, R>, options: AddTaskOptions): Effect.Effect<A, E, Exclude<R, Task>>;
|
|
79
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>>;
|
|
80
167
|
};
|
|
81
168
|
}
|
|
82
169
|
declare const Task_base: Context.TagClass<Task, "stromseng.dev/effective-progress/Task", number & Brand.Brand<"TaskId">>;
|
|
@@ -142,6 +229,14 @@ declare class Progress extends Progress_base {
|
|
|
142
229
|
}
|
|
143
230
|
//#endregion
|
|
144
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
|
+
}
|
|
145
240
|
interface EffectExecutionOptions {
|
|
146
241
|
readonly concurrency?: Concurrency;
|
|
147
242
|
readonly batching?: boolean | "inherit";
|
|
@@ -157,21 +252,74 @@ interface ForEachExecutionOptions extends EffectExecutionOptions {
|
|
|
157
252
|
readonly discard?: false | undefined;
|
|
158
253
|
}
|
|
159
254
|
type ForEachOptions = Omit<TrackOptions, "countDisplay"> & ForEachExecutionOptions;
|
|
160
|
-
type TaskOptions = AddTaskOptions
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
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;
|
|
165
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
|
+
*/
|
|
166
270
|
declare const all: {
|
|
167
271
|
<const Arg extends AllArg, O extends EffectAllExecutionOptions>(effects: Arg, options: Omit<TrackOptions, "total" | "countDisplay"> & O): AllReturn<Arg, O>;
|
|
168
272
|
<O extends EffectAllExecutionOptions>(options: Omit<TrackOptions, "total" | "countDisplay"> & O): <const Arg extends AllArg>(effects: Arg) => AllReturn<Arg, O>;
|
|
169
273
|
};
|
|
274
|
+
/**
|
|
275
|
+
* Runs `Effect.forEach` under a single parent task and advances the task counters as items finish.
|
|
276
|
+
*/
|
|
170
277
|
declare const forEach: {
|
|
171
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>>;
|
|
172
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>>;
|
|
173
280
|
};
|
|
174
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
|
|
175
323
|
//#region src/services/stdio.d.ts
|
|
176
324
|
interface ProgressStdioService {
|
|
177
325
|
readonly stdout: NodeJS.WriteStream;
|
|
@@ -182,4 +330,4 @@ declare class ProgressStdio extends ProgressStdio_base {
|
|
|
182
330
|
static readonly Default: Layer.Layer<ProgressStdio, never, never>;
|
|
183
331
|
}
|
|
184
332
|
//#endregion
|
|
185
|
-
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, 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 };
|