chore: fixing issues with typescript
Signed-off-by: benjdlambert <ben@blam.sh>
This commit is contained in:
@@ -37,7 +37,7 @@ import { TemplateEntityStepV1beta3 } from '@backstage/plugin-scaffolder-common';
|
||||
import { TemplateFilter } from '@backstage/plugin-scaffolder-node';
|
||||
import { TemplateGlobal } from '@backstage/plugin-scaffolder-node';
|
||||
import { TemplateParametersV1beta3 } from '@backstage/plugin-scaffolder-common';
|
||||
import { UpdateTaskCheckpointOptions } from '@backstage/plugin-scaffolder-node';
|
||||
import { UpdateTaskCheckpointOptions } from '@backstage/plugin-scaffolder-node/alpha';
|
||||
import { UrlReaderService } from '@backstage/backend-plugin-api';
|
||||
import { WorkspaceProvider } from '@backstage/plugin-scaffolder-node/alpha';
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user