@wpkernel/pipeline 0.12.3-beta.0 → 0.12.3-beta.2

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,257 +1,343 @@
1
- import { maybeThen as x, maybeTry as F } from "../async-utils.js";
2
- import { createDependencyGraph as U } from "../dependency-graph.js";
3
- import { executeHelpers as C } from "../executor.js";
4
- import { buildExecutionSnapshot as v, assertAllHelpersExecuted as A } from "./helper-execution.js";
5
- import { initExtensionCoordinator as B } from "./extension-coordinator.js";
6
- function j(r) {
7
- return {
8
- prepareContext: (s) => {
9
- const a = r.options.createBuildOptions(s), n = r.options.createContext(s);
10
- r.diagnosticManager.setReporter(n.reporter);
11
- const l = r.options.createFragmentState({
12
- options: s,
13
- context: n,
14
- buildOptions: a
15
- }), m = U(
16
- r.fragmentEntries,
17
- {
18
- onMissingDependency: ({ dependant: t, dependencyKey: e }) => {
19
- const o = t.helper;
20
- r.diagnosticManager.flagMissingDependency(
21
- o,
22
- e,
23
- r.fragmentKind
24
- ), r.diagnosticManager.flagUnusedHelper(
25
- o,
26
- r.fragmentKind,
27
- `could not execute because dependency "${e}" was not found`,
28
- o.dependsOn
29
- );
30
- },
31
- onUnresolvedHelpers: ({ unresolved: t }) => {
32
- for (const e of t) {
33
- const o = e.helper;
34
- r.diagnosticManager.flagUnusedHelper(
35
- o,
36
- r.fragmentKind,
37
- "could not execute because its dependencies never resolved",
38
- o.dependsOn
39
- );
40
- }
41
- }
42
- },
43
- r.createError
44
- ).order, c = [], b = (t) => {
45
- const e = t.helper;
46
- c.push({
47
- id: t.id,
48
- index: c.length,
49
- key: e.key,
50
- kind: e.kind,
51
- mode: e.mode,
52
- priority: e.priority,
53
- dependsOn: e.dependsOn,
54
- origin: e.origin
55
- });
56
- }, p = {
57
- onMissingDependency: ({ dependant: t, dependencyKey: e }) => {
58
- const o = t.helper;
59
- r.diagnosticManager.flagMissingDependency(
60
- o,
61
- e,
62
- r.builderKind
63
- ), r.diagnosticManager.flagUnusedHelper(
64
- o,
65
- r.builderKind,
66
- `could not execute because dependency "${e}" was not found`,
67
- o.dependsOn
1
+ import { maybeThen as b, composeK as j } from "../async-utils.js";
2
+ import { createDependencyGraph as x } from "../dependency-graph.js";
3
+ import { buildExecutionSnapshot as u, assertAllHelpersExecuted as E } from "./helper-execution.js";
4
+ import { initExtensionCoordinator as I } from "./extension-coordinator.js";
5
+ import { isHalt as g, makeFinalizeResultStage as J, makeCommitStage as Q, makeHelperStageFactory as W, makeAfterFragmentsStage as X, makeFinalizeFragmentsStage as Y, runRollbackToHalt as Z } from "./pipeline-program-utils.js";
6
+ const h = "after-fragments";
7
+ function ar(o) {
8
+ const p = (r) => ({
9
+ __halt: !0,
10
+ error: r
11
+ }), k = (r) => {
12
+ const t = o.options.createBuildOptions(r), n = o.options.createContext(r);
13
+ o.diagnosticManager.setReporter(n.reporter);
14
+ const l = o.options.createFragmentState({
15
+ options: r,
16
+ context: n,
17
+ buildOptions: t
18
+ }), c = x(
19
+ o.fragmentEntries,
20
+ {
21
+ providedKeys: o.options.fragmentProvidedKeys,
22
+ onMissingDependency: ({ dependant: e, dependencyKey: i }) => {
23
+ const a = e.helper;
24
+ o.diagnosticManager.flagMissingDependency(
25
+ a,
26
+ i,
27
+ o.fragmentKind
28
+ ), o.diagnosticManager.flagUnusedHelper(
29
+ a,
30
+ o.fragmentKind,
31
+ `could not execute because dependency "${i}" was not found`,
32
+ a.dependsOn
68
33
  );
69
34
  },
70
- onUnresolvedHelpers: ({ unresolved: t }) => {
71
- for (const e of t) {
72
- const o = e.helper;
73
- r.diagnosticManager.flagUnusedHelper(
74
- o,
75
- r.builderKind,
35
+ onUnresolvedHelpers: ({ unresolved: e }) => {
36
+ for (const i of e) {
37
+ const a = i.helper;
38
+ o.diagnosticManager.flagUnusedHelper(
39
+ a,
40
+ o.fragmentKind,
76
41
  "could not execute because its dependencies never resolved",
77
- o.dependsOn
42
+ a.dependsOn
78
43
  );
79
44
  }
80
45
  }
81
- }, E = r.options.createExtensionHookOptions ?? ((t) => ({
82
- context: t.context,
83
- options: t.options,
84
- artifact: t.artifact,
85
- lifecycle: t.lifecycle
86
- })), y = (t, e) => E({
87
- context: n,
88
- options: s,
89
- buildOptions: a,
90
- artifact: t,
91
- lifecycle: e
92
- }), M = r.options.onExtensionRollbackError ?? ((t) => {
93
- const { reporter: e } = t.context, o = e.warn;
94
- typeof o == "function" && o.call(e, "Pipeline extension rollback failed.", {
95
- error: t.error,
96
- errorName: t.errorMetadata.name,
97
- errorMessage: t.errorMetadata.message,
98
- errorStack: t.errorMetadata.stack,
99
- errorCause: t.errorMetadata.cause,
100
- extensions: t.extensionKeys,
101
- hookKeys: t.hookSequence
102
- });
46
+ },
47
+ o.createError
48
+ ).order, s = [], m = (e) => {
49
+ const i = e.helper;
50
+ s.push({
51
+ id: e.id,
52
+ index: s.length,
53
+ key: i.key,
54
+ kind: i.kind,
55
+ mode: i.mode,
56
+ priority: i.priority,
57
+ dependsOn: i.dependsOn,
58
+ origin: i.origin
103
59
  });
104
- return {
105
- runOptions: s,
106
- buildOptions: a,
107
- context: n,
108
- draft: l,
109
- fragmentOrder: m,
110
- steps: c,
111
- pushStep: b,
112
- builderGraphOptions: p,
113
- buildHookOptions: y,
114
- handleRollbackError: M
115
- };
116
- },
117
- executeRun: (s) => {
118
- const {
119
- runOptions: a,
120
- buildOptions: n,
121
- context: l,
122
- draft: m,
123
- fragmentOrder: c,
124
- steps: b,
125
- pushStep: p,
126
- builderGraphOptions: E,
127
- buildHookOptions: y,
128
- handleRollbackError: M
129
- } = s;
130
- let t = v(
131
- r.builderEntries,
132
- /* @__PURE__ */ new Set(),
133
- r.builderKind
134
- );
135
- const e = C(
136
- c,
137
- (o) => r.options.createFragmentArgs({
138
- helper: o.helper,
139
- options: a,
140
- context: l,
141
- buildOptions: n,
142
- draft: m
143
- }),
144
- (o, g, u) => o.apply(g, u),
145
- (o) => p(o)
146
- );
147
- return x(e, (o) => {
148
- r.diagnosticManager.reviewUnusedHelpers(
149
- r.fragmentEntries,
150
- o,
151
- r.fragmentKind
152
- );
153
- const g = v(
154
- r.fragmentEntries,
155
- o,
156
- r.fragmentKind
157
- );
158
- A(
159
- r.fragmentEntries,
160
- g,
161
- r.fragmentKind,
162
- r.diagnosticManager.describeHelper,
163
- r.createError
164
- );
165
- let u = r.options.finalizeFragmentState({
166
- draft: m,
167
- options: a,
168
- context: l,
169
- buildOptions: n,
170
- helpers: { fragments: g }
171
- });
172
- const D = U(
173
- r.builderEntries,
174
- E,
175
- r.createError
176
- ).order, H = B(
177
- ({ error: f, extensionKeys: h, hookSequence: R, errorMetadata: K }) => M({
178
- error: f,
179
- extensionKeys: h,
180
- hookSequence: R,
181
- errorMetadata: K,
182
- context: l
183
- })
184
- ), w = "after-fragments", O = H.runLifecycle(
185
- w,
186
- {
187
- hooks: r.extensionHooks,
188
- hookOptions: y(u, w)
189
- }
60
+ }, f = {
61
+ providedKeys: o.options.builderProvidedKeys,
62
+ onMissingDependency: ({ dependant: e, dependencyKey: i }) => {
63
+ const a = e.helper;
64
+ o.diagnosticManager.flagMissingDependency(
65
+ a,
66
+ i,
67
+ o.builderKind
68
+ ), o.diagnosticManager.flagUnusedHelper(
69
+ a,
70
+ o.builderKind,
71
+ `could not execute because dependency "${i}" was not found`,
72
+ a.dependsOn
190
73
  );
191
- return x(O, (f) => {
192
- u = f.artifact;
193
- const h = () => H.createRollbackHandler(
194
- f
195
- ), R = h(), K = (i) => {
196
- r.diagnosticManager.reviewUnusedHelpers(
197
- r.builderEntries,
198
- i,
199
- r.builderKind
200
- );
201
- const d = v(
202
- r.builderEntries,
203
- i,
204
- r.builderKind
205
- );
206
- A(
207
- r.builderEntries,
208
- d,
209
- r.builderKind,
210
- r.diagnosticManager.describeHelper,
211
- r.createError
212
- ), t = d;
213
- const k = () => r.resolveRunResult({
214
- artifact: u,
215
- diagnostics: [
216
- ...r.diagnosticManager.readDiagnostics()
217
- ],
218
- steps: b,
219
- context: l,
220
- buildOptions: n,
221
- options: a,
222
- helpers: {
223
- fragments: g,
224
- builders: t
225
- }
226
- }), S = h();
227
- return x(
228
- F(
229
- () => H.commit(f),
230
- S
231
- ),
232
- k
233
- );
234
- };
235
- return F(() => x(
236
- C(
237
- D,
238
- (i) => r.options.createBuilderArgs({
239
- helper: i.helper,
240
- options: a,
241
- context: l,
242
- buildOptions: n,
243
- artifact: u
244
- }),
245
- (i, d, k) => i.apply(d, k),
246
- (i) => p(i)
247
- ),
248
- K
249
- ), R);
250
- });
74
+ },
75
+ onUnresolvedHelpers: ({ unresolved: e }) => {
76
+ for (const i of e) {
77
+ const a = i.helper;
78
+ o.diagnosticManager.flagUnusedHelper(
79
+ a,
80
+ o.builderKind,
81
+ "could not execute because its dependencies never resolved",
82
+ a.dependsOn
83
+ );
84
+ }
85
+ }
86
+ }, N = o.options.createExtensionHookOptions ?? ((e) => ({
87
+ context: e.context,
88
+ options: e.options,
89
+ artifact: e.artifact,
90
+ lifecycle: e.lifecycle
91
+ })), $ = (e, i) => N({
92
+ context: n,
93
+ options: r,
94
+ buildOptions: t,
95
+ artifact: e,
96
+ lifecycle: i
97
+ }), q = o.options.onExtensionRollbackError ?? ((e) => {
98
+ const { reporter: i } = e.context, a = i.warn;
99
+ typeof a == "function" && a.call(i, "Pipeline extension rollback failed.", {
100
+ error: e.error,
101
+ errorName: e.errorMetadata.name,
102
+ errorMessage: e.errorMetadata.message,
103
+ errorStack: e.errorMetadata.stack,
104
+ errorCause: e.errorMetadata.cause,
105
+ extensions: e.extensionKeys,
106
+ hookKeys: e.hookSequence
251
107
  });
108
+ });
109
+ return {
110
+ runOptions: r,
111
+ buildOptions: t,
112
+ context: n,
113
+ draft: l,
114
+ fragmentOrder: c,
115
+ steps: s,
116
+ pushStep: m,
117
+ builderGraphOptions: f,
118
+ buildHookOptions: $,
119
+ handleRollbackError: q
120
+ };
121
+ }, R = (r, t, n) => {
122
+ o.diagnosticManager.reviewUnusedHelpers(
123
+ r.fragmentEntries,
124
+ t,
125
+ o.fragmentKind
126
+ );
127
+ const l = u(
128
+ r.fragmentEntries,
129
+ t,
130
+ o.fragmentKind
131
+ );
132
+ return E(
133
+ r.fragmentEntries,
134
+ l,
135
+ o.fragmentKind,
136
+ o.diagnosticManager.describeHelper,
137
+ o.createError
138
+ ), {
139
+ ...r,
140
+ fragmentVisited: t,
141
+ fragmentExecution: l,
142
+ fragmentRollbacks: n
143
+ };
144
+ }, H = (r, t, n) => {
145
+ o.diagnosticManager.reviewUnusedHelpers(
146
+ r.builderEntries,
147
+ t,
148
+ o.builderKind
149
+ );
150
+ const l = u(
151
+ r.builderEntries,
152
+ t,
153
+ o.builderKind
154
+ );
155
+ return E(
156
+ r.builderEntries,
157
+ l,
158
+ o.builderKind,
159
+ o.diagnosticManager.describeHelper,
160
+ o.createError
161
+ ), {
162
+ ...r,
163
+ builderVisited: t,
164
+ builderExecution: l,
165
+ builderRollbacks: n
166
+ };
167
+ }, O = (r, t) => o.options.createFragmentArgs({
168
+ helper: t.helper,
169
+ options: r.runOptions,
170
+ context: r.context,
171
+ buildOptions: r.buildOptions,
172
+ draft: r.draft
173
+ }), y = (r, t) => o.options.createBuilderArgs({
174
+ helper: t.helper,
175
+ options: r.runOptions,
176
+ context: r.context,
177
+ buildOptions: r.buildOptions,
178
+ artifact: r.artifact
179
+ }), M = (r) => (t) => O(r, t), F = (r) => (t) => y(r, t), K = (r) => r.fragmentRollbacks, S = (r) => r.builderRollbacks ?? [], d = (r) => ({
180
+ context: r.context,
181
+ extensionCoordinator: r.extensionCoordinator,
182
+ extensionState: r.extensionState
183
+ }), A = (r) => r.fragmentExecution ?? u(
184
+ r.fragmentEntries,
185
+ r.fragmentVisited,
186
+ o.fragmentKind
187
+ ), P = (r) => {
188
+ const { extensionCoordinator: t, extensionState: n } = r;
189
+ if (!(!t || !n))
190
+ return t.commit(n);
191
+ }, v = (r) => ({
192
+ context: r.context,
193
+ rollbackContext: d(r),
194
+ helperRollbacks: r.builderRollbacks ?? [],
195
+ onHelperRollbackError: o.options.onHelperRollbackError
196
+ }), w = (r, t) => Z(
197
+ {
198
+ rollbackPlan: v(r),
199
+ halt: p
200
+ },
201
+ t
202
+ ), B = (r) => (t) => {
203
+ const n = I(
204
+ ({ error: c, extensionKeys: s, hookSequence: m, errorMetadata: f }) => r.handleRollbackError({
205
+ error: c,
206
+ extensionKeys: s,
207
+ hookSequence: m,
208
+ errorMetadata: f,
209
+ context: t.context
210
+ })
211
+ ), l = n.runLifecycle(
212
+ h,
213
+ {
214
+ hooks: o.extensionHooks,
215
+ hookOptions: r.buildHookOptions(
216
+ t.artifact,
217
+ h
218
+ )
219
+ }
220
+ );
221
+ return b(
222
+ l,
223
+ (c) => ({
224
+ ...t,
225
+ artifact: c.artifact,
226
+ extensionCoordinator: n,
227
+ extensionState: c
228
+ })
229
+ );
230
+ }, U = (r) => r.helpers ?? {
231
+ fragments: r.fragmentExecution ?? u(
232
+ r.fragmentEntries,
233
+ r.fragmentVisited,
234
+ o.fragmentKind
235
+ ),
236
+ builders: r.builderExecution ?? u(
237
+ r.builderEntries,
238
+ r.builderVisited,
239
+ o.builderKind
240
+ )
241
+ }, z = (r) => ({
242
+ ...r,
243
+ helpers: U(r),
244
+ diagnostics: [
245
+ ...o.diagnosticManager.readDiagnostics()
246
+ ]
247
+ }), D = Y({
248
+ isHalt: g,
249
+ snapshotFragments: A,
250
+ applyArtifact: (r, t) => ({
251
+ ...r,
252
+ artifact: o.options.finalizeFragmentState({
253
+ draft: r.draft,
254
+ options: r.runOptions,
255
+ context: r.context,
256
+ buildOptions: r.buildOptions,
257
+ helpers: {
258
+ fragments: t
259
+ }
260
+ }),
261
+ fragmentExecution: t
262
+ })
263
+ }), T = (r) => X({
264
+ isHalt: g,
265
+ execute: B(r)
266
+ }), G = Q({
267
+ isHalt: g,
268
+ commit: P,
269
+ rollbackToHalt: w
270
+ }), V = J({
271
+ isHalt: g,
272
+ finalize: z
273
+ }), _ = {
274
+ getOrder: (r) => r.fragmentOrder,
275
+ makeArgs: M,
276
+ onVisited: (r, t, n) => R(r, t, n),
277
+ readRollbacks: K
278
+ }, C = {
279
+ getOrder: (r) => r.builderOrder,
280
+ makeArgs: F,
281
+ onVisited: (r, t, n) => H(r, t, n),
282
+ readRollbacks: S
283
+ }, L = (r) => {
284
+ const t = W({
285
+ pushStep: r.pushStep,
286
+ toRollbackContext: d,
287
+ halt: p,
288
+ isHalt: g,
289
+ onHelperRollbackError: o.options.onHelperRollbackError
290
+ }), n = t(_), l = t(C), c = [
291
+ V,
292
+ G,
293
+ l,
294
+ T(r),
295
+ D,
296
+ n
297
+ ];
298
+ return j(...c);
299
+ };
300
+ return {
301
+ prepareContext: k,
302
+ executeRun: (r) => {
303
+ const t = x(
304
+ o.builderEntries,
305
+ r.builderGraphOptions,
306
+ o.createError
307
+ ).order, n = {
308
+ context: r.context,
309
+ reporter: r.context.reporter,
310
+ runOptions: r.runOptions,
311
+ buildOptions: r.buildOptions,
312
+ fragmentEntries: o.fragmentEntries,
313
+ builderEntries: o.builderEntries,
314
+ fragmentOrder: r.fragmentOrder,
315
+ builderOrder: t,
316
+ fragmentVisited: /* @__PURE__ */ new Set(),
317
+ builderVisited: /* @__PURE__ */ new Set(),
318
+ draft: r.draft,
319
+ artifact: null,
320
+ steps: r.steps,
321
+ diagnostics: [],
322
+ fragmentRollbacks: [],
323
+ builderRollbacks: []
324
+ }, l = L(r), c = (s) => {
325
+ if (g(s))
326
+ throw s.error ?? new Error("Pipeline halted");
327
+ return o.resolveRunResult({
328
+ artifact: s.artifact,
329
+ diagnostics: s.diagnostics,
330
+ steps: s.steps,
331
+ context: s.context,
332
+ buildOptions: s.buildOptions,
333
+ options: s.runOptions,
334
+ helpers: s.helpers
335
+ });
336
+ };
337
+ return b(l(n), c);
252
338
  }
253
339
  };
254
340
  }
255
341
  export {
256
- j as initPipelineRunner
342
+ ar as initPipelineRunner
257
343
  };
@@ -1,6 +1,8 @@
1
1
  import { CreateDependencyGraphOptions, RegisteredHelper } from '../dependency-graph';
2
2
  import { ErrorFactory } from '../error-factory';
3
- import { CreatePipelineOptions, Helper, HelperApplyOptions, HelperKind, MaybePromise, PipelineDiagnostic, PipelineExecutionMetadata, PipelineExtensionHookOptions, PipelineExtensionLifecycle, PipelineExtensionRollbackErrorMetadata, PipelineReporter, PipelineStep } from '../types';
3
+ import { CreatePipelineOptions, Helper, HelperApplyOptions, HelperExecutionSnapshot, HelperKind, MaybePromise, PipelineDiagnostic, PipelineExecutionMetadata, PipelineExtensionHookOptions, PipelineExtensionLifecycle, PipelineExtensionRollbackErrorMetadata, PipelineReporter, PipelineStep } from '../types';
4
+ import { PipelineRollback } from '../rollback';
5
+ import { ExtensionCoordinator, ExtensionLifecycleState } from './extension-coordinator.types';
4
6
  import { DiagnosticManager } from './diagnostic-manager.types';
5
7
  import { ExtensionHookEntry } from '../extensions';
6
8
  /**
@@ -75,5 +77,91 @@ export interface PipelineRunner<TRunOptions, TBuildOptions, TContext extends {
75
77
  helperArgs: HelperApplyOptions<unknown, unknown, unknown>;
76
78
  };
77
79
  }
80
+ /**
81
+ * Closed-world state threaded through composed pipeline programs. While the implementation still
82
+ * mutates some nested values (e.g. `steps`), every program returns a new state value to keep the
83
+ * orchestrator closed under composition.
84
+ *
85
+ * @category Pipeline
86
+ * @internal
87
+ */
88
+ export interface PipelineState<TRunOptions, TBuildOptions, TContext extends {
89
+ reporter: TReporter;
90
+ }, TReporter extends PipelineReporter, TDraft, TArtifact, TDiagnostic extends PipelineDiagnostic, TFragmentInput, TFragmentOutput, TBuilderInput, TBuilderOutput, TFragmentKind extends HelperKind, TBuilderKind extends HelperKind, TFragmentHelper extends Helper<TContext, TFragmentInput, TFragmentOutput, TReporter, TFragmentKind>, TBuilderHelper extends Helper<TContext, TBuilderInput, TBuilderOutput, TReporter, TBuilderKind>> {
91
+ readonly context: TContext;
92
+ readonly reporter: TReporter;
93
+ readonly runOptions: TRunOptions;
94
+ readonly buildOptions: TBuildOptions;
95
+ readonly fragmentEntries: RegisteredHelper<TFragmentHelper>[];
96
+ readonly builderEntries: RegisteredHelper<TBuilderHelper>[];
97
+ readonly fragmentOrder: RegisteredHelper<TFragmentHelper>[];
98
+ readonly builderOrder: RegisteredHelper<TBuilderHelper>[];
99
+ readonly fragmentVisited: Set<string>;
100
+ readonly builderVisited: Set<string>;
101
+ readonly draft: TDraft;
102
+ readonly artifact: TArtifact | null;
103
+ readonly steps: PipelineStep[];
104
+ readonly diagnostics: TDiagnostic[];
105
+ readonly fragmentExecution?: HelperExecutionSnapshot<TFragmentKind>;
106
+ readonly builderExecution?: HelperExecutionSnapshot<TBuilderKind>;
107
+ readonly helpers?: PipelineExecutionMetadata<TFragmentKind, TBuilderKind>;
108
+ readonly fragmentRollbacks?: Array<{
109
+ readonly helper: TFragmentHelper;
110
+ readonly rollback: PipelineRollback;
111
+ }>;
112
+ readonly builderRollbacks?: Array<{
113
+ readonly helper: TBuilderHelper;
114
+ readonly rollback: PipelineRollback;
115
+ }>;
116
+ readonly extensionCoordinator?: ExtensionCoordinator<TContext, TRunOptions, TArtifact>;
117
+ readonly extensionState?: ExtensionLifecycleState<TContext, TRunOptions, TArtifact>;
118
+ }
78
119
  export type { ExtensionHookEntry };
120
+ export type RollbackCapableCoordinator<TContext, TOptions, TArtifact> = {
121
+ createRollbackHandler: <TResult>(state: ExtensionLifecycleState<TContext, TOptions, TArtifact>) => (error: unknown) => MaybePromise<TResult>;
122
+ };
123
+ export type RollbackEntry<THelper> = {
124
+ readonly helper: THelper;
125
+ readonly rollback: PipelineRollback;
126
+ };
127
+ export type Halt<TRunResult> = {
128
+ readonly __halt: true;
129
+ readonly error?: unknown;
130
+ readonly result?: TRunResult;
131
+ };
132
+ export type RollbackContext<TContext, TOptions, TArtifact> = {
133
+ readonly context: TContext;
134
+ readonly extensionCoordinator?: RollbackCapableCoordinator<TContext, TOptions, TArtifact>;
135
+ readonly extensionState?: ExtensionLifecycleState<TContext, TOptions, TArtifact>;
136
+ };
137
+ export type HelperInvokeOptions<THelper, TInput, TOutput, TContext, TReporter extends PipelineReporter> = {
138
+ readonly helper: THelper;
139
+ readonly args: HelperApplyOptions<TContext, TInput, TOutput, TReporter>;
140
+ readonly next: () => MaybePromise<void>;
141
+ };
142
+ export type StageEnv<TState, TRunResult, TContext, TOptions, TArtifact, TReporter extends PipelineReporter> = {
143
+ pushStep: (entry: RegisteredHelper<unknown>) => void;
144
+ toRollbackContext: (state: TState) => RollbackContext<TContext, TOptions, TArtifact>;
145
+ halt: (error?: unknown) => Halt<TRunResult>;
146
+ isHalt: (value: unknown) => value is Halt<TRunResult>;
147
+ onHelperRollbackError?: (options: {
148
+ readonly error: unknown;
149
+ readonly helper: Helper<TContext, unknown, unknown, TReporter, HelperKind>;
150
+ readonly errorMetadata: PipelineExtensionRollbackErrorMetadata;
151
+ readonly context: TContext;
152
+ }) => void;
153
+ };
154
+ export type HelperRollbackPlan<TContext, TOptions, TArtifact, THelper extends {
155
+ key: string;
156
+ }> = {
157
+ readonly context: TContext;
158
+ readonly rollbackContext: RollbackContext<TContext, TOptions, TArtifact>;
159
+ readonly helperRollbacks: readonly RollbackEntry<THelper>[];
160
+ readonly onHelperRollbackError?: (options: {
161
+ readonly error: unknown;
162
+ readonly helper: THelper;
163
+ readonly errorMetadata: PipelineExtensionRollbackErrorMetadata;
164
+ readonly context: TContext;
165
+ }) => void;
166
+ };
79
167
  //# sourceMappingURL=pipeline-runner.types.d.ts.map