feat: Step Function + hardning

This commit is contained in:
Zakaria
2026-09-27 23:26:00 -04:00
parent ce8400757c
commit 0d613ae256
11 changed files with 672 additions and 1 deletions
+26 -1
View File
@@ -49,7 +49,12 @@ export const apiEndpointKeys = {
deleteEventBridgeRule: "clouds.services.resources.events.rule.delete",
createSqsLambdaEventSourceMapping: "clouds.services.resources.serverless.sqs-event-source-mapping.create",
listSqsLambdaEventSourceMappings: "clouds.services.resources.serverless.sqs-event-source-mappings.list",
deleteSqsLambdaEventSourceMapping: "clouds.services.resources.serverless.sqs-event-source-mapping.delete",
deleteSqsLambdaEventSourceMapping: "clouds.services.resources.serverless.sqs-event-source-mapping.delete",
startWorkflowExecution: "clouds.services.resources.workflows.execution.start",
listWorkflowExecutions: "clouds.services.resources.workflows.executions.list",
describeWorkflowExecution: "clouds.services.resources.workflows.execution.describe",
getWorkflowExecutionHistory: "clouds.services.resources.workflows.execution.history.get",
stopWorkflowExecution: "clouds.services.resources.workflows.execution.stop",
},
storage: {
objects: {
@@ -530,6 +535,26 @@ export const endpointRegistry: EndpointRegistry = new Map([
telemetry: { service: "serverless" },
},
],
[
apiEndpointKeys.clouds.resources.startWorkflowExecution,
{ path: "/clouds/:cloud/services/workflows/resources/:id/executions", method: "POST", telemetry: { service: "workflows" } },
],
[
apiEndpointKeys.clouds.resources.listWorkflowExecutions,
{ path: "/clouds/:cloud/services/workflows/resources/:id/executions", method: "GET", telemetry: { service: "workflows" } },
],
[
apiEndpointKeys.clouds.resources.describeWorkflowExecution,
{ path: "/clouds/:cloud/services/workflows/resources/:id/executions/:executionArn", method: "GET", telemetry: { service: "workflows" } },
],
[
apiEndpointKeys.clouds.resources.getWorkflowExecutionHistory,
{ path: "/clouds/:cloud/services/workflows/resources/:id/executions/:executionArn/history", method: "GET", telemetry: { service: "workflows" } },
],
[
apiEndpointKeys.clouds.resources.stopWorkflowExecution,
{ path: "/clouds/:cloud/services/workflows/resources/:id/executions/:executionArn/stop", method: "POST", telemetry: { service: "workflows" } },
],
[
apiEndpointKeys.clouds.resources.get,
{
@@ -234,6 +234,27 @@ export interface PublishNotificationResult {
messageId: string | null;
}
export interface WorkflowExecutionSummary {
executionArn: string;
name: string;
status: string;
startDate: string;
stopDate?: string;
}
export interface WorkflowExecutionDetail extends WorkflowExecutionSummary {
stateMachineArn: string;
input?: string;
output?: string;
error?: string;
cause?: string;
}
export interface WorkflowExecutionHistoryPage {
events: Array<Record<string, unknown>>;
nextToken?: string;
}
export interface CreateApiGatewayLambdaRouteInput {
path: string;
method: string;
@@ -768,6 +789,53 @@ export async function invokeCloudResource(
return res.data;
}
export async function startWorkflowExecution(
stateMachineArn: string,
input: {input: string; name?: string},
): Promise<{executionArn: string; startDate: string}> {
const res = await apiClient.call<{executionArn: string; startDate: string}, {input: string; name?: string}>(
apiEndpointKeys.clouds.resources.startWorkflowExecution,
requestOptions("aws", "workflows", {body: input}),
{cloud: "aws", id: stateMachineArn},
);
return res.data;
}
export async function listWorkflowExecutions(stateMachineArn: string, signal?: AbortSignal): Promise<WorkflowExecutionSummary[]> {
const res = await apiClient.call<WorkflowExecutionSummary[]>(
apiEndpointKeys.clouds.resources.listWorkflowExecutions,
requestOptions("aws", "workflows", {signal}),
{cloud: "aws", id: stateMachineArn},
);
return res.data;
}
export async function describeWorkflowExecution(stateMachineArn: string, executionArn: string, signal?: AbortSignal): Promise<WorkflowExecutionDetail> {
const res = await apiClient.call<WorkflowExecutionDetail>(
apiEndpointKeys.clouds.resources.describeWorkflowExecution,
requestOptions("aws", "workflows", {signal}),
{cloud: "aws", id: stateMachineArn, executionArn},
);
return res.data;
}
export async function getWorkflowExecutionHistory(stateMachineArn: string, executionArn: string, nextToken?: string, signal?: AbortSignal): Promise<WorkflowExecutionHistoryPage> {
const res = await apiClient.call<WorkflowExecutionHistoryPage>(
apiEndpointKeys.clouds.resources.getWorkflowExecutionHistory,
requestOptions("aws", "workflows", {signal, params: {nextToken}}),
{cloud: "aws", id: stateMachineArn, executionArn},
);
return res.data;
}
export async function stopWorkflowExecution(stateMachineArn: string, executionArn: string): Promise<void> {
await apiClient.call<void>(
apiEndpointKeys.clouds.resources.stopWorkflowExecution,
requestOptions("aws", "workflows"),
{cloud: "aws", id: stateMachineArn, executionArn},
);
}
export async function publishNotification(
cloud: CloudProvider,
topicArn: string,