diff --git a/api-contracts/openapi/components/schemas/_index.yaml b/api-contracts/openapi/components/schemas/_index.yaml index 7eec99e65..b6b669910 100644 --- a/api-contracts/openapi/components/schemas/_index.yaml +++ b/api-contracts/openapi/components/schemas/_index.yaml @@ -234,6 +234,10 @@ RerunStepRunRequest: $ref: "./workflow_run.yaml#/RerunStepRunRequest" TriggerWorkflowRunRequest: $ref: "./workflow_run.yaml#/TriggerWorkflowRunRequest" +ScheduleWorkflowRunRequest: + $ref: "./workflow_run.yaml#/ScheduleWorkflowRunRequest" +CreateCronWorkflowTriggerRequest: + $ref: "./workflow_run.yaml#/CreateCronWorkflowTriggerRequest" CreatePullRequestFromStepRun: $ref: "./workflow_run.yaml#/CreatePullRequestFromStepRun" GetStepRunDiffResponse: diff --git a/api-contracts/openapi/components/schemas/workflow_run.yaml b/api-contracts/openapi/components/schemas/workflow_run.yaml index 36c58ee5a..d06e874cf 100644 --- a/api-contracts/openapi/components/schemas/workflow_run.yaml +++ b/api-contracts/openapi/components/schemas/workflow_run.yaml @@ -240,6 +240,8 @@ CronWorkflows: type: string cron: type: string + name: + type: string input: type: object additionalProperties: true @@ -636,6 +638,36 @@ TriggerWorkflowRunRequest: required: - input +CreateCronWorkflowTriggerRequest: + properties: + input: + type: object + additionalMetadata: + type: object + cronName: + type: string + cronExpression: + type: string + required: + - input + - additionalMetadata + - cronName + - cronExpression + +ScheduleWorkflowRunRequest: + properties: + input: + type: object + additionalMetadata: + type: object + triggerAt: + type: string + format: date-time + required: + - input + - additionalMetadata + - triggerAt + CreatePullRequestFromStepRun: properties: branchName: diff --git a/api-contracts/openapi/openapi.yaml b/api-contracts/openapi/openapi.yaml index 8a4392be3..86b156d5f 100644 --- a/api-contracts/openapi/openapi.yaml +++ b/api-contracts/openapi/openapi.yaml @@ -116,12 +116,18 @@ paths: $ref: "./paths/event/event.yaml#/keys" /api/v1/tenants/{tenant}/workflows: $ref: "./paths/workflow/workflow.yaml#/withTenant" + /api/v1/tenants/{tenant}/workflows/{workflow}/scheduled: + $ref: "./paths/workflow/workflow.yaml#/scheduledCreate" /api/v1/tenants/{tenant}/workflows/scheduled: $ref: "./paths/workflow/workflow.yaml#/scheduledList" - /api/v1/tenants/{tenant}/workflows/scheduled/{scheduledId}: + /api/v1/tenants/{tenant}/workflows/scheduled/{scheduled-workflow-run}: $ref: "./paths/workflow/workflow.yaml#/scheduled" + /api/v1/tenants/{tenant}/workflows/{workflow}/crons: + $ref: "./paths/workflow/workflow.yaml#/cronsCreate" /api/v1/tenants/{tenant}/workflows/crons: $ref: "./paths/workflow/workflow.yaml#/cronsList" + /api/v1/tenants/{tenant}/workflows/crons/{cron-workflow}: + $ref: "./paths/workflow/workflow.yaml#/crons" /api/v1/tenants/{tenant}/workflows/cancel: $ref: "./paths/workflow/workflow.yaml#/cancelWorkflowRuns" /api/v1/workflows/{workflow}: diff --git a/api-contracts/openapi/paths/workflow/workflow.yaml b/api-contracts/openapi/paths/workflow/workflow.yaml index c0f9cd64c..dc9d8d89f 100644 --- a/api-contracts/openapi/paths/workflow/workflow.yaml +++ b/api-contracts/openapi/paths/workflow/workflow.yaml @@ -828,6 +828,81 @@ workflowWorkersCount: - Workflow +scheduledCreate: + post: + x-resources: ["tenant", "workflow"] + description: Schedule a new workflow run for a tenant + operationId: scheduled-workflow-run:create + parameters: + - description: The tenant id + in: path + name: tenant + required: true + schema: + type: string + format: uuid + minLength: 36 + maxLength: 36 + - description: The workflow id + in: path + name: workflow + required: true + schema: + type: string + format: uuid + minLength: 36 + maxLength: 36 + - description: The workflow version. If not supplied, the latest version is fetched. + in: query + name: version + required: false + schema: + type: string + format: uuid + minLength: 36 + maxLength: 36 + requestBody: + content: + application/json: + schema: + $ref: "../../components/schemas/_index.yaml#/ScheduleWorkflowRunRequest" + description: The input to the scheduled workflow run + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "../../components/schemas/_index.yaml#/ScheduledWorkflows" + description: Successfully created the scheduled workflow run + "400": + content: + application/json: + schema: + $ref: "../../components/schemas/_index.yaml#/APIErrors" + description: A malformed or bad request + "429": + content: + application/json: + schema: + $ref: "../../components/schemas/_index.yaml#/APIErrors" + description: Resource limit exceeded + "403": + content: + application/json: + schema: + $ref: "../../components/schemas/_index.yaml#/APIErrors" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "../../components/schemas/_index.yaml#/APIErrors" + description: Not found + summary: Trigger workflow run + tags: + - Workflow Run + scheduledList: get: x-resources: ["tenant"] @@ -938,7 +1013,7 @@ scheduledList: scheduled: get: - x-resources: ["tenant"] + x-resources: ["tenant", "scheduled-workflow-run"] description: Get a scheduled workflow run for a tenant operationId: workflow-scheduled:get parameters: @@ -953,7 +1028,7 @@ scheduled: maxLength: 36 - description: The scheduled workflow id in: path - name: scheduledId + name: scheduled-workflow-run required: true schema: type: string @@ -1004,7 +1079,7 @@ scheduled: maxLength: 36 - description: The scheduled workflow id in: path - name: scheduledId + name: scheduled-workflow-run required: true schema: type: string @@ -1030,10 +1105,179 @@ scheduled: tags: - Workflow +crons: + get: + x-resources: ["tenant", "cron-workflow"] + description: Get a cron job workflow run for a tenant + operationId: workflow-cron:get + parameters: + - description: The tenant id + in: path + name: tenant + required: true + schema: + type: string + format: uuid + minLength: 36 + maxLength: 36 + - description: The cron job id + in: path + name: cron-workflow + required: true + schema: + type: string + format: uuid + minLength: 36 + maxLength: 36 + responses: + "200": + content: + application/json: + schema: + $ref: "../../components/schemas/_index.yaml#/CronWorkflows" + description: Successfully retrieved the workflow runs + "400": + content: + application/json: + schema: + $ref: "../../components/schemas/_index.yaml#/APIErrors" + description: A malformed or bad request + "403": + content: + application/json: + schema: + $ref: "../../components/schemas/_index.yaml#/APIErrors" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "../../components/schemas/_index.yaml#/APIErrors" + description: Forbidden + summary: Get cron job workflow run + tags: + - Workflow + delete: + x-resources: ["tenant", "cron-workflow"] + description: Delete a cron job workflow run for a tenant + operationId: workflow-cron:delete + parameters: + - description: The tenant id + in: path + name: tenant + required: true + schema: + type: string + format: uuid + minLength: 36 + maxLength: 36 + - description: The cron job id + in: path + name: cron-workflow + required: true + schema: + type: string + format: uuid + minLength: 36 + maxLength: 36 + responses: + "204": + description: Successfully deleted the cron job workflow run + "400": + content: + application/json: + schema: + $ref: "../../components/schemas/_index.yaml#/APIErrors" + description: A malformed or bad request + "403": + content: + application/json: + schema: + $ref: "../../components/schemas/_index.yaml#/APIError" + description: Forbidden + summary: Delete cron job workflow run + tags: + - Workflow + +cronsCreate: + post: + x-resources: ["tenant", "workflow"] + description: Create a new cron job workflow trigger for a tenant + operationId: cron-workflow-trigger:create + parameters: + - description: The tenant id + in: path + name: tenant + required: true + schema: + type: string + format: uuid + minLength: 36 + maxLength: 36 + - description: The workflow id + in: path + name: workflow + required: true + schema: + type: string + format: uuid + minLength: 36 + maxLength: 36 + - description: The workflow version. If not supplied, the latest version is fetched. + in: query + name: version + required: false + schema: + type: string + format: uuid + minLength: 36 + maxLength: 36 + requestBody: + content: + application/json: + schema: + $ref: "../../components/schemas/_index.yaml#/CreateCronWorkflowTriggerRequest" + description: The input to the cron job workflow trigger + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "../../components/schemas/_index.yaml#/CronWorkflows" + description: Successfully created the cron job workflow trigger + "400": + content: + application/json: + schema: + $ref: "../../components/schemas/_index.yaml#/APIErrors" + description: A malformed or bad request + "429": + content: + application/json: + schema: + $ref: "../../components/schemas/_index.yaml#/APIErrors" + description: Resource limit exceeded + "403": + content: + application/json: + schema: + $ref: "../../components/schemas/_index.yaml#/APIErrors" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "../../components/schemas/_index.yaml#/APIErrors" + description: Not found + summary: Create cron job workflow trigger + tags: + - Workflow Run + cronsList: get: x-resources: ["tenant"] - description: Get all cron job workflow runs for a tenant + description: Get all cron job workflow triggers for a tenant operationId: cron-workflow:list parameters: - description: The tenant id diff --git a/api/v1/server/handlers/workflows/create_cron.go b/api/v1/server/handlers/workflows/create_cron.go new file mode 100644 index 000000000..5d925379b --- /dev/null +++ b/api/v1/server/handlers/workflows/create_cron.go @@ -0,0 +1,33 @@ +package workflows + +import ( + "github.com/labstack/echo/v4" + + "github.com/hatchet-dev/hatchet/api/v1/server/oas/apierrors" + "github.com/hatchet-dev/hatchet/api/v1/server/oas/gen" + "github.com/hatchet-dev/hatchet/api/v1/server/oas/transformers" + "github.com/hatchet-dev/hatchet/pkg/repository" + "github.com/hatchet-dev/hatchet/pkg/repository/prisma/db" +) + +func (t *WorkflowService) CronWorkflowTriggerCreate(ctx echo.Context, request gen.CronWorkflowTriggerCreateRequestObject) (gen.CronWorkflowTriggerCreateResponseObject, error) { + tenant := ctx.Get("tenant").(*db.TenantModel) + + cronTrigger, err := t.config.APIRepository.Workflow().CreateCronWorkflow( + ctx.Request().Context(), tenant.ID, &repository.CreateCronWorkflowTriggerOpts{ + Name: request.Body.CronName, + Cron: request.Body.CronExpression, + Input: request.Body.Input, + AdditionalMetadata: request.Body.AdditionalMetadata, + WorkflowId: request.Workflow.String(), + }, + ) + + if err != nil { + return gen.CronWorkflowTriggerCreate400JSONResponse(apierrors.NewAPIErrors(err.Error())), err + } + + return gen.CronWorkflowTriggerCreate200JSONResponse( + *transformers.ToCronWorkflowsFromSQLC(cronTrigger), + ), nil +} diff --git a/api/v1/server/handlers/workflows/create_scheduled.go b/api/v1/server/handlers/workflows/create_scheduled.go new file mode 100644 index 000000000..fddd154d0 --- /dev/null +++ b/api/v1/server/handlers/workflows/create_scheduled.go @@ -0,0 +1,32 @@ +package workflows + +import ( + "github.com/labstack/echo/v4" + + "github.com/hatchet-dev/hatchet/api/v1/server/oas/apierrors" + "github.com/hatchet-dev/hatchet/api/v1/server/oas/gen" + "github.com/hatchet-dev/hatchet/api/v1/server/oas/transformers" + "github.com/hatchet-dev/hatchet/pkg/repository" + "github.com/hatchet-dev/hatchet/pkg/repository/prisma/db" +) + +func (t *WorkflowService) ScheduledWorkflowRunCreate(ctx echo.Context, request gen.ScheduledWorkflowRunCreateRequestObject) (gen.ScheduledWorkflowRunCreateResponseObject, error) { + tenant := ctx.Get("tenant").(*db.TenantModel) + + scheduled, err := t.config.APIRepository.Workflow().CreateScheduledWorkflow(ctx.Request().Context(), tenant.ID, &repository.CreateScheduledWorkflowRunForWorkflowOpts{ + ScheduledTrigger: request.Body.TriggerAt, + Input: request.Body.Input, + AdditionalMetadata: request.Body.AdditionalMetadata, + WorkflowId: request.Workflow.String(), + }) + + if err != nil { + return gen.ScheduledWorkflowRunCreate400JSONResponse( + apierrors.NewAPIErrors(err.Error()), + ), nil + } + + return gen.ScheduledWorkflowRunCreate200JSONResponse( + *transformers.ToScheduledWorkflowsFromSQLC(scheduled), + ), nil +} diff --git a/api/v1/server/handlers/workflows/delete_cron.go b/api/v1/server/handlers/workflows/delete_cron.go new file mode 100644 index 000000000..d4d07f29d --- /dev/null +++ b/api/v1/server/handlers/workflows/delete_cron.go @@ -0,0 +1,32 @@ +package workflows + +import ( + "context" + "time" + + "github.com/labstack/echo/v4" + + "github.com/hatchet-dev/hatchet/api/v1/server/oas/gen" + "github.com/hatchet-dev/hatchet/pkg/repository/prisma/db" + "github.com/hatchet-dev/hatchet/pkg/repository/prisma/dbsqlc" + "github.com/hatchet-dev/hatchet/pkg/repository/prisma/sqlchelpers" +) + +func (t *WorkflowService) WorkflowCronDelete(ctx echo.Context, request gen.WorkflowCronDeleteRequestObject) (gen.WorkflowCronDeleteResponseObject, error) { + _ = ctx.Get("tenant").(*db.TenantModel) + cron := ctx.Get("cron-workflow").(*dbsqlc.ListCronWorkflowsRow) + + dbCtx, cancel := context.WithTimeout(ctx.Request().Context(), 30*time.Second) + defer cancel() + + err := t.config.APIRepository.Workflow().DeleteCronWorkflow(dbCtx, + sqlchelpers.UUIDToStr(cron.TenantId), + sqlchelpers.UUIDToStr(cron.CronId), + ) + + if err != nil { + return nil, err + } + + return gen.WorkflowCronDelete204Response{}, nil +} diff --git a/api/v1/server/handlers/workflows/delete_scheduled.go b/api/v1/server/handlers/workflows/delete_scheduled.go index 190bce1d6..d30faa33d 100644 --- a/api/v1/server/handlers/workflows/delete_scheduled.go +++ b/api/v1/server/handlers/workflows/delete_scheduled.go @@ -7,19 +7,17 @@ import ( "github.com/labstack/echo/v4" "github.com/hatchet-dev/hatchet/api/v1/server/oas/gen" - "github.com/hatchet-dev/hatchet/pkg/repository/prisma/db" "github.com/hatchet-dev/hatchet/pkg/repository/prisma/dbsqlc" "github.com/hatchet-dev/hatchet/pkg/repository/prisma/sqlchelpers" ) func (t *WorkflowService) WorkflowScheduledDelete(ctx echo.Context, request gen.WorkflowScheduledDeleteRequestObject) (gen.WorkflowScheduledDeleteResponseObject, error) { - _ = ctx.Get("tenant").(*db.TenantModel) scheduled := ctx.Get("scheduled-workflow-run").(*dbsqlc.ListScheduledWorkflowsRow) dbCtx, cancel := context.WithTimeout(ctx.Request().Context(), 30*time.Second) defer cancel() - err := t.config.APIRepository.WorkflowRun().DeleteScheduledWorkflow(dbCtx, sqlchelpers.UUIDToStr(scheduled.TenantId), request.ScheduledId.String()) + err := t.config.APIRepository.WorkflowRun().DeleteScheduledWorkflow(dbCtx, sqlchelpers.UUIDToStr(scheduled.TenantId), request.ScheduledWorkflowRun.String()) if err != nil { return nil, err diff --git a/api/v1/server/handlers/workflows/get_cron.go b/api/v1/server/handlers/workflows/get_cron.go new file mode 100644 index 000000000..121870f71 --- /dev/null +++ b/api/v1/server/handlers/workflows/get_cron.go @@ -0,0 +1,34 @@ +package workflows + +import ( + "context" + "time" + + "github.com/labstack/echo/v4" + + "github.com/hatchet-dev/hatchet/api/v1/server/oas/apierrors" + "github.com/hatchet-dev/hatchet/api/v1/server/oas/gen" + "github.com/hatchet-dev/hatchet/api/v1/server/oas/transformers" + "github.com/hatchet-dev/hatchet/pkg/repository/prisma/db" +) + +func (t *WorkflowService) WorkflowCronGet(ctx echo.Context, request gen.WorkflowCronGetRequestObject) (gen.WorkflowCronGetResponseObject, error) { + tenant := ctx.Get("tenant").(*db.TenantModel) + + dbCtx, cancel := context.WithTimeout(ctx.Request().Context(), 30*time.Second) + defer cancel() + + scheduled, err := t.config.APIRepository.Workflow().GetCronWorkflow(dbCtx, tenant.ID, request.CronWorkflow.String()) + + if err != nil { + return nil, err + } + + if scheduled == nil { + return gen.WorkflowCronGet404JSONResponse(apierrors.NewAPIErrors("Scheduled workflow not found.")), nil + } + + return gen.WorkflowCronGet200JSONResponse( + *transformers.ToCronWorkflowsFromSQLC(scheduled), + ), nil +} diff --git a/api/v1/server/handlers/workflows/get_scheduled.go b/api/v1/server/handlers/workflows/get_scheduled.go index 35eb8901e..6d7f47895 100644 --- a/api/v1/server/handlers/workflows/get_scheduled.go +++ b/api/v1/server/handlers/workflows/get_scheduled.go @@ -1,28 +1,16 @@ package workflows import ( - "context" - "time" - "github.com/labstack/echo/v4" "github.com/hatchet-dev/hatchet/api/v1/server/oas/apierrors" "github.com/hatchet-dev/hatchet/api/v1/server/oas/gen" "github.com/hatchet-dev/hatchet/api/v1/server/oas/transformers" - "github.com/hatchet-dev/hatchet/pkg/repository/prisma/db" + "github.com/hatchet-dev/hatchet/pkg/repository/prisma/dbsqlc" ) func (t *WorkflowService) WorkflowScheduledGet(ctx echo.Context, request gen.WorkflowScheduledGetRequestObject) (gen.WorkflowScheduledGetResponseObject, error) { - tenant := ctx.Get("tenant").(*db.TenantModel) - - dbCtx, cancel := context.WithTimeout(ctx.Request().Context(), 30*time.Second) - defer cancel() - - scheduled, err := t.config.APIRepository.WorkflowRun().GetScheduledWorkflow(dbCtx, tenant.ID, request.ScheduledId.String()) - - if err != nil { - return nil, err - } + scheduled := ctx.Get("scheduled").(*dbsqlc.ListScheduledWorkflowsRow) if scheduled == nil { return gen.WorkflowScheduledGet404JSONResponse(apierrors.NewAPIErrors("Scheduled workflow not found.")), nil diff --git a/api/v1/server/handlers/workflows/list_crons.go b/api/v1/server/handlers/workflows/list_crons.go index 24d6eab92..ff6617310 100644 --- a/api/v1/server/handlers/workflows/list_crons.go +++ b/api/v1/server/handlers/workflows/list_crons.go @@ -76,7 +76,7 @@ func (t *WorkflowService) CronWorkflowList(ctx echo.Context, request gen.CronWor dbCtx, cancel := context.WithTimeout(ctx.Request().Context(), 30*time.Second) defer cancel() - scheduled, count, err := t.config.APIRepository.WorkflowRun().ListCronWorkflows(dbCtx, tenant.ID, listOpts) + scheduled, count, err := t.config.APIRepository.Workflow().ListCronWorkflows(dbCtx, tenant.ID, listOpts) if err != nil { return nil, err diff --git a/api/v1/server/oas/gen/openapi.gen.go b/api/v1/server/oas/gen/openapi.gen.go index 8b12b50ad..7ca71134b 100644 --- a/api/v1/server/oas/gen/openapi.gen.go +++ b/api/v1/server/oas/gen/openapi.gen.go @@ -339,6 +339,14 @@ type CreateAPITokenResponse struct { Token string `json:"token"` } +// CreateCronWorkflowTriggerRequest defines model for CreateCronWorkflowTriggerRequest. +type CreateCronWorkflowTriggerRequest struct { + AdditionalMetadata map[string]interface{} `json:"additionalMetadata"` + CronExpression string `json:"cronExpression"` + CronName string `json:"cronName"` + Input map[string]interface{} `json:"input"` +} + // CreateEventRequest defines model for CreateEventRequest. type CreateEventRequest struct { // AdditionalMetadata Additional metadata for the event. @@ -385,6 +393,7 @@ type CronWorkflows struct { Cron string `json:"cron"` Input *map[string]interface{} `json:"input,omitempty"` Metadata APIResourceMeta `json:"metadata"` + Name *string `json:"name,omitempty"` TenantId string `json:"tenantId"` WorkflowId string `json:"workflowId"` WorkflowName string `json:"workflowName"` @@ -661,6 +670,13 @@ type SNSIntegration struct { TopicArn string `json:"topicArn"` } +// ScheduleWorkflowRunRequest defines model for ScheduleWorkflowRunRequest. +type ScheduleWorkflowRunRequest struct { + AdditionalMetadata map[string]interface{} `json:"additionalMetadata"` + Input map[string]interface{} `json:"input"` + TriggerAt time.Time `json:"triggerAt"` +} + // ScheduledRunStatus defines model for ScheduledRunStatus. type ScheduledRunStatus string @@ -1663,6 +1679,18 @@ type WorkflowScheduledListParams struct { Statuses *[]ScheduledRunStatus `form:"statuses,omitempty" json:"statuses,omitempty"` } +// CronWorkflowTriggerCreateParams defines parameters for CronWorkflowTriggerCreate. +type CronWorkflowTriggerCreateParams struct { + // Version The workflow version. If not supplied, the latest version is fetched. + Version *openapi_types.UUID `form:"version,omitempty" json:"version,omitempty"` +} + +// ScheduledWorkflowRunCreateParams defines parameters for ScheduledWorkflowRunCreate. +type ScheduledWorkflowRunCreateParams struct { + // Version The workflow version. If not supplied, the latest version is fetched. + Version *openapi_types.UUID `form:"version,omitempty" json:"version,omitempty"` +} + // WorkflowGetMetricsParams defines parameters for WorkflowGetMetrics. type WorkflowGetMetricsParams struct { // Status A status of workflow run statuses to filter by @@ -1732,6 +1760,12 @@ type WorkflowRunUpdateReplayJSONRequestBody = ReplayWorkflowRunsRequest // WorkflowRunCancelJSONRequestBody defines body for WorkflowRunCancel for application/json ContentType. type WorkflowRunCancelJSONRequestBody = WorkflowRunsCancelRequest +// CronWorkflowTriggerCreateJSONRequestBody defines body for CronWorkflowTriggerCreate for application/json ContentType. +type CronWorkflowTriggerCreateJSONRequestBody = CreateCronWorkflowTriggerRequest + +// ScheduledWorkflowRunCreateJSONRequestBody defines body for ScheduledWorkflowRunCreate for application/json ContentType. +type ScheduledWorkflowRunCreateJSONRequestBody = ScheduleWorkflowRunRequest + // TenantInviteAcceptJSONRequestBody defines body for TenantInviteAccept for application/json ContentType. type TenantInviteAcceptJSONRequestBody = AcceptInviteRequest @@ -1932,6 +1966,12 @@ type ServerInterface interface { // Get cron job workflows // (GET /api/v1/tenants/{tenant}/workflows/crons) CronWorkflowList(ctx echo.Context, tenant openapi_types.UUID, params CronWorkflowListParams) error + // Delete cron job workflow run + // (DELETE /api/v1/tenants/{tenant}/workflows/crons/{cron-workflow}) + WorkflowCronDelete(ctx echo.Context, tenant openapi_types.UUID, cronWorkflow openapi_types.UUID) error + // Get cron job workflow run + // (GET /api/v1/tenants/{tenant}/workflows/crons/{cron-workflow}) + WorkflowCronGet(ctx echo.Context, tenant openapi_types.UUID, cronWorkflow openapi_types.UUID) error // Get workflow runs // (GET /api/v1/tenants/{tenant}/workflows/runs) WorkflowRunList(ctx echo.Context, tenant openapi_types.UUID, params WorkflowRunListParams) error @@ -1942,11 +1982,17 @@ type ServerInterface interface { // (GET /api/v1/tenants/{tenant}/workflows/scheduled) WorkflowScheduledList(ctx echo.Context, tenant openapi_types.UUID, params WorkflowScheduledListParams) error // Delete scheduled workflow run - // (DELETE /api/v1/tenants/{tenant}/workflows/scheduled/{scheduledId}) - WorkflowScheduledDelete(ctx echo.Context, tenant openapi_types.UUID, scheduledId openapi_types.UUID) error + // (DELETE /api/v1/tenants/{tenant}/workflows/scheduled/{scheduled-workflow-run}) + WorkflowScheduledDelete(ctx echo.Context, tenant openapi_types.UUID, scheduledWorkflowRun openapi_types.UUID) error // Get scheduled workflow run - // (GET /api/v1/tenants/{tenant}/workflows/scheduled/{scheduledId}) - WorkflowScheduledGet(ctx echo.Context, tenant openapi_types.UUID, scheduledId openapi_types.UUID) error + // (GET /api/v1/tenants/{tenant}/workflows/scheduled/{scheduled-workflow-run}) + WorkflowScheduledGet(ctx echo.Context, tenant openapi_types.UUID, scheduledWorkflowRun openapi_types.UUID) error + // Create cron job workflow trigger + // (POST /api/v1/tenants/{tenant}/workflows/{workflow}/crons) + CronWorkflowTriggerCreate(ctx echo.Context, tenant openapi_types.UUID, workflow openapi_types.UUID, params CronWorkflowTriggerCreateParams) error + // Trigger workflow run + // (POST /api/v1/tenants/{tenant}/workflows/{workflow}/scheduled) + ScheduledWorkflowRunCreate(ctx echo.Context, tenant openapi_types.UUID, workflow openapi_types.UUID, params ScheduledWorkflowRunCreateParams) error // Get workflow worker count // (GET /api/v1/tenants/{tenant}/workflows/{workflow}/worker-count) WorkflowGetWorkersCount(ctx echo.Context, tenant openapi_types.UUID, workflow openapi_types.UUID) error @@ -3475,6 +3521,62 @@ func (w *ServerInterfaceWrapper) CronWorkflowList(ctx echo.Context) error { return err } +// WorkflowCronDelete converts echo context to params. +func (w *ServerInterfaceWrapper) WorkflowCronDelete(ctx echo.Context) error { + var err error + // ------------- Path parameter "tenant" ------------- + var tenant openapi_types.UUID + + err = runtime.BindStyledParameterWithLocation("simple", false, "tenant", runtime.ParamLocationPath, ctx.Param("tenant"), &tenant) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter tenant: %s", err)) + } + + // ------------- Path parameter "cron-workflow" ------------- + var cronWorkflow openapi_types.UUID + + err = runtime.BindStyledParameterWithLocation("simple", false, "cron-workflow", runtime.ParamLocationPath, ctx.Param("cron-workflow"), &cronWorkflow) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter cron-workflow: %s", err)) + } + + ctx.Set(BearerAuthScopes, []string{}) + + ctx.Set(CookieAuthScopes, []string{}) + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.WorkflowCronDelete(ctx, tenant, cronWorkflow) + return err +} + +// WorkflowCronGet converts echo context to params. +func (w *ServerInterfaceWrapper) WorkflowCronGet(ctx echo.Context) error { + var err error + // ------------- Path parameter "tenant" ------------- + var tenant openapi_types.UUID + + err = runtime.BindStyledParameterWithLocation("simple", false, "tenant", runtime.ParamLocationPath, ctx.Param("tenant"), &tenant) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter tenant: %s", err)) + } + + // ------------- Path parameter "cron-workflow" ------------- + var cronWorkflow openapi_types.UUID + + err = runtime.BindStyledParameterWithLocation("simple", false, "cron-workflow", runtime.ParamLocationPath, ctx.Param("cron-workflow"), &cronWorkflow) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter cron-workflow: %s", err)) + } + + ctx.Set(BearerAuthScopes, []string{}) + + ctx.Set(CookieAuthScopes, []string{}) + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.WorkflowCronGet(ctx, tenant, cronWorkflow) + return err +} + // WorkflowRunList converts echo context to params. func (w *ServerInterfaceWrapper) WorkflowRunList(ctx echo.Context) error { var err error @@ -3769,12 +3871,12 @@ func (w *ServerInterfaceWrapper) WorkflowScheduledDelete(ctx echo.Context) error return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter tenant: %s", err)) } - // ------------- Path parameter "scheduledId" ------------- - var scheduledId openapi_types.UUID + // ------------- Path parameter "scheduled-workflow-run" ------------- + var scheduledWorkflowRun openapi_types.UUID - err = runtime.BindStyledParameterWithLocation("simple", false, "scheduledId", runtime.ParamLocationPath, ctx.Param("scheduledId"), &scheduledId) + err = runtime.BindStyledParameterWithLocation("simple", false, "scheduled-workflow-run", runtime.ParamLocationPath, ctx.Param("scheduled-workflow-run"), &scheduledWorkflowRun) if err != nil { - return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter scheduledId: %s", err)) + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter scheduled-workflow-run: %s", err)) } ctx.Set(BearerAuthScopes, []string{}) @@ -3782,7 +3884,7 @@ func (w *ServerInterfaceWrapper) WorkflowScheduledDelete(ctx echo.Context) error ctx.Set(CookieAuthScopes, []string{}) // Invoke the callback with all the unmarshaled arguments - err = w.Handler.WorkflowScheduledDelete(ctx, tenant, scheduledId) + err = w.Handler.WorkflowScheduledDelete(ctx, tenant, scheduledWorkflowRun) return err } @@ -3797,20 +3899,94 @@ func (w *ServerInterfaceWrapper) WorkflowScheduledGet(ctx echo.Context) error { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter tenant: %s", err)) } - // ------------- Path parameter "scheduledId" ------------- - var scheduledId openapi_types.UUID + // ------------- Path parameter "scheduled-workflow-run" ------------- + var scheduledWorkflowRun openapi_types.UUID + + err = runtime.BindStyledParameterWithLocation("simple", false, "scheduled-workflow-run", runtime.ParamLocationPath, ctx.Param("scheduled-workflow-run"), &scheduledWorkflowRun) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter scheduled-workflow-run: %s", err)) + } + + ctx.Set(BearerAuthScopes, []string{}) + + ctx.Set(CookieAuthScopes, []string{}) + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.WorkflowScheduledGet(ctx, tenant, scheduledWorkflowRun) + return err +} + +// CronWorkflowTriggerCreate converts echo context to params. +func (w *ServerInterfaceWrapper) CronWorkflowTriggerCreate(ctx echo.Context) error { + var err error + // ------------- Path parameter "tenant" ------------- + var tenant openapi_types.UUID + + err = runtime.BindStyledParameterWithLocation("simple", false, "tenant", runtime.ParamLocationPath, ctx.Param("tenant"), &tenant) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter tenant: %s", err)) + } + + // ------------- Path parameter "workflow" ------------- + var workflow openapi_types.UUID + + err = runtime.BindStyledParameterWithLocation("simple", false, "workflow", runtime.ParamLocationPath, ctx.Param("workflow"), &workflow) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter workflow: %s", err)) + } + + ctx.Set(BearerAuthScopes, []string{}) + + ctx.Set(CookieAuthScopes, []string{}) + + // Parameter object where we will unmarshal all parameters from the context + var params CronWorkflowTriggerCreateParams + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameter("form", true, false, "version", ctx.QueryParams(), ¶ms.Version) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter version: %s", err)) + } + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.CronWorkflowTriggerCreate(ctx, tenant, workflow, params) + return err +} + +// ScheduledWorkflowRunCreate converts echo context to params. +func (w *ServerInterfaceWrapper) ScheduledWorkflowRunCreate(ctx echo.Context) error { + var err error + // ------------- Path parameter "tenant" ------------- + var tenant openapi_types.UUID + + err = runtime.BindStyledParameterWithLocation("simple", false, "tenant", runtime.ParamLocationPath, ctx.Param("tenant"), &tenant) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter tenant: %s", err)) + } + + // ------------- Path parameter "workflow" ------------- + var workflow openapi_types.UUID - err = runtime.BindStyledParameterWithLocation("simple", false, "scheduledId", runtime.ParamLocationPath, ctx.Param("scheduledId"), &scheduledId) + err = runtime.BindStyledParameterWithLocation("simple", false, "workflow", runtime.ParamLocationPath, ctx.Param("workflow"), &workflow) if err != nil { - return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter scheduledId: %s", err)) + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter workflow: %s", err)) } ctx.Set(BearerAuthScopes, []string{}) ctx.Set(CookieAuthScopes, []string{}) + // Parameter object where we will unmarshal all parameters from the context + var params ScheduledWorkflowRunCreateParams + // ------------- Optional query parameter "version" ------------- + + err = runtime.BindQueryParameter("form", true, false, "version", ctx.QueryParams(), ¶ms.Version) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter version: %s", err)) + } + // Invoke the callback with all the unmarshaled arguments - err = w.Handler.WorkflowScheduledGet(ctx, tenant, scheduledId) + err = w.Handler.ScheduledWorkflowRunCreate(ctx, tenant, workflow, params) return err } @@ -4308,11 +4484,15 @@ func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL router.GET(baseURL+"/api/v1/tenants/:tenant/workflows", wrapper.WorkflowList) router.POST(baseURL+"/api/v1/tenants/:tenant/workflows/cancel", wrapper.WorkflowRunCancel) router.GET(baseURL+"/api/v1/tenants/:tenant/workflows/crons", wrapper.CronWorkflowList) + router.DELETE(baseURL+"/api/v1/tenants/:tenant/workflows/crons/:cron-workflow", wrapper.WorkflowCronDelete) + router.GET(baseURL+"/api/v1/tenants/:tenant/workflows/crons/:cron-workflow", wrapper.WorkflowCronGet) router.GET(baseURL+"/api/v1/tenants/:tenant/workflows/runs", wrapper.WorkflowRunList) router.GET(baseURL+"/api/v1/tenants/:tenant/workflows/runs/metrics", wrapper.WorkflowRunGetMetrics) router.GET(baseURL+"/api/v1/tenants/:tenant/workflows/scheduled", wrapper.WorkflowScheduledList) - router.DELETE(baseURL+"/api/v1/tenants/:tenant/workflows/scheduled/:scheduledId", wrapper.WorkflowScheduledDelete) - router.GET(baseURL+"/api/v1/tenants/:tenant/workflows/scheduled/:scheduledId", wrapper.WorkflowScheduledGet) + router.DELETE(baseURL+"/api/v1/tenants/:tenant/workflows/scheduled/:scheduled-workflow-run", wrapper.WorkflowScheduledDelete) + router.GET(baseURL+"/api/v1/tenants/:tenant/workflows/scheduled/:scheduled-workflow-run", wrapper.WorkflowScheduledGet) + router.POST(baseURL+"/api/v1/tenants/:tenant/workflows/:workflow/crons", wrapper.CronWorkflowTriggerCreate) + router.POST(baseURL+"/api/v1/tenants/:tenant/workflows/:workflow/scheduled", wrapper.ScheduledWorkflowRunCreate) router.GET(baseURL+"/api/v1/tenants/:tenant/workflows/:workflow/worker-count", wrapper.WorkflowGetWorkersCount) router.GET(baseURL+"/api/v1/users/current", wrapper.UserGetCurrent) router.GET(baseURL+"/api/v1/users/github/callback", wrapper.UserUpdateGithubOauthCallback) @@ -6518,6 +6698,86 @@ func (response CronWorkflowList403JSONResponse) VisitCronWorkflowListResponse(w return json.NewEncoder(w).Encode(response) } +type WorkflowCronDeleteRequestObject struct { + Tenant openapi_types.UUID `json:"tenant"` + CronWorkflow openapi_types.UUID `json:"cron-workflow"` +} + +type WorkflowCronDeleteResponseObject interface { + VisitWorkflowCronDeleteResponse(w http.ResponseWriter) error +} + +type WorkflowCronDelete204Response struct { +} + +func (response WorkflowCronDelete204Response) VisitWorkflowCronDeleteResponse(w http.ResponseWriter) error { + w.WriteHeader(204) + return nil +} + +type WorkflowCronDelete400JSONResponse APIErrors + +func (response WorkflowCronDelete400JSONResponse) VisitWorkflowCronDeleteResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(400) + + return json.NewEncoder(w).Encode(response) +} + +type WorkflowCronDelete403JSONResponse APIError + +func (response WorkflowCronDelete403JSONResponse) VisitWorkflowCronDeleteResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(403) + + return json.NewEncoder(w).Encode(response) +} + +type WorkflowCronGetRequestObject struct { + Tenant openapi_types.UUID `json:"tenant"` + CronWorkflow openapi_types.UUID `json:"cron-workflow"` +} + +type WorkflowCronGetResponseObject interface { + VisitWorkflowCronGetResponse(w http.ResponseWriter) error +} + +type WorkflowCronGet200JSONResponse CronWorkflows + +func (response WorkflowCronGet200JSONResponse) VisitWorkflowCronGetResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(200) + + return json.NewEncoder(w).Encode(response) +} + +type WorkflowCronGet400JSONResponse APIErrors + +func (response WorkflowCronGet400JSONResponse) VisitWorkflowCronGetResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(400) + + return json.NewEncoder(w).Encode(response) +} + +type WorkflowCronGet403JSONResponse APIErrors + +func (response WorkflowCronGet403JSONResponse) VisitWorkflowCronGetResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(403) + + return json.NewEncoder(w).Encode(response) +} + +type WorkflowCronGet404JSONResponse APIErrors + +func (response WorkflowCronGet404JSONResponse) VisitWorkflowCronGetResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(404) + + return json.NewEncoder(w).Encode(response) +} + type WorkflowRunListRequestObject struct { Tenant openapi_types.UUID `json:"tenant"` Params WorkflowRunListParams @@ -6627,8 +6887,8 @@ func (response WorkflowScheduledList403JSONResponse) VisitWorkflowScheduledListR } type WorkflowScheduledDeleteRequestObject struct { - Tenant openapi_types.UUID `json:"tenant"` - ScheduledId openapi_types.UUID `json:"scheduledId"` + Tenant openapi_types.UUID `json:"tenant"` + ScheduledWorkflowRun openapi_types.UUID `json:"scheduled-workflow-run"` } type WorkflowScheduledDeleteResponseObject interface { @@ -6662,8 +6922,8 @@ func (response WorkflowScheduledDelete403JSONResponse) VisitWorkflowScheduledDel } type WorkflowScheduledGetRequestObject struct { - Tenant openapi_types.UUID `json:"tenant"` - ScheduledId openapi_types.UUID `json:"scheduledId"` + Tenant openapi_types.UUID `json:"tenant"` + ScheduledWorkflowRun openapi_types.UUID `json:"scheduled-workflow-run"` } type WorkflowScheduledGetResponseObject interface { @@ -6706,6 +6966,118 @@ func (response WorkflowScheduledGet404JSONResponse) VisitWorkflowScheduledGetRes return json.NewEncoder(w).Encode(response) } +type CronWorkflowTriggerCreateRequestObject struct { + Tenant openapi_types.UUID `json:"tenant"` + Workflow openapi_types.UUID `json:"workflow"` + Params CronWorkflowTriggerCreateParams + Body *CronWorkflowTriggerCreateJSONRequestBody +} + +type CronWorkflowTriggerCreateResponseObject interface { + VisitCronWorkflowTriggerCreateResponse(w http.ResponseWriter) error +} + +type CronWorkflowTriggerCreate200JSONResponse CronWorkflows + +func (response CronWorkflowTriggerCreate200JSONResponse) VisitCronWorkflowTriggerCreateResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(200) + + return json.NewEncoder(w).Encode(response) +} + +type CronWorkflowTriggerCreate400JSONResponse APIErrors + +func (response CronWorkflowTriggerCreate400JSONResponse) VisitCronWorkflowTriggerCreateResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(400) + + return json.NewEncoder(w).Encode(response) +} + +type CronWorkflowTriggerCreate403JSONResponse APIErrors + +func (response CronWorkflowTriggerCreate403JSONResponse) VisitCronWorkflowTriggerCreateResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(403) + + return json.NewEncoder(w).Encode(response) +} + +type CronWorkflowTriggerCreate404JSONResponse APIErrors + +func (response CronWorkflowTriggerCreate404JSONResponse) VisitCronWorkflowTriggerCreateResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(404) + + return json.NewEncoder(w).Encode(response) +} + +type CronWorkflowTriggerCreate429JSONResponse APIErrors + +func (response CronWorkflowTriggerCreate429JSONResponse) VisitCronWorkflowTriggerCreateResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(429) + + return json.NewEncoder(w).Encode(response) +} + +type ScheduledWorkflowRunCreateRequestObject struct { + Tenant openapi_types.UUID `json:"tenant"` + Workflow openapi_types.UUID `json:"workflow"` + Params ScheduledWorkflowRunCreateParams + Body *ScheduledWorkflowRunCreateJSONRequestBody +} + +type ScheduledWorkflowRunCreateResponseObject interface { + VisitScheduledWorkflowRunCreateResponse(w http.ResponseWriter) error +} + +type ScheduledWorkflowRunCreate200JSONResponse ScheduledWorkflows + +func (response ScheduledWorkflowRunCreate200JSONResponse) VisitScheduledWorkflowRunCreateResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(200) + + return json.NewEncoder(w).Encode(response) +} + +type ScheduledWorkflowRunCreate400JSONResponse APIErrors + +func (response ScheduledWorkflowRunCreate400JSONResponse) VisitScheduledWorkflowRunCreateResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(400) + + return json.NewEncoder(w).Encode(response) +} + +type ScheduledWorkflowRunCreate403JSONResponse APIErrors + +func (response ScheduledWorkflowRunCreate403JSONResponse) VisitScheduledWorkflowRunCreateResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(403) + + return json.NewEncoder(w).Encode(response) +} + +type ScheduledWorkflowRunCreate404JSONResponse APIErrors + +func (response ScheduledWorkflowRunCreate404JSONResponse) VisitScheduledWorkflowRunCreateResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(404) + + return json.NewEncoder(w).Encode(response) +} + +type ScheduledWorkflowRunCreate429JSONResponse APIErrors + +func (response ScheduledWorkflowRunCreate429JSONResponse) VisitScheduledWorkflowRunCreateResponse(w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(429) + + return json.NewEncoder(w).Encode(response) +} + type WorkflowGetWorkersCountRequestObject struct { Tenant openapi_types.UUID `json:"tenant"` Workflow openapi_types.UUID `json:"workflow"` @@ -7744,6 +8116,10 @@ type StrictServerInterface interface { CronWorkflowList(ctx echo.Context, request CronWorkflowListRequestObject) (CronWorkflowListResponseObject, error) + WorkflowCronDelete(ctx echo.Context, request WorkflowCronDeleteRequestObject) (WorkflowCronDeleteResponseObject, error) + + WorkflowCronGet(ctx echo.Context, request WorkflowCronGetRequestObject) (WorkflowCronGetResponseObject, error) + WorkflowRunList(ctx echo.Context, request WorkflowRunListRequestObject) (WorkflowRunListResponseObject, error) WorkflowRunGetMetrics(ctx echo.Context, request WorkflowRunGetMetricsRequestObject) (WorkflowRunGetMetricsResponseObject, error) @@ -7754,6 +8130,10 @@ type StrictServerInterface interface { WorkflowScheduledGet(ctx echo.Context, request WorkflowScheduledGetRequestObject) (WorkflowScheduledGetResponseObject, error) + CronWorkflowTriggerCreate(ctx echo.Context, request CronWorkflowTriggerCreateRequestObject) (CronWorkflowTriggerCreateResponseObject, error) + + ScheduledWorkflowRunCreate(ctx echo.Context, request ScheduledWorkflowRunCreateRequestObject) (ScheduledWorkflowRunCreateResponseObject, error) + WorkflowGetWorkersCount(ctx echo.Context, request WorkflowGetWorkersCountRequestObject) (WorkflowGetWorkersCountResponseObject, error) UserGetCurrent(ctx echo.Context, request UserGetCurrentRequestObject) (UserGetCurrentResponseObject, error) @@ -9370,6 +9750,58 @@ func (sh *strictHandler) CronWorkflowList(ctx echo.Context, tenant openapi_types return nil } +// WorkflowCronDelete operation middleware +func (sh *strictHandler) WorkflowCronDelete(ctx echo.Context, tenant openapi_types.UUID, cronWorkflow openapi_types.UUID) error { + var request WorkflowCronDeleteRequestObject + + request.Tenant = tenant + request.CronWorkflow = cronWorkflow + + handler := func(ctx echo.Context, request interface{}) (interface{}, error) { + return sh.ssi.WorkflowCronDelete(ctx, request.(WorkflowCronDeleteRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "WorkflowCronDelete") + } + + response, err := handler(ctx, request) + + if err != nil { + return err + } else if validResponse, ok := response.(WorkflowCronDeleteResponseObject); ok { + return validResponse.VisitWorkflowCronDeleteResponse(ctx.Response()) + } else if response != nil { + return fmt.Errorf("Unexpected response type: %T", response) + } + return nil +} + +// WorkflowCronGet operation middleware +func (sh *strictHandler) WorkflowCronGet(ctx echo.Context, tenant openapi_types.UUID, cronWorkflow openapi_types.UUID) error { + var request WorkflowCronGetRequestObject + + request.Tenant = tenant + request.CronWorkflow = cronWorkflow + + handler := func(ctx echo.Context, request interface{}) (interface{}, error) { + return sh.ssi.WorkflowCronGet(ctx, request.(WorkflowCronGetRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "WorkflowCronGet") + } + + response, err := handler(ctx, request) + + if err != nil { + return err + } else if validResponse, ok := response.(WorkflowCronGetResponseObject); ok { + return validResponse.VisitWorkflowCronGetResponse(ctx.Response()) + } else if response != nil { + return fmt.Errorf("Unexpected response type: %T", response) + } + return nil +} + // WorkflowRunList operation middleware func (sh *strictHandler) WorkflowRunList(ctx echo.Context, tenant openapi_types.UUID, params WorkflowRunListParams) error { var request WorkflowRunListRequestObject @@ -9449,11 +9881,11 @@ func (sh *strictHandler) WorkflowScheduledList(ctx echo.Context, tenant openapi_ } // WorkflowScheduledDelete operation middleware -func (sh *strictHandler) WorkflowScheduledDelete(ctx echo.Context, tenant openapi_types.UUID, scheduledId openapi_types.UUID) error { +func (sh *strictHandler) WorkflowScheduledDelete(ctx echo.Context, tenant openapi_types.UUID, scheduledWorkflowRun openapi_types.UUID) error { var request WorkflowScheduledDeleteRequestObject request.Tenant = tenant - request.ScheduledId = scheduledId + request.ScheduledWorkflowRun = scheduledWorkflowRun handler := func(ctx echo.Context, request interface{}) (interface{}, error) { return sh.ssi.WorkflowScheduledDelete(ctx, request.(WorkflowScheduledDeleteRequestObject)) @@ -9475,11 +9907,11 @@ func (sh *strictHandler) WorkflowScheduledDelete(ctx echo.Context, tenant openap } // WorkflowScheduledGet operation middleware -func (sh *strictHandler) WorkflowScheduledGet(ctx echo.Context, tenant openapi_types.UUID, scheduledId openapi_types.UUID) error { +func (sh *strictHandler) WorkflowScheduledGet(ctx echo.Context, tenant openapi_types.UUID, scheduledWorkflowRun openapi_types.UUID) error { var request WorkflowScheduledGetRequestObject request.Tenant = tenant - request.ScheduledId = scheduledId + request.ScheduledWorkflowRun = scheduledWorkflowRun handler := func(ctx echo.Context, request interface{}) (interface{}, error) { return sh.ssi.WorkflowScheduledGet(ctx, request.(WorkflowScheduledGetRequestObject)) @@ -9500,6 +9932,72 @@ func (sh *strictHandler) WorkflowScheduledGet(ctx echo.Context, tenant openapi_t return nil } +// CronWorkflowTriggerCreate operation middleware +func (sh *strictHandler) CronWorkflowTriggerCreate(ctx echo.Context, tenant openapi_types.UUID, workflow openapi_types.UUID, params CronWorkflowTriggerCreateParams) error { + var request CronWorkflowTriggerCreateRequestObject + + request.Tenant = tenant + request.Workflow = workflow + request.Params = params + + var body CronWorkflowTriggerCreateJSONRequestBody + if err := ctx.Bind(&body); err != nil { + return err + } + request.Body = &body + + handler := func(ctx echo.Context, request interface{}) (interface{}, error) { + return sh.ssi.CronWorkflowTriggerCreate(ctx, request.(CronWorkflowTriggerCreateRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "CronWorkflowTriggerCreate") + } + + response, err := handler(ctx, request) + + if err != nil { + return err + } else if validResponse, ok := response.(CronWorkflowTriggerCreateResponseObject); ok { + return validResponse.VisitCronWorkflowTriggerCreateResponse(ctx.Response()) + } else if response != nil { + return fmt.Errorf("Unexpected response type: %T", response) + } + return nil +} + +// ScheduledWorkflowRunCreate operation middleware +func (sh *strictHandler) ScheduledWorkflowRunCreate(ctx echo.Context, tenant openapi_types.UUID, workflow openapi_types.UUID, params ScheduledWorkflowRunCreateParams) error { + var request ScheduledWorkflowRunCreateRequestObject + + request.Tenant = tenant + request.Workflow = workflow + request.Params = params + + var body ScheduledWorkflowRunCreateJSONRequestBody + if err := ctx.Bind(&body); err != nil { + return err + } + request.Body = &body + + handler := func(ctx echo.Context, request interface{}) (interface{}, error) { + return sh.ssi.ScheduledWorkflowRunCreate(ctx, request.(ScheduledWorkflowRunCreateRequestObject)) + } + for _, middleware := range sh.middlewares { + handler = middleware(handler, "ScheduledWorkflowRunCreate") + } + + response, err := handler(ctx, request) + + if err != nil { + return err + } else if validResponse, ok := response.(ScheduledWorkflowRunCreateResponseObject); ok { + return validResponse.VisitScheduledWorkflowRunCreateResponse(ctx.Response()) + } else if response != nil { + return fmt.Errorf("Unexpected response type: %T", response) + } + return nil +} + // WorkflowGetWorkersCount operation middleware func (sh *strictHandler) WorkflowGetWorkersCount(ctx echo.Context, tenant openapi_types.UUID, workflow openapi_types.UUID) error { var request WorkflowGetWorkersCountRequestObject @@ -10152,194 +10650,199 @@ func (sh *strictHandler) WorkflowVersionGet(ctx echo.Context, workflow openapi_t // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "H4sIAAAAAAAC/+x9+2/bOtLovyLoXuDuAs6z7fnOFvh+cBO39TZNsnZygv0WRUBLtM0TWdIRqTy+Iv/7", - "BV8SZZES5VeURsBiT2rxMRzODIfDefx0vWgRRyEMCXY//nSxN4cLwP7sXw4HSRIl9O84iWKYEATZFy/y", - "If2vD7GXoJigKHQ/usDxUkyihfMVEG8OiQNpb4c17rnwESziALofj94fHvbcaZQsAHE/uikKyW/v3Z5L", - "nmLofnRRSOAMJu5zrzh8eTbl3840ShwyR5jPqU7n9vOG91DAtIAYgxnMZ8UkQeGMTRp5+DZA4Z1uSvq7", - "QyKHzKHjR166gCEBGgB6Dpo6iDjwEWGCC+DMEJmnk30vWhzMOZ72fHgv/9ZBNEUw8MvQUBjYJ4fMAVEm", - "dxB2AMaRhwCBvvOAyJzBA+I4QB6YBIXtcEOw0CDiuecm8K8UJdB3P/6nMPWPrHE0+RN6hMIoaQWXiQVm", - "vyMCF+yP/5vAqfvR/T8HOe0dCMI7yKjuOZ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bdX0uHuuUamzvyUE0i1JSwwxRSuy4IUpf3tYjaDRqWZ7QjkhrlFFG", - "PbZku4CLCUzwHMUNrkBKJ7trED9CvufdhDfkVglcP2nz+5CKou5OtMqdSMVgPUnGAOOHKPHNspSLSSFJ", - "Hdm+SqReyjG3p2OczEE4yyZqk7LhMcj8DFGdOH9F4pyTVZHSLZgogTMqyJKqSx9vgSs1kqzE2rbYRoLR", - "JoaRyOueuV6Fni5JyFbnwQHw7rbywjCmI7f4gaFG1DR8cViqiXrwU/xg4axqUdzR3g9VFgM1OoRkE+3Y", - "H8TSx7MrhdjCUoiZU3VdKcReRl92zHEg8Gxz35JNZV7kao4RRyi2DTVrLd9svkKpQM0qJYaz7erYs6U1", - "hvMtasqjGW+yP2xKpmmMG5zCLB24hbNZle8im+L1FihdwVexZep1ayqTNihM2pOkw8pqA+LNK8wmlYTM", - "W70aWt7CrZQhoHBuVJUTpfcOibLdVRC15DUOWcdpek4TDLEOsy2dJstO/lZhe5knslXIUIN7USs95ZtE", - "v2UAdmEyOwqTOTeUbRHEqlDMin7yPaticlac0EDlegsBIysGiXS89dK8pUajrMNYNmqfPXc10wNbwWDb", - "q+Mi6+3b1XDhWleRy3atHFpJhGX1sJMHRgVxPeasUROtEk7STSpmlswY7x4mmCf/MZ6UDRJMtoGfNUle", - "eIqWDWTgXj3/th6wWRKlMcuck4MgN8oICuv0DT4VgHkJtWHNbHaC9LqEdm3UJlbKoNdIcJEEzWZVbgZX", - "vIEDnBA+rFYtOvNBeJ2S60rDLvvOcMqs2zil1AH9nijTSiAmGU8h7Ewh8ebQN+VXywV/yxUpQQbKrtoq", - "U6U60i+hSY3SsN7Nimcv7Qpft0Ek9tz3x//YzawjIUNFskr46EHolx6spBysyTBiW9rfQjQL2YBtC/hL", - "qWMllv/gjV+RCeZXkMtblnJiU9dUBTt51yoVMCfFVVXAZR+yCQQJTDIfsp7Wqwwm91IepEngfnTd5x/P", - "/z8AAP//eDS2D/bmAQA=", + "H4sIAAAAAAAC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IG4xRRj22ZLuAiwlM8BzFLY5ASie7YxBXId/zbiJlbKMErp+0/XlIRVF3", + "JlrmTKRisJkkY4DxQ5TUxF9wMSkkqSPb14nUSznm5myMkzkIZ9lEu2RseAwyP0NUJ85fkTjnZFWkdAsm", + "SuCMCrKk7tDHW+BaiySLTtoU20gwdolhJPK6a65XYadLErK1eXAAvLuN3DCM6cg7fMHQIGpa3jg8wMk8", + "iu72REDKwU/xg0UaHxU6onU1YIX/bp+hJwYyB4RkE205HsQy5U3C14mYlxcx5TQ7lUyNUSCihR1zHAg8", + "25y3ZFP5AFw9xwgVim3rcews36wnjopDz8OoBGooZkZiQlMQbFZuVGAn266OPXeIPdnxsrJFbXk04032", + "x7PFm84a5wanMMt8VhFsVhe7qMnreT2Ri61jyMSKO8dKJTixkvlC7a/6WERmoVEqJN68xm1SS8i81auh", + "5Q2cShkCCnrDpCsEBlKJsu2lRljyGoes4zQ9pwmGWIXZStqkHORvVdAki0S2qqDQ4ly0k5HybYqBZAB2", + "OTvbz9nRHYcUilkyTr7XZGHZc0ILk+stJIwsmSTS8dZL85aajbIKY9mYffbc1c4O3AkG29yD1RwZtumz", + "3Ooqctm2jUMriVA2Dzt5YDQQV2POBjPRqio/3aRi+f1yinudpmxRhX8nU/r7oublGp4pWv6RIj1gsyRK", + "Y1ZeNAdBbpQRFNbpG3wqAPMSZsOKJb9l4YSu6vcOWhNLlRlvJbhkjRZjmIFMtG9bKmWpCildMZJdNaQE", + "GSxZi+TFKpAo8LYqPdIVHOkKjmyx4IhWNAvZgC1utQqa3Eos/8YbvyIXzN9BLm9YyolNXdEU7OTdTpmA", + "OSkuawKWY8gmECQwyWLIetqoMpjcS3mQJoH70XWffzz//wAAAP//gZAEF8v9AQA=", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/api/v1/server/oas/transformers/workflow_run.go b/api/v1/server/oas/transformers/workflow_run.go index 454c001e8..597dcf0b1 100644 --- a/api/v1/server/oas/transformers/workflow_run.go +++ b/api/v1/server/oas/transformers/workflow_run.go @@ -560,10 +560,11 @@ func ToCronWorkflowsFromSQLC(cron *dbsqlc.ListCronWorkflowsRow) *gen.CronWorkflo Metadata: *toAPIMetadata(sqlchelpers.UUIDToStr(cron.ID), cron.CreatedAt.Time, cron.UpdatedAt.Time), WorkflowVersionId: sqlchelpers.UUIDToStr(cron.WorkflowVersionId), WorkflowId: sqlchelpers.UUIDToStr(cron.WorkflowId), - WorkflowName: cron.Name, + WorkflowName: cron.WorkflowName, TenantId: sqlchelpers.UUIDToStr(cron.TenantId), Cron: cron.Cron, AdditionalMetadata: &additionalMetadata, + Name: &cron.Name.String, } return res diff --git a/api/v1/server/run/run.go b/api/v1/server/run/run.go index 241fffc10..c42a6039c 100644 --- a/api/v1/server/run/run.go +++ b/api/v1/server/run/run.go @@ -262,6 +262,16 @@ func (t *APIServer) registerSpec(g *echo.Group, spec *openapi3.T) (*populator.Po return scheduled, sqlchelpers.UUIDToStr(scheduled.TenantId), nil }) + populatorMW.RegisterGetter("cron-workflow", func(config *server.ServerConfig, parentId, id string) (result interface{}, uniqueParentId string, err error) { + scheduled, err := config.APIRepository.Workflow().GetCronWorkflow(context.Background(), parentId, id) + + if err != nil { + return nil, "", err + } + + return scheduled, sqlchelpers.UUIDToStr(scheduled.TenantId), nil + }) + populatorMW.RegisterGetter("step-run", func(config *server.ServerConfig, parentId, id string) (result interface{}, uniqueParentId string, err error) { stepRun, err := config.APIRepository.StepRun().GetStepRunById(id) diff --git a/frontend/app/src/lib/api/generated/Api.ts b/frontend/app/src/lib/api/generated/Api.ts index ddae67815..2b2d1d8e5 100644 --- a/frontend/app/src/lib/api/generated/Api.ts +++ b/frontend/app/src/lib/api/generated/Api.ts @@ -19,11 +19,13 @@ import { CancelEventRequest, CreateAPITokenRequest, CreateAPITokenResponse, + CreateCronWorkflowTriggerRequest, CreateEventRequest, CreateSNSIntegrationRequest, CreateTenantAlertEmailGroupRequest, CreateTenantInviteRequest, CreateTenantRequest, + CronWorkflows, CronWorkflowsList, CronWorkflowsOrderByField, Event, @@ -55,6 +57,7 @@ import { ScheduledWorkflows, ScheduledWorkflowsList, ScheduledWorkflowsOrderByField, + ScheduleWorkflowRunRequest, SNSIntegration, StepRun, StepRunArchiveList, @@ -1121,6 +1124,40 @@ export class Api extends HttpClient + this.request({ + path: `/api/v1/tenants/${tenant}/workflows/${workflow}/scheduled`, + method: 'POST', + query: query, + body: data, + secure: true, + type: ContentType.Json, + format: 'json', + ...params, + }); /** * @description Get all scheduled workflow runs for a tenant * @@ -1192,12 +1229,12 @@ export class Api extends HttpClient + workflowScheduledGet = (tenant: string, scheduledWorkflowRun: string, params: RequestParams = {}) => this.request({ - path: `/api/v1/tenants/${tenant}/workflows/scheduled/${scheduledId}`, + path: `/api/v1/tenants/${tenant}/workflows/scheduled/${scheduledWorkflowRun}`, method: 'GET', secure: true, format: 'json', @@ -1209,18 +1246,52 @@ export class Api extends HttpClient + workflowScheduledDelete = (tenant: string, scheduledWorkflowRun: string, params: RequestParams = {}) => this.request({ - path: `/api/v1/tenants/${tenant}/workflows/scheduled/${scheduledId}`, + path: `/api/v1/tenants/${tenant}/workflows/scheduled/${scheduledWorkflowRun}`, method: 'DELETE', secure: true, ...params, }); /** - * @description Get all cron job workflow runs for a tenant + * @description Create a new cron job workflow trigger for a tenant + * + * @tags Workflow Run + * @name CronWorkflowTriggerCreate + * @summary Create cron job workflow trigger + * @request POST:/api/v1/tenants/{tenant}/workflows/{workflow}/crons + * @secure + */ + cronWorkflowTriggerCreate = ( + tenant: string, + workflow: string, + data: CreateCronWorkflowTriggerRequest, + query?: { + /** + * The workflow version. If not supplied, the latest version is fetched. + * @format uuid + * @minLength 36 + * @maxLength 36 + */ + version?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: `/api/v1/tenants/${tenant}/workflows/${workflow}/crons`, + method: 'POST', + query: query, + body: data, + secure: true, + type: ContentType.Json, + format: 'json', + ...params, + }); + /** + * @description Get all cron job workflow triggers for a tenant * * @tags Workflow * @name CronWorkflowList @@ -1268,6 +1339,39 @@ export class Api extends HttpClient + this.request({ + path: `/api/v1/tenants/${tenant}/workflows/crons/${cronWorkflow}`, + method: 'GET', + secure: true, + format: 'json', + ...params, + }); + /** + * @description Delete a cron job workflow run for a tenant + * + * @tags Workflow + * @name WorkflowCronDelete + * @summary Delete cron job workflow run + * @request DELETE:/api/v1/tenants/{tenant}/workflows/crons/{cron-workflow} + * @secure + */ + workflowCronDelete = (tenant: string, cronWorkflow: string, params: RequestParams = {}) => + this.request({ + path: `/api/v1/tenants/${tenant}/workflows/crons/${cronWorkflow}`, + method: 'DELETE', + secure: true, + ...params, + }); /** * @description Cancel a batch of workflow runs * diff --git a/frontend/app/src/lib/api/generated/data-contracts.ts b/frontend/app/src/lib/api/generated/data-contracts.ts index 04f5403a6..a59011521 100644 --- a/frontend/app/src/lib/api/generated/data-contracts.ts +++ b/frontend/app/src/lib/api/generated/data-contracts.ts @@ -810,6 +810,7 @@ export interface CronWorkflows { workflowId: string; workflowName: string; cron: string; + name?: string; input?: Record; additionalMetadata?: Record; } @@ -1195,6 +1196,20 @@ export interface TriggerWorkflowRunRequest { additionalMetadata?: object; } +export interface ScheduleWorkflowRunRequest { + input: object; + additionalMetadata: object; + /** @format date-time */ + triggerAt: string; +} + +export interface CreateCronWorkflowTriggerRequest { + input: object; + additionalMetadata: object; + cronName: string; + cronExpression: string; +} + export interface CreatePullRequestFromStepRun { branchName: string; } diff --git a/frontend/app/src/lib/api/queries.ts b/frontend/app/src/lib/api/queries.ts index 913ac15ca..7fa3e2d6c 100644 --- a/frontend/app/src/lib/api/queries.ts +++ b/frontend/app/src/lib/api/queries.ts @@ -197,9 +197,9 @@ export const queries = createQueryKeyStore({ (await api.workflowScheduledList(tenant, query)).data, }), }, - cronRuns: { + cronJobs: { list: (tenant: string, query: CronWorkflowsQuery) => ({ - queryKey: ['cron-run:list', tenant, query], + queryKey: ['cron-job:list', tenant, query], queryFn: async () => (await api.cronWorkflowList(tenant, query)).data, }), }, diff --git a/frontend/app/src/pages/main/recurring/components/delete-cron.tsx b/frontend/app/src/pages/main/recurring/components/delete-cron.tsx new file mode 100644 index 000000000..599bff651 --- /dev/null +++ b/frontend/app/src/pages/main/recurring/components/delete-cron.tsx @@ -0,0 +1,92 @@ +import { Button } from '@/components/ui/button'; +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, +} from '@/components/ui/dialog'; +import { Spinner } from '@/components/ui/loading'; +import api, { CronWorkflows } from '@/lib/api'; +import { useApiError } from '@/lib/hooks'; +import { useMutation } from '@tanstack/react-query'; + +interface DeleteCronFormProps { + className?: string; + onCancel: () => void; + isLoading: boolean; + onSubmit: () => void; +} + +export function DeleteCron({ + tenant, + cron, + setShowCronRevoke, + onSuccess, +}: { + tenant: string; + cron?: CronWorkflows; + setShowCronRevoke: (show?: CronWorkflows) => void; + onSuccess: () => void; +}) { + const { handleApiError } = useApiError({}); + + const deleteMutation = useMutation({ + mutationKey: ['cron-job:delete', tenant, cron], + mutationFn: async () => { + if (!cron) { + return; + } + await api.workflowCronDelete(tenant, cron.metadata.id); + }, + onSuccess: onSuccess, + onError: handleApiError, + }); + + return ( + setShowCronRevoke(open ? cron : undefined)} + > + deleteMutation.mutate()} + onCancel={() => setShowCronRevoke(undefined)} + /> + + ); +} + +export function DeleteCronForm({ className, ...props }: DeleteCronFormProps) { + return ( + + + Delete cron job + +
+
+ Are you sure you want to delete the cron job? This action will prevent + the run from running in the future and cannot be undone. +
+
+ + +
+
+
+ ); +} diff --git a/frontend/app/src/pages/main/recurring/components/recurring-columns.tsx b/frontend/app/src/pages/main/recurring/components/recurring-columns.tsx index 2d3e22dad..59da1d0cf 100644 --- a/frontend/app/src/pages/main/recurring/components/recurring-columns.tsx +++ b/frontend/app/src/pages/main/recurring/components/recurring-columns.tsx @@ -1,83 +1,112 @@ import { ColumnDef } from '@tanstack/react-table'; import { DataTableColumnHeader } from '../../../../components/molecules/data-table/data-table-column-header'; -import { CronWorkflows, RateLimit } from '@/lib/api'; +import { CronWorkflows } from '@/lib/api'; import CronPrettifier from 'cronstrue'; import RelativeDate from '@/components/molecules/relative-date'; import { Link } from 'react-router-dom'; +import { DataTableRowActions } from '@/components/molecules/data-table/data-table-row-actions'; -export type RateLimitRow = RateLimit & { - metadata: { - id: string; - }; -}; - -export const columns: ColumnDef[] = [ - { - accessorKey: 'crons', - header: ({ column }) => ( - - ), - cell: ({ row }) => ( -
- {row.original.cron} -
- ), - enableSorting: false, - }, - { - accessorKey: 'readable', - header: ({ column }) => ( - - ), - cell: ({ row }) => ( -
- (runs {CronPrettifier.toString(row.original.cron).toLowerCase()} UTC) -
- ), - enableSorting: false, - }, - { - accessorKey: 'Workflow', - header: ({ column }) => ( - - ), - cell: ({ row }) => ( -
-
- - {row.original.workflowName} - +export const columns = ({ + onDeleteClick, +}: { + onDeleteClick: (row: CronWorkflows) => void; +}): ColumnDef[] => { + return [ + { + accessorKey: 'crons', + header: ({ column }) => ( + + ), + cell: ({ row }) => ( +
+ {row.original.cron} +
+ ), + enableSorting: false, + }, + { + accessorKey: 'name', + header: ({ column }) => ( + + ), + cell: ({ row }) =>
{row.original.name}
, + }, + { + accessorKey: 'readable', + header: ({ column }) => ( + + ), + cell: ({ row }) => ( +
+ (runs {CronPrettifier.toString(row.original.cron).toLowerCase()} UTC) +
+ ), + enableSorting: false, + }, + { + accessorKey: 'Workflow', + header: ({ column }) => ( + + ), + cell: ({ row }) => ( +
+
+ + {row.original.workflowName} + +
-
- ), - enableSorting: false, - enableHiding: true, - }, - // { - // accessorKey: 'Metadata', - // header: ({ column }) => ( - // - // ), - // cell: ({ row }) => { - // if (!row.original.additionalMetadata) { - // return
; - // } + ), + enableSorting: false, + enableHiding: true, + }, + // { + // accessorKey: 'Metadata', + // header: ({ column }) => ( + // + // ), + // cell: ({ row }) => { + // if (!row.original.additionalMetadata) { + // return
; + // } - // return ; - // }, - // enableSorting: false, - // }, - { - accessorKey: 'createdAt', - header: ({ column }) => ( - - ), - cell: ({ row }) => ( -
- -
- ), - enableSorting: true, - enableHiding: true, - }, -]; + // return ; + // }, + // enableSorting: false, + // }, + { + accessorKey: 'createdAt', + header: ({ column }) => ( + + ), + cell: ({ row }) => ( +
+ +
+ ), + enableSorting: true, + enableHiding: true, + }, + { + accessorKey: 'actions', + header: ({ column }) => ( + + ), + cell: ({ row }) => ( +
+ onDeleteClick(row.original), + }, + ]} + /> +
+ ), + enableHiding: true, + enableSorting: false, + }, + ]; +}; diff --git a/frontend/app/src/pages/main/recurring/components/recurring-table.tsx b/frontend/app/src/pages/main/recurring/components/recurring-table.tsx index 4eb8c860c..3266706e7 100644 --- a/frontend/app/src/pages/main/recurring/components/recurring-table.tsx +++ b/frontend/app/src/pages/main/recurring/components/recurring-table.tsx @@ -6,8 +6,9 @@ import { SortingState, VisibilityState, } from '@tanstack/react-table'; -import { useQuery } from '@tanstack/react-query'; +import { useQuery, useQueryClient } from '@tanstack/react-query'; import { + CronWorkflows, CronWorkflowsOrderByField, WorkflowRunOrderByDirection, queries, @@ -17,10 +18,14 @@ import { useOutletContext, useSearchParams } from 'react-router-dom'; import { TenantContextType } from '@/lib/outlet'; import { DataTable } from '@/components/molecules/data-table/data-table'; import { columns } from './recurring-columns'; +import { Button } from '@/components/ui/button'; +import { ArrowPathIcon } from '@heroicons/react/24/outline'; +import { DeleteCron } from './delete-cron'; export function CronsTable() { const { tenant } = useOutletContext(); const [searchParams, setSearchParams] = useSearchParams(); + const queryClient = useQueryClient(); invariant(tenant); @@ -32,6 +37,7 @@ export function CronsTable() { } return []; }); + const [columnFilters, setColumnFilters] = useState(() => { const filtersParam = searchParams.get('filters'); if (filtersParam) { @@ -39,6 +45,7 @@ export function CronsTable() { } return []; }); + const [columnVisibility, setColumnVisibility] = useState({ createdAt: false, }); @@ -48,6 +55,7 @@ export function CronsTable() { const pageSize = Number(searchParams.get('pageSize')) || 50; return { pageIndex, pageSize }; }); + const [pageSize, setPageSize] = useState( Number(searchParams.get('pageSize')) || 50, ); @@ -66,9 +74,9 @@ export function CronsTable() { setSearchParams(newSearchParams); }, [sorting, columnFilters, pagination, setSearchParams, searchParams]); - const orderByDirection = useMemo((): - | WorkflowRunOrderByDirection - | undefined => { + const orderByDirection = useMemo< + WorkflowRunOrderByDirection | undefined + >(() => { if (!sorting.length) { return; } @@ -78,7 +86,7 @@ export function CronsTable() { : WorkflowRunOrderByDirection.ASC; }, [sorting]); - const orderByField = useMemo((): CronWorkflowsOrderByField | undefined => { + const orderByField = useMemo(() => { if (!sorting.length) { return; } @@ -103,8 +111,9 @@ export function CronsTable() { data, isLoading: queryIsLoading, error: queryError, + refetch, } = useQuery({ - ...queries.cronRuns.list(tenant.metadata.id, { + ...queries.cronJobs.list(tenant.metadata.id, { // TODO: add filters orderByField, orderByDirection, @@ -114,27 +123,69 @@ export function CronsTable() { refetchInterval: 2000, }); + const [showDeleteCron, setShowDeleteCron] = useState< + CronWorkflows | undefined + >(); + + const handleDeleteClick = (cron: CronWorkflows) => { + setShowDeleteCron(cron); + }; + + const handleConfirmDelete = () => { + if (showDeleteCron) { + setShowDeleteCron(undefined); + } + }; + + const actions = [ + , + ]; + return ( - row.metadata.id} - /> + <> + {showDeleteCron && ( + + )} + row.metadata.id} + /> + ); } diff --git a/frontend/app/src/pages/main/recurring/index.tsx b/frontend/app/src/pages/main/recurring/index.tsx index 619556595..2b5f64f22 100644 --- a/frontend/app/src/pages/main/recurring/index.tsx +++ b/frontend/app/src/pages/main/recurring/index.tsx @@ -1,13 +1,27 @@ import { Separator } from '@/components/ui/separator'; import { CronsTable } from './components/recurring-table'; +import { TriggerWorkflowForm } from '../workflows/$workflow/components/trigger-workflow-form'; +import { useState } from 'react'; +import { Button } from '@/components/ui/button'; export default function Crons() { + const [triggerWorkflow, setTriggerWorkflow] = useState(false); + return (

Cron Jobs

+ + setTriggerWorkflow(false)} + />
diff --git a/frontend/app/src/pages/main/scheduled-runs/index.tsx b/frontend/app/src/pages/main/scheduled-runs/index.tsx index 13128986d..b356178e1 100644 --- a/frontend/app/src/pages/main/scheduled-runs/index.tsx +++ b/frontend/app/src/pages/main/scheduled-runs/index.tsx @@ -1,13 +1,27 @@ import { Separator } from '@/components/ui/separator'; import { ScheduledRunsTable } from './components/scheduled-runs-table'; +import { TriggerWorkflowForm } from '../workflows/$workflow/components/trigger-workflow-form'; +import { useState } from 'react'; +import { Button } from '@/components/ui/button'; export default function RateLimits() { + const [triggerWorkflow, setTriggerWorkflow] = useState(false); + return (

Scheduled Runs

+ + setTriggerWorkflow(false)} + />
diff --git a/frontend/app/src/pages/main/workers/webhooks/index.tsx b/frontend/app/src/pages/main/workers/webhooks/index.tsx index b5588946f..84e765948 100644 --- a/frontend/app/src/pages/main/workers/webhooks/index.tsx +++ b/frontend/app/src/pages/main/workers/webhooks/index.tsx @@ -74,7 +74,7 @@ export default function Webhooks() { {worker.name} - + + setTriggerWorkflow(false)} + />
diff --git a/frontend/app/src/pages/main/workflows/$workflow/components/trigger-workflow-form.tsx b/frontend/app/src/pages/main/workflows/$workflow/components/trigger-workflow-form.tsx index 98e680db0..fd88150f2 100644 --- a/frontend/app/src/pages/main/workflows/$workflow/components/trigger-workflow-form.tsx +++ b/frontend/app/src/pages/main/workflows/$workflow/components/trigger-workflow-form.tsx @@ -5,26 +5,46 @@ import { DialogHeader, DialogTitle, } from '@/components/ui/dialog'; -import api, { Workflow, WorkflowRun } from '@/lib/api'; -import { useState } from 'react'; +import api, { + CronWorkflows, + queries, + ScheduledWorkflows, + Workflow, + WorkflowRun, +} from '@/lib/api'; +import { useMemo, useState } from 'react'; import { Button } from '@/components/ui/button'; import invariant from 'tiny-invariant'; import { useApiError } from '@/lib/hooks'; -import { useMutation } from '@tanstack/react-query'; -import { PlusIcon } from '@heroicons/react/24/outline'; +import { useMutation, useQuery } from '@tanstack/react-query'; +import { ChevronDownIcon, PlusIcon } from '@heroicons/react/24/outline'; import { cn } from '@/lib/utils'; import { useNavigate, useOutletContext } from 'react-router-dom'; import { TenantContextType } from '@/lib/outlet'; import { CodeEditor } from '@/components/ui/code-editor'; +import { Input } from '@/components/ui/input'; +import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; +import CronPrettifier from 'cronstrue'; +import { DateTimePicker } from '@/components/molecules/time-picker/date-time-picker'; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from '@/components/ui/dropdown-menu'; + +type TimingOption = 'now' | 'schedule' | 'cron'; export function TriggerWorkflowForm({ - workflow, + defaultWorkflow, show, onClose, + defaultTimingOption = 'now', }: { - workflow: Workflow; + defaultWorkflow?: Workflow; show: boolean; onClose: () => void; + defaultTimingOption?: TimingOption; }) { const { tenant } = useOutletContext(); invariant(tenant); @@ -35,18 +55,64 @@ export function TriggerWorkflowForm({ const [addlMeta, setAddlMeta] = useState('{}'); const [errors, setErrors] = useState([]); + const [timingOption, setTimingOption] = + useState(defaultTimingOption); + const [scheduleTime, setScheduleTime] = useState( + new Date(), + ); + const [cronExpression, setCronExpression] = useState('* * * * *'); + + const [selectedWorkflowId, setSelectedWorkflowId] = useState< + string | undefined + >(defaultWorkflow?.metadata.id); + + const cronPretty = useMemo(() => { + try { + return { + pretty: CronPrettifier.toString(cronExpression || '').toLowerCase(), + }; + } catch (e) { + console.error(e); + return { error: e as string }; + } + }, [cronExpression]); + const { handleApiError } = useApiError({ setErrors, }); - const triggerWorkflowMutation = useMutation({ + const { + data: workflowKeys, + isLoading: workflowKeysIsLoading, + error: workflowKeysError, + } = useQuery({ + ...queries.workflows.list(tenant.metadata.id), + }); + + const workflow = useMemo(() => { + if (defaultWorkflow) { + return workflowKeys?.rows?.find( + (w) => w.metadata.id === defaultWorkflow.metadata.id, + ); + } + + if (selectedWorkflowId) { + return workflowKeys?.rows?.find( + (w) => w.metadata.id === selectedWorkflowId, + ); + } + + return (workflowKeys?.rows || [])[0]; + }, [workflowKeys, defaultWorkflow, selectedWorkflowId]); + + const triggerNowMutation = useMutation({ mutationKey: ['workflow-run:create', workflow?.metadata.id], mutationFn: async (data: { input: object; addlMeta: object }) => { if (!workflow) { return; } - const res = await api.workflowRunCreate(workflow?.metadata.id, { + const res = await api.workflowRunCreate(workflow.metadata.id, { input: data.input, additionalMetadata: data.addlMeta, }); @@ -66,6 +132,117 @@ export function TriggerWorkflowForm({ onError: handleApiError, }); + const triggerScheduleMutation = useMutation({ + mutationKey: ['workflow-run:schedule', workflow?.metadata.id], + mutationFn: async (data: { + input: object; + addlMeta: object; + scheduledAt: string; + }) => { + if (!workflow) { + return; + } + + const res = await api.scheduledWorkflowRunCreate( + tenant.metadata.id, + workflow?.metadata.id, + { + input: data.input, + additionalMetadata: data.addlMeta, + triggerAt: data.scheduledAt, + }, + ); + + return res.data; + }, + onMutate: () => { + setErrors([]); + }, + onSuccess: (workflowRun: ScheduledWorkflows | undefined) => { + if (!workflowRun) { + return; + } + + // TODO: navigate to the scheduled workflow runs page + navigate(`/scheduled`); + }, + onError: handleApiError, + }); + + const triggerCronMutation = useMutation({ + mutationKey: ['workflow-run:cron', workflow?.metadata.id], + mutationFn: async (data: { + input: object; + addlMeta: object; + cron: string; + }) => { + if (!workflow) { + return; + } + + const res = await api.cronWorkflowTriggerCreate( + tenant.metadata.id, + workflow?.metadata.id, + { + input: data.input, + additionalMetadata: data.addlMeta, + cronName: 'helloworld', + cronExpression: data.cron, + }, + ); + + return res.data; + }, + onMutate: () => { + setErrors([]); + }, + onSuccess: (workflowRun: CronWorkflows | undefined) => { + if (!workflowRun) { + return; + } + // TODO: navigate to the cron workflow runs page + navigate(`/cron-jobs`); + }, + onError: handleApiError, + }); + + const handleSubmit = () => { + if (!workflow) { + setErrors(['No workflow selected.']); + return; + } + + const inputObj = JSON.parse(input || '{}'); + const addlMetaObj = JSON.parse(addlMeta || '{}'); + + if (timingOption === 'now') { + triggerNowMutation.mutate({ + input: inputObj, + addlMeta: addlMetaObj, + }); + } else if (timingOption === 'schedule') { + if (!scheduleTime) { + setErrors(['Please select a date and time for scheduling.']); + return; + } + triggerScheduleMutation.mutate({ + input: inputObj, + addlMeta: addlMetaObj, + scheduledAt: scheduleTime.toISOString(), + }); + } else if (timingOption === 'cron') { + if (!cronExpression) { + setErrors(['Please enter a valid cron expression.']); + return; + } + triggerCronMutation.mutate({ + input: inputObj, + addlMeta: addlMetaObj, + cron: cronExpression, + }); + } + }; + return ( - Trigger this workflow + Trigger Workflow You can change the input to your workflow here. + +
Workflow
+ + + + + + {workflowKeysIsLoading && ( + Loading workflows... + )} + {workflowKeysError && ( + + Error loading workflows + + )} + {workflowKeys?.rows?.map((w) => ( + setSelectedWorkflowId(w.metadata.id)} + > + {w.name} + + ))} + + +
Input
+
+
Timing
+ + setTimingOption(value as 'now' | 'schedule' | 'cron') + } + > + + Now + Schedule + Cron + + + +
+
Select Date and Time
+
+ + +
+
+ + + + + +
+
+
+ +
+
Cron Expression
+ setCronExpression(e.target.value)} + placeholder="e.g., 0 0 * * *" + className="w-full" + /> +
+ {cronPretty?.error || `(runs ${cronPretty?.pretty} UTC)`} +
+
+
+
+
+ - {errors.length > 0 && ( + {(errors.length > 0 || + triggerNowMutation.error || + triggerScheduleMutation.error || + triggerCronMutation.error) && (
{errors.map((error, index) => (
diff --git a/frontend/app/src/pages/main/workflows/$workflow/index.tsx b/frontend/app/src/pages/main/workflows/$workflow/index.tsx index 7b3389280..0d95b1190 100644 --- a/frontend/app/src/pages/main/workflows/$workflow/index.tsx +++ b/frontend/app/src/pages/main/workflows/$workflow/index.tsx @@ -171,7 +171,7 @@ export default function ExpandedWorkflow() {
setTriggerWorkflow(false)} />
diff --git a/internal/integrations/alerting/alerter.go b/internal/integrations/alerting/alerter.go index d0a073855..67ca9287c 100644 --- a/internal/integrations/alerting/alerter.go +++ b/internal/integrations/alerting/alerter.go @@ -121,11 +121,7 @@ func (t *TenantAlertManager) sendWorkflowRunAlert(ctx context.Context, tenantAle return nil } - failedItems, err := t.getFailedItems(failedWorkflowRuns) - - if err != nil { - return err - } + failedItems := t.getFailedItems(failedWorkflowRuns) if len(failedItems) == 0 { return nil @@ -147,25 +143,13 @@ func (t *TenantAlertManager) sendWorkflowRunAlert(ctx context.Context, tenantAle return nil } -func (t *TenantAlertManager) getFailedItems(failedWorkflowRuns *repository.ListWorkflowRunsResult) ([]alerttypes.WorkflowRunFailedItem, error) { +func (t *TenantAlertManager) getFailedItems(failedWorkflowRuns *repository.ListWorkflowRunsResult) []alerttypes.WorkflowRunFailedItem { res := make([]alerttypes.WorkflowRunFailedItem, 0) for _, workflowRun := range failedWorkflowRuns.Rows { - workflowRunId := sqlchelpers.UUIDToStr(workflowRun.WorkflowRun.ID) tenantId := sqlchelpers.UUIDToStr(workflowRun.WorkflowRun.TenantId) - details, err := t.repo.WorkflowRun().GetFailureDetails(context.Background(), tenantId, workflowRunId) - - if err != nil { - return nil, err - } - - if len(details) == 0 { - // we don't want to alert on cancelled workflow runs - continue - } - readableId := workflowRun.WorkflowRun.DisplayName.String if readableId == "" { @@ -181,7 +165,7 @@ func (t *TenantAlertManager) getFailedItems(failedWorkflowRuns *repository.ListW }) } - return res, nil + return res } func (t *TenantAlertManager) SendExpiringTokenAlert(tenantId string, token *dbsqlc.PollExpiringTokensRow) error { diff --git a/internal/services/ticker/cron.go b/internal/services/ticker/cron.go index 176e6ab54..9049c0c19 100644 --- a/internal/services/ticker/cron.go +++ b/internal/services/ticker/cron.go @@ -2,6 +2,7 @@ package ticker import ( "context" + "encoding/json" "fmt" "time" @@ -79,11 +80,19 @@ func (t *TickerImpl) handleScheduleCron(ctx context.Context, cron *dbsqlc.PollCr workflowVersionId := sqlchelpers.UUIDToStr(cron.WorkflowVersionId) cronParentId := sqlchelpers.UUIDToStr(cron.ParentId) + var additionalMetadata map[string]interface{} + + if cron.AdditionalMetadata != nil { + if err := json.Unmarshal(cron.AdditionalMetadata, &additionalMetadata); err != nil { + return fmt.Errorf("could not unmarshal additional metadata: %w", err) + } + } + // schedule the cron _, err = s.NewJob( gocron.CronJob(cron.Cron, false), gocron.NewTask( - t.runCronWorkflow(tenantId, workflowVersionId, cron.Cron, cronParentId, cron.Input), + t.runCronWorkflow(tenantId, workflowVersionId, cron.Cron, cronParentId, &cron.Name.String, cron.Input, additionalMetadata), ), ) @@ -99,7 +108,7 @@ func (t *TickerImpl) handleScheduleCron(ctx context.Context, cron *dbsqlc.PollCr return nil } -func (t *TickerImpl) runCronWorkflow(tenantId, workflowVersionId, cron, cronParentId string, input []byte) func() { +func (t *TickerImpl) runCronWorkflow(tenantId, workflowVersionId, cron, cronParentId string, cronName *string, input []byte, additionalMetadata map[string]interface{}) func() { return func() { ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) defer cancel() @@ -113,8 +122,7 @@ func (t *TickerImpl) runCronWorkflow(tenantId, workflowVersionId, cron, cronPare return } // create a new workflow run in the database - // FIXME additionalMetadata is not used for cron runs - createOpts, err := repository.GetCreateWorkflowRunOptsFromCron(cron, cronParentId, workflowVersion, input, nil) + createOpts, err := repository.GetCreateWorkflowRunOptsFromCron(cron, cronParentId, cronName, workflowVersion, input, additionalMetadata) if err != nil { t.l.Err(err).Msg("could not get create workflow run opts") diff --git a/pkg/client/rest/gen.go b/pkg/client/rest/gen.go index c9b6bcb94..c26db8b76 100644 --- a/pkg/client/rest/gen.go +++ b/pkg/client/rest/gen.go @@ -336,6 +336,14 @@ type CreateAPITokenResponse struct { Token string `json:"token"` } +// CreateCronWorkflowTriggerRequest defines model for CreateCronWorkflowTriggerRequest. +type CreateCronWorkflowTriggerRequest struct { + AdditionalMetadata map[string]interface{} `json:"additionalMetadata"` + CronExpression string `json:"cronExpression"` + CronName string `json:"cronName"` + Input map[string]interface{} `json:"input"` +} + // CreateEventRequest defines model for CreateEventRequest. type CreateEventRequest struct { // AdditionalMetadata Additional metadata for the event. @@ -382,6 +390,7 @@ type CronWorkflows struct { Cron string `json:"cron"` Input *map[string]interface{} `json:"input,omitempty"` Metadata APIResourceMeta `json:"metadata"` + Name *string `json:"name,omitempty"` TenantId string `json:"tenantId"` WorkflowId string `json:"workflowId"` WorkflowName string `json:"workflowName"` @@ -658,6 +667,13 @@ type SNSIntegration struct { TopicArn string `json:"topicArn"` } +// ScheduleWorkflowRunRequest defines model for ScheduleWorkflowRunRequest. +type ScheduleWorkflowRunRequest struct { + AdditionalMetadata map[string]interface{} `json:"additionalMetadata"` + Input map[string]interface{} `json:"input"` + TriggerAt time.Time `json:"triggerAt"` +} + // ScheduledRunStatus defines model for ScheduledRunStatus. type ScheduledRunStatus string @@ -1660,6 +1676,18 @@ type WorkflowScheduledListParams struct { Statuses *[]ScheduledRunStatus `form:"statuses,omitempty" json:"statuses,omitempty"` } +// CronWorkflowTriggerCreateParams defines parameters for CronWorkflowTriggerCreate. +type CronWorkflowTriggerCreateParams struct { + // Version The workflow version. If not supplied, the latest version is fetched. + Version *openapi_types.UUID `form:"version,omitempty" json:"version,omitempty"` +} + +// ScheduledWorkflowRunCreateParams defines parameters for ScheduledWorkflowRunCreate. +type ScheduledWorkflowRunCreateParams struct { + // Version The workflow version. If not supplied, the latest version is fetched. + Version *openapi_types.UUID `form:"version,omitempty" json:"version,omitempty"` +} + // WorkflowGetMetricsParams defines parameters for WorkflowGetMetrics. type WorkflowGetMetricsParams struct { // Status A status of workflow run statuses to filter by @@ -1729,6 +1757,12 @@ type WorkflowRunUpdateReplayJSONRequestBody = ReplayWorkflowRunsRequest // WorkflowRunCancelJSONRequestBody defines body for WorkflowRunCancel for application/json ContentType. type WorkflowRunCancelJSONRequestBody = WorkflowRunsCancelRequest +// CronWorkflowTriggerCreateJSONRequestBody defines body for CronWorkflowTriggerCreate for application/json ContentType. +type CronWorkflowTriggerCreateJSONRequestBody = CreateCronWorkflowTriggerRequest + +// ScheduledWorkflowRunCreateJSONRequestBody defines body for ScheduledWorkflowRunCreate for application/json ContentType. +type ScheduledWorkflowRunCreateJSONRequestBody = ScheduleWorkflowRunRequest + // TenantInviteAcceptJSONRequestBody defines body for TenantInviteAccept for application/json ContentType. type TenantInviteAcceptJSONRequestBody = AcceptInviteRequest @@ -2032,6 +2066,12 @@ type ClientInterface interface { // CronWorkflowList request CronWorkflowList(ctx context.Context, tenant openapi_types.UUID, params *CronWorkflowListParams, reqEditors ...RequestEditorFn) (*http.Response, error) + // WorkflowCronDelete request + WorkflowCronDelete(ctx context.Context, tenant openapi_types.UUID, cronWorkflow openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // WorkflowCronGet request + WorkflowCronGet(ctx context.Context, tenant openapi_types.UUID, cronWorkflow openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + // WorkflowRunList request WorkflowRunList(ctx context.Context, tenant openapi_types.UUID, params *WorkflowRunListParams, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -2042,10 +2082,20 @@ type ClientInterface interface { WorkflowScheduledList(ctx context.Context, tenant openapi_types.UUID, params *WorkflowScheduledListParams, reqEditors ...RequestEditorFn) (*http.Response, error) // WorkflowScheduledDelete request - WorkflowScheduledDelete(ctx context.Context, tenant openapi_types.UUID, scheduledId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + WorkflowScheduledDelete(ctx context.Context, tenant openapi_types.UUID, scheduledWorkflowRun openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) // WorkflowScheduledGet request - WorkflowScheduledGet(ctx context.Context, tenant openapi_types.UUID, scheduledId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + WorkflowScheduledGet(ctx context.Context, tenant openapi_types.UUID, scheduledWorkflowRun openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // CronWorkflowTriggerCreateWithBody request with any body + CronWorkflowTriggerCreateWithBody(ctx context.Context, tenant openapi_types.UUID, workflow openapi_types.UUID, params *CronWorkflowTriggerCreateParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + CronWorkflowTriggerCreate(ctx context.Context, tenant openapi_types.UUID, workflow openapi_types.UUID, params *CronWorkflowTriggerCreateParams, body CronWorkflowTriggerCreateJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ScheduledWorkflowRunCreateWithBody request with any body + ScheduledWorkflowRunCreateWithBody(ctx context.Context, tenant openapi_types.UUID, workflow openapi_types.UUID, params *ScheduledWorkflowRunCreateParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + ScheduledWorkflowRunCreate(ctx context.Context, tenant openapi_types.UUID, workflow openapi_types.UUID, params *ScheduledWorkflowRunCreateParams, body ScheduledWorkflowRunCreateJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // WorkflowGetWorkersCount request WorkflowGetWorkersCount(ctx context.Context, tenant openapi_types.UUID, workflow openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -3027,6 +3077,30 @@ func (c *Client) CronWorkflowList(ctx context.Context, tenant openapi_types.UUID return c.Client.Do(req) } +func (c *Client) WorkflowCronDelete(ctx context.Context, tenant openapi_types.UUID, cronWorkflow openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewWorkflowCronDeleteRequest(c.Server, tenant, cronWorkflow) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) WorkflowCronGet(ctx context.Context, tenant openapi_types.UUID, cronWorkflow openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewWorkflowCronGetRequest(c.Server, tenant, cronWorkflow) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + func (c *Client) WorkflowRunList(ctx context.Context, tenant openapi_types.UUID, params *WorkflowRunListParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewWorkflowRunListRequest(c.Server, tenant, params) if err != nil { @@ -3063,8 +3137,56 @@ func (c *Client) WorkflowScheduledList(ctx context.Context, tenant openapi_types return c.Client.Do(req) } -func (c *Client) WorkflowScheduledDelete(ctx context.Context, tenant openapi_types.UUID, scheduledId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewWorkflowScheduledDeleteRequest(c.Server, tenant, scheduledId) +func (c *Client) WorkflowScheduledDelete(ctx context.Context, tenant openapi_types.UUID, scheduledWorkflowRun openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewWorkflowScheduledDeleteRequest(c.Server, tenant, scheduledWorkflowRun) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) WorkflowScheduledGet(ctx context.Context, tenant openapi_types.UUID, scheduledWorkflowRun openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewWorkflowScheduledGetRequest(c.Server, tenant, scheduledWorkflowRun) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) CronWorkflowTriggerCreateWithBody(ctx context.Context, tenant openapi_types.UUID, workflow openapi_types.UUID, params *CronWorkflowTriggerCreateParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCronWorkflowTriggerCreateRequestWithBody(c.Server, tenant, workflow, params, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) CronWorkflowTriggerCreate(ctx context.Context, tenant openapi_types.UUID, workflow openapi_types.UUID, params *CronWorkflowTriggerCreateParams, body CronWorkflowTriggerCreateJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCronWorkflowTriggerCreateRequest(c.Server, tenant, workflow, params, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) ScheduledWorkflowRunCreateWithBody(ctx context.Context, tenant openapi_types.UUID, workflow openapi_types.UUID, params *ScheduledWorkflowRunCreateParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewScheduledWorkflowRunCreateRequestWithBody(c.Server, tenant, workflow, params, contentType, body) if err != nil { return nil, err } @@ -3075,8 +3197,8 @@ func (c *Client) WorkflowScheduledDelete(ctx context.Context, tenant openapi_typ return c.Client.Do(req) } -func (c *Client) WorkflowScheduledGet(ctx context.Context, tenant openapi_types.UUID, scheduledId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewWorkflowScheduledGetRequest(c.Server, tenant, scheduledId) +func (c *Client) ScheduledWorkflowRunCreate(ctx context.Context, tenant openapi_types.UUID, workflow openapi_types.UUID, params *ScheduledWorkflowRunCreateParams, body ScheduledWorkflowRunCreateJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewScheduledWorkflowRunCreateRequest(c.Server, tenant, workflow, params, body) if err != nil { return nil, err } @@ -6297,6 +6419,88 @@ func NewCronWorkflowListRequest(server string, tenant openapi_types.UUID, params return req, nil } +// NewWorkflowCronDeleteRequest generates requests for WorkflowCronDelete +func NewWorkflowCronDeleteRequest(server string, tenant openapi_types.UUID, cronWorkflow openapi_types.UUID) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "tenant", runtime.ParamLocationPath, tenant) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "cron-workflow", runtime.ParamLocationPath, cronWorkflow) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/api/v1/tenants/%s/workflows/crons/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewWorkflowCronGetRequest generates requests for WorkflowCronGet +func NewWorkflowCronGetRequest(server string, tenant openapi_types.UUID, cronWorkflow openapi_types.UUID) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "tenant", runtime.ParamLocationPath, tenant) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "cron-workflow", runtime.ParamLocationPath, cronWorkflow) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/api/v1/tenants/%s/workflows/crons/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + // NewWorkflowRunListRequest generates requests for WorkflowRunList func NewWorkflowRunListRequest(server string, tenant openapi_types.UUID, params *WorkflowRunListParams) (*http.Request, error) { var err error @@ -6914,7 +7118,7 @@ func NewWorkflowScheduledListRequest(server string, tenant openapi_types.UUID, p } // NewWorkflowScheduledDeleteRequest generates requests for WorkflowScheduledDelete -func NewWorkflowScheduledDeleteRequest(server string, tenant openapi_types.UUID, scheduledId openapi_types.UUID) (*http.Request, error) { +func NewWorkflowScheduledDeleteRequest(server string, tenant openapi_types.UUID, scheduledWorkflowRun openapi_types.UUID) (*http.Request, error) { var err error var pathParam0 string @@ -6926,7 +7130,7 @@ func NewWorkflowScheduledDeleteRequest(server string, tenant openapi_types.UUID, var pathParam1 string - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "scheduledId", runtime.ParamLocationPath, scheduledId) + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "scheduled-workflow-run", runtime.ParamLocationPath, scheduledWorkflowRun) if err != nil { return nil, err } @@ -6955,7 +7159,7 @@ func NewWorkflowScheduledDeleteRequest(server string, tenant openapi_types.UUID, } // NewWorkflowScheduledGetRequest generates requests for WorkflowScheduledGet -func NewWorkflowScheduledGetRequest(server string, tenant openapi_types.UUID, scheduledId openapi_types.UUID) (*http.Request, error) { +func NewWorkflowScheduledGetRequest(server string, tenant openapi_types.UUID, scheduledWorkflowRun openapi_types.UUID) (*http.Request, error) { var err error var pathParam0 string @@ -6967,7 +7171,7 @@ func NewWorkflowScheduledGetRequest(server string, tenant openapi_types.UUID, sc var pathParam1 string - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "scheduledId", runtime.ParamLocationPath, scheduledId) + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "scheduled-workflow-run", runtime.ParamLocationPath, scheduledWorkflowRun) if err != nil { return nil, err } @@ -6995,8 +7199,19 @@ func NewWorkflowScheduledGetRequest(server string, tenant openapi_types.UUID, sc return req, nil } -// NewWorkflowGetWorkersCountRequest generates requests for WorkflowGetWorkersCount -func NewWorkflowGetWorkersCountRequest(server string, tenant openapi_types.UUID, workflow openapi_types.UUID) (*http.Request, error) { +// NewCronWorkflowTriggerCreateRequest calls the generic CronWorkflowTriggerCreate builder with application/json body +func NewCronWorkflowTriggerCreateRequest(server string, tenant openapi_types.UUID, workflow openapi_types.UUID, params *CronWorkflowTriggerCreateParams, body CronWorkflowTriggerCreateJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewCronWorkflowTriggerCreateRequestWithBody(server, tenant, workflow, params, "application/json", bodyReader) +} + +// NewCronWorkflowTriggerCreateRequestWithBody generates requests for CronWorkflowTriggerCreate with any type of body +func NewCronWorkflowTriggerCreateRequestWithBody(server string, tenant openapi_types.UUID, workflow openapi_types.UUID, params *CronWorkflowTriggerCreateParams, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -7018,7 +7233,7 @@ func NewWorkflowGetWorkersCountRequest(server string, tenant openapi_types.UUID, return nil, err } - operationPath := fmt.Sprintf("/api/v1/tenants/%s/workflows/%s/worker-count", pathParam0, pathParam1) + operationPath := fmt.Sprintf("/api/v1/tenants/%s/workflows/%s/crons", pathParam0, pathParam1) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -7028,51 +7243,73 @@ func NewWorkflowGetWorkersCountRequest(server string, tenant openapi_types.UUID, return nil, err } - req, err := http.NewRequest("GET", queryURL.String(), nil) + if params != nil { + queryValues := queryURL.Query() + + if params.Version != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "version", runtime.ParamLocationQuery, *params.Version); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + + req, err := http.NewRequest("POST", queryURL.String(), body) if err != nil { return nil, err } + req.Header.Add("Content-Type", contentType) + return req, nil } -// NewUserGetCurrentRequest generates requests for UserGetCurrent -func NewUserGetCurrentRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) +// NewScheduledWorkflowRunCreateRequest calls the generic ScheduledWorkflowRunCreate builder with application/json body +func NewScheduledWorkflowRunCreateRequest(server string, tenant openapi_types.UUID, workflow openapi_types.UUID, params *ScheduledWorkflowRunCreateParams, body ScheduledWorkflowRunCreateJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) + return NewScheduledWorkflowRunCreateRequestWithBody(server, tenant, workflow, params, "application/json", bodyReader) +} - operationPath := fmt.Sprintf("/api/v1/users/current") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } +// NewScheduledWorkflowRunCreateRequestWithBody generates requests for ScheduledWorkflowRunCreate with any type of body +func NewScheduledWorkflowRunCreateRequestWithBody(server string, tenant openapi_types.UUID, workflow openapi_types.UUID, params *ScheduledWorkflowRunCreateParams, contentType string, body io.Reader) (*http.Request, error) { + var err error - queryURL, err := serverURL.Parse(operationPath) + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "tenant", runtime.ParamLocationPath, tenant) if err != nil { return nil, err } - req, err := http.NewRequest("GET", queryURL.String(), nil) + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "workflow", runtime.ParamLocationPath, workflow) if err != nil { return nil, err } - return req, nil -} - -// NewUserUpdateGithubOauthCallbackRequest generates requests for UserUpdateGithubOauthCallback -func NewUserUpdateGithubOauthCallbackRequest(server string) (*http.Request, error) { - var err error - serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/api/v1/users/github/callback") + operationPath := fmt.Sprintf("/api/v1/tenants/%s/workflows/%s/scheduled", pathParam0, pathParam1) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -7082,24 +7319,143 @@ func NewUserUpdateGithubOauthCallbackRequest(server string) (*http.Request, erro return nil, err } - req, err := http.NewRequest("GET", queryURL.String(), nil) + if params != nil { + queryValues := queryURL.Query() + + if params.Version != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "version", runtime.ParamLocationQuery, *params.Version); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + + req, err := http.NewRequest("POST", queryURL.String(), body) if err != nil { return nil, err } + req.Header.Add("Content-Type", contentType) + return req, nil } -// NewUserUpdateGithubOauthStartRequest generates requests for UserUpdateGithubOauthStart -func NewUserUpdateGithubOauthStartRequest(server string) (*http.Request, error) { +// NewWorkflowGetWorkersCountRequest generates requests for WorkflowGetWorkersCount +func NewWorkflowGetWorkersCountRequest(server string, tenant openapi_types.UUID, workflow openapi_types.UUID) (*http.Request, error) { var err error - serverURL, err := url.Parse(server) + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "tenant", runtime.ParamLocationPath, tenant) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/api/v1/users/github/start") + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "workflow", runtime.ParamLocationPath, workflow) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/api/v1/tenants/%s/workflows/%s/worker-count", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewUserGetCurrentRequest generates requests for UserGetCurrent +func NewUserGetCurrentRequest(server string) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/api/v1/users/current") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewUserUpdateGithubOauthCallbackRequest generates requests for UserUpdateGithubOauthCallback +func NewUserUpdateGithubOauthCallbackRequest(server string) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/api/v1/users/github/callback") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewUserUpdateGithubOauthStartRequest generates requests for UserUpdateGithubOauthStart +func NewUserUpdateGithubOauthStartRequest(server string) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/api/v1/users/github/start") if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -8189,6 +8545,12 @@ type ClientWithResponsesInterface interface { // CronWorkflowListWithResponse request CronWorkflowListWithResponse(ctx context.Context, tenant openapi_types.UUID, params *CronWorkflowListParams, reqEditors ...RequestEditorFn) (*CronWorkflowListResponse, error) + // WorkflowCronDeleteWithResponse request + WorkflowCronDeleteWithResponse(ctx context.Context, tenant openapi_types.UUID, cronWorkflow openapi_types.UUID, reqEditors ...RequestEditorFn) (*WorkflowCronDeleteResponse, error) + + // WorkflowCronGetWithResponse request + WorkflowCronGetWithResponse(ctx context.Context, tenant openapi_types.UUID, cronWorkflow openapi_types.UUID, reqEditors ...RequestEditorFn) (*WorkflowCronGetResponse, error) + // WorkflowRunListWithResponse request WorkflowRunListWithResponse(ctx context.Context, tenant openapi_types.UUID, params *WorkflowRunListParams, reqEditors ...RequestEditorFn) (*WorkflowRunListResponse, error) @@ -8199,10 +8561,20 @@ type ClientWithResponsesInterface interface { WorkflowScheduledListWithResponse(ctx context.Context, tenant openapi_types.UUID, params *WorkflowScheduledListParams, reqEditors ...RequestEditorFn) (*WorkflowScheduledListResponse, error) // WorkflowScheduledDeleteWithResponse request - WorkflowScheduledDeleteWithResponse(ctx context.Context, tenant openapi_types.UUID, scheduledId openapi_types.UUID, reqEditors ...RequestEditorFn) (*WorkflowScheduledDeleteResponse, error) + WorkflowScheduledDeleteWithResponse(ctx context.Context, tenant openapi_types.UUID, scheduledWorkflowRun openapi_types.UUID, reqEditors ...RequestEditorFn) (*WorkflowScheduledDeleteResponse, error) // WorkflowScheduledGetWithResponse request - WorkflowScheduledGetWithResponse(ctx context.Context, tenant openapi_types.UUID, scheduledId openapi_types.UUID, reqEditors ...RequestEditorFn) (*WorkflowScheduledGetResponse, error) + WorkflowScheduledGetWithResponse(ctx context.Context, tenant openapi_types.UUID, scheduledWorkflowRun openapi_types.UUID, reqEditors ...RequestEditorFn) (*WorkflowScheduledGetResponse, error) + + // CronWorkflowTriggerCreateWithBodyWithResponse request with any body + CronWorkflowTriggerCreateWithBodyWithResponse(ctx context.Context, tenant openapi_types.UUID, workflow openapi_types.UUID, params *CronWorkflowTriggerCreateParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CronWorkflowTriggerCreateResponse, error) + + CronWorkflowTriggerCreateWithResponse(ctx context.Context, tenant openapi_types.UUID, workflow openapi_types.UUID, params *CronWorkflowTriggerCreateParams, body CronWorkflowTriggerCreateJSONRequestBody, reqEditors ...RequestEditorFn) (*CronWorkflowTriggerCreateResponse, error) + + // ScheduledWorkflowRunCreateWithBodyWithResponse request with any body + ScheduledWorkflowRunCreateWithBodyWithResponse(ctx context.Context, tenant openapi_types.UUID, workflow openapi_types.UUID, params *ScheduledWorkflowRunCreateParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ScheduledWorkflowRunCreateResponse, error) + + ScheduledWorkflowRunCreateWithResponse(ctx context.Context, tenant openapi_types.UUID, workflow openapi_types.UUID, params *ScheduledWorkflowRunCreateParams, body ScheduledWorkflowRunCreateJSONRequestBody, reqEditors ...RequestEditorFn) (*ScheduledWorkflowRunCreateResponse, error) // WorkflowGetWorkersCountWithResponse request WorkflowGetWorkersCountWithResponse(ctx context.Context, tenant openapi_types.UUID, workflow openapi_types.UUID, reqEditors ...RequestEditorFn) (*WorkflowGetWorkersCountResponse, error) @@ -9695,6 +10067,54 @@ func (r CronWorkflowListResponse) StatusCode() int { return 0 } +type WorkflowCronDeleteResponse struct { + Body []byte + HTTPResponse *http.Response + JSON400 *APIErrors + JSON403 *APIError +} + +// Status returns HTTPResponse.Status +func (r WorkflowCronDeleteResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r WorkflowCronDeleteResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type WorkflowCronGetResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *CronWorkflows + JSON400 *APIErrors + JSON403 *APIErrors + JSON404 *APIErrors +} + +// Status returns HTTPResponse.Status +func (r WorkflowCronGetResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r WorkflowCronGetResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type WorkflowRunListResponse struct { Body []byte HTTPResponse *http.Response @@ -9815,6 +10235,58 @@ func (r WorkflowScheduledGetResponse) StatusCode() int { return 0 } +type CronWorkflowTriggerCreateResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *CronWorkflows + JSON400 *APIErrors + JSON403 *APIErrors + JSON404 *APIErrors + JSON429 *APIErrors +} + +// Status returns HTTPResponse.Status +func (r CronWorkflowTriggerCreateResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r CronWorkflowTriggerCreateResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type ScheduledWorkflowRunCreateResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *ScheduledWorkflows + JSON400 *APIErrors + JSON403 *APIErrors + JSON404 *APIErrors + JSON429 *APIErrors +} + +// Status returns HTTPResponse.Status +func (r ScheduledWorkflowRunCreateResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ScheduledWorkflowRunCreateResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type WorkflowGetWorkersCountResponse struct { Body []byte HTTPResponse *http.Response @@ -11059,6 +11531,24 @@ func (c *ClientWithResponses) CronWorkflowListWithResponse(ctx context.Context, return ParseCronWorkflowListResponse(rsp) } +// WorkflowCronDeleteWithResponse request returning *WorkflowCronDeleteResponse +func (c *ClientWithResponses) WorkflowCronDeleteWithResponse(ctx context.Context, tenant openapi_types.UUID, cronWorkflow openapi_types.UUID, reqEditors ...RequestEditorFn) (*WorkflowCronDeleteResponse, error) { + rsp, err := c.WorkflowCronDelete(ctx, tenant, cronWorkflow, reqEditors...) + if err != nil { + return nil, err + } + return ParseWorkflowCronDeleteResponse(rsp) +} + +// WorkflowCronGetWithResponse request returning *WorkflowCronGetResponse +func (c *ClientWithResponses) WorkflowCronGetWithResponse(ctx context.Context, tenant openapi_types.UUID, cronWorkflow openapi_types.UUID, reqEditors ...RequestEditorFn) (*WorkflowCronGetResponse, error) { + rsp, err := c.WorkflowCronGet(ctx, tenant, cronWorkflow, reqEditors...) + if err != nil { + return nil, err + } + return ParseWorkflowCronGetResponse(rsp) +} + // WorkflowRunListWithResponse request returning *WorkflowRunListResponse func (c *ClientWithResponses) WorkflowRunListWithResponse(ctx context.Context, tenant openapi_types.UUID, params *WorkflowRunListParams, reqEditors ...RequestEditorFn) (*WorkflowRunListResponse, error) { rsp, err := c.WorkflowRunList(ctx, tenant, params, reqEditors...) @@ -11087,8 +11577,8 @@ func (c *ClientWithResponses) WorkflowScheduledListWithResponse(ctx context.Cont } // WorkflowScheduledDeleteWithResponse request returning *WorkflowScheduledDeleteResponse -func (c *ClientWithResponses) WorkflowScheduledDeleteWithResponse(ctx context.Context, tenant openapi_types.UUID, scheduledId openapi_types.UUID, reqEditors ...RequestEditorFn) (*WorkflowScheduledDeleteResponse, error) { - rsp, err := c.WorkflowScheduledDelete(ctx, tenant, scheduledId, reqEditors...) +func (c *ClientWithResponses) WorkflowScheduledDeleteWithResponse(ctx context.Context, tenant openapi_types.UUID, scheduledWorkflowRun openapi_types.UUID, reqEditors ...RequestEditorFn) (*WorkflowScheduledDeleteResponse, error) { + rsp, err := c.WorkflowScheduledDelete(ctx, tenant, scheduledWorkflowRun, reqEditors...) if err != nil { return nil, err } @@ -11096,14 +11586,48 @@ func (c *ClientWithResponses) WorkflowScheduledDeleteWithResponse(ctx context.Co } // WorkflowScheduledGetWithResponse request returning *WorkflowScheduledGetResponse -func (c *ClientWithResponses) WorkflowScheduledGetWithResponse(ctx context.Context, tenant openapi_types.UUID, scheduledId openapi_types.UUID, reqEditors ...RequestEditorFn) (*WorkflowScheduledGetResponse, error) { - rsp, err := c.WorkflowScheduledGet(ctx, tenant, scheduledId, reqEditors...) +func (c *ClientWithResponses) WorkflowScheduledGetWithResponse(ctx context.Context, tenant openapi_types.UUID, scheduledWorkflowRun openapi_types.UUID, reqEditors ...RequestEditorFn) (*WorkflowScheduledGetResponse, error) { + rsp, err := c.WorkflowScheduledGet(ctx, tenant, scheduledWorkflowRun, reqEditors...) if err != nil { return nil, err } return ParseWorkflowScheduledGetResponse(rsp) } +// CronWorkflowTriggerCreateWithBodyWithResponse request with arbitrary body returning *CronWorkflowTriggerCreateResponse +func (c *ClientWithResponses) CronWorkflowTriggerCreateWithBodyWithResponse(ctx context.Context, tenant openapi_types.UUID, workflow openapi_types.UUID, params *CronWorkflowTriggerCreateParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CronWorkflowTriggerCreateResponse, error) { + rsp, err := c.CronWorkflowTriggerCreateWithBody(ctx, tenant, workflow, params, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseCronWorkflowTriggerCreateResponse(rsp) +} + +func (c *ClientWithResponses) CronWorkflowTriggerCreateWithResponse(ctx context.Context, tenant openapi_types.UUID, workflow openapi_types.UUID, params *CronWorkflowTriggerCreateParams, body CronWorkflowTriggerCreateJSONRequestBody, reqEditors ...RequestEditorFn) (*CronWorkflowTriggerCreateResponse, error) { + rsp, err := c.CronWorkflowTriggerCreate(ctx, tenant, workflow, params, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseCronWorkflowTriggerCreateResponse(rsp) +} + +// ScheduledWorkflowRunCreateWithBodyWithResponse request with arbitrary body returning *ScheduledWorkflowRunCreateResponse +func (c *ClientWithResponses) ScheduledWorkflowRunCreateWithBodyWithResponse(ctx context.Context, tenant openapi_types.UUID, workflow openapi_types.UUID, params *ScheduledWorkflowRunCreateParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ScheduledWorkflowRunCreateResponse, error) { + rsp, err := c.ScheduledWorkflowRunCreateWithBody(ctx, tenant, workflow, params, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseScheduledWorkflowRunCreateResponse(rsp) +} + +func (c *ClientWithResponses) ScheduledWorkflowRunCreateWithResponse(ctx context.Context, tenant openapi_types.UUID, workflow openapi_types.UUID, params *ScheduledWorkflowRunCreateParams, body ScheduledWorkflowRunCreateJSONRequestBody, reqEditors ...RequestEditorFn) (*ScheduledWorkflowRunCreateResponse, error) { + rsp, err := c.ScheduledWorkflowRunCreate(ctx, tenant, workflow, params, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseScheduledWorkflowRunCreateResponse(rsp) +} + // WorkflowGetWorkersCountWithResponse request returning *WorkflowGetWorkersCountResponse func (c *ClientWithResponses) WorkflowGetWorkersCountWithResponse(ctx context.Context, tenant openapi_types.UUID, workflow openapi_types.UUID, reqEditors ...RequestEditorFn) (*WorkflowGetWorkersCountResponse, error) { rsp, err := c.WorkflowGetWorkersCount(ctx, tenant, workflow, reqEditors...) @@ -13729,6 +14253,86 @@ func ParseCronWorkflowListResponse(rsp *http.Response) (*CronWorkflowListRespons return response, nil } +// ParseWorkflowCronDeleteResponse parses an HTTP response from a WorkflowCronDeleteWithResponse call +func ParseWorkflowCronDeleteResponse(rsp *http.Response) (*WorkflowCronDeleteResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &WorkflowCronDeleteResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest APIErrors + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest APIError + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + } + + return response, nil +} + +// ParseWorkflowCronGetResponse parses an HTTP response from a WorkflowCronGetWithResponse call +func ParseWorkflowCronGetResponse(rsp *http.Response) (*WorkflowCronGetResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &WorkflowCronGetResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest CronWorkflows + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest APIErrors + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest APIErrors + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest APIErrors + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + + } + + return response, nil +} + // ParseWorkflowRunListResponse parses an HTTP response from a WorkflowRunListWithResponse call func ParseWorkflowRunListResponse(rsp *http.Response) (*WorkflowRunListResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) @@ -13929,6 +14533,114 @@ func ParseWorkflowScheduledGetResponse(rsp *http.Response) (*WorkflowScheduledGe return response, nil } +// ParseCronWorkflowTriggerCreateResponse parses an HTTP response from a CronWorkflowTriggerCreateWithResponse call +func ParseCronWorkflowTriggerCreateResponse(rsp *http.Response) (*CronWorkflowTriggerCreateResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &CronWorkflowTriggerCreateResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest CronWorkflows + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest APIErrors + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest APIErrors + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest APIErrors + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 429: + var dest APIErrors + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON429 = &dest + + } + + return response, nil +} + +// ParseScheduledWorkflowRunCreateResponse parses an HTTP response from a ScheduledWorkflowRunCreateWithResponse call +func ParseScheduledWorkflowRunCreateResponse(rsp *http.Response) (*ScheduledWorkflowRunCreateResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &ScheduledWorkflowRunCreateResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest ScheduledWorkflows + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest APIErrors + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest APIErrors + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest APIErrors + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 429: + var dest APIErrors + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON429 = &dest + + } + + return response, nil +} + // ParseWorkflowGetWorkersCountResponse parses an HTTP response from a WorkflowGetWorkersCountWithResponse call func ParseWorkflowGetWorkersCountResponse(rsp *http.Response) (*WorkflowGetWorkersCountResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) diff --git a/pkg/repository/prisma/db/db_gen.go b/pkg/repository/prisma/db/db_gen.go index 456b80e31..393f6a303 100644 --- a/pkg/repository/prisma/db/db_gen.go +++ b/pkg/repository/prisma/db/db_gen.go @@ -719,6 +719,10 @@ model WorkflowTriggerEventRef { } model WorkflowTriggerCronRef { + id String @unique @default(uuid()) @db.Uuid + + name String? + // the parent workflow parent WorkflowTriggers @relation(fields: [parentId], references: [id], onDelete: Cascade, onUpdate: Cascade) parentId String @db.Uuid @@ -745,6 +749,7 @@ model WorkflowTriggerCronRef { // cron references must be unique per workflow @@unique([parentId, cron]) + @@unique([parentId, cron, name]) } model WorkflowTriggerScheduledRef { @@ -1176,9 +1181,10 @@ model WorkflowRunTriggeredBy { eventId String? @db.Uuid // the cron reference that triggered this workflow - cron WorkflowTriggerCronRef? @relation(fields: [cronParentId, cronSchedule], references: [parentId, cron]) + cron WorkflowTriggerCronRef? @relation(fields: [cronParentId, cronSchedule, cronName], references: [parentId, cron, name]) cronParentId String? @db.Uuid cronSchedule String? + cronName String? // a specific time that triggered this workflow scheduled WorkflowTriggerScheduledRef? @relation(fields: [scheduledId], references: [id]) @@ -2779,6 +2785,8 @@ const ( type WorkflowTriggerCronRefScalarFieldEnum string const ( + WorkflowTriggerCronRefScalarFieldEnumID WorkflowTriggerCronRefScalarFieldEnum = "id" + WorkflowTriggerCronRefScalarFieldEnumName WorkflowTriggerCronRefScalarFieldEnum = "name" WorkflowTriggerCronRefScalarFieldEnumParentID WorkflowTriggerCronRefScalarFieldEnum = "parentId" WorkflowTriggerCronRefScalarFieldEnumCreatedAt WorkflowTriggerCronRefScalarFieldEnum = "createdAt" WorkflowTriggerCronRefScalarFieldEnumUpdatedAt WorkflowTriggerCronRefScalarFieldEnum = "updatedAt" @@ -2972,6 +2980,7 @@ const ( WorkflowRunTriggeredByScalarFieldEnumEventID WorkflowRunTriggeredByScalarFieldEnum = "eventId" WorkflowRunTriggeredByScalarFieldEnumCronParentID WorkflowRunTriggeredByScalarFieldEnum = "cronParentId" WorkflowRunTriggeredByScalarFieldEnumCronSchedule WorkflowRunTriggeredByScalarFieldEnum = "cronSchedule" + WorkflowRunTriggeredByScalarFieldEnumCronName WorkflowRunTriggeredByScalarFieldEnum = "cronName" WorkflowRunTriggeredByScalarFieldEnumScheduledID WorkflowRunTriggeredByScalarFieldEnum = "scheduledId" ) @@ -3932,6 +3941,10 @@ const workflowTriggerEventRefFieldEventKey workflowTriggerEventRefPrismaFields = type workflowTriggerCronRefPrismaFields = prismaFields +const workflowTriggerCronRefFieldID workflowTriggerCronRefPrismaFields = "id" + +const workflowTriggerCronRefFieldName workflowTriggerCronRefPrismaFields = "name" + const workflowTriggerCronRefFieldParent workflowTriggerCronRefPrismaFields = "parent" const workflowTriggerCronRefFieldParentID workflowTriggerCronRefPrismaFields = "parentId" @@ -4292,6 +4305,8 @@ const workflowRunTriggeredByFieldCronParentID workflowRunTriggeredByPrismaFields const workflowRunTriggeredByFieldCronSchedule workflowRunTriggeredByPrismaFields = "cronSchedule" +const workflowRunTriggeredByFieldCronName workflowRunTriggeredByPrismaFields = "cronName" + const workflowRunTriggeredByFieldScheduled workflowRunTriggeredByPrismaFields = "scheduled" const workflowRunTriggeredByFieldScheduledID workflowRunTriggeredByPrismaFields = "scheduledId" @@ -9596,6 +9611,8 @@ type WorkflowTriggerCronRefModel struct { // InnerWorkflowTriggerCronRef holds the actual data type InnerWorkflowTriggerCronRef struct { + ID string `json:"id"` + Name *string `json:"name,omitempty"` ParentID string `json:"parentId"` CreatedAt DateTime `json:"createdAt"` UpdatedAt DateTime `json:"updatedAt"` @@ -9609,6 +9626,8 @@ type InnerWorkflowTriggerCronRef struct { // RawWorkflowTriggerCronRefModel is a struct for WorkflowTriggerCronRef when used in raw queries type RawWorkflowTriggerCronRefModel struct { + ID RawString `json:"id"` + Name *RawString `json:"name,omitempty"` ParentID RawString `json:"parentId"` CreatedAt RawDateTime `json:"createdAt"` UpdatedAt RawDateTime `json:"updatedAt"` @@ -9627,6 +9646,13 @@ type RelationsWorkflowTriggerCronRef struct { Triggered []WorkflowRunTriggeredByModel `json:"triggered,omitempty"` } +func (r WorkflowTriggerCronRefModel) Name() (value String, ok bool) { + if r.InnerWorkflowTriggerCronRef.Name == nil { + return value, false + } + return *r.InnerWorkflowTriggerCronRef.Name, true +} + func (r WorkflowTriggerCronRefModel) Parent() (value *WorkflowTriggersModel) { if r.RelationsWorkflowTriggerCronRef.Parent == nil { panic("attempted to access parent but did not fetch it using the .With() syntax") @@ -10697,6 +10723,7 @@ type InnerWorkflowRunTriggeredBy struct { EventID *string `json:"eventId,omitempty"` CronParentID *string `json:"cronParentId,omitempty"` CronSchedule *string `json:"cronSchedule,omitempty"` + CronName *string `json:"cronName,omitempty"` ScheduledID *string `json:"scheduledId,omitempty"` } @@ -10712,6 +10739,7 @@ type RawWorkflowRunTriggeredByModel struct { EventID *RawString `json:"eventId,omitempty"` CronParentID *RawString `json:"cronParentId,omitempty"` CronSchedule *RawString `json:"cronSchedule,omitempty"` + CronName *RawString `json:"cronName,omitempty"` ScheduledID *RawString `json:"scheduledId,omitempty"` } @@ -10763,6 +10791,13 @@ func (r WorkflowRunTriggeredByModel) CronSchedule() (value String, ok bool) { return *r.InnerWorkflowRunTriggeredBy.CronSchedule, true } +func (r WorkflowRunTriggeredByModel) CronName() (value String, ok bool) { + if r.InnerWorkflowRunTriggeredBy.CronName == nil { + return value, false + } + return *r.InnerWorkflowRunTriggeredBy.CronName, true +} + func (r WorkflowRunTriggeredByModel) Scheduled() (value *WorkflowTriggerScheduledRefModel, ok bool) { if r.RelationsWorkflowRunTriggeredBy.Scheduled == nil { return value, false @@ -80792,6 +80827,18 @@ var WorkflowTriggerCronRef = workflowTriggerCronRefQuery{} // workflowTriggerCronRefQuery exposes query functions for the workflowTriggerCronRef model type workflowTriggerCronRefQuery struct { + + // ID + // + // @required + // @unique + ID workflowTriggerCronRefQueryIDString + + // Name + // + // @optional + Name workflowTriggerCronRefQueryNameString + Parent workflowTriggerCronRefQueryParentRelations // ParentID @@ -80913,6 +80960,766 @@ func (workflowTriggerCronRefQuery) ParentIDCron( } } +func (workflowTriggerCronRefQuery) ParentIDCronName( + _parentID WorkflowTriggerCronRefWithPrismaParentIDWhereParam, + + _cron WorkflowTriggerCronRefWithPrismaCronWhereParam, + + _name WorkflowTriggerCronRefWithPrismaNameWhereParam, +) WorkflowTriggerCronRefEqualsUniqueWhereParam { + var fields []builder.Field + + fields = append(fields, _parentID.field()) + fields = append(fields, _cron.field()) + fields = append(fields, _name.field()) + + return workflowTriggerCronRefEqualsUniqueParam{ + data: builder.Field{ + Name: "parentId_cron_name", + Fields: builder.TransformEquals(fields), + }, + } +} + +// base struct +type workflowTriggerCronRefQueryIDString struct{} + +// Set the required value of ID +func (r workflowTriggerCronRefQueryIDString) Set(value string) workflowTriggerCronRefSetParam { + + return workflowTriggerCronRefSetParam{ + data: builder.Field{ + Name: "id", + Value: value, + }, + } + +} + +// Set the optional value of ID dynamically +func (r workflowTriggerCronRefQueryIDString) SetIfPresent(value *String) workflowTriggerCronRefSetParam { + if value == nil { + return workflowTriggerCronRefSetParam{} + } + + return r.Set(*value) +} + +func (r workflowTriggerCronRefQueryIDString) Equals(value string) workflowTriggerCronRefWithPrismaIDEqualsUniqueParam { + + return workflowTriggerCronRefWithPrismaIDEqualsUniqueParam{ + data: builder.Field{ + Name: "id", + Fields: []builder.Field{ + { + Name: "equals", + Value: value, + }, + }, + }, + } +} + +func (r workflowTriggerCronRefQueryIDString) EqualsIfPresent(value *string) workflowTriggerCronRefWithPrismaIDEqualsUniqueParam { + if value == nil { + return workflowTriggerCronRefWithPrismaIDEqualsUniqueParam{} + } + return r.Equals(*value) +} + +func (r workflowTriggerCronRefQueryIDString) Order(direction SortOrder) workflowTriggerCronRefDefaultParam { + return workflowTriggerCronRefDefaultParam{ + data: builder.Field{ + Name: "id", + Value: direction, + }, + } +} + +func (r workflowTriggerCronRefQueryIDString) Cursor(cursor string) workflowTriggerCronRefCursorParam { + return workflowTriggerCronRefCursorParam{ + data: builder.Field{ + Name: "id", + Value: cursor, + }, + } +} + +func (r workflowTriggerCronRefQueryIDString) In(value []string) workflowTriggerCronRefParamUnique { + return workflowTriggerCronRefParamUnique{ + data: builder.Field{ + Name: "id", + Fields: []builder.Field{ + { + Name: "in", + Value: value, + }, + }, + }, + } +} + +func (r workflowTriggerCronRefQueryIDString) InIfPresent(value []string) workflowTriggerCronRefParamUnique { + if value == nil { + return workflowTriggerCronRefParamUnique{} + } + return r.In(value) +} + +func (r workflowTriggerCronRefQueryIDString) NotIn(value []string) workflowTriggerCronRefParamUnique { + return workflowTriggerCronRefParamUnique{ + data: builder.Field{ + Name: "id", + Fields: []builder.Field{ + { + Name: "notIn", + Value: value, + }, + }, + }, + } +} + +func (r workflowTriggerCronRefQueryIDString) NotInIfPresent(value []string) workflowTriggerCronRefParamUnique { + if value == nil { + return workflowTriggerCronRefParamUnique{} + } + return r.NotIn(value) +} + +func (r workflowTriggerCronRefQueryIDString) Lt(value string) workflowTriggerCronRefParamUnique { + return workflowTriggerCronRefParamUnique{ + data: builder.Field{ + Name: "id", + Fields: []builder.Field{ + { + Name: "lt", + Value: value, + }, + }, + }, + } +} + +func (r workflowTriggerCronRefQueryIDString) LtIfPresent(value *string) workflowTriggerCronRefParamUnique { + if value == nil { + return workflowTriggerCronRefParamUnique{} + } + return r.Lt(*value) +} + +func (r workflowTriggerCronRefQueryIDString) Lte(value string) workflowTriggerCronRefParamUnique { + return workflowTriggerCronRefParamUnique{ + data: builder.Field{ + Name: "id", + Fields: []builder.Field{ + { + Name: "lte", + Value: value, + }, + }, + }, + } +} + +func (r workflowTriggerCronRefQueryIDString) LteIfPresent(value *string) workflowTriggerCronRefParamUnique { + if value == nil { + return workflowTriggerCronRefParamUnique{} + } + return r.Lte(*value) +} + +func (r workflowTriggerCronRefQueryIDString) Gt(value string) workflowTriggerCronRefParamUnique { + return workflowTriggerCronRefParamUnique{ + data: builder.Field{ + Name: "id", + Fields: []builder.Field{ + { + Name: "gt", + Value: value, + }, + }, + }, + } +} + +func (r workflowTriggerCronRefQueryIDString) GtIfPresent(value *string) workflowTriggerCronRefParamUnique { + if value == nil { + return workflowTriggerCronRefParamUnique{} + } + return r.Gt(*value) +} + +func (r workflowTriggerCronRefQueryIDString) Gte(value string) workflowTriggerCronRefParamUnique { + return workflowTriggerCronRefParamUnique{ + data: builder.Field{ + Name: "id", + Fields: []builder.Field{ + { + Name: "gte", + Value: value, + }, + }, + }, + } +} + +func (r workflowTriggerCronRefQueryIDString) GteIfPresent(value *string) workflowTriggerCronRefParamUnique { + if value == nil { + return workflowTriggerCronRefParamUnique{} + } + return r.Gte(*value) +} + +func (r workflowTriggerCronRefQueryIDString) Contains(value string) workflowTriggerCronRefParamUnique { + return workflowTriggerCronRefParamUnique{ + data: builder.Field{ + Name: "id", + Fields: []builder.Field{ + { + Name: "contains", + Value: value, + }, + }, + }, + } +} + +func (r workflowTriggerCronRefQueryIDString) ContainsIfPresent(value *string) workflowTriggerCronRefParamUnique { + if value == nil { + return workflowTriggerCronRefParamUnique{} + } + return r.Contains(*value) +} + +func (r workflowTriggerCronRefQueryIDString) StartsWith(value string) workflowTriggerCronRefParamUnique { + return workflowTriggerCronRefParamUnique{ + data: builder.Field{ + Name: "id", + Fields: []builder.Field{ + { + Name: "startsWith", + Value: value, + }, + }, + }, + } +} + +func (r workflowTriggerCronRefQueryIDString) StartsWithIfPresent(value *string) workflowTriggerCronRefParamUnique { + if value == nil { + return workflowTriggerCronRefParamUnique{} + } + return r.StartsWith(*value) +} + +func (r workflowTriggerCronRefQueryIDString) EndsWith(value string) workflowTriggerCronRefParamUnique { + return workflowTriggerCronRefParamUnique{ + data: builder.Field{ + Name: "id", + Fields: []builder.Field{ + { + Name: "endsWith", + Value: value, + }, + }, + }, + } +} + +func (r workflowTriggerCronRefQueryIDString) EndsWithIfPresent(value *string) workflowTriggerCronRefParamUnique { + if value == nil { + return workflowTriggerCronRefParamUnique{} + } + return r.EndsWith(*value) +} + +func (r workflowTriggerCronRefQueryIDString) Mode(value QueryMode) workflowTriggerCronRefParamUnique { + return workflowTriggerCronRefParamUnique{ + data: builder.Field{ + Name: "id", + Fields: []builder.Field{ + { + Name: "mode", + Value: value, + }, + }, + }, + } +} + +func (r workflowTriggerCronRefQueryIDString) ModeIfPresent(value *QueryMode) workflowTriggerCronRefParamUnique { + if value == nil { + return workflowTriggerCronRefParamUnique{} + } + return r.Mode(*value) +} + +func (r workflowTriggerCronRefQueryIDString) Not(value string) workflowTriggerCronRefParamUnique { + return workflowTriggerCronRefParamUnique{ + data: builder.Field{ + Name: "id", + Fields: []builder.Field{ + { + Name: "not", + Value: value, + }, + }, + }, + } +} + +func (r workflowTriggerCronRefQueryIDString) NotIfPresent(value *string) workflowTriggerCronRefParamUnique { + if value == nil { + return workflowTriggerCronRefParamUnique{} + } + return r.Not(*value) +} + +// deprecated: Use StartsWith instead. + +func (r workflowTriggerCronRefQueryIDString) HasPrefix(value string) workflowTriggerCronRefParamUnique { + return workflowTriggerCronRefParamUnique{ + data: builder.Field{ + Name: "id", + Fields: []builder.Field{ + { + Name: "starts_with", + Value: value, + }, + }, + }, + } +} + +// deprecated: Use StartsWithIfPresent instead. +func (r workflowTriggerCronRefQueryIDString) HasPrefixIfPresent(value *string) workflowTriggerCronRefParamUnique { + if value == nil { + return workflowTriggerCronRefParamUnique{} + } + return r.HasPrefix(*value) +} + +// deprecated: Use EndsWith instead. + +func (r workflowTriggerCronRefQueryIDString) HasSuffix(value string) workflowTriggerCronRefParamUnique { + return workflowTriggerCronRefParamUnique{ + data: builder.Field{ + Name: "id", + Fields: []builder.Field{ + { + Name: "ends_with", + Value: value, + }, + }, + }, + } +} + +// deprecated: Use EndsWithIfPresent instead. +func (r workflowTriggerCronRefQueryIDString) HasSuffixIfPresent(value *string) workflowTriggerCronRefParamUnique { + if value == nil { + return workflowTriggerCronRefParamUnique{} + } + return r.HasSuffix(*value) +} + +func (r workflowTriggerCronRefQueryIDString) Field() workflowTriggerCronRefPrismaFields { + return workflowTriggerCronRefFieldID +} + +// base struct +type workflowTriggerCronRefQueryNameString struct{} + +// Set the optional value of Name +func (r workflowTriggerCronRefQueryNameString) Set(value string) workflowTriggerCronRefSetParam { + + return workflowTriggerCronRefSetParam{ + data: builder.Field{ + Name: "name", + Value: value, + }, + } + +} + +// Set the optional value of Name dynamically +func (r workflowTriggerCronRefQueryNameString) SetIfPresent(value *String) workflowTriggerCronRefSetParam { + if value == nil { + return workflowTriggerCronRefSetParam{} + } + + return r.Set(*value) +} + +// Set the optional value of Name dynamically +func (r workflowTriggerCronRefQueryNameString) SetOptional(value *String) workflowTriggerCronRefSetParam { + if value == nil { + + var v *string + return workflowTriggerCronRefSetParam{ + data: builder.Field{ + Name: "name", + Value: v, + }, + } + } + + return r.Set(*value) +} + +func (r workflowTriggerCronRefQueryNameString) Equals(value string) workflowTriggerCronRefWithPrismaNameEqualsParam { + + return workflowTriggerCronRefWithPrismaNameEqualsParam{ + data: builder.Field{ + Name: "name", + Fields: []builder.Field{ + { + Name: "equals", + Value: value, + }, + }, + }, + } +} + +func (r workflowTriggerCronRefQueryNameString) EqualsIfPresent(value *string) workflowTriggerCronRefWithPrismaNameEqualsParam { + if value == nil { + return workflowTriggerCronRefWithPrismaNameEqualsParam{} + } + return r.Equals(*value) +} + +func (r workflowTriggerCronRefQueryNameString) EqualsOptional(value *String) workflowTriggerCronRefDefaultParam { + return workflowTriggerCronRefDefaultParam{ + data: builder.Field{ + Name: "name", + Fields: []builder.Field{ + { + Name: "equals", + Value: value, + }, + }, + }, + } +} + +func (r workflowTriggerCronRefQueryNameString) IsNull() workflowTriggerCronRefDefaultParam { + var str *string = nil + return workflowTriggerCronRefDefaultParam{ + data: builder.Field{ + Name: "name", + Fields: []builder.Field{ + { + Name: "equals", + Value: str, + }, + }, + }, + } +} + +func (r workflowTriggerCronRefQueryNameString) Order(direction SortOrder) workflowTriggerCronRefDefaultParam { + return workflowTriggerCronRefDefaultParam{ + data: builder.Field{ + Name: "name", + Value: direction, + }, + } +} + +func (r workflowTriggerCronRefQueryNameString) Cursor(cursor string) workflowTriggerCronRefCursorParam { + return workflowTriggerCronRefCursorParam{ + data: builder.Field{ + Name: "name", + Value: cursor, + }, + } +} + +func (r workflowTriggerCronRefQueryNameString) In(value []string) workflowTriggerCronRefDefaultParam { + return workflowTriggerCronRefDefaultParam{ + data: builder.Field{ + Name: "name", + Fields: []builder.Field{ + { + Name: "in", + Value: value, + }, + }, + }, + } +} + +func (r workflowTriggerCronRefQueryNameString) InIfPresent(value []string) workflowTriggerCronRefDefaultParam { + if value == nil { + return workflowTriggerCronRefDefaultParam{} + } + return r.In(value) +} + +func (r workflowTriggerCronRefQueryNameString) NotIn(value []string) workflowTriggerCronRefDefaultParam { + return workflowTriggerCronRefDefaultParam{ + data: builder.Field{ + Name: "name", + Fields: []builder.Field{ + { + Name: "notIn", + Value: value, + }, + }, + }, + } +} + +func (r workflowTriggerCronRefQueryNameString) NotInIfPresent(value []string) workflowTriggerCronRefDefaultParam { + if value == nil { + return workflowTriggerCronRefDefaultParam{} + } + return r.NotIn(value) +} + +func (r workflowTriggerCronRefQueryNameString) Lt(value string) workflowTriggerCronRefDefaultParam { + return workflowTriggerCronRefDefaultParam{ + data: builder.Field{ + Name: "name", + Fields: []builder.Field{ + { + Name: "lt", + Value: value, + }, + }, + }, + } +} + +func (r workflowTriggerCronRefQueryNameString) LtIfPresent(value *string) workflowTriggerCronRefDefaultParam { + if value == nil { + return workflowTriggerCronRefDefaultParam{} + } + return r.Lt(*value) +} + +func (r workflowTriggerCronRefQueryNameString) Lte(value string) workflowTriggerCronRefDefaultParam { + return workflowTriggerCronRefDefaultParam{ + data: builder.Field{ + Name: "name", + Fields: []builder.Field{ + { + Name: "lte", + Value: value, + }, + }, + }, + } +} + +func (r workflowTriggerCronRefQueryNameString) LteIfPresent(value *string) workflowTriggerCronRefDefaultParam { + if value == nil { + return workflowTriggerCronRefDefaultParam{} + } + return r.Lte(*value) +} + +func (r workflowTriggerCronRefQueryNameString) Gt(value string) workflowTriggerCronRefDefaultParam { + return workflowTriggerCronRefDefaultParam{ + data: builder.Field{ + Name: "name", + Fields: []builder.Field{ + { + Name: "gt", + Value: value, + }, + }, + }, + } +} + +func (r workflowTriggerCronRefQueryNameString) GtIfPresent(value *string) workflowTriggerCronRefDefaultParam { + if value == nil { + return workflowTriggerCronRefDefaultParam{} + } + return r.Gt(*value) +} + +func (r workflowTriggerCronRefQueryNameString) Gte(value string) workflowTriggerCronRefDefaultParam { + return workflowTriggerCronRefDefaultParam{ + data: builder.Field{ + Name: "name", + Fields: []builder.Field{ + { + Name: "gte", + Value: value, + }, + }, + }, + } +} + +func (r workflowTriggerCronRefQueryNameString) GteIfPresent(value *string) workflowTriggerCronRefDefaultParam { + if value == nil { + return workflowTriggerCronRefDefaultParam{} + } + return r.Gte(*value) +} + +func (r workflowTriggerCronRefQueryNameString) Contains(value string) workflowTriggerCronRefDefaultParam { + return workflowTriggerCronRefDefaultParam{ + data: builder.Field{ + Name: "name", + Fields: []builder.Field{ + { + Name: "contains", + Value: value, + }, + }, + }, + } +} + +func (r workflowTriggerCronRefQueryNameString) ContainsIfPresent(value *string) workflowTriggerCronRefDefaultParam { + if value == nil { + return workflowTriggerCronRefDefaultParam{} + } + return r.Contains(*value) +} + +func (r workflowTriggerCronRefQueryNameString) StartsWith(value string) workflowTriggerCronRefDefaultParam { + return workflowTriggerCronRefDefaultParam{ + data: builder.Field{ + Name: "name", + Fields: []builder.Field{ + { + Name: "startsWith", + Value: value, + }, + }, + }, + } +} + +func (r workflowTriggerCronRefQueryNameString) StartsWithIfPresent(value *string) workflowTriggerCronRefDefaultParam { + if value == nil { + return workflowTriggerCronRefDefaultParam{} + } + return r.StartsWith(*value) +} + +func (r workflowTriggerCronRefQueryNameString) EndsWith(value string) workflowTriggerCronRefDefaultParam { + return workflowTriggerCronRefDefaultParam{ + data: builder.Field{ + Name: "name", + Fields: []builder.Field{ + { + Name: "endsWith", + Value: value, + }, + }, + }, + } +} + +func (r workflowTriggerCronRefQueryNameString) EndsWithIfPresent(value *string) workflowTriggerCronRefDefaultParam { + if value == nil { + return workflowTriggerCronRefDefaultParam{} + } + return r.EndsWith(*value) +} + +func (r workflowTriggerCronRefQueryNameString) Mode(value QueryMode) workflowTriggerCronRefDefaultParam { + return workflowTriggerCronRefDefaultParam{ + data: builder.Field{ + Name: "name", + Fields: []builder.Field{ + { + Name: "mode", + Value: value, + }, + }, + }, + } +} + +func (r workflowTriggerCronRefQueryNameString) ModeIfPresent(value *QueryMode) workflowTriggerCronRefDefaultParam { + if value == nil { + return workflowTriggerCronRefDefaultParam{} + } + return r.Mode(*value) +} + +func (r workflowTriggerCronRefQueryNameString) Not(value string) workflowTriggerCronRefDefaultParam { + return workflowTriggerCronRefDefaultParam{ + data: builder.Field{ + Name: "name", + Fields: []builder.Field{ + { + Name: "not", + Value: value, + }, + }, + }, + } +} + +func (r workflowTriggerCronRefQueryNameString) NotIfPresent(value *string) workflowTriggerCronRefDefaultParam { + if value == nil { + return workflowTriggerCronRefDefaultParam{} + } + return r.Not(*value) +} + +// deprecated: Use StartsWith instead. + +func (r workflowTriggerCronRefQueryNameString) HasPrefix(value string) workflowTriggerCronRefDefaultParam { + return workflowTriggerCronRefDefaultParam{ + data: builder.Field{ + Name: "name", + Fields: []builder.Field{ + { + Name: "starts_with", + Value: value, + }, + }, + }, + } +} + +// deprecated: Use StartsWithIfPresent instead. +func (r workflowTriggerCronRefQueryNameString) HasPrefixIfPresent(value *string) workflowTriggerCronRefDefaultParam { + if value == nil { + return workflowTriggerCronRefDefaultParam{} + } + return r.HasPrefix(*value) +} + +// deprecated: Use EndsWith instead. + +func (r workflowTriggerCronRefQueryNameString) HasSuffix(value string) workflowTriggerCronRefDefaultParam { + return workflowTriggerCronRefDefaultParam{ + data: builder.Field{ + Name: "name", + Fields: []builder.Field{ + { + Name: "ends_with", + Value: value, + }, + }, + }, + } +} + +// deprecated: Use EndsWithIfPresent instead. +func (r workflowTriggerCronRefQueryNameString) HasSuffixIfPresent(value *string) workflowTriggerCronRefDefaultParam { + if value == nil { + return workflowTriggerCronRefDefaultParam{} + } + return r.HasSuffix(*value) +} + +func (r workflowTriggerCronRefQueryNameString) Field() workflowTriggerCronRefPrismaFields { + return workflowTriggerCronRefFieldName +} + // base struct type workflowTriggerCronRefQueryParentWorkflowTriggers struct{} @@ -128469,6 +129276,11 @@ type workflowRunTriggeredByQuery struct { // @optional CronSchedule workflowRunTriggeredByQueryCronScheduleString + // CronName + // + // @optional + CronName workflowRunTriggeredByQueryCronNameString + Scheduled workflowRunTriggeredByQueryScheduledRelations // ScheduledID @@ -132177,6 +132989,398 @@ func (r workflowRunTriggeredByQueryCronScheduleString) Field() workflowRunTrigge return workflowRunTriggeredByFieldCronSchedule } +// base struct +type workflowRunTriggeredByQueryCronNameString struct{} + +// Set the optional value of CronName +func (r workflowRunTriggeredByQueryCronNameString) Set(value string) workflowRunTriggeredBySetParam { + + return workflowRunTriggeredBySetParam{ + data: builder.Field{ + Name: "cronName", + Value: value, + }, + } + +} + +// Set the optional value of CronName dynamically +func (r workflowRunTriggeredByQueryCronNameString) SetIfPresent(value *String) workflowRunTriggeredBySetParam { + if value == nil { + return workflowRunTriggeredBySetParam{} + } + + return r.Set(*value) +} + +// Set the optional value of CronName dynamically +func (r workflowRunTriggeredByQueryCronNameString) SetOptional(value *String) workflowRunTriggeredBySetParam { + if value == nil { + + var v *string + return workflowRunTriggeredBySetParam{ + data: builder.Field{ + Name: "cronName", + Value: v, + }, + } + } + + return r.Set(*value) +} + +func (r workflowRunTriggeredByQueryCronNameString) Equals(value string) workflowRunTriggeredByWithPrismaCronNameEqualsParam { + + return workflowRunTriggeredByWithPrismaCronNameEqualsParam{ + data: builder.Field{ + Name: "cronName", + Fields: []builder.Field{ + { + Name: "equals", + Value: value, + }, + }, + }, + } +} + +func (r workflowRunTriggeredByQueryCronNameString) EqualsIfPresent(value *string) workflowRunTriggeredByWithPrismaCronNameEqualsParam { + if value == nil { + return workflowRunTriggeredByWithPrismaCronNameEqualsParam{} + } + return r.Equals(*value) +} + +func (r workflowRunTriggeredByQueryCronNameString) EqualsOptional(value *String) workflowRunTriggeredByDefaultParam { + return workflowRunTriggeredByDefaultParam{ + data: builder.Field{ + Name: "cronName", + Fields: []builder.Field{ + { + Name: "equals", + Value: value, + }, + }, + }, + } +} + +func (r workflowRunTriggeredByQueryCronNameString) IsNull() workflowRunTriggeredByDefaultParam { + var str *string = nil + return workflowRunTriggeredByDefaultParam{ + data: builder.Field{ + Name: "cronName", + Fields: []builder.Field{ + { + Name: "equals", + Value: str, + }, + }, + }, + } +} + +func (r workflowRunTriggeredByQueryCronNameString) Order(direction SortOrder) workflowRunTriggeredByDefaultParam { + return workflowRunTriggeredByDefaultParam{ + data: builder.Field{ + Name: "cronName", + Value: direction, + }, + } +} + +func (r workflowRunTriggeredByQueryCronNameString) Cursor(cursor string) workflowRunTriggeredByCursorParam { + return workflowRunTriggeredByCursorParam{ + data: builder.Field{ + Name: "cronName", + Value: cursor, + }, + } +} + +func (r workflowRunTriggeredByQueryCronNameString) In(value []string) workflowRunTriggeredByDefaultParam { + return workflowRunTriggeredByDefaultParam{ + data: builder.Field{ + Name: "cronName", + Fields: []builder.Field{ + { + Name: "in", + Value: value, + }, + }, + }, + } +} + +func (r workflowRunTriggeredByQueryCronNameString) InIfPresent(value []string) workflowRunTriggeredByDefaultParam { + if value == nil { + return workflowRunTriggeredByDefaultParam{} + } + return r.In(value) +} + +func (r workflowRunTriggeredByQueryCronNameString) NotIn(value []string) workflowRunTriggeredByDefaultParam { + return workflowRunTriggeredByDefaultParam{ + data: builder.Field{ + Name: "cronName", + Fields: []builder.Field{ + { + Name: "notIn", + Value: value, + }, + }, + }, + } +} + +func (r workflowRunTriggeredByQueryCronNameString) NotInIfPresent(value []string) workflowRunTriggeredByDefaultParam { + if value == nil { + return workflowRunTriggeredByDefaultParam{} + } + return r.NotIn(value) +} + +func (r workflowRunTriggeredByQueryCronNameString) Lt(value string) workflowRunTriggeredByDefaultParam { + return workflowRunTriggeredByDefaultParam{ + data: builder.Field{ + Name: "cronName", + Fields: []builder.Field{ + { + Name: "lt", + Value: value, + }, + }, + }, + } +} + +func (r workflowRunTriggeredByQueryCronNameString) LtIfPresent(value *string) workflowRunTriggeredByDefaultParam { + if value == nil { + return workflowRunTriggeredByDefaultParam{} + } + return r.Lt(*value) +} + +func (r workflowRunTriggeredByQueryCronNameString) Lte(value string) workflowRunTriggeredByDefaultParam { + return workflowRunTriggeredByDefaultParam{ + data: builder.Field{ + Name: "cronName", + Fields: []builder.Field{ + { + Name: "lte", + Value: value, + }, + }, + }, + } +} + +func (r workflowRunTriggeredByQueryCronNameString) LteIfPresent(value *string) workflowRunTriggeredByDefaultParam { + if value == nil { + return workflowRunTriggeredByDefaultParam{} + } + return r.Lte(*value) +} + +func (r workflowRunTriggeredByQueryCronNameString) Gt(value string) workflowRunTriggeredByDefaultParam { + return workflowRunTriggeredByDefaultParam{ + data: builder.Field{ + Name: "cronName", + Fields: []builder.Field{ + { + Name: "gt", + Value: value, + }, + }, + }, + } +} + +func (r workflowRunTriggeredByQueryCronNameString) GtIfPresent(value *string) workflowRunTriggeredByDefaultParam { + if value == nil { + return workflowRunTriggeredByDefaultParam{} + } + return r.Gt(*value) +} + +func (r workflowRunTriggeredByQueryCronNameString) Gte(value string) workflowRunTriggeredByDefaultParam { + return workflowRunTriggeredByDefaultParam{ + data: builder.Field{ + Name: "cronName", + Fields: []builder.Field{ + { + Name: "gte", + Value: value, + }, + }, + }, + } +} + +func (r workflowRunTriggeredByQueryCronNameString) GteIfPresent(value *string) workflowRunTriggeredByDefaultParam { + if value == nil { + return workflowRunTriggeredByDefaultParam{} + } + return r.Gte(*value) +} + +func (r workflowRunTriggeredByQueryCronNameString) Contains(value string) workflowRunTriggeredByDefaultParam { + return workflowRunTriggeredByDefaultParam{ + data: builder.Field{ + Name: "cronName", + Fields: []builder.Field{ + { + Name: "contains", + Value: value, + }, + }, + }, + } +} + +func (r workflowRunTriggeredByQueryCronNameString) ContainsIfPresent(value *string) workflowRunTriggeredByDefaultParam { + if value == nil { + return workflowRunTriggeredByDefaultParam{} + } + return r.Contains(*value) +} + +func (r workflowRunTriggeredByQueryCronNameString) StartsWith(value string) workflowRunTriggeredByDefaultParam { + return workflowRunTriggeredByDefaultParam{ + data: builder.Field{ + Name: "cronName", + Fields: []builder.Field{ + { + Name: "startsWith", + Value: value, + }, + }, + }, + } +} + +func (r workflowRunTriggeredByQueryCronNameString) StartsWithIfPresent(value *string) workflowRunTriggeredByDefaultParam { + if value == nil { + return workflowRunTriggeredByDefaultParam{} + } + return r.StartsWith(*value) +} + +func (r workflowRunTriggeredByQueryCronNameString) EndsWith(value string) workflowRunTriggeredByDefaultParam { + return workflowRunTriggeredByDefaultParam{ + data: builder.Field{ + Name: "cronName", + Fields: []builder.Field{ + { + Name: "endsWith", + Value: value, + }, + }, + }, + } +} + +func (r workflowRunTriggeredByQueryCronNameString) EndsWithIfPresent(value *string) workflowRunTriggeredByDefaultParam { + if value == nil { + return workflowRunTriggeredByDefaultParam{} + } + return r.EndsWith(*value) +} + +func (r workflowRunTriggeredByQueryCronNameString) Mode(value QueryMode) workflowRunTriggeredByDefaultParam { + return workflowRunTriggeredByDefaultParam{ + data: builder.Field{ + Name: "cronName", + Fields: []builder.Field{ + { + Name: "mode", + Value: value, + }, + }, + }, + } +} + +func (r workflowRunTriggeredByQueryCronNameString) ModeIfPresent(value *QueryMode) workflowRunTriggeredByDefaultParam { + if value == nil { + return workflowRunTriggeredByDefaultParam{} + } + return r.Mode(*value) +} + +func (r workflowRunTriggeredByQueryCronNameString) Not(value string) workflowRunTriggeredByDefaultParam { + return workflowRunTriggeredByDefaultParam{ + data: builder.Field{ + Name: "cronName", + Fields: []builder.Field{ + { + Name: "not", + Value: value, + }, + }, + }, + } +} + +func (r workflowRunTriggeredByQueryCronNameString) NotIfPresent(value *string) workflowRunTriggeredByDefaultParam { + if value == nil { + return workflowRunTriggeredByDefaultParam{} + } + return r.Not(*value) +} + +// deprecated: Use StartsWith instead. + +func (r workflowRunTriggeredByQueryCronNameString) HasPrefix(value string) workflowRunTriggeredByDefaultParam { + return workflowRunTriggeredByDefaultParam{ + data: builder.Field{ + Name: "cronName", + Fields: []builder.Field{ + { + Name: "starts_with", + Value: value, + }, + }, + }, + } +} + +// deprecated: Use StartsWithIfPresent instead. +func (r workflowRunTriggeredByQueryCronNameString) HasPrefixIfPresent(value *string) workflowRunTriggeredByDefaultParam { + if value == nil { + return workflowRunTriggeredByDefaultParam{} + } + return r.HasPrefix(*value) +} + +// deprecated: Use EndsWith instead. + +func (r workflowRunTriggeredByQueryCronNameString) HasSuffix(value string) workflowRunTriggeredByDefaultParam { + return workflowRunTriggeredByDefaultParam{ + data: builder.Field{ + Name: "cronName", + Fields: []builder.Field{ + { + Name: "ends_with", + Value: value, + }, + }, + }, + } +} + +// deprecated: Use EndsWithIfPresent instead. +func (r workflowRunTriggeredByQueryCronNameString) HasSuffixIfPresent(value *string) workflowRunTriggeredByDefaultParam { + if value == nil { + return workflowRunTriggeredByDefaultParam{} + } + return r.HasSuffix(*value) +} + +func (r workflowRunTriggeredByQueryCronNameString) Field() workflowRunTriggeredByPrismaFields { + return workflowRunTriggeredByFieldCronName +} + // base struct type workflowRunTriggeredByQueryScheduledWorkflowTriggerScheduledRef struct{} @@ -234140,6 +235344,8 @@ type workflowTriggerCronRefActions struct { } var workflowTriggerCronRefOutput = []builder.Output{ + {Name: "id"}, + {Name: "name"}, {Name: "parentId"}, {Name: "createdAt"}, {Name: "updatedAt"}, @@ -234315,6 +235521,162 @@ func (p workflowTriggerCronRefSetParam) field() builder.Field { func (p workflowTriggerCronRefSetParam) workflowTriggerCronRefModel() {} +type WorkflowTriggerCronRefWithPrismaIDEqualsSetParam interface { + field() builder.Field + getQuery() builder.Query + equals() + workflowTriggerCronRefModel() + idField() +} + +type WorkflowTriggerCronRefWithPrismaIDSetParam interface { + field() builder.Field + getQuery() builder.Query + workflowTriggerCronRefModel() + idField() +} + +type workflowTriggerCronRefWithPrismaIDSetParam struct { + data builder.Field + query builder.Query +} + +func (p workflowTriggerCronRefWithPrismaIDSetParam) field() builder.Field { + return p.data +} + +func (p workflowTriggerCronRefWithPrismaIDSetParam) getQuery() builder.Query { + return p.query +} + +func (p workflowTriggerCronRefWithPrismaIDSetParam) workflowTriggerCronRefModel() {} + +func (p workflowTriggerCronRefWithPrismaIDSetParam) idField() {} + +type WorkflowTriggerCronRefWithPrismaIDWhereParam interface { + field() builder.Field + getQuery() builder.Query + workflowTriggerCronRefModel() + idField() +} + +type workflowTriggerCronRefWithPrismaIDEqualsParam struct { + data builder.Field + query builder.Query +} + +func (p workflowTriggerCronRefWithPrismaIDEqualsParam) field() builder.Field { + return p.data +} + +func (p workflowTriggerCronRefWithPrismaIDEqualsParam) getQuery() builder.Query { + return p.query +} + +func (p workflowTriggerCronRefWithPrismaIDEqualsParam) workflowTriggerCronRefModel() {} + +func (p workflowTriggerCronRefWithPrismaIDEqualsParam) idField() {} + +func (workflowTriggerCronRefWithPrismaIDSetParam) settable() {} +func (workflowTriggerCronRefWithPrismaIDEqualsParam) equals() {} + +type workflowTriggerCronRefWithPrismaIDEqualsUniqueParam struct { + data builder.Field + query builder.Query +} + +func (p workflowTriggerCronRefWithPrismaIDEqualsUniqueParam) field() builder.Field { + return p.data +} + +func (p workflowTriggerCronRefWithPrismaIDEqualsUniqueParam) getQuery() builder.Query { + return p.query +} + +func (p workflowTriggerCronRefWithPrismaIDEqualsUniqueParam) workflowTriggerCronRefModel() {} +func (p workflowTriggerCronRefWithPrismaIDEqualsUniqueParam) idField() {} + +func (workflowTriggerCronRefWithPrismaIDEqualsUniqueParam) unique() {} +func (workflowTriggerCronRefWithPrismaIDEqualsUniqueParam) equals() {} + +type WorkflowTriggerCronRefWithPrismaNameEqualsSetParam interface { + field() builder.Field + getQuery() builder.Query + equals() + workflowTriggerCronRefModel() + nameField() +} + +type WorkflowTriggerCronRefWithPrismaNameSetParam interface { + field() builder.Field + getQuery() builder.Query + workflowTriggerCronRefModel() + nameField() +} + +type workflowTriggerCronRefWithPrismaNameSetParam struct { + data builder.Field + query builder.Query +} + +func (p workflowTriggerCronRefWithPrismaNameSetParam) field() builder.Field { + return p.data +} + +func (p workflowTriggerCronRefWithPrismaNameSetParam) getQuery() builder.Query { + return p.query +} + +func (p workflowTriggerCronRefWithPrismaNameSetParam) workflowTriggerCronRefModel() {} + +func (p workflowTriggerCronRefWithPrismaNameSetParam) nameField() {} + +type WorkflowTriggerCronRefWithPrismaNameWhereParam interface { + field() builder.Field + getQuery() builder.Query + workflowTriggerCronRefModel() + nameField() +} + +type workflowTriggerCronRefWithPrismaNameEqualsParam struct { + data builder.Field + query builder.Query +} + +func (p workflowTriggerCronRefWithPrismaNameEqualsParam) field() builder.Field { + return p.data +} + +func (p workflowTriggerCronRefWithPrismaNameEqualsParam) getQuery() builder.Query { + return p.query +} + +func (p workflowTriggerCronRefWithPrismaNameEqualsParam) workflowTriggerCronRefModel() {} + +func (p workflowTriggerCronRefWithPrismaNameEqualsParam) nameField() {} + +func (workflowTriggerCronRefWithPrismaNameSetParam) settable() {} +func (workflowTriggerCronRefWithPrismaNameEqualsParam) equals() {} + +type workflowTriggerCronRefWithPrismaNameEqualsUniqueParam struct { + data builder.Field + query builder.Query +} + +func (p workflowTriggerCronRefWithPrismaNameEqualsUniqueParam) field() builder.Field { + return p.data +} + +func (p workflowTriggerCronRefWithPrismaNameEqualsUniqueParam) getQuery() builder.Query { + return p.query +} + +func (p workflowTriggerCronRefWithPrismaNameEqualsUniqueParam) workflowTriggerCronRefModel() {} +func (p workflowTriggerCronRefWithPrismaNameEqualsUniqueParam) nameField() {} + +func (workflowTriggerCronRefWithPrismaNameEqualsUniqueParam) unique() {} +func (workflowTriggerCronRefWithPrismaNameEqualsUniqueParam) equals() {} + type WorkflowTriggerCronRefWithPrismaParentEqualsSetParam interface { field() builder.Field getQuery() builder.Query @@ -248632,6 +249994,7 @@ var workflowRunTriggeredByOutput = []builder.Output{ {Name: "eventId"}, {Name: "cronParentId"}, {Name: "cronSchedule"}, + {Name: "cronName"}, {Name: "scheduledId"}, } @@ -249659,6 +251022,84 @@ func (p workflowRunTriggeredByWithPrismaCronScheduleEqualsUniqueParam) cronSched func (workflowRunTriggeredByWithPrismaCronScheduleEqualsUniqueParam) unique() {} func (workflowRunTriggeredByWithPrismaCronScheduleEqualsUniqueParam) equals() {} +type WorkflowRunTriggeredByWithPrismaCronNameEqualsSetParam interface { + field() builder.Field + getQuery() builder.Query + equals() + workflowRunTriggeredByModel() + cronNameField() +} + +type WorkflowRunTriggeredByWithPrismaCronNameSetParam interface { + field() builder.Field + getQuery() builder.Query + workflowRunTriggeredByModel() + cronNameField() +} + +type workflowRunTriggeredByWithPrismaCronNameSetParam struct { + data builder.Field + query builder.Query +} + +func (p workflowRunTriggeredByWithPrismaCronNameSetParam) field() builder.Field { + return p.data +} + +func (p workflowRunTriggeredByWithPrismaCronNameSetParam) getQuery() builder.Query { + return p.query +} + +func (p workflowRunTriggeredByWithPrismaCronNameSetParam) workflowRunTriggeredByModel() {} + +func (p workflowRunTriggeredByWithPrismaCronNameSetParam) cronNameField() {} + +type WorkflowRunTriggeredByWithPrismaCronNameWhereParam interface { + field() builder.Field + getQuery() builder.Query + workflowRunTriggeredByModel() + cronNameField() +} + +type workflowRunTriggeredByWithPrismaCronNameEqualsParam struct { + data builder.Field + query builder.Query +} + +func (p workflowRunTriggeredByWithPrismaCronNameEqualsParam) field() builder.Field { + return p.data +} + +func (p workflowRunTriggeredByWithPrismaCronNameEqualsParam) getQuery() builder.Query { + return p.query +} + +func (p workflowRunTriggeredByWithPrismaCronNameEqualsParam) workflowRunTriggeredByModel() {} + +func (p workflowRunTriggeredByWithPrismaCronNameEqualsParam) cronNameField() {} + +func (workflowRunTriggeredByWithPrismaCronNameSetParam) settable() {} +func (workflowRunTriggeredByWithPrismaCronNameEqualsParam) equals() {} + +type workflowRunTriggeredByWithPrismaCronNameEqualsUniqueParam struct { + data builder.Field + query builder.Query +} + +func (p workflowRunTriggeredByWithPrismaCronNameEqualsUniqueParam) field() builder.Field { + return p.data +} + +func (p workflowRunTriggeredByWithPrismaCronNameEqualsUniqueParam) getQuery() builder.Query { + return p.query +} + +func (p workflowRunTriggeredByWithPrismaCronNameEqualsUniqueParam) workflowRunTriggeredByModel() {} +func (p workflowRunTriggeredByWithPrismaCronNameEqualsUniqueParam) cronNameField() {} + +func (workflowRunTriggeredByWithPrismaCronNameEqualsUniqueParam) unique() {} +func (workflowRunTriggeredByWithPrismaCronNameEqualsUniqueParam) equals() {} + type WorkflowRunTriggeredByWithPrismaScheduledEqualsSetParam interface { field() builder.Field getQuery() builder.Query diff --git a/pkg/repository/prisma/dbsqlc/copyfrom.go b/pkg/repository/prisma/dbsqlc/copyfrom.go index 953a92d7a..db902bbec 100644 --- a/pkg/repository/prisma/dbsqlc/copyfrom.go +++ b/pkg/repository/prisma/dbsqlc/copyfrom.go @@ -192,6 +192,7 @@ func (r iteratorForCreateWorkflowRunTriggeredBys) Values() ([]interface{}, error r.rows[0].EventId, r.rows[0].CronParentId, r.rows[0].CronSchedule, + r.rows[0].CronName, r.rows[0].ScheduledId, }, nil } @@ -201,7 +202,7 @@ func (r iteratorForCreateWorkflowRunTriggeredBys) Err() error { } func (q *Queries) CreateWorkflowRunTriggeredBys(ctx context.Context, db DBTX, arg []CreateWorkflowRunTriggeredBysParams) (int64, error) { - return db.CopyFrom(ctx, []string{"WorkflowRunTriggeredBy"}, []string{"id", "tenantId", "parentId", "eventId", "cronParentId", "cronSchedule", "scheduledId"}, &iteratorForCreateWorkflowRunTriggeredBys{rows: arg}) + return db.CopyFrom(ctx, []string{"WorkflowRunTriggeredBy"}, []string{"id", "tenantId", "parentId", "eventId", "cronParentId", "cronSchedule", "cronName", "scheduledId"}, &iteratorForCreateWorkflowRunTriggeredBys{rows: arg}) } // iteratorForCreateWorkflowRuns implements pgx.CopyFromSource. diff --git a/pkg/repository/prisma/dbsqlc/models.go b/pkg/repository/prisma/dbsqlc/models.go index 00eec830a..1d71fcc2d 100644 --- a/pkg/repository/prisma/dbsqlc/models.go +++ b/pkg/repository/prisma/dbsqlc/models.go @@ -1700,6 +1700,7 @@ type WorkflowRunTriggeredBy struct { ScheduledId pgtype.UUID `json:"scheduledId"` Input []byte `json:"input"` ParentId pgtype.UUID `json:"parentId"` + CronName pgtype.Text `json:"cronName"` } type WorkflowTag struct { @@ -1726,6 +1727,8 @@ type WorkflowTriggerCronRef struct { CreatedAt pgtype.Timestamp `json:"createdAt"` DeletedAt pgtype.Timestamp `json:"deletedAt"` UpdatedAt pgtype.Timestamp `json:"updatedAt"` + Name pgtype.Text `json:"name"` + ID pgtype.UUID `json:"id"` } type WorkflowTriggerEventRef struct { diff --git a/pkg/repository/prisma/dbsqlc/schema.sql b/pkg/repository/prisma/dbsqlc/schema.sql index 3b6a4c48d..40d532e0a 100644 --- a/pkg/repository/prisma/dbsqlc/schema.sql +++ b/pkg/repository/prisma/dbsqlc/schema.sql @@ -880,6 +880,7 @@ CREATE TABLE "WorkflowRunTriggeredBy" ( "scheduledId" UUID, "input" JSONB, "parentId" UUID NOT NULL, + "cronName" TEXT, CONSTRAINT "WorkflowRunTriggeredBy_pkey" PRIMARY KEY ("id") ); @@ -906,7 +907,9 @@ CREATE TABLE "WorkflowTriggerCronRef" ( "additionalMetadata" JSONB, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "deletedAt" TIMESTAMP(3), - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP + "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "name" TEXT, + "id" UUID NOT NULL ); -- CreateTable @@ -1368,7 +1371,10 @@ CREATE UNIQUE INDEX "WorkflowTag_id_key" ON "WorkflowTag"("id" ASC); CREATE UNIQUE INDEX "WorkflowTag_tenantId_name_key" ON "WorkflowTag"("tenantId" ASC, "name" ASC); -- CreateIndex -CREATE UNIQUE INDEX "WorkflowTriggerCronRef_parentId_cron_key" ON "WorkflowTriggerCronRef"("parentId" ASC, "cron" ASC); +CREATE UNIQUE INDEX "WorkflowTriggerCronRef_id_key" ON "WorkflowTriggerCronRef"("id" ASC); + +-- CreateIndex +CREATE UNIQUE INDEX "WorkflowTriggerCronRef_parentId_cron_name_key" ON "WorkflowTriggerCronRef"("parentId" ASC, "cron" ASC, "name" ASC); -- CreateIndex CREATE UNIQUE INDEX "WorkflowTriggerEventRef_parentId_eventKey_key" ON "WorkflowTriggerEventRef"("parentId" ASC, "eventKey" ASC); @@ -1578,7 +1584,7 @@ ALTER TABLE "WorkflowRun" ADD CONSTRAINT "WorkflowRun_parentStepRunId_fkey" FORE ALTER TABLE "WorkflowRunStickyState" ADD CONSTRAINT "WorkflowRunStickyState_workflowRunId_fkey" FOREIGN KEY ("workflowRunId") REFERENCES "WorkflowRun"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey -ALTER TABLE "WorkflowRunTriggeredBy" ADD CONSTRAINT "WorkflowRunTriggeredBy_cronParentId_cronSchedule_fkey" FOREIGN KEY ("cronParentId", "cronSchedule") REFERENCES "WorkflowTriggerCronRef"("parentId", "cron") ON DELETE SET NULL ON UPDATE CASCADE; +ALTER TABLE "WorkflowRunTriggeredBy" ADD CONSTRAINT "WorkflowRunTriggeredBy_cronParentId_cronSchedule_cronName_fkey" FOREIGN KEY ("cronParentId", "cronSchedule", "cronName") REFERENCES "WorkflowTriggerCronRef"("parentId", "cron", "name") ON DELETE SET NULL ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "WorkflowRunTriggeredBy" ADD CONSTRAINT "WorkflowRunTriggeredBy_scheduledId_fkey" FOREIGN KEY ("scheduledId") REFERENCES "WorkflowTriggerScheduledRef"("id") ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/pkg/repository/prisma/dbsqlc/tickers.sql.go b/pkg/repository/prisma/dbsqlc/tickers.sql.go index bcffe7861..1aaa87cef 100644 --- a/pkg/repository/prisma/dbsqlc/tickers.sql.go +++ b/pkg/repository/prisma/dbsqlc/tickers.sql.go @@ -227,7 +227,7 @@ FROM active_cron_schedules WHERE cronSchedules."parentId" = active_cron_schedules."parentId" -RETURNING cronschedules."parentId", cronschedules.cron, cronschedules."tickerId", cronschedules.input, cronschedules.enabled, cronschedules."additionalMetadata", cronschedules."createdAt", cronschedules."deletedAt", cronschedules."updatedAt", active_cron_schedules."workflowVersionId", active_cron_schedules."tenantId" +RETURNING cronschedules."parentId", cronschedules.cron, cronschedules."tickerId", cronschedules.input, cronschedules.enabled, cronschedules."additionalMetadata", cronschedules."createdAt", cronschedules."deletedAt", cronschedules."updatedAt", cronschedules.name, cronschedules.id, active_cron_schedules."workflowVersionId", active_cron_schedules."tenantId" ` type PollCronSchedulesRow struct { @@ -240,6 +240,8 @@ type PollCronSchedulesRow struct { CreatedAt pgtype.Timestamp `json:"createdAt"` DeletedAt pgtype.Timestamp `json:"deletedAt"` UpdatedAt pgtype.Timestamp `json:"updatedAt"` + Name pgtype.Text `json:"name"` + ID pgtype.UUID `json:"id"` WorkflowVersionId pgtype.UUID `json:"workflowVersionId"` TenantId pgtype.UUID `json:"tenantId"` } @@ -263,6 +265,8 @@ func (q *Queries) PollCronSchedules(ctx context.Context, db DBTX, tickerid pgtyp &i.CreatedAt, &i.DeletedAt, &i.UpdatedAt, + &i.Name, + &i.ID, &i.WorkflowVersionId, &i.TenantId, ); err != nil { diff --git a/pkg/repository/prisma/dbsqlc/workflow_runs.sql b/pkg/repository/prisma/dbsqlc/workflow_runs.sql index 34433af02..93e6feff1 100644 --- a/pkg/repository/prisma/dbsqlc/workflow_runs.sql +++ b/pkg/repository/prisma/dbsqlc/workflow_runs.sql @@ -684,6 +684,7 @@ INSERT INTO "WorkflowRunTriggeredBy" ( "eventId", "cronParentId", "cronSchedule", + "cronName", "scheduledId" ) VALUES ( gen_random_uuid(), @@ -694,12 +695,12 @@ INSERT INTO "WorkflowRunTriggeredBy" ( @workflowRunId::uuid, sqlc.narg('eventId')::uuid, sqlc.narg('cronParentId')::uuid, - sqlc.narg('cron')::text, + sqlc.narg('cronSchedule')::text, + sqlc.narg('cronName')::text, sqlc.narg('scheduledId')::uuid ) RETURNING *; -- name: CreateWorkflowRunTriggeredBys :copyfrom - INSERT INTO "WorkflowRunTriggeredBy" ( "id", "tenantId", @@ -707,6 +708,7 @@ INSERT INTO "WorkflowRunTriggeredBy" ( "eventId", "cronParentId", "cronSchedule", + "cronName", "scheduledId" ) VALUES ( $1, @@ -715,8 +717,8 @@ INSERT INTO "WorkflowRunTriggeredBy" ( $4, $5, $6, - $7 - + $7, + $8 ); -- name: CreateGetGroupKeyRun :one @@ -1519,29 +1521,7 @@ DELETE FROM "WorkflowTriggerScheduledRef" WHERE "id" = @scheduleId::uuid; --- name: ListCronWorkflows :many -SELECT - w."name", - w."id" as "workflowId", - v."id" as "workflowVersionId", - w."tenantId", - t.*, - c.* -FROM "WorkflowTriggerCronRef" c -JOIN "WorkflowTriggers" t ON c."parentId" = t."id" -JOIN "WorkflowVersion" v ON t."workflowVersionId" = v."id" -JOIN "Workflow" w on v."workflowId" = w."id" -WHERE v."deletedAt" IS NULL - AND w."tenantId" = @tenantId::uuid -ORDER BY - case when @orderBy = 'createdAt ASC' THEN t."createdAt" END ASC , - case when @orderBy = 'createdAt DESC' THEN t."createdAt" END DESC, - t."id" ASC -OFFSET - COALESCE(sqlc.narg('offset'), 0) -LIMIT - COALESCE(sqlc.narg('limit'), 50); - +-- TODO move this to workflow.sql -- name: CountCronWorkflows :one SELECT count(*) FROM "WorkflowTriggerCronRef" c diff --git a/pkg/repository/prisma/dbsqlc/workflow_runs.sql.go b/pkg/repository/prisma/dbsqlc/workflow_runs.sql.go index 1534a9b34..8c3b43094 100644 --- a/pkg/repository/prisma/dbsqlc/workflow_runs.sql.go +++ b/pkg/repository/prisma/dbsqlc/workflow_runs.sql.go @@ -99,6 +99,7 @@ JOIN "Workflow" w on v."workflowId" = w."id" WHERE v."deletedAt" IS NULL AND w."tenantId" = $1::uuid ` +// TODO move this to workflow.sql func (q *Queries) CountCronWorkflows(ctx context.Context, db DBTX, tenantid pgtype.UUID) (int64, error) { row := db.QueryRow(ctx, countCronWorkflows, tenantid) var count int64 @@ -1028,6 +1029,7 @@ INSERT INTO "WorkflowRunTriggeredBy" ( "eventId", "cronParentId", "cronSchedule", + "cronName", "scheduledId" ) VALUES ( gen_random_uuid(), @@ -1039,8 +1041,9 @@ INSERT INTO "WorkflowRunTriggeredBy" ( $3::uuid, $4::uuid, $5::text, - $6::uuid -) RETURNING id, "createdAt", "updatedAt", "deletedAt", "tenantId", "eventId", "cronParentId", "cronSchedule", "scheduledId", input, "parentId" + $6::text, + $7::uuid +) RETURNING id, "createdAt", "updatedAt", "deletedAt", "tenantId", "eventId", "cronParentId", "cronSchedule", "scheduledId", input, "parentId", "cronName" ` type CreateWorkflowRunTriggeredByParams struct { @@ -1048,7 +1051,8 @@ type CreateWorkflowRunTriggeredByParams struct { Workflowrunid pgtype.UUID `json:"workflowrunid"` EventId pgtype.UUID `json:"eventId"` CronParentId pgtype.UUID `json:"cronParentId"` - Cron pgtype.Text `json:"cron"` + CronSchedule pgtype.Text `json:"cronSchedule"` + CronName pgtype.Text `json:"cronName"` ScheduledId pgtype.UUID `json:"scheduledId"` } @@ -1058,7 +1062,8 @@ func (q *Queries) CreateWorkflowRunTriggeredBy(ctx context.Context, db DBTX, arg arg.Workflowrunid, arg.EventId, arg.CronParentId, - arg.Cron, + arg.CronSchedule, + arg.CronName, arg.ScheduledId, ) var i WorkflowRunTriggeredBy @@ -1074,6 +1079,7 @@ func (q *Queries) CreateWorkflowRunTriggeredBy(ctx context.Context, db DBTX, arg &i.ScheduledId, &i.Input, &i.ParentId, + &i.CronName, ) return &i, err } @@ -1085,6 +1091,7 @@ type CreateWorkflowRunTriggeredBysParams struct { EventId pgtype.UUID `json:"eventId"` CronParentId pgtype.UUID `json:"cronParentId"` CronSchedule pgtype.Text `json:"cronSchedule"` + CronName pgtype.Text `json:"cronName"` ScheduledId pgtype.UUID `json:"scheduledId"` } @@ -1604,7 +1611,7 @@ func (q *Queries) GetStepsForWorkflowVersion(ctx context.Context, db DBTX, workf const getWorkflowRun = `-- name: GetWorkflowRun :many SELECT runs."createdAt", runs."updatedAt", runs."deletedAt", runs."tenantId", runs."workflowVersionId", runs.status, runs.error, runs."startedAt", runs."finishedAt", runs."concurrencyGroupId", runs."displayName", runs.id, runs."childIndex", runs."childKey", runs."parentId", runs."parentStepRunId", runs."additionalMetadata", runs.duration, runs.priority, runs."insertOrder", - runtriggers.id, runtriggers."createdAt", runtriggers."updatedAt", runtriggers."deletedAt", runtriggers."tenantId", runtriggers."eventId", runtriggers."cronParentId", runtriggers."cronSchedule", runtriggers."scheduledId", runtriggers.input, runtriggers."parentId", + runtriggers.id, runtriggers."createdAt", runtriggers."updatedAt", runtriggers."deletedAt", runtriggers."tenantId", runtriggers."eventId", runtriggers."cronParentId", runtriggers."cronSchedule", runtriggers."scheduledId", runtriggers.input, runtriggers."parentId", runtriggers."cronName", workflowversion.id, workflowversion."createdAt", workflowversion."updatedAt", workflowversion."deletedAt", workflowversion.version, workflowversion."order", workflowversion."workflowId", workflowversion.checksum, workflowversion."scheduleTimeout", workflowversion."onFailureJobId", workflowversion.sticky, workflowversion.kind, workflowversion."defaultPriority", workflow."name" as "workflowName", -- waiting on https://github.com/sqlc-dev/sqlc/pull/2858 for nullable fields @@ -1691,6 +1698,7 @@ func (q *Queries) GetWorkflowRun(ctx context.Context, db DBTX, arg GetWorkflowRu &i.WorkflowRunTriggeredBy.ScheduledId, &i.WorkflowRunTriggeredBy.Input, &i.WorkflowRunTriggeredBy.ParentId, + &i.WorkflowRunTriggeredBy.CronName, &i.WorkflowVersion.ID, &i.WorkflowVersion.CreatedAt, &i.WorkflowVersion.UpdatedAt, @@ -1754,7 +1762,7 @@ SELECT r."createdAt", r."updatedAt", r."deletedAt", r."tenantId", r."workflowVersionId", r.status, r.error, r."startedAt", r."finishedAt", r."concurrencyGroupId", r."displayName", r.id, r."childIndex", r."childKey", r."parentId", r."parentStepRunId", r."additionalMetadata", r.duration, r.priority, r."insertOrder", wv.id, wv."createdAt", wv."updatedAt", wv."deletedAt", wv.version, wv."order", wv."workflowId", wv.checksum, wv."scheduleTimeout", wv."onFailureJobId", wv.sticky, wv.kind, wv."defaultPriority", w.id, w."createdAt", w."updatedAt", w."deletedAt", w."tenantId", w.name, w.description, w."isPaused", - tb.id, tb."createdAt", tb."updatedAt", tb."deletedAt", tb."tenantId", tb."eventId", tb."cronParentId", tb."cronSchedule", tb."scheduledId", tb.input, tb."parentId" + tb.id, tb."createdAt", tb."updatedAt", tb."deletedAt", tb."tenantId", tb."eventId", tb."cronParentId", tb."cronSchedule", tb."scheduledId", tb.input, tb."parentId", tb."cronName" FROM "WorkflowRun" r JOIN @@ -1856,6 +1864,7 @@ func (q *Queries) GetWorkflowRunById(ctx context.Context, db DBTX, arg GetWorkfl &i.WorkflowRunTriggeredBy.ScheduledId, &i.WorkflowRunTriggeredBy.Input, &i.WorkflowRunTriggeredBy.ParentId, + &i.WorkflowRunTriggeredBy.CronName, ) return &i, err } @@ -1865,7 +1874,7 @@ SELECT r."createdAt", r."updatedAt", r."deletedAt", r."tenantId", r."workflowVersionId", r.status, r.error, r."startedAt", r."finishedAt", r."concurrencyGroupId", r."displayName", r.id, r."childIndex", r."childKey", r."parentId", r."parentStepRunId", r."additionalMetadata", r.duration, r.priority, r."insertOrder", wv.id, wv."createdAt", wv."updatedAt", wv."deletedAt", wv.version, wv."order", wv."workflowId", wv.checksum, wv."scheduleTimeout", wv."onFailureJobId", wv.sticky, wv.kind, wv."defaultPriority", w.id, w."createdAt", w."updatedAt", w."deletedAt", w."tenantId", w.name, w.description, w."isPaused", - tb.id, tb."createdAt", tb."updatedAt", tb."deletedAt", tb."tenantId", tb."eventId", tb."cronParentId", tb."cronSchedule", tb."scheduledId", tb.input, tb."parentId" + tb.id, tb."createdAt", tb."updatedAt", tb."deletedAt", tb."tenantId", tb."eventId", tb."cronParentId", tb."cronSchedule", tb."scheduledId", tb.input, tb."parentId", tb."cronName" FROM "WorkflowRun" r JOIN @@ -1973,6 +1982,7 @@ func (q *Queries) GetWorkflowRunByIds(ctx context.Context, db DBTX, arg GetWorkf &i.WorkflowRunTriggeredBy.ScheduledId, &i.WorkflowRunTriggeredBy.Input, &i.WorkflowRunTriggeredBy.ParentId, + &i.WorkflowRunTriggeredBy.CronName, ); err != nil { return nil, err } @@ -2031,7 +2041,7 @@ func (q *Queries) GetWorkflowRunStickyStateForUpdate(ctx context.Context, db DBT } const getWorkflowRunTrigger = `-- name: GetWorkflowRunTrigger :one -SELECT id, "createdAt", "updatedAt", "deletedAt", "tenantId", "eventId", "cronParentId", "cronSchedule", "scheduledId", input, "parentId" +SELECT id, "createdAt", "updatedAt", "deletedAt", "tenantId", "eventId", "cronParentId", "cronSchedule", "scheduledId", input, "parentId", "cronName" FROM "WorkflowRunTriggeredBy" WHERE @@ -2059,6 +2069,7 @@ func (q *Queries) GetWorkflowRunTrigger(ctx context.Context, db DBTX, arg GetWor &i.ScheduledId, &i.Input, &i.ParentId, + &i.CronName, ) return &i, err } @@ -2240,104 +2251,6 @@ func (q *Queries) ListChildWorkflowRunCounts(ctx context.Context, db DBTX, stepr return items, nil } -const listCronWorkflows = `-- name: ListCronWorkflows :many -SELECT - w."name", - w."id" as "workflowId", - v."id" as "workflowVersionId", - w."tenantId", - t.id, t."createdAt", t."updatedAt", t."deletedAt", t."workflowVersionId", t."tenantId", - c."parentId", c.cron, c."tickerId", c.input, c.enabled, c."additionalMetadata", c."createdAt", c."deletedAt", c."updatedAt" -FROM "WorkflowTriggerCronRef" c -JOIN "WorkflowTriggers" t ON c."parentId" = t."id" -JOIN "WorkflowVersion" v ON t."workflowVersionId" = v."id" -JOIN "Workflow" w on v."workflowId" = w."id" -WHERE v."deletedAt" IS NULL - AND w."tenantId" = $1::uuid -ORDER BY - case when $2 = 'createdAt ASC' THEN t."createdAt" END ASC , - case when $2 = 'createdAt DESC' THEN t."createdAt" END DESC, - t."id" ASC -OFFSET - COALESCE($3, 0) -LIMIT - COALESCE($4, 50) -` - -type ListCronWorkflowsParams struct { - Tenantid pgtype.UUID `json:"tenantid"` - Orderby interface{} `json:"orderby"` - Offset interface{} `json:"offset"` - Limit interface{} `json:"limit"` -} - -type ListCronWorkflowsRow struct { - Name string `json:"name"` - WorkflowId pgtype.UUID `json:"workflowId"` - WorkflowVersionId pgtype.UUID `json:"workflowVersionId"` - TenantId pgtype.UUID `json:"tenantId"` - ID pgtype.UUID `json:"id"` - CreatedAt pgtype.Timestamp `json:"createdAt"` - UpdatedAt pgtype.Timestamp `json:"updatedAt"` - DeletedAt pgtype.Timestamp `json:"deletedAt"` - WorkflowVersionId_2 pgtype.UUID `json:"workflowVersionId_2"` - TenantId_2 pgtype.UUID `json:"tenantId_2"` - ParentId pgtype.UUID `json:"parentId"` - Cron string `json:"cron"` - TickerId pgtype.UUID `json:"tickerId"` - Input []byte `json:"input"` - Enabled bool `json:"enabled"` - AdditionalMetadata []byte `json:"additionalMetadata"` - CreatedAt_2 pgtype.Timestamp `json:"createdAt_2"` - DeletedAt_2 pgtype.Timestamp `json:"deletedAt_2"` - UpdatedAt_2 pgtype.Timestamp `json:"updatedAt_2"` -} - -func (q *Queries) ListCronWorkflows(ctx context.Context, db DBTX, arg ListCronWorkflowsParams) ([]*ListCronWorkflowsRow, error) { - rows, err := db.Query(ctx, listCronWorkflows, - arg.Tenantid, - arg.Orderby, - arg.Offset, - arg.Limit, - ) - if err != nil { - return nil, err - } - defer rows.Close() - var items []*ListCronWorkflowsRow - for rows.Next() { - var i ListCronWorkflowsRow - if err := rows.Scan( - &i.Name, - &i.WorkflowId, - &i.WorkflowVersionId, - &i.TenantId, - &i.ID, - &i.CreatedAt, - &i.UpdatedAt, - &i.DeletedAt, - &i.WorkflowVersionId_2, - &i.TenantId_2, - &i.ParentId, - &i.Cron, - &i.TickerId, - &i.Input, - &i.Enabled, - &i.AdditionalMetadata, - &i.CreatedAt_2, - &i.DeletedAt_2, - &i.UpdatedAt_2, - ); err != nil { - return nil, err - } - items = append(items, &i) - } - if err := rows.Err(); err != nil { - return nil, err - } - return items, nil -} - const listScheduledWorkflows = `-- name: ListScheduledWorkflows :many SELECT w."name", @@ -2560,7 +2473,7 @@ const listWorkflowRuns = `-- name: ListWorkflowRuns :many SELECT runs."createdAt", runs."updatedAt", runs."deletedAt", runs."tenantId", runs."workflowVersionId", runs.status, runs.error, runs."startedAt", runs."finishedAt", runs."concurrencyGroupId", runs."displayName", runs.id, runs."childIndex", runs."childKey", runs."parentId", runs."parentStepRunId", runs."additionalMetadata", runs.duration, runs.priority, runs."insertOrder", workflow.id, workflow."createdAt", workflow."updatedAt", workflow."deletedAt", workflow."tenantId", workflow.name, workflow.description, workflow."isPaused", - runtriggers.id, runtriggers."createdAt", runtriggers."updatedAt", runtriggers."deletedAt", runtriggers."tenantId", runtriggers."eventId", runtriggers."cronParentId", runtriggers."cronSchedule", runtriggers."scheduledId", runtriggers.input, runtriggers."parentId", + runtriggers.id, runtriggers."createdAt", runtriggers."updatedAt", runtriggers."deletedAt", runtriggers."tenantId", runtriggers."eventId", runtriggers."cronParentId", runtriggers."cronSchedule", runtriggers."scheduledId", runtriggers.input, runtriggers."parentId", runtriggers."cronName", workflowversion.id, workflowversion."createdAt", workflowversion."updatedAt", workflowversion."deletedAt", workflowversion.version, workflowversion."order", workflowversion."workflowId", workflowversion.checksum, workflowversion."scheduleTimeout", workflowversion."onFailureJobId", workflowversion.sticky, workflowversion.kind, workflowversion."defaultPriority", -- waiting on https://github.com/sqlc-dev/sqlc/pull/2858 for nullable events field events.id, events.key, events."createdAt", events."updatedAt" @@ -2759,6 +2672,7 @@ func (q *Queries) ListWorkflowRuns(ctx context.Context, db DBTX, arg ListWorkflo &i.WorkflowRunTriggeredBy.ScheduledId, &i.WorkflowRunTriggeredBy.Input, &i.WorkflowRunTriggeredBy.ParentId, + &i.WorkflowRunTriggeredBy.CronName, &i.WorkflowVersion.ID, &i.WorkflowVersion.CreatedAt, &i.WorkflowVersion.UpdatedAt, diff --git a/pkg/repository/prisma/dbsqlc/workflows.sql b/pkg/repository/prisma/dbsqlc/workflows.sql index ccd7b7ddc..b9daf5936 100644 --- a/pkg/repository/prisma/dbsqlc/workflows.sql +++ b/pkg/repository/prisma/dbsqlc/workflows.sql @@ -331,11 +331,74 @@ INSERT INTO "WorkflowTriggerEventRef" ( INSERT INTO "WorkflowTriggerCronRef" ( "parentId", "cron", - "input" + "name", + "input", + "additionalMetadata", + "id" ) VALUES ( @workflowTriggersId::uuid, @cronTrigger::text, - sqlc.narg('input')::jsonb + sqlc.narg('name')::text, + sqlc.narg('input')::jsonb, + sqlc.narg('additionalMetadata')::jsonb, + gen_random_uuid() +) RETURNING *; + + +-- name: CreateWorkflowTriggerCronRefForWorkflow :one +WITH latest_version AS ( + SELECT "id" FROM "WorkflowVersion" + WHERE "workflowId" = @workflowId::uuid + ORDER BY "order" DESC + LIMIT 1 +), +latest_trigger AS ( + SELECT "id" FROM "WorkflowTriggers" + WHERE "workflowVersionId" = (SELECT "id" FROM latest_version) + ORDER BY "createdAt" DESC + LIMIT 1 +) +INSERT INTO "WorkflowTriggerCronRef" ( + "parentId", + "cron", + "name", + "input", + "additionalMetadata", + "id" +) VALUES ( + (SELECT "id" FROM latest_trigger), + @cronTrigger::text, + sqlc.narg('name')::text, + sqlc.narg('input')::jsonb, + sqlc.narg('additionalMetadata')::jsonb, + gen_random_uuid() +) RETURNING *; + +-- name: CreateWorkflowTriggerScheduledRefForWorkflow :one +WITH latest_version AS ( + SELECT "id" FROM "WorkflowVersion" + WHERE "workflowId" = @workflowId::uuid + ORDER BY "order" DESC + LIMIT 1 +), +latest_trigger AS ( + SELECT "id" FROM "WorkflowTriggers" + WHERE "workflowVersionId" = (SELECT "id" FROM latest_version) + ORDER BY "createdAt" DESC + LIMIT 1 +) +INSERT INTO "WorkflowTriggerScheduledRef" ( + "id", + "parentId", + "triggerAt", + "input", + "additionalMetadata" +) VALUES ( + gen_random_uuid(), + (SELECT "id" FROM latest_version), + @scheduledTrigger::timestamp, + @input::jsonb, + @additionalMetadata::jsonb ) RETURNING *; -- name: CreateWorkflowTriggerScheduledRef :one @@ -343,14 +406,14 @@ INSERT INTO "WorkflowTriggerScheduledRef" ( "id", "parentId", "triggerAt", - "tickerId", - "input" + "input", + "additionalMetadata" ) VALUES ( gen_random_uuid(), @workflowVersionId::uuid, @scheduledTrigger::timestamp, - NULL, -- or provide a tickerId if applicable - NULL -- or provide input if applicable + @input::jsonb, + @additionalMetadata::jsonb ) RETURNING *; -- name: ListWorkflowsForEvent :many @@ -664,3 +727,57 @@ WHERE ORDER BY wv."order" DESC LIMIT 1; + + +-- name: ListCronWorkflows :many +-- Get all of the latest workflow versions for the tenant +WITH latest_versions AS ( + SELECT DISTINCT ON("workflowId") + workflowVersions."id" AS "workflowVersionId", + workflowVersions."workflowId" + FROM + "WorkflowVersion" as workflowVersions + JOIN + "Workflow" as workflow ON workflow."id" = workflowVersions."workflowId" + WHERE + workflow."tenantId" = @tenantId::uuid + AND workflowVersions."deletedAt" IS NULL + ORDER BY "workflowId", "order" DESC +) +SELECT + latest_versions."workflowVersionId", + w."name" as "workflowName", + w."id" as "workflowId", + w."tenantId", + t."id" as "triggerId", + c."id" as "cronId", + t.*, + c.* +FROM + latest_versions +JOIN + "WorkflowTriggers" as t ON t."workflowVersionId" = latest_versions."workflowVersionId" +JOIN + "WorkflowTriggerCronRef" as c ON c."parentId" = t."id" +JOIN + "Workflow" w on w."id" = latest_versions."workflowId" +WHERE + t."deletedAt" IS NULL + AND w."tenantId" = @tenantId::uuid + AND (@cronId::uuid IS NULL OR t."id" = @cronId::uuid) + AND (@workflowId::uuid IS NULL OR w."id" = @workflowId::uuid) + AND (sqlc.narg('additionalMetadata')::jsonb IS NULL OR + c."additionalMetadata" @> sqlc.narg('additionalMetadata')::jsonb) +ORDER BY + case when @orderBy = 'createdAt ASC' THEN t."createdAt" END ASC , + case when @orderBy = 'createdAt DESC' THEN t."createdAt" END DESC, + t."id" ASC +OFFSET + COALESCE(sqlc.narg('offset'), 0) +LIMIT + COALESCE(sqlc.narg('limit'), 50); + +-- name: DeleteWorkflowTriggerCronRef :exec +DELETE FROM "WorkflowTriggerCronRef" +WHERE + "id" = @id::uuid; diff --git a/pkg/repository/prisma/dbsqlc/workflows.sql.go b/pkg/repository/prisma/dbsqlc/workflows.sql.go index dcdf89393..3eb9815dc 100644 --- a/pkg/repository/prisma/dbsqlc/workflows.sql.go +++ b/pkg/repository/prisma/dbsqlc/workflows.sql.go @@ -567,22 +567,36 @@ const createWorkflowTriggerCronRef = `-- name: CreateWorkflowTriggerCronRef :one INSERT INTO "WorkflowTriggerCronRef" ( "parentId", "cron", - "input" + "name", + "input", + "additionalMetadata", + "id" ) VALUES ( $1::uuid, $2::text, - $3::jsonb -) RETURNING "parentId", cron, "tickerId", input, enabled, "additionalMetadata", "createdAt", "deletedAt", "updatedAt" + $3::text, + $4::jsonb, + $5::jsonb, + gen_random_uuid() +) RETURNING "parentId", cron, "tickerId", input, enabled, "additionalMetadata", "createdAt", "deletedAt", "updatedAt", name, id ` type CreateWorkflowTriggerCronRefParams struct { Workflowtriggersid pgtype.UUID `json:"workflowtriggersid"` Crontrigger string `json:"crontrigger"` + Name pgtype.Text `json:"name"` Input []byte `json:"input"` + AdditionalMetadata []byte `json:"additionalMetadata"` } func (q *Queries) CreateWorkflowTriggerCronRef(ctx context.Context, db DBTX, arg CreateWorkflowTriggerCronRefParams) (*WorkflowTriggerCronRef, error) { - row := db.QueryRow(ctx, createWorkflowTriggerCronRef, arg.Workflowtriggersid, arg.Crontrigger, arg.Input) + row := db.QueryRow(ctx, createWorkflowTriggerCronRef, + arg.Workflowtriggersid, + arg.Crontrigger, + arg.Name, + arg.Input, + arg.AdditionalMetadata, + ) var i WorkflowTriggerCronRef err := row.Scan( &i.ParentId, @@ -594,6 +608,71 @@ func (q *Queries) CreateWorkflowTriggerCronRef(ctx context.Context, db DBTX, arg &i.CreatedAt, &i.DeletedAt, &i.UpdatedAt, + &i.Name, + &i.ID, + ) + return &i, err +} + +const createWorkflowTriggerCronRefForWorkflow = `-- name: CreateWorkflowTriggerCronRefForWorkflow :one +WITH latest_version AS ( + SELECT "id" FROM "WorkflowVersion" + WHERE "workflowId" = $5::uuid + ORDER BY "order" DESC + LIMIT 1 +), +latest_trigger AS ( + SELECT "id" FROM "WorkflowTriggers" + WHERE "workflowVersionId" = (SELECT "id" FROM latest_version) + ORDER BY "createdAt" DESC + LIMIT 1 +) +INSERT INTO "WorkflowTriggerCronRef" ( + "parentId", + "cron", + "name", + "input", + "additionalMetadata", + "id" +) VALUES ( + (SELECT "id" FROM latest_trigger), + $1::text, + $2::text, + $3::jsonb, + $4::jsonb, + gen_random_uuid() +) RETURNING "parentId", cron, "tickerId", input, enabled, "additionalMetadata", "createdAt", "deletedAt", "updatedAt", name, id +` + +type CreateWorkflowTriggerCronRefForWorkflowParams struct { + Crontrigger string `json:"crontrigger"` + Name pgtype.Text `json:"name"` + Input []byte `json:"input"` + AdditionalMetadata []byte `json:"additionalMetadata"` + Workflowid pgtype.UUID `json:"workflowid"` +} + +func (q *Queries) CreateWorkflowTriggerCronRefForWorkflow(ctx context.Context, db DBTX, arg CreateWorkflowTriggerCronRefForWorkflowParams) (*WorkflowTriggerCronRef, error) { + row := db.QueryRow(ctx, createWorkflowTriggerCronRefForWorkflow, + arg.Crontrigger, + arg.Name, + arg.Input, + arg.AdditionalMetadata, + arg.Workflowid, + ) + var i WorkflowTriggerCronRef + err := row.Scan( + &i.ParentId, + &i.Cron, + &i.TickerId, + &i.Input, + &i.Enabled, + &i.AdditionalMetadata, + &i.CreatedAt, + &i.DeletedAt, + &i.UpdatedAt, + &i.Name, + &i.ID, ) return &i, err } @@ -625,24 +704,92 @@ INSERT INTO "WorkflowTriggerScheduledRef" ( "id", "parentId", "triggerAt", - "tickerId", - "input" + "input", + "additionalMetadata" ) VALUES ( gen_random_uuid(), $1::uuid, $2::timestamp, - NULL, -- or provide a tickerId if applicable - NULL -- or provide input if applicable + $3::jsonb, + $4::jsonb ) RETURNING id, "parentId", "triggerAt", "tickerId", input, "childIndex", "childKey", "parentStepRunId", "parentWorkflowRunId", "additionalMetadata", "createdAt", "deletedAt", "updatedAt" ` type CreateWorkflowTriggerScheduledRefParams struct { - Workflowversionid pgtype.UUID `json:"workflowversionid"` - Scheduledtrigger pgtype.Timestamp `json:"scheduledtrigger"` + Workflowversionid pgtype.UUID `json:"workflowversionid"` + Scheduledtrigger pgtype.Timestamp `json:"scheduledtrigger"` + Input []byte `json:"input"` + Additionalmetadata []byte `json:"additionalmetadata"` } func (q *Queries) CreateWorkflowTriggerScheduledRef(ctx context.Context, db DBTX, arg CreateWorkflowTriggerScheduledRefParams) (*WorkflowTriggerScheduledRef, error) { - row := db.QueryRow(ctx, createWorkflowTriggerScheduledRef, arg.Workflowversionid, arg.Scheduledtrigger) + row := db.QueryRow(ctx, createWorkflowTriggerScheduledRef, + arg.Workflowversionid, + arg.Scheduledtrigger, + arg.Input, + arg.Additionalmetadata, + ) + var i WorkflowTriggerScheduledRef + err := row.Scan( + &i.ID, + &i.ParentId, + &i.TriggerAt, + &i.TickerId, + &i.Input, + &i.ChildIndex, + &i.ChildKey, + &i.ParentStepRunId, + &i.ParentWorkflowRunId, + &i.AdditionalMetadata, + &i.CreatedAt, + &i.DeletedAt, + &i.UpdatedAt, + ) + return &i, err +} + +const createWorkflowTriggerScheduledRefForWorkflow = `-- name: CreateWorkflowTriggerScheduledRefForWorkflow :one +WITH latest_version AS ( + SELECT "id" FROM "WorkflowVersion" + WHERE "workflowId" = $4::uuid + ORDER BY "order" DESC + LIMIT 1 +), +latest_trigger AS ( + SELECT "id" FROM "WorkflowTriggers" + WHERE "workflowVersionId" = (SELECT "id" FROM latest_version) + ORDER BY "createdAt" DESC + LIMIT 1 +) +INSERT INTO "WorkflowTriggerScheduledRef" ( + "id", + "parentId", + "triggerAt", + "input", + "additionalMetadata" +) VALUES ( + gen_random_uuid(), + (SELECT "id" FROM latest_version), + $1::timestamp, + $2::jsonb, + $3::jsonb +) RETURNING id, "parentId", "triggerAt", "tickerId", input, "childIndex", "childKey", "parentStepRunId", "parentWorkflowRunId", "additionalMetadata", "createdAt", "deletedAt", "updatedAt" +` + +type CreateWorkflowTriggerScheduledRefForWorkflowParams struct { + Scheduledtrigger pgtype.Timestamp `json:"scheduledtrigger"` + Input []byte `json:"input"` + Additionalmetadata []byte `json:"additionalmetadata"` + Workflowid pgtype.UUID `json:"workflowid"` +} + +func (q *Queries) CreateWorkflowTriggerScheduledRefForWorkflow(ctx context.Context, db DBTX, arg CreateWorkflowTriggerScheduledRefForWorkflowParams) (*WorkflowTriggerScheduledRef, error) { + row := db.QueryRow(ctx, createWorkflowTriggerScheduledRefForWorkflow, + arg.Scheduledtrigger, + arg.Input, + arg.Additionalmetadata, + arg.Workflowid, + ) var i WorkflowTriggerScheduledRef err := row.Scan( &i.ID, @@ -775,6 +922,17 @@ func (q *Queries) CreateWorkflowVersion(ctx context.Context, db DBTX, arg Create return &i, err } +const deleteWorkflowTriggerCronRef = `-- name: DeleteWorkflowTriggerCronRef :exec +DELETE FROM "WorkflowTriggerCronRef" +WHERE + "id" = $1::uuid +` + +func (q *Queries) DeleteWorkflowTriggerCronRef(ctx context.Context, db DBTX, id pgtype.UUID) error { + _, err := db.Exec(ctx, deleteWorkflowTriggerCronRef, id) + return err +} + const getLatestWorkflowVersionForWorkflows = `-- name: GetLatestWorkflowVersionForWorkflows :many WITH latest_versions AS ( SELECT DISTINCT ON (workflowVersions."workflowId") @@ -981,7 +1139,7 @@ func (q *Queries) GetWorkflowVersionById(ctx context.Context, db DBTX, id pgtype const getWorkflowVersionCronTriggerRefs = `-- name: GetWorkflowVersionCronTriggerRefs :many SELECT - wtc."parentId", wtc.cron, wtc."tickerId", wtc.input, wtc.enabled, wtc."additionalMetadata", wtc."createdAt", wtc."deletedAt", wtc."updatedAt" + wtc."parentId", wtc.cron, wtc."tickerId", wtc.input, wtc.enabled, wtc."additionalMetadata", wtc."createdAt", wtc."deletedAt", wtc."updatedAt", wtc.name, wtc.id FROM "WorkflowTriggerCronRef" as wtc JOIN "WorkflowTriggers" as wt ON wt."id" = wtc."parentId" @@ -1008,6 +1166,8 @@ func (q *Queries) GetWorkflowVersionCronTriggerRefs(ctx context.Context, db DBTX &i.CreatedAt, &i.DeletedAt, &i.UpdatedAt, + &i.Name, + &i.ID, ); err != nil { return nil, err } @@ -1333,6 +1493,143 @@ func (q *Queries) LinkOnFailureJob(ctx context.Context, db DBTX, arg LinkOnFailu return &i, err } +const listCronWorkflows = `-- name: ListCronWorkflows :many +WITH latest_versions AS ( + SELECT DISTINCT ON("workflowId") + workflowVersions."id" AS "workflowVersionId", + workflowVersions."workflowId" + FROM + "WorkflowVersion" as workflowVersions + JOIN + "Workflow" as workflow ON workflow."id" = workflowVersions."workflowId" + WHERE + workflow."tenantId" = $1::uuid + AND workflowVersions."deletedAt" IS NULL + ORDER BY "workflowId", "order" DESC +) +SELECT + latest_versions."workflowVersionId", + w."name" as "workflowName", + w."id" as "workflowId", + w."tenantId", + t."id" as "triggerId", + c."id" as "cronId", + t.id, t."createdAt", t."updatedAt", t."deletedAt", t."workflowVersionId", t."tenantId", + c."parentId", c.cron, c."tickerId", c.input, c.enabled, c."additionalMetadata", c."createdAt", c."deletedAt", c."updatedAt", c.name, c.id +FROM + latest_versions +JOIN + "WorkflowTriggers" as t ON t."workflowVersionId" = latest_versions."workflowVersionId" +JOIN + "WorkflowTriggerCronRef" as c ON c."parentId" = t."id" +JOIN + "Workflow" w on w."id" = latest_versions."workflowId" +WHERE + t."deletedAt" IS NULL + AND w."tenantId" = $1::uuid + AND ($2::uuid IS NULL OR t."id" = $2::uuid) + AND ($3::uuid IS NULL OR w."id" = $3::uuid) + AND ($4::jsonb IS NULL OR + c."additionalMetadata" @> $4::jsonb) +ORDER BY + case when $5 = 'createdAt ASC' THEN t."createdAt" END ASC , + case when $5 = 'createdAt DESC' THEN t."createdAt" END DESC, + t."id" ASC +OFFSET + COALESCE($6, 0) +LIMIT + COALESCE($7, 50) +` + +type ListCronWorkflowsParams struct { + Tenantid pgtype.UUID `json:"tenantid"` + Cronid pgtype.UUID `json:"cronid"` + Workflowid pgtype.UUID `json:"workflowid"` + AdditionalMetadata []byte `json:"additionalMetadata"` + Orderby interface{} `json:"orderby"` + Offset interface{} `json:"offset"` + Limit interface{} `json:"limit"` +} + +type ListCronWorkflowsRow struct { + WorkflowVersionId pgtype.UUID `json:"workflowVersionId"` + WorkflowName string `json:"workflowName"` + WorkflowId pgtype.UUID `json:"workflowId"` + TenantId pgtype.UUID `json:"tenantId"` + TriggerId pgtype.UUID `json:"triggerId"` + CronId pgtype.UUID `json:"cronId"` + ID pgtype.UUID `json:"id"` + CreatedAt pgtype.Timestamp `json:"createdAt"` + UpdatedAt pgtype.Timestamp `json:"updatedAt"` + DeletedAt pgtype.Timestamp `json:"deletedAt"` + WorkflowVersionId_2 pgtype.UUID `json:"workflowVersionId_2"` + TenantId_2 pgtype.UUID `json:"tenantId_2"` + ParentId pgtype.UUID `json:"parentId"` + Cron string `json:"cron"` + TickerId pgtype.UUID `json:"tickerId"` + Input []byte `json:"input"` + Enabled bool `json:"enabled"` + AdditionalMetadata []byte `json:"additionalMetadata"` + CreatedAt_2 pgtype.Timestamp `json:"createdAt_2"` + DeletedAt_2 pgtype.Timestamp `json:"deletedAt_2"` + UpdatedAt_2 pgtype.Timestamp `json:"updatedAt_2"` + Name pgtype.Text `json:"name"` + ID_2 pgtype.UUID `json:"id_2"` +} + +// Get all of the latest workflow versions for the tenant +func (q *Queries) ListCronWorkflows(ctx context.Context, db DBTX, arg ListCronWorkflowsParams) ([]*ListCronWorkflowsRow, error) { + rows, err := db.Query(ctx, listCronWorkflows, + arg.Tenantid, + arg.Cronid, + arg.Workflowid, + arg.AdditionalMetadata, + arg.Orderby, + arg.Offset, + arg.Limit, + ) + if err != nil { + return nil, err + } + defer rows.Close() + var items []*ListCronWorkflowsRow + for rows.Next() { + var i ListCronWorkflowsRow + if err := rows.Scan( + &i.WorkflowVersionId, + &i.WorkflowName, + &i.WorkflowId, + &i.TenantId, + &i.TriggerId, + &i.CronId, + &i.ID, + &i.CreatedAt, + &i.UpdatedAt, + &i.DeletedAt, + &i.WorkflowVersionId_2, + &i.TenantId_2, + &i.ParentId, + &i.Cron, + &i.TickerId, + &i.Input, + &i.Enabled, + &i.AdditionalMetadata, + &i.CreatedAt_2, + &i.DeletedAt_2, + &i.UpdatedAt_2, + &i.Name, + &i.ID_2, + ); err != nil { + return nil, err + } + items = append(items, &i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const listPausedWorkflows = `-- name: ListPausedWorkflows :many SELECT "id" diff --git a/pkg/repository/prisma/workflow.go b/pkg/repository/prisma/workflow.go index ac1e5f4cb..b2f508ef0 100644 --- a/pkg/repository/prisma/workflow.go +++ b/pkg/repository/prisma/workflow.go @@ -2,9 +2,11 @@ package prisma import ( "context" + "encoding/json" "errors" "fmt" "strings" + "time" "github.com/google/uuid" "github.com/jackc/pgx/v5" @@ -279,6 +281,130 @@ func (r *workflowAPIRepository) GetWorkflowMetrics(tenantId, workflowId string, }, nil } +func (w *workflowAPIRepository) ListCronWorkflows(ctx context.Context, tenantId string, opts *repository.ListCronWorkflowsOpts) ([]*dbsqlc.ListCronWorkflowsRow, int64, error) { + if err := w.v.Validate(opts); err != nil { + return nil, 0, err + } + + ctx, cancel := context.WithTimeout(ctx, time.Second*30) + defer cancel() + + count, err := w.queries.CountCronWorkflows(ctx, w.pool, sqlchelpers.UUIDFromStr(tenantId)) + + if err != nil { + return nil, 0, err + } + + listOpts := dbsqlc.ListCronWorkflowsParams{ + Tenantid: sqlchelpers.UUIDFromStr(tenantId), + } + + if opts.Limit != nil { + listOpts.Limit = pgtype.Int4{ + Int32: int32(*opts.Limit), // nolint: gosec + Valid: true, + } + } + + if opts.Offset != nil { + listOpts.Offset = pgtype.Int4{ + Int32: int32(*opts.Offset), // nolint: gosec + Valid: true, + } + } + + orderByField := "createdAt" + + if opts.OrderBy != nil { + orderByField = *opts.OrderBy + } + + orderByDirection := "DESC" + + if opts.OrderDirection != nil { + orderByDirection = *opts.OrderDirection + } + + listOpts.Orderby = orderByField + " " + orderByDirection + + cronWorkflows, err := w.queries.ListCronWorkflows(ctx, w.pool, listOpts) + if err != nil { + return nil, 0, err + } + + return cronWorkflows, count, nil +} + +func (w *workflowAPIRepository) GetCronWorkflow(ctx context.Context, tenantId, cronWorkflowId string) (*dbsqlc.ListCronWorkflowsRow, error) { + listOpts := dbsqlc.ListCronWorkflowsParams{ + Tenantid: sqlchelpers.UUIDFromStr(tenantId), + Cronid: sqlchelpers.UUIDFromStr(cronWorkflowId), + } + + cronWorkflows, err := w.queries.ListCronWorkflows(ctx, w.pool, listOpts) + + if err != nil { + return nil, err + } + + if len(cronWorkflows) == 0 { + return nil, nil + } + + return cronWorkflows[0], nil +} + +func (w *workflowAPIRepository) DeleteCronWorkflow(ctx context.Context, tenantId, id string) error { + return w.queries.DeleteWorkflowTriggerCronRef(ctx, w.pool, sqlchelpers.UUIDFromStr(id)) +} + +func (w *workflowAPIRepository) CreateCronWorkflow(ctx context.Context, tenantId string, opts *repository.CreateCronWorkflowTriggerOpts) (*dbsqlc.ListCronWorkflowsRow, error) { + + var input, additionalMetadata []byte + var err error + + if opts.Input != nil { + input, err = json.Marshal(opts.Input) + + if err != nil { + return nil, err + } + } + + if opts.AdditionalMetadata != nil { + additionalMetadata, err = json.Marshal(opts.AdditionalMetadata) + + if err != nil { + return nil, err + } + } + + createParams := dbsqlc.CreateWorkflowTriggerCronRefForWorkflowParams{ + Workflowid: sqlchelpers.UUIDFromStr(opts.WorkflowId), + Crontrigger: opts.Cron, + Name: sqlchelpers.TextFromStr(opts.Name), + Input: input, + AdditionalMetadata: additionalMetadata, + } + + cronTrigger, err := w.queries.CreateWorkflowTriggerCronRefForWorkflow(ctx, w.pool, createParams) + + if err != nil { + return nil, err + } + + row, err := w.queries.ListCronWorkflows(ctx, w.pool, dbsqlc.ListCronWorkflowsParams{ + Tenantid: sqlchelpers.UUIDFromStr(tenantId), + Cronid: cronTrigger.ID, + }) + + if err != nil { + return nil, err + } + + return row[0], nil +} + type workflowEngineRepository struct { pool *pgxpool.Pool v validator.Validator @@ -505,6 +631,51 @@ func (r *workflowEngineRepository) CreateSchedules( return r.queries.CreateSchedules(ctx, r.pool, createParams) } +func (r *workflowAPIRepository) CreateScheduledWorkflow(ctx context.Context, tenantId string, opts *repository.CreateScheduledWorkflowRunForWorkflowOpts) (*dbsqlc.ListScheduledWorkflowsRow, error) { + if err := r.v.Validate(opts); err != nil { + return nil, err + } + + var input, additionalMetadata []byte + var err error + + if opts.Input != nil { + input, err = json.Marshal(opts.Input) + } + + if opts.AdditionalMetadata != nil { + additionalMetadata, err = json.Marshal(opts.AdditionalMetadata) + } + + if err != nil { + return nil, err + } + + createParams := dbsqlc.CreateWorkflowTriggerScheduledRefForWorkflowParams{ + Workflowid: sqlchelpers.UUIDFromStr(opts.WorkflowId), + Scheduledtrigger: sqlchelpers.TimestampFromTime(opts.ScheduledTrigger), + Input: input, + Additionalmetadata: additionalMetadata, + } + + created, err := r.queries.CreateWorkflowTriggerScheduledRefForWorkflow(ctx, r.pool, createParams) + + if err != nil { + return nil, err + } + + scheduled, err := r.queries.ListScheduledWorkflows(ctx, r.pool, dbsqlc.ListScheduledWorkflowsParams{ + Tenantid: sqlchelpers.UUIDFromStr(tenantId), + Scheduleid: created.ID, + }) + + if err != nil { + return nil, err + } + + return scheduled[0], nil +} + func (r *workflowEngineRepository) GetLatestWorkflowVersions(ctx context.Context, tenantId string, workflowIds []string) ([]*dbsqlc.GetWorkflowVersionForEngineRow, error) { var workflowVersionIds = make([]pgtype.UUID, len(workflowIds)) diff --git a/pkg/repository/prisma/workflow_run.go b/pkg/repository/prisma/workflow_run.go index ba93c7522..40487f587 100644 --- a/pkg/repository/prisma/workflow_run.go +++ b/pkg/repository/prisma/workflow_run.go @@ -848,20 +848,6 @@ func (w *workflowRunEngineRepository) GetWorkflowRunByIds(ctx context.Context, t return runs, nil } -func (w *workflowRunEngineRepository) GetFailureDetails(ctx context.Context, tenantId, workflowRunId string) ([]*dbsqlc.GetFailureDetailsRow, error) { - - steps, err := w.queries.GetFailureDetails(ctx, w.pool, dbsqlc.GetFailureDetailsParams{ - Tenantid: sqlchelpers.UUIDFromStr(tenantId), - Workflowrunid: sqlchelpers.UUIDFromStr(workflowRunId), - }) - - if err != nil { - return nil, err - } - - return steps, nil -} - func (w *workflowRunEngineRepository) GetWorkflowRunAdditionalMeta(ctx context.Context, tenantId, workflowRunId string) (*dbsqlc.GetWorkflowRunAdditionalMetaRow, error) { return w.queries.GetWorkflowRunAdditionalMeta(ctx, w.pool, dbsqlc.GetWorkflowRunAdditionalMetaParams{ Tenantid: sqlchelpers.UUIDFromStr(tenantId), @@ -1709,7 +1695,7 @@ func createNewWorkflowRuns(ctx context.Context, pool *pgxpool.Pool, queries *dbs var ( eventId, cronParentId, scheduledWorkflowId pgtype.UUID - cronSchedule pgtype.Text + cronSchedule, cronName pgtype.Text ) if opt.TriggeringEventId != nil { @@ -1724,6 +1710,10 @@ func createNewWorkflowRuns(ctx context.Context, pool *pgxpool.Pool, queries *dbs cronSchedule = sqlchelpers.TextFromStr(*opt.Cron) } + if opt.CronName != nil { + cronName = sqlchelpers.TextFromStr(*opt.CronName) + } + if opt.ScheduledWorkflowId != nil { scheduledWorkflowId = sqlchelpers.UUIDFromStr(*opt.ScheduledWorkflowId) } @@ -1736,6 +1726,7 @@ func createNewWorkflowRuns(ctx context.Context, pool *pgxpool.Pool, queries *dbs CronParentId: cronParentId, ScheduledId: scheduledWorkflowId, CronSchedule: cronSchedule, + CronName: cronName, } triggeredByParams = append(triggeredByParams, cp) diff --git a/pkg/repository/workflow.go b/pkg/repository/workflow.go index e4a135bba..df9c20d9d 100644 --- a/pkg/repository/workflow.go +++ b/pkg/repository/workflow.go @@ -58,6 +58,19 @@ type CreateWorkflowVersionOpts struct { DefaultPriority *int32 `validate:"omitempty,min=1,max=3"` } +type CreateCronWorkflowTriggerOpts struct { + // (required) the workflow id + WorkflowId string `validate:"required,uuid"` + + // (required) the workflow name + Name string `validate:"required"` + + Cron string `validate:"required,cron"` + + Input map[string]interface{} + AdditionalMetadata map[string]interface{} +} + type CreateWorkflowConcurrencyOpts struct { // (optional) the action id for getting the concurrency group Action *string `validate:"omitempty,actionId"` @@ -96,6 +109,15 @@ type CreateWorkflowSchedulesOpts struct { AdditionalMetadata []byte } +type CreateScheduledWorkflowRunForWorkflowOpts struct { + WorkflowId string `validate:"required,uuid"` + + ScheduledTrigger time.Time + + Input map[string]interface{} + AdditionalMetadata map[string]interface{} +} + type CreateWorkflowTagOpts struct { // (required) the tag name Name string `validate:"required"` @@ -265,6 +287,21 @@ type WorkflowAPIRepository interface { // GetWorkflowWorkerCount returns the number of workers for a given workflow. GetWorkflowWorkerCount(tenantId, workflowId string) (int, int, error) + + // CreateCronWorkflow creates a cron trigger + CreateCronWorkflow(ctx context.Context, tenantId string, opts *CreateCronWorkflowTriggerOpts) (*dbsqlc.ListCronWorkflowsRow, error) + + // List ScheduledWorkflows lists workflows by scheduled trigger + ListCronWorkflows(ctx context.Context, tenantId string, opts *ListCronWorkflowsOpts) ([]*dbsqlc.ListCronWorkflowsRow, int64, error) + + // GetCronWorkflow gets a cron workflow run + GetCronWorkflow(ctx context.Context, tenantId, cronWorkflowId string) (*dbsqlc.ListCronWorkflowsRow, error) + + // DeleteCronWorkflow deletes a cron workflow run + DeleteCronWorkflow(ctx context.Context, tenantId, id string) error + + // CreateScheduledWorkflow creates a scheduled workflow run + CreateScheduledWorkflow(ctx context.Context, tenantId string, opts *CreateScheduledWorkflowRunForWorkflowOpts) (*dbsqlc.ListScheduledWorkflowsRow, error) } type WorkflowEngineRepository interface { diff --git a/pkg/repository/workflow_run.go b/pkg/repository/workflow_run.go index 0a2968dfa..c3903baf3 100644 --- a/pkg/repository/workflow_run.go +++ b/pkg/repository/workflow_run.go @@ -31,6 +31,7 @@ type CreateWorkflowRunOpts struct { // (optional) the cron schedule that triggered the workflow run Cron *string `validate:"omitnil,cron,required_without=ManualTriggerInput,required_without=TriggeringEventId,required_without=ScheduledWorkflowId,excluded_with=ManualTriggerInput,excluded_with=TriggeringEventId,excluded_with=ScheduledWorkflowId"` CronParentId *string `validate:"omitnil,uuid,required_without=ManualTriggerInput,required_without=TriggeringEventId,required_without=ScheduledWorkflowId,excluded_with=ManualTriggerInput,excluded_with=TriggeringEventId,excluded_with=ScheduledWorkflowId"` + CronName *string `validate:"omitnil"` // (optional) the scheduled trigger ScheduledWorkflowId *string `validate:"omitnil,uuid,required_without=ManualTriggerInput,required_without=TriggeringEventId,required_without=Cron,excluded_with=ManualTriggerInput,excluded_with=TriggeringEventId,excluded_with=Cron"` @@ -190,6 +191,7 @@ func GetCreateWorkflowRunOptsFromEvent( func GetCreateWorkflowRunOptsFromCron( cron, cronParentId string, + cronName *string, workflowVersion *dbsqlc.GetWorkflowVersionForEngineRow, input []byte, additionalMetadata map[string]interface{}, @@ -203,6 +205,7 @@ func GetCreateWorkflowRunOptsFromCron( WorkflowVersionId: sqlchelpers.UUIDToStr(workflowVersion.WorkflowVersion.ID), Cron: &cron, CronParentId: &cronParentId, + CronName: cronName, TriggeredBy: string(datautils.TriggeredByCron), InputData: input, AdditionalMetadata: additionalMetadata, @@ -420,6 +423,7 @@ type ListScheduledWorkflowsOpts struct { AdditionalMetadata map[string]interface{} `validate:"omitempty"` } +// TODO move this to workflow.go type ListCronWorkflowsOpts struct { // (optional) number of events to skip Offset *int @@ -461,9 +465,6 @@ type WorkflowRunAPIRepository interface { // UpdateScheduledWorkflow updates a scheduled workflow run UpdateScheduledWorkflow(ctx context.Context, tenantId, scheduledWorkflowId string, triggerAt time.Time) error - // List ScheduledWorkflows lists workflows by scheduled trigger - ListCronWorkflows(ctx context.Context, tenantId string, opts *ListCronWorkflowsOpts) ([]*dbsqlc.ListCronWorkflowsRow, int64, error) - // CreateNewWorkflowRun creates a new workflow run for a workflow version. CreateNewWorkflowRun(ctx context.Context, tenantId string, opts *CreateWorkflowRunOpts) (*dbsqlc.WorkflowRun, error) @@ -550,6 +551,4 @@ type WorkflowRunEngineRepository interface { // DeleteExpiredWorkflowRuns deletes workflow runs that were created before the given time. It returns the number of deleted runs // and the number of non-deleted runs that match the conditions. SoftDeleteExpiredWorkflowRuns(ctx context.Context, tenantId string, statuses []dbsqlc.WorkflowRunStatus, before time.Time) (bool, error) - - GetFailureDetails(ctx context.Context, tenantId, workflowRunId string) ([]*dbsqlc.GetFailureDetailsRow, error) } diff --git a/prisma/migrations/20241030131339_tmp/migration.sql b/prisma/migrations/20241030131339_tmp/migration.sql new file mode 100644 index 000000000..e994d5f0b --- /dev/null +++ b/prisma/migrations/20241030131339_tmp/migration.sql @@ -0,0 +1,23 @@ +/* + Warnings: + + - A unique constraint covering the columns `[parentId,cron,name]` on the table `WorkflowTriggerCronRef` will be added. If there are existing duplicate values, this will fail. + - The required column `id` was added to the `WorkflowTriggerCronRef` table with a prisma-level default value. This is not possible if the table is not empty. Please add this column as optional, then populate it before making it required. + +*/ +-- DropForeignKey +ALTER TABLE "WorkflowRunTriggeredBy" DROP CONSTRAINT "WorkflowRunTriggeredBy_cronParentId_cronSchedule_fkey"; + +-- AlterTable +ALTER TABLE "WorkflowRunTriggeredBy" ADD COLUMN "cronName" TEXT; + +-- AlterTable +ALTER TABLE "WorkflowTriggerCronRef" ADD COLUMN "id" UUID NOT NULL, +ADD COLUMN "name" TEXT, +ADD CONSTRAINT "WorkflowTriggerCronRef_pkey" PRIMARY KEY ("id"); + +-- CreateIndex +CREATE UNIQUE INDEX "WorkflowTriggerCronRef_parentId_cron_name_key" ON "WorkflowTriggerCronRef"("parentId", "cron", "name"); + +-- AddForeignKey +ALTER TABLE "WorkflowRunTriggeredBy" ADD CONSTRAINT "WorkflowRunTriggeredBy_cronParentId_cronSchedule_cronName_fkey" FOREIGN KEY ("cronParentId", "cronSchedule", "cronName") REFERENCES "WorkflowTriggerCronRef"("parentId", "cron", "name") ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/prisma/migrations/20241030133040_tmp/migration.sql b/prisma/migrations/20241030133040_tmp/migration.sql new file mode 100644 index 000000000..1465f196e --- /dev/null +++ b/prisma/migrations/20241030133040_tmp/migration.sql @@ -0,0 +1,10 @@ +/* + Warnings: + + - The primary key for the `WorkflowTriggerCronRef` table will be changed. If it partially fails, the table could be left without primary key constraint. + - You are about to drop the column `id` on the `WorkflowTriggerCronRef` table. All the data in the column will be lost. + +*/ +-- AlterTable +ALTER TABLE "WorkflowTriggerCronRef" DROP CONSTRAINT "WorkflowTriggerCronRef_pkey", +DROP COLUMN "id"; diff --git a/prisma/migrations/20241030150107_tmp/migration.sql b/prisma/migrations/20241030150107_tmp/migration.sql new file mode 100644 index 000000000..67a1cef29 --- /dev/null +++ b/prisma/migrations/20241030150107_tmp/migration.sql @@ -0,0 +1,12 @@ +/* + Warnings: + + - A unique constraint covering the columns `[id]` on the table `WorkflowTriggerCronRef` will be added. If there are existing duplicate values, this will fail. + - The required column `id` was added to the `WorkflowTriggerCronRef` table with a prisma-level default value. This is not possible if the table is not empty. Please add this column as optional, then populate it before making it required. + +*/ +-- AlterTable +ALTER TABLE "WorkflowTriggerCronRef" ADD COLUMN "id" UUID NOT NULL; + +-- CreateIndex +CREATE UNIQUE INDEX "WorkflowTriggerCronRef_id_key" ON "WorkflowTriggerCronRef"("id"); diff --git a/prisma/migrations/20241104202817_tmp/migration.sql b/prisma/migrations/20241104202817_tmp/migration.sql new file mode 100644 index 000000000..a64493312 --- /dev/null +++ b/prisma/migrations/20241104202817_tmp/migration.sql @@ -0,0 +1,2 @@ +-- DropIndex +DROP INDEX "WorkflowTriggerCronRef_parentId_cron_key"; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 0cfc8a901..dfe0c4a2a 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -645,6 +645,10 @@ model WorkflowTriggerEventRef { } model WorkflowTriggerCronRef { + id String @unique @default(uuid()) @db.Uuid + + name String? + // the parent workflow parent WorkflowTriggers @relation(fields: [parentId], references: [id], onDelete: Cascade, onUpdate: Cascade) parentId String @db.Uuid @@ -670,7 +674,7 @@ model WorkflowTriggerCronRef { additionalMetadata Json? // cron references must be unique per workflow - @@unique([parentId, cron]) + @@unique([parentId, cron, name]) } model WorkflowTriggerScheduledRef { @@ -1102,9 +1106,10 @@ model WorkflowRunTriggeredBy { eventId String? @db.Uuid // the cron reference that triggered this workflow - cron WorkflowTriggerCronRef? @relation(fields: [cronParentId, cronSchedule], references: [parentId, cron]) + cron WorkflowTriggerCronRef? @relation(fields: [cronParentId, cronSchedule, cronName], references: [parentId, cron, name]) cronParentId String? @db.Uuid cronSchedule String? + cronName String? // a specific time that triggered this workflow scheduled WorkflowTriggerScheduledRef? @relation(fields: [scheduledId], references: [id]) diff --git a/sql/migrations/20241030131347_tmp.sql b/sql/migrations/20241030131347_tmp.sql new file mode 100644 index 000000000..6f6e239cd --- /dev/null +++ b/sql/migrations/20241030131347_tmp.sql @@ -0,0 +1,6 @@ +-- Modify "WorkflowTriggerCronRef" table +ALTER TABLE "WorkflowTriggerCronRef" ADD COLUMN "id" uuid NOT NULL, ADD COLUMN "name" text NULL, ADD PRIMARY KEY ("id"); +-- Create index "WorkflowTriggerCronRef_parentId_cron_name_key" to table: "WorkflowTriggerCronRef" +CREATE UNIQUE INDEX "WorkflowTriggerCronRef_parentId_cron_name_key" ON "WorkflowTriggerCronRef" ("parentId", "cron", "name"); +-- Modify "WorkflowRunTriggeredBy" table +ALTER TABLE "WorkflowRunTriggeredBy" DROP CONSTRAINT "WorkflowRunTriggeredBy_cronParentId_cronSchedule_fkey", ADD COLUMN "cronName" text NULL, ADD CONSTRAINT "WorkflowRunTriggeredBy_cronParentId_cronSchedule_cronName_fkey" FOREIGN KEY ("cronParentId", "cronSchedule", "cronName") REFERENCES "WorkflowTriggerCronRef" ("parentId", "cron", "name") ON UPDATE CASCADE ON DELETE SET NULL; diff --git a/sql/migrations/20241030133048_tmp.sql b/sql/migrations/20241030133048_tmp.sql new file mode 100644 index 000000000..7efec8213 --- /dev/null +++ b/sql/migrations/20241030133048_tmp.sql @@ -0,0 +1,2 @@ +-- Modify "WorkflowTriggerCronRef" table +ALTER TABLE "WorkflowTriggerCronRef" DROP CONSTRAINT "WorkflowTriggerCronRef_pkey", DROP COLUMN "id"; diff --git a/sql/migrations/20241030150116_tmp.sql b/sql/migrations/20241030150116_tmp.sql new file mode 100644 index 000000000..3c5392d64 --- /dev/null +++ b/sql/migrations/20241030150116_tmp.sql @@ -0,0 +1,5 @@ +-- Modify "WorkflowTriggerCronRef" table +CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; +ALTER TABLE "WorkflowTriggerCronRef" ADD COLUMN "id" uuid NOT NULL DEFAULT uuid_generate_v4(); +-- Create index "WorkflowTriggerCronRef_id_key" to table: "WorkflowTriggerCronRef" +CREATE UNIQUE INDEX "WorkflowTriggerCronRef_id_key" ON "WorkflowTriggerCronRef" ("id"); diff --git a/sql/migrations/20241030150342_tmp.sql b/sql/migrations/20241030150342_tmp.sql new file mode 100644 index 000000000..5eb64be46 --- /dev/null +++ b/sql/migrations/20241030150342_tmp.sql @@ -0,0 +1,2 @@ +-- Modify "WorkflowTriggerCronRef" table +ALTER TABLE "WorkflowTriggerCronRef" ALTER COLUMN "id" DROP DEFAULT; diff --git a/sql/migrations/20241104202826_tmp.sql b/sql/migrations/20241104202826_tmp.sql new file mode 100644 index 000000000..c092ab7fb --- /dev/null +++ b/sql/migrations/20241104202826_tmp.sql @@ -0,0 +1,2 @@ +-- Drop index "WorkflowTriggerCronRef_parentId_cron_key" from table: "WorkflowTriggerCronRef" +DROP INDEX "WorkflowTriggerCronRef_parentId_cron_key"; diff --git a/sql/schema/schema.sql b/sql/schema/schema.sql index a085378a6..0207b0621 100644 --- a/sql/schema/schema.sql +++ b/sql/schema/schema.sql @@ -880,6 +880,7 @@ CREATE TABLE "WorkflowRunTriggeredBy" ( "scheduledId" UUID, "input" JSONB, "parentId" UUID NOT NULL, + "cronName" TEXT, CONSTRAINT "WorkflowRunTriggeredBy_pkey" PRIMARY KEY ("id") ); @@ -906,7 +907,9 @@ CREATE TABLE "WorkflowTriggerCronRef" ( "additionalMetadata" JSONB, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "deletedAt" TIMESTAMP(3), - "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP + "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "name" TEXT, + "id" UUID NOT NULL ); -- CreateTable @@ -1368,7 +1371,10 @@ CREATE UNIQUE INDEX "WorkflowTag_id_key" ON "WorkflowTag"("id" ASC); CREATE UNIQUE INDEX "WorkflowTag_tenantId_name_key" ON "WorkflowTag"("tenantId" ASC, "name" ASC); -- CreateIndex -CREATE UNIQUE INDEX "WorkflowTriggerCronRef_parentId_cron_key" ON "WorkflowTriggerCronRef"("parentId" ASC, "cron" ASC); +CREATE UNIQUE INDEX "WorkflowTriggerCronRef_id_key" ON "WorkflowTriggerCronRef"("id" ASC); + +-- CreateIndex +CREATE UNIQUE INDEX "WorkflowTriggerCronRef_parentId_cron_name_key" ON "WorkflowTriggerCronRef"("parentId" ASC, "cron" ASC, "name" ASC); -- CreateIndex CREATE UNIQUE INDEX "WorkflowTriggerEventRef_parentId_eventKey_key" ON "WorkflowTriggerEventRef"("parentId" ASC, "eventKey" ASC); @@ -1578,7 +1584,7 @@ ALTER TABLE "WorkflowRun" ADD CONSTRAINT "WorkflowRun_parentStepRunId_fkey" FORE ALTER TABLE "WorkflowRunStickyState" ADD CONSTRAINT "WorkflowRunStickyState_workflowRunId_fkey" FOREIGN KEY ("workflowRunId") REFERENCES "WorkflowRun"("id") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey -ALTER TABLE "WorkflowRunTriggeredBy" ADD CONSTRAINT "WorkflowRunTriggeredBy_cronParentId_cronSchedule_fkey" FOREIGN KEY ("cronParentId", "cronSchedule") REFERENCES "WorkflowTriggerCronRef"("parentId", "cron") ON DELETE SET NULL ON UPDATE CASCADE; +ALTER TABLE "WorkflowRunTriggeredBy" ADD CONSTRAINT "WorkflowRunTriggeredBy_cronParentId_cronSchedule_cronName_fkey" FOREIGN KEY ("cronParentId", "cronSchedule", "cronName") REFERENCES "WorkflowTriggerCronRef"("parentId", "cron", "name") ON DELETE SET NULL ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "WorkflowRunTriggeredBy" ADD CONSTRAINT "WorkflowRunTriggeredBy_scheduledId_fkey" FOREIGN KEY ("scheduledId") REFERENCES "WorkflowTriggerScheduledRef"("id") ON DELETE SET NULL ON UPDATE CASCADE;