@moonrepo/types 1.33.2 → 2.0.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/src/pipeline.ts CHANGED
@@ -1,4 +1,5 @@
1
- import type { Duration, Id, Runtime, ToolchainSpec } from './common';
1
+ import type { Duration, GraphContainer, Id, ToolchainSpec } from './common';
2
+ import type { TaskDependencyType } from './tasks-config';
2
3
 
3
4
  export type ActionPipelineStatus =
4
5
  | 'aborted'
@@ -11,7 +12,6 @@ export type ActionStatus =
11
12
  | 'aborted'
12
13
  | 'cached-from-remote'
13
14
  | 'cached'
14
- | 'failed-and-abort' // Legacy
15
15
  | 'failed'
16
16
  | 'invalid'
17
17
  | 'passed'
@@ -19,21 +19,13 @@ export type ActionStatus =
19
19
  | 'skipped'
20
20
  | 'timed-out';
21
21
 
22
- /** @deprecated */
23
- export interface Attempt {
24
- duration: Duration | null;
25
- exitCode: number | null;
26
- finishedAt: string | null;
27
- index: number;
28
- startedAt: string;
29
- status: ActionStatus;
30
- stderr: string | null;
31
- stdout: string | null;
32
- }
33
-
34
22
  // OPERATIONS
35
23
 
36
- export interface OperationMetaBaseOutput {
24
+ export interface OperationBaseFileChange {
25
+ changedFiles?: string[];
26
+ }
27
+
28
+ export interface OperationBaseProcessOutput {
37
29
  command?: string | null;
38
30
  exitCode?: number | null;
39
31
  stderr?: string | null;
@@ -46,7 +38,7 @@ export interface OperationMetaArchiveCreation {
46
38
 
47
39
  export interface OperationMetaHashGeneration {
48
40
  type: 'hash-generation';
49
- hash: string;
41
+ hash?: string;
50
42
  }
51
43
 
52
44
  export interface OperationMetaMutexAcquisition {
@@ -57,16 +49,23 @@ export interface OperationMetaNoOperation {
57
49
  type: 'no-operation';
58
50
  }
59
51
 
60
- export interface OperationMetaOutputHydration extends OperationMetaBaseOutput {
52
+ export interface OperationMetaOutputHydration extends OperationBaseProcessOutput {
61
53
  type: 'output-hydration';
62
54
  }
63
55
 
64
- export interface OperationMetaSyncOperation {
56
+ export interface OperationMetaProcessExecution extends OperationBaseProcessOutput {
57
+ type: 'process-execution';
58
+ }
59
+
60
+ export interface OperationMetaSetupOperation extends OperationBaseFileChange {
61
+ type: 'setup-operation';
62
+ }
63
+
64
+ export interface OperationMetaSyncOperation extends OperationBaseFileChange {
65
65
  type: 'sync-operation';
66
- label: string;
67
66
  }
68
67
 
69
- export interface OperationMetaTaskExecution extends OperationMetaBaseOutput {
68
+ export interface OperationMetaTaskExecution extends OperationBaseProcessOutput {
70
69
  type: 'task-execution';
71
70
  }
72
71
 
@@ -76,13 +75,18 @@ export type OperationMeta =
76
75
  | OperationMetaMutexAcquisition
77
76
  | OperationMetaNoOperation
78
77
  | OperationMetaOutputHydration
78
+ | OperationMetaProcessExecution
79
+ | OperationMetaSetupOperation
79
80
  | OperationMetaSyncOperation
80
81
  | OperationMetaTaskExecution;
81
82
 
82
83
  export interface Operation {
83
- duration: Duration | null;
84
- finishedAt: string | null;
84
+ duration?: Duration | null;
85
+ finishedAt?: string | null;
86
+ id?: Id | null;
85
87
  meta: OperationMeta;
88
+ operations?: Operation[];
89
+ plugin?: Id | null;
86
90
  startedAt: string;
87
91
  status: ActionStatus;
88
92
  }
@@ -91,18 +95,16 @@ export interface Operation {
91
95
 
92
96
  export interface Action {
93
97
  allowFailure: boolean;
94
- /** @deprecated */
95
- attempts: Attempt[] | null;
96
98
  createdAt: string;
97
- duration: Duration | null;
98
- error: string | null;
99
- finishedAt: string | null;
99
+ duration?: Duration | null;
100
+ error?: string | null;
101
+ finishedAt?: string | null;
100
102
  flaky: boolean;
101
103
  label: string;
102
104
  node: ActionNode;
103
105
  nodeIndex: number;
104
106
  operations: Operation[];
105
- startedAt: string | null;
107
+ startedAt?: string | null;
106
108
  status: ActionStatus;
107
109
  }
108
110
 
@@ -111,14 +113,37 @@ export interface TargetState {
111
113
  hash?: string;
112
114
  }
113
115
 
116
+ export interface AffectedProjectState {
117
+ files?: string[];
118
+ tasks?: string[];
119
+ upstream?: Id[];
120
+ downstream?: Id[];
121
+ other: boolean;
122
+ }
123
+
124
+ export interface AffectedTaskState {
125
+ env?: string[];
126
+ files?: string[];
127
+ projects?: string[];
128
+ upstream?: Id[];
129
+ downstream?: Id[];
130
+ other: boolean;
131
+ }
132
+
133
+ export interface Affected {
134
+ projects: Record<string, AffectedProjectState>;
135
+ tasks: Record<string, AffectedTaskState>;
136
+ shouldCheck: boolean;
137
+ }
138
+
114
139
  export interface ActionContext {
115
- affectedOnly: boolean;
140
+ affected?: Affected | null;
141
+ changedFiles: string[];
116
142
  initialTargets: string[];
117
143
  passthroughArgs: string[];
118
144
  primaryTargets: string[];
119
145
  profile: 'cpu' | 'heap' | null;
120
146
  targetStates: Record<string, TargetState>;
121
- touchedFiles: string[];
122
147
  }
123
148
 
124
149
  export interface RunReport {
@@ -138,47 +163,30 @@ export interface RunReport {
138
163
  }
139
164
  >;
140
165
  };
166
+ status: ActionPipelineStatus;
141
167
  }
142
168
 
143
169
  // NODES
144
170
 
145
171
  export type ActionNode =
146
172
  | ActionNodeInstallDependencies
147
- | ActionNodeInstallProjectDeps
148
- | ActionNodeInstallWorkspaceDeps
149
173
  | ActionNodeRunTask
150
174
  | ActionNodeSetupEnvironment
151
175
  | ActionNodeSetupProto
152
176
  | ActionNodeSetupToolchain
153
- | ActionNodeSetupToolchainLegacy
154
177
  | ActionNodeSyncProject
155
178
  | ActionNodeSyncWorkspace;
156
179
 
157
180
  export interface ActionNodeInstallDependencies {
158
181
  action: 'install-dependencies';
159
182
  params: {
160
- projectId: Id | null;
183
+ members?: string[] | null;
184
+ projectId?: Id | null;
161
185
  root: string;
162
186
  toolchainId: Id;
163
187
  };
164
188
  }
165
189
 
166
- export interface ActionNodeInstallWorkspaceDeps {
167
- action: 'install-workspace-deps';
168
- params: {
169
- runtime: Runtime;
170
- root: string;
171
- };
172
- }
173
-
174
- export interface ActionNodeInstallProjectDeps {
175
- action: 'install-project-deps';
176
- params: {
177
- runtime: Runtime;
178
- projectId: Id;
179
- };
180
- }
181
-
182
190
  export interface ActionNodeRunTask {
183
191
  action: 'run-task';
184
192
  params: {
@@ -186,38 +194,32 @@ export interface ActionNodeRunTask {
186
194
  env: Record<string, string>;
187
195
  interactive: boolean;
188
196
  persistent: boolean;
189
- runtime: Runtime;
197
+ priority: number;
190
198
  target: string;
191
- id: number | null;
199
+ id?: number | null;
192
200
  };
193
201
  }
194
202
 
195
203
  export interface ActionNodeSetupEnvironment {
196
- action: 'install-environment';
204
+ action: 'setup-environment';
197
205
  params: {
198
- projectId: Id | null;
206
+ projectId?: Id | null;
199
207
  root: string;
200
208
  toolchainId: Id;
201
209
  };
202
210
  }
203
211
 
204
- export interface ActionNodeSetupToolchainLegacy {
205
- action: 'setup-toolchain-legacy';
206
- params: {
207
- runtime: Runtime;
208
- };
209
- }
210
-
211
212
  export interface ActionNodeSetupProto {
212
213
  action: 'setup-proto';
213
- params: {};
214
+ params: {
215
+ version: string;
216
+ };
214
217
  }
215
218
 
216
219
  export interface ActionNodeSetupToolchain {
217
220
  action: 'setup-toolchain';
218
221
  params: {
219
- projectId: Id | null;
220
- spec: ToolchainSpec;
222
+ toolchain: ToolchainSpec;
221
223
  };
222
224
  }
223
225
 
@@ -232,21 +234,4 @@ export interface ActionNodeSyncWorkspace {
232
234
  action: 'sync-workspace';
233
235
  }
234
236
 
235
- // GRAPH
236
-
237
- export interface ActionGraphNode {
238
- id: number;
239
- label: string;
240
- }
241
-
242
- export interface ActionGraphEdge {
243
- id: number;
244
- label: string;
245
- source: number;
246
- target: number;
247
- }
248
-
249
- export interface ActionGraph {
250
- edges: ActionGraphEdge[];
251
- nodes: ActionGraphNode[];
252
- }
237
+ export type ActionGraph = GraphContainer<ActionNode, TaskDependencyType>;