Skip to content

Commit

Permalink
add call back function support to deceide generator scheduling
Browse files Browse the repository at this point in the history
  • Loading branch information
dwarakaprasad committed Mar 9, 2024
1 parent 6a5bf93 commit 9f3970a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion workspaces/types/types/environment/environment.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import type {
BaseGeneratorMeta,
InstantiateOptions,
ComposeOptions,
SchedulingOptions,
} from './methods-options.js';

export type EnvironmentConstructor<A extends InputOutputAdapter = InputOutputAdapter> = new (
Expand Down Expand Up @@ -149,7 +150,7 @@ export type BaseEnvironment<A = InputOutputAdapter, S extends Store<MemFsEditorF
*/
getVersion(dependency: string): string | undefined;

queueGenerator<G extends BaseGenerator = BaseGenerator>(generator: G, queueOptions?: { schedule?: boolean }): Promise<G>;
queueGenerator<G extends BaseGenerator = BaseGenerator>(generator: G, queueOptions?: SchedulingOptions): Promise<G>;

rootGenerator<G extends BaseGenerator = BaseGenerator>(): G;

Expand Down
7 changes: 6 additions & 1 deletion workspaces/types/types/environment/methods-options.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,9 @@ export type InstantiateOptions<G extends BaseGenerator = BaseGenerator> = {
generatorOptions?: Partial<Omit<GetGeneratorOptions<G>, 'env' | 'resolved' | 'namespace'>> | undefined;
};

export type ComposeOptions<G extends BaseGenerator = BaseGenerator> = InstantiateOptions<G> & { schedule?: boolean };
export type ComposeOptions<G extends BaseGenerator = BaseGenerator> = InstantiateOptions<G> & SchedulingOptions;

export type SchedulingOptions<G extends BaseGenerator = BaseGenerator> = {
/** Schedule can be a simple boolean or a function defined in the generator that returns a boolean */
schedule?: boolean | ((generator: G) => boolean);
};

0 comments on commit 9f3970a

Please sign in to comment.