Refactor global datasource part 2 (#16399)
## Context Deprecating TwentyORMManager in favor of TwentyORMGlobalManager (temporarily, as this will simplify the ultimate goal to later replace all usages with the new TwentyORMGlobalManagerV2 which will have a similar signature) This means this PR had to refactor a bit of code to pass down the workspaceId when not available directly as it is now a requirement, meaning we also deprecated scopedWorkspaceContextFactory to have a less obscure way to fetch the workspaceId and have something more declarative. Step 3 will be to update TwentyORMGlobalManager to use a featureFlag toggling and use the new GlobalWorkspaceOrmManager internally using the new cache service Step 4 will be to remove the feature flag and pg_pool patch
This commit is contained in:
+2
@@ -97,9 +97,11 @@ export class WorkflowToolWorkspaceService {
|
||||
createUpdateWorkflowVersionPositionsTool(this.deps, context);
|
||||
const activateWorkflowVersion = createActivateWorkflowVersionTool(
|
||||
this.deps,
|
||||
context,
|
||||
);
|
||||
const deactivateWorkflowVersion = createDeactivateWorkflowVersionTool(
|
||||
this.deps,
|
||||
context,
|
||||
);
|
||||
const computeStepOutputSchema = createComputeStepOutputSchemaTool(
|
||||
this.deps,
|
||||
|
||||
+6
-1
@@ -1,6 +1,9 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
import { type WorkflowToolDependencies } from 'src/modules/workflow/workflow-tools/types/workflow-tool-dependencies.type';
|
||||
import {
|
||||
type WorkflowToolContext,
|
||||
type WorkflowToolDependencies,
|
||||
} from 'src/modules/workflow/workflow-tools/types/workflow-tool-dependencies.type';
|
||||
|
||||
const activateWorkflowVersionSchema = z.object({
|
||||
workflowVersionId: z
|
||||
@@ -14,6 +17,7 @@ type ActivateWorkflowVersionInput = z.infer<
|
||||
|
||||
export const createActivateWorkflowVersionTool = (
|
||||
deps: Pick<WorkflowToolDependencies, 'workflowTriggerService'>,
|
||||
context: WorkflowToolContext,
|
||||
) => ({
|
||||
name: 'activate_workflow_version' as const,
|
||||
description:
|
||||
@@ -23,6 +27,7 @@ export const createActivateWorkflowVersionTool = (
|
||||
try {
|
||||
return await deps.workflowTriggerService.activateWorkflowVersion(
|
||||
parameters.workflowVersionId,
|
||||
context.workspaceId,
|
||||
);
|
||||
} catch (error) {
|
||||
return {
|
||||
|
||||
+1
@@ -155,6 +155,7 @@ This is the most efficient way for AI to create workflows as it handles all the
|
||||
if (parameters.activate) {
|
||||
await deps.workflowTriggerService.activateWorkflowVersion(
|
||||
workflowVersionId,
|
||||
context.workspaceId,
|
||||
);
|
||||
|
||||
await updateWorkflowStatus({
|
||||
|
||||
+6
-1
@@ -1,6 +1,9 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
import { type WorkflowToolDependencies } from 'src/modules/workflow/workflow-tools/types/workflow-tool-dependencies.type';
|
||||
import {
|
||||
type WorkflowToolContext,
|
||||
type WorkflowToolDependencies,
|
||||
} from 'src/modules/workflow/workflow-tools/types/workflow-tool-dependencies.type';
|
||||
|
||||
const deactivateWorkflowVersionSchema = z.object({
|
||||
workflowVersionId: z
|
||||
@@ -14,6 +17,7 @@ type DeactivateWorkflowVersionInput = z.infer<
|
||||
|
||||
export const createDeactivateWorkflowVersionTool = (
|
||||
deps: Pick<WorkflowToolDependencies, 'workflowTriggerService'>,
|
||||
context: WorkflowToolContext,
|
||||
) => ({
|
||||
name: 'deactivate_workflow_version' as const,
|
||||
description:
|
||||
@@ -23,6 +27,7 @@ export const createDeactivateWorkflowVersionTool = (
|
||||
try {
|
||||
return await deps.workflowTriggerService.deactivateWorkflowVersion(
|
||||
parameters.workflowVersionId,
|
||||
context.workspaceId,
|
||||
);
|
||||
} catch (error) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user