chore: fixing issues with typescript

Signed-off-by: benjdlambert <ben@blam.sh>
This commit is contained in:
benjdlambert
2025-06-16 11:41:51 +02:00
parent 04106ae76e
commit 77f713137e
5 changed files with 45 additions and 20 deletions
@@ -27,6 +27,37 @@ export type AutocompleteHandler = ({
}[];
}>;
// @alpha
export type CheckpointContext<T extends JsonValue | void = JsonValue> = {
key: string;
fn: () => Promise<T> | T;
};
// @alpha
export type CheckpointFailedState = {
status: 'failed';
reason: string;
};
// @alpha
export type CheckpointState = {
[key: string]: CheckpointStateValue;
};
// @alpha
export type CheckpointStateValue =
| CheckpointSuccessState
| CheckpointFailedState;
// @alpha
export type CheckpointStatus = 'failed' | 'success';
// @alpha
export type CheckpointSuccessState<T extends JsonValue = JsonValue> = {
status: 'success';
value: T;
};
// @alpha (undocumented)
export type CreatedTemplateFilter<
TFunctionArgs extends [z.ZodTypeAny, ...z.ZodTypeAny[]],
@@ -187,6 +218,11 @@ export type TemplateGlobalFunctionExample = {
notes?: string;
};
// @alpha
export type UpdateTaskCheckpointOptions = {
key: string;
} & CheckpointStateValue;
// @alpha
export interface WorkspaceProvider {
// (undocumented)
+6 -17
View File
@@ -4,6 +4,7 @@
```ts
import { BackstageCredentials } from '@backstage/backend-plugin-api';
import { CheckpointContext } from '@backstage/plugin-scaffolder-node/alpha';
import { Expand } from '@backstage/types';
import { JsonObject } from '@backstage/types';
import { JsonValue } from '@backstage/types';
@@ -15,6 +16,7 @@ import { ScmIntegrations } from '@backstage/integration';
import { SpawnOptionsWithoutStdio } from 'child_process';
import { TaskSpec } from '@backstage/plugin-scaffolder-common';
import { TemplateInfo } from '@backstage/plugin-scaffolder-common';
import { UpdateTaskCheckpointOptions } from '@backstage/plugin-scaffolder-node/alpha';
import { UrlReaderService } from '@backstage/backend-plugin-api';
import { UserEntity } from '@backstage/catalog-model';
import { Writable } from 'stream';
@@ -30,10 +32,9 @@ export type ActionContext<
secrets?: TaskSecrets;
workspacePath: string;
input: TActionInput;
checkpoint<T extends JsonValue | void>(opts: {
key: string;
fn: () => Promise<T> | T;
}): Promise<T>;
checkpoint<T extends JsonValue | void>(
opts: CheckpointContext<T>,
): Promise<T>;
output(
name: keyof TActionOutput,
value: TActionOutput[keyof TActionOutput],
@@ -446,19 +447,7 @@ export interface TaskContext {
// (undocumented)
taskId?: string;
// (undocumented)
updateCheckpoint?(
options:
| {
key: string;
status: 'success';
value: JsonValue;
}
| {
key: string;
status: 'failed';
reason: string;
},
): Promise<void>;
updateCheckpoint?(options: UpdateTaskCheckpointOptions): Promise<void>;
}
// @public
+1 -1
View File
@@ -23,7 +23,7 @@ import {
BackstageCredentials,
LoggerService,
} from '@backstage/backend-plugin-api';
import { CheckpointContext } from '../alpha';
import { CheckpointContext } from '@backstage/plugin-scaffolder-node/alpha';
/**
* ActionContext is passed into scaffolder actions.
+1 -1
View File
@@ -17,7 +17,7 @@
import { BackstageCredentials } from '@backstage/backend-plugin-api';
import { TaskSpec } from '@backstage/plugin-scaffolder-common';
import { JsonObject, Observable } from '@backstage/types';
import { UpdateTaskCheckpointOptions } from '../alpha';
import { UpdateTaskCheckpointOptions } from '@backstage/plugin-scaffolder-node/alpha';
/**
* TaskSecrets