66
77/// <reference types = " node" />
88
9+ import type { GetInputsSnapshotAsyncFn } from ' @microsoft/rush-lib' ;
910import type { IDaemonPaths } from ' @rushstack/rush-daemon-transport' ;
1011import type { IInputsSnapshot } from ' @microsoft/rush-lib' ;
1112import type { IOperationGraph } from ' @microsoft/rush-lib' ;
13+ import type { Operation } from ' @microsoft/rush-lib' ;
1214import { RushConfiguration } from ' @microsoft/rush-lib' ;
15+ import type { RushConfigurationProject } from ' @microsoft/rush-lib' ;
1316import type { RushSession } from ' @microsoft/rush-lib' ;
1417
18+ // @beta
19+ export type CreateWorkspaceEngineComponentsAsync = (options : ICreateWorkspaceEngineComponentsOptions ) => Promise <IWorkspaceEngineComponents >;
20+
1521// @beta
1622export type CreateWorkspaceSessionComponentsAsync = (options : ICreateWorkspaceSessionComponentsOptions ) => Promise <IWorkspaceSessionComponents >;
1723
24+ // @beta
25+ export interface IClassifyWorkspaceInvalidationsOptions {
26+ // (undocumented)
27+ readonly changedPaths: ReadonlyArray <string >;
28+ // (undocumented)
29+ readonly rushConfiguration: RushConfiguration ;
30+ }
31+
32+ // @beta
33+ export interface ICreateWorkspaceEngineComponentsOptions extends IWorkspaceEngineShape {
34+ readonly projectSelection: ReadonlySet <RushConfigurationProject >;
35+ // (undocumented)
36+ readonly rushConfiguration: RushConfiguration ;
37+ }
38+
1839// @beta
1940export interface ICreateWorkspaceSessionComponentsOptions {
2041 // (undocumented)
@@ -25,6 +46,18 @@ export interface ICreateWorkspaceSessionComponentsOptions {
2546 readonly rushConfiguration: RushConfiguration ;
2647}
2748
49+ // @beta
50+ export interface IMapWorkspaceInvalidationsOptions {
51+ // (undocumented)
52+ readonly changedPaths: ReadonlyArray <string >;
53+ // (undocumented)
54+ readonly currentInputsSnapshot: IInputsSnapshot ;
55+ // (undocumented)
56+ readonly nextInputsSnapshot: IInputsSnapshot ;
57+ // (undocumented)
58+ readonly operationGraph: IOperationGraph ;
59+ }
60+
2861// @public
2962export interface IRequestLease {
3063 // (undocumented)
@@ -58,6 +91,54 @@ export interface IRushDaemonServeOptions extends IRushDaemonHostOptions {
5891 readonly shutdownSignal? : AbortSignal ;
5992}
6093
94+ // @beta
95+ export type IsWorkspaceEngineRecreationRequiredAsync = (options : IClassifyWorkspaceInvalidationsOptions ) => Promise <boolean >;
96+
97+ // @beta
98+ export interface IWorkspaceEngineComponentFactoryOptions {
99+ // (undocumented)
100+ readonly createEngineComponentsAsync: CreateWorkspaceEngineComponentsAsync ;
101+ // (undocumented)
102+ readonly isEngineRecreationRequiredAsync? : IsWorkspaceEngineRecreationRequiredAsync ;
103+ // (undocumented)
104+ readonly mapInvalidationsToOperationsAsync: MapWorkspaceInvalidationsToOperationsAsync ;
105+ // (undocumented)
106+ readonly shape: IWorkspaceEngineShape ;
107+ }
108+
109+ // @beta
110+ export interface IWorkspaceEngineComponents extends AsyncDisposable {
111+ [Symbol .asyncDispose ](): Promise <void >;
112+ // (undocumented)
113+ readonly getInputsSnapshotAsync: GetInputsSnapshotAsyncFn ;
114+ // (undocumented)
115+ readonly inputsSnapshot: IInputsSnapshot ;
116+ // (undocumented)
117+ readonly operationGraph: IOperationGraph ;
118+ // (undocumented)
119+ readonly rushSession: RushSession ;
120+ }
121+
122+ // @beta
123+ export interface IWorkspaceEngineShape {
124+ // (undocumented)
125+ readonly phaseNames: ReadonlyArray <string >;
126+ // (undocumented)
127+ readonly pluginNames: ReadonlyArray <string >;
128+ }
129+
130+ // @beta
131+ export interface IWorkspaceInvalidationReconciliation {
132+ // (undocumented)
133+ readonly inputsSnapshot: IInputsSnapshot ;
134+ // (undocumented)
135+ readonly invalidatedOperationCount: number ;
136+ // (undocumented)
137+ readonly isFullInvalidation: boolean ;
138+ // (undocumented)
139+ readonly sequence: number ;
140+ }
141+
61142// @beta
62143export interface IWorkspaceInvalidationSnapshot {
63144 readonly changedPaths: ReadonlyArray <string >;
@@ -74,6 +155,8 @@ export interface IWorkspaceInvalidationWatcher extends AsyncDisposable {
74155
75156// @beta
76157export interface IWorkspaceSession extends AsyncDisposable {
158+ // (undocumented)
159+ readonly engineShape: IWorkspaceEngineShape | undefined ;
77160 // (undocumented)
78161 readonly inputsSnapshot: IInputsSnapshot | undefined ;
79162 // (undocumented)
@@ -83,19 +166,25 @@ export interface IWorkspaceSession extends AsyncDisposable {
83166 // (undocumented)
84167 readonly operationGraph: IOperationGraph | undefined ;
85168 // (undocumented)
169+ reconcileInvalidationsAsync(): Promise <IWorkspaceInvalidationReconciliation | undefined >;
170+ // (undocumented)
86171 readonly rushConfiguration: RushConfiguration ;
87172 // (undocumented)
88173 readonly rushSession: RushSession | undefined ;
89174}
90175
91176// @beta
92177export interface IWorkspaceSessionComponents extends AsyncDisposable {
178+ // (undocumented)
179+ readonly engineShape? : IWorkspaceEngineShape ;
93180 // (undocumented)
94181 readonly inputsSnapshot? : IInputsSnapshot ;
95182 // (undocumented)
96183 readonly operationGraph? : IOperationGraph ;
97184 readonly projectWatcher? : IWorkspaceInvalidationWatcher ;
98185 // (undocumented)
186+ readonly reconcileInvalidationsAsync? : () => Promise <IWorkspaceInvalidationReconciliation >;
187+ // (undocumented)
99188 readonly rushSession? : RushSession ;
100189}
101190
@@ -125,6 +214,9 @@ export interface IWorkspaceSessionOptions {
125214 readonly rushVersion: string ;
126215}
127216
217+ // @beta
218+ export type MapWorkspaceInvalidationsToOperationsAsync = (options : IMapWorkspaceInvalidationsOptions ) => Promise <Iterable <Operation >>;
219+
128220// @public
129221export enum RequestExclusivityClass {
130222 // (undocumented)
@@ -171,11 +263,29 @@ export class RushDaemonHost {
171263// @beta
172264export function serveRushDaemonAsync(options : IRushDaemonServeOptions ): Promise <void >;
173265
266+ // @beta
267+ export class WorkspaceEngineComponentFactory {
268+ constructor (options : IWorkspaceEngineComponentFactoryOptions );
269+ // (undocumented)
270+ readonly createAsync: CreateWorkspaceSessionComponentsAsync ;
271+ // (undocumented)
272+ readonly shape: IWorkspaceEngineShape ;
273+ }
274+
275+ // @beta
276+ export class WorkspaceEngineRecreationRequiredError extends Error {
277+ constructor ();
278+ }
279+
174280// @beta
175281export class WorkspaceInvalidationTracker {
176282 acknowledgeThrough(sequence : number ): void ;
177283 getSnapshot(): IWorkspaceInvalidationSnapshot ;
284+ // @internal (undocumented)
285+ get hasUnattributedUnknownChanges(): boolean ;
178286 invalidate(changedPath ? : string ): void ;
287+ // @internal (undocumented)
288+ invalidateForInitialization(): void ;
179289 markWatcherUnhealthy(): void ;
180290}
181291
@@ -184,13 +294,16 @@ export class WorkspaceSession implements IWorkspaceSession {
184294 [Symbol .asyncDispose ](): Promise <void >;
185295 static createAsync(options : IWorkspaceSessionOptions ): Promise <WorkspaceSession >;
186296 // (undocumented)
187- readonly inputsSnapshot: IInputsSnapshot | undefined ;
297+ get engineShape(): IWorkspaceEngineShape | undefined ;
298+ // (undocumented)
299+ get inputsSnapshot(): IInputsSnapshot | undefined ;
188300 // (undocumented)
189301 readonly invalidations: WorkspaceInvalidationTracker ;
190302 // (undocumented)
191303 readonly metadata: IWorkspaceSessionMetadata ;
192304 // (undocumented)
193305 readonly operationGraph: IOperationGraph | undefined ;
306+ reconcileInvalidationsAsync(): Promise <IWorkspaceInvalidationReconciliation | undefined >;
194307 // (undocumented)
195308 readonly rushConfiguration: RushConfiguration ;
196309 // (undocumented)
0 commit comments