Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+2
-2
@@ -2,7 +2,7 @@ import { Fragment, useContext } from "react";
|
||||
import { BaseEdge, EdgeLabelRenderer, type EdgeProps, getStraightPath } from "@xyflow/react";
|
||||
import WorkflowContext from "../../context/WorkflowContext";
|
||||
import clsx from "clsx";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
|
||||
function getConditionLabel(condition: string) {
|
||||
if (condition === "true" || condition === "false") {
|
||||
@@ -20,7 +20,7 @@ function getConditionLabel(condition: string) {
|
||||
return condition;
|
||||
}
|
||||
|
||||
export default function CustomEdge({ id, data, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, style = {}, markerEnd }: EdgeProps) {
|
||||
export default function CustomEdge({ id, data, sourceX, sourceY, targetX, targetY, sourcePosition: _sourcePosition, targetPosition: _targetPosition, style = {}, markerEnd }: EdgeProps) {
|
||||
const { isReadOnly, onEdgeDelete } = useContext(WorkflowContext);
|
||||
const [edgePath, labelX, labelY] = getStraightPath({
|
||||
sourceX,
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ import SimpleBadge from "~/components/ui/badges/SimpleBadge";
|
||||
import { WorkflowStatus } from "../../dtos/WorkflowStatus";
|
||||
import ShowModalButton from "~/components/ui/json/ShowModalButton";
|
||||
import ErrorBanner from "~/components/ui/banners/ErrorBanner";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { formatWorkflowExecutionErrorText } from "../../utils/workflowExecutionErrorText";
|
||||
|
||||
interface Props {
|
||||
@@ -20,7 +20,7 @@ enum State {
|
||||
WaitingForBlock = "waitingBlock",
|
||||
Unknown = "unknown",
|
||||
}
|
||||
export default function WorkflowResultBadge({ startedAt, completedAt, status, error }: Props) {
|
||||
export default function WorkflowResultBadge({ startedAt: _startedAt, completedAt: _completedAt, status, error }: Props) {
|
||||
function getState() {
|
||||
if (status === "waitingBlock") {
|
||||
return State.WaitingForBlock;
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { Position, Handle, type NodeProps } from "@xyflow/react";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { WorkflowBlockDto } from "../../dtos/WorkflowBlockDto";
|
||||
import { getWorkflowBlockCategoryLabel, getWorkflowBlockName, WorkflowBlockTypes } from "../../dtos/WorkflowBlockTypes";
|
||||
import WorkflowContext from "../../context/WorkflowContext";
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { Position, Handle, type NodeProps } from "@xyflow/react";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { WorkflowBlockDto } from "../../dtos/WorkflowBlockDto";
|
||||
import { getWorkflowBlockCategoryLabel, getWorkflowBlockName, WorkflowBlockTypes } from "../../dtos/WorkflowBlockTypes";
|
||||
import WorkflowContext from "../../context/WorkflowContext";
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import ButtonPrimary from "~/components/ui/buttons/ButtonPrimary";
|
||||
import ButtonSecondary from "~/components/ui/buttons/ButtonSecondary";
|
||||
import { WorkflowConditionOperators, WorkflowConditionsDto, WorkflowConditionsGroupDto } from "~/modules/workflowEngine/dtos/WorkflowConditionDtos";
|
||||
@@ -12,10 +12,10 @@ import { TrashIcon } from "~/components/ui/icons/vendor";
|
||||
function ConditionsGroupInput({
|
||||
workflow,
|
||||
block,
|
||||
type,
|
||||
type: _type,
|
||||
conditionsGroup,
|
||||
onSave,
|
||||
onCancel,
|
||||
onCancel: _onCancel,
|
||||
}: {
|
||||
workflow: WorkflowDto;
|
||||
block: WorkflowBlockDto;
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { useState } from "react";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import SlideOverWideEmpty from "~/components/ui/slideOvers/SlideOverWideEmpty";
|
||||
import { WorkflowConditionsGroupDto } from "~/modules/workflowEngine/dtos/WorkflowConditionDtos";
|
||||
import ConditionsGroupInput from "./ConditionsGroupInput";
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { type NodeProps } from "@xyflow/react";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
|
||||
export default function SetTriggerNode({ id }: NodeProps) {
|
||||
return (
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import TableSimple from "~/components/ui/tables/TableSimple";
|
||||
import { WorkflowsTemplateDto } from "../../dtos/WorkflowsTemplateDto";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { getTemplateBlockDescription, getTemplateWorkflowName } from "../../utils/workflowTemplateI18n";
|
||||
|
||||
export default function PreviewWorkflowsTemplate({ template }: { template: WorkflowsTemplateDto }) {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import InfoBanner from "~/components/ui/banners/InfoBanner";
|
||||
import FormGroup from "~/components/ui/forms/FormGroup";
|
||||
import InputText, { RefInputText } from "~/components/ui/input/InputText";
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import FormGroup from "~/components/ui/forms/FormGroup";
|
||||
import InputText, { RefInputText } from "~/components/ui/input/InputText";
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { useState, useEffect, Fragment, useMemo, useRef } from "react";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { WorkflowBlockDto } from "../../dtos/WorkflowBlockDto";
|
||||
import {
|
||||
getWorkflowBlockInputHrefLabel,
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { Fragment } from "react";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { WorkflowBlockDto } from "../../dtos/WorkflowBlockDto";
|
||||
import { getWorkflowBlockName, WorkflowBlockTypes } from "../../dtos/WorkflowBlockTypes";
|
||||
import MonacoEditor from "~/components/editors/MonacoEditor";
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import React, { useMemo, useState } from "react";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { WorkflowDto } from "../../dtos/WorkflowDto";
|
||||
import WorkflowUtils from "../../helpers/WorkflowUtils";
|
||||
import InputText from "~/components/ui/input/InputText";
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { Fragment, useMemo } from "react";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { WorkflowDto } from "../../dtos/WorkflowDto";
|
||||
import { WorkflowExecutionDto } from "../../dtos/WorkflowExecutionDto";
|
||||
import { Link, useParams, useSearchParams } from "react-router";
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
import { Form, useSubmit } from "react-router";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { useEffect, useMemo, useRef, useState } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
import { toast } from "sonner";
|
||||
import MonacoEditor from "~/components/editors/MonacoEditor";
|
||||
import ButtonSecondary from "~/components/ui/buttons/ButtonSecondary";
|
||||
import InputText, { RefInputText } from "~/components/ui/input/InputText";
|
||||
@@ -154,7 +154,7 @@ function WorkflowInputExampleForm({
|
||||
let inputJson: { [key: string]: any } = {};
|
||||
try {
|
||||
inputJson = JSON.parse(input);
|
||||
} catch (e) {
|
||||
} catch (_e) {
|
||||
toast.error(i18nT("workflows.errors.invalidJson"));
|
||||
return;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { Menu } from "@headlessui/react";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import clsx from "clsx";
|
||||
import DropdownOptions from "~/components/ui/dropdowns/DropdownOptions";
|
||||
import { WorkflowDto } from "~/modules/workflowEngine/dtos/WorkflowDto";
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { Menu } from "@headlessui/react";
|
||||
import { Link, useParams } from "react-router";
|
||||
import clsx from "clsx";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import DropdownOptions from "~/components/ui/dropdowns/DropdownOptions";
|
||||
import { WorkflowDto } from "~/modules/workflowEngine/dtos/WorkflowDto";
|
||||
import WorkflowUtils from "~/modules/workflowEngine/helpers/WorkflowUtils";
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { Form, useNavigation, useSubmit } from "react-router";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import clsx from "clsx";
|
||||
import { useEffect, useId, useRef, useState } from "react";
|
||||
import { Colors } from "~/application/enums/shared/Colors";
|
||||
|
||||
+3
-3
@@ -8,8 +8,8 @@ const WorkflowContext = createContext<{
|
||||
incomingBlockIds?: ReadonlySet<string>;
|
||||
}>({
|
||||
isReadOnly: false,
|
||||
onEdgeDelete: (edgeId) => {},
|
||||
onNodeDelete: (nodeId) => {},
|
||||
isNodeSelected: (nodeId) => false,
|
||||
onEdgeDelete: (_edgeId) => {},
|
||||
onNodeDelete: (_nodeId) => {},
|
||||
isNodeSelected: (_nodeId) => false,
|
||||
});
|
||||
export default WorkflowContext;
|
||||
+14
-14
@@ -2,7 +2,7 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
type WorkflowExecutionDbTestMocks = {
|
||||
findMany: ReturnType<typeof vi.fn>;
|
||||
findFirstOrThrow: ReturnType<typeof vi.fn>;
|
||||
findFirst: ReturnType<typeof vi.fn>;
|
||||
updateMany: ReturnType<typeof vi.fn>;
|
||||
count: ReturnType<typeof vi.fn>;
|
||||
};
|
||||
@@ -11,7 +11,7 @@ function getDbMocks(): WorkflowExecutionDbTestMocks {
|
||||
const store = globalThis as typeof globalThis & { __workflowExecutionDbTestMocks__?: WorkflowExecutionDbTestMocks };
|
||||
store.__workflowExecutionDbTestMocks__ ??= {
|
||||
findMany: vi.fn(),
|
||||
findFirstOrThrow: vi.fn(),
|
||||
findFirst: vi.fn(),
|
||||
updateMany: vi.fn(),
|
||||
count: vi.fn(),
|
||||
};
|
||||
@@ -22,7 +22,7 @@ vi.mock("~/utils/db.server", () => ({
|
||||
db: {
|
||||
workflowExecution: {
|
||||
findMany: getDbMocks().findMany,
|
||||
findFirstOrThrow: getDbMocks().findFirstOrThrow,
|
||||
findFirst: getDbMocks().findFirst,
|
||||
updateMany: getDbMocks().updateMany,
|
||||
count: getDbMocks().count,
|
||||
},
|
||||
@@ -37,7 +37,7 @@ describe("workflow execution filters", () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
dbMocks.findMany.mockResolvedValue([]);
|
||||
dbMocks.findFirstOrThrow.mockResolvedValue({ id: "execution_1", tenantId: "tenant_1" });
|
||||
dbMocks.findFirst.mockResolvedValue({ id: "execution_1", tenantId: "tenant_1" });
|
||||
dbMocks.updateMany.mockResolvedValue({ count: 1 });
|
||||
dbMocks.count.mockResolvedValue(0);
|
||||
});
|
||||
@@ -65,7 +65,7 @@ describe("workflow execution filters", () => {
|
||||
status: "running",
|
||||
type: "api",
|
||||
},
|
||||
}),
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
@@ -99,7 +99,7 @@ describe("workflow execution filters", () => {
|
||||
},
|
||||
},
|
||||
}),
|
||||
}),
|
||||
})
|
||||
);
|
||||
const query = dbMocks.findMany.mock.calls[0][0];
|
||||
expect(query).not.toHaveProperty("include");
|
||||
@@ -112,7 +112,7 @@ describe("workflow execution filters", () => {
|
||||
tenantId: "tenant_1",
|
||||
appliesToAllTenants: false,
|
||||
},
|
||||
}),
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
@@ -122,11 +122,11 @@ describe("workflow execution filters", () => {
|
||||
{ tenantId: "tenant_1" },
|
||||
{
|
||||
status: "success",
|
||||
output: "{\"ok\":true}",
|
||||
output: '{"ok":true}',
|
||||
duration: 12,
|
||||
error: null,
|
||||
waitingBlockId: null,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
expect(dbMocks.updateMany).toHaveBeenCalledWith(
|
||||
@@ -134,17 +134,17 @@ describe("workflow execution filters", () => {
|
||||
where: { id: "execution_1", tenantId: "tenant_1" },
|
||||
data: expect.objectContaining({
|
||||
status: "success",
|
||||
output: "{\"ok\":true}",
|
||||
output: '{"ok":true}',
|
||||
duration: 12,
|
||||
error: null,
|
||||
waitingBlockId: null,
|
||||
}),
|
||||
}),
|
||||
})
|
||||
);
|
||||
expect(dbMocks.findFirstOrThrow).toHaveBeenCalledWith(
|
||||
expect(dbMocks.findFirst).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
where: { id: "execution_1", tenantId: "tenant_1" },
|
||||
}),
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
@@ -154,7 +154,7 @@ describe("workflow execution filters", () => {
|
||||
expect(dbMocks.findMany).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
where: { workflowId: "workflow_global", tenantId: null },
|
||||
}),
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
+1
-1
@@ -132,7 +132,7 @@ describe("WorkflowBlockUtils.getBlockErrors", () => {
|
||||
});
|
||||
|
||||
expect(WorkflowBlockUtils.getBlockErrors({ workflow: workflow([manual]), block: manual })).toEqual(
|
||||
expect.arrayContaining([expect.stringContaining("workflows.validation.errors.invalidManualValidationSchema:error=")])
|
||||
expect.arrayContaining(["workflows.validation.errors.invalidManualValidationSchemaSummary"])
|
||||
);
|
||||
});
|
||||
});
|
||||
+3
-8
@@ -1,4 +1,4 @@
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { WorkflowDto } from "../dtos/WorkflowDto";
|
||||
import { WorkflowBlockInput, WorkflowBlockType, WorkflowBlockTypes } from "../dtos/WorkflowBlockTypes";
|
||||
import { WorkflowBlockDto } from "../dtos/WorkflowBlockDto";
|
||||
@@ -11,7 +11,7 @@ function rowToDto(block: WorkflowBlockWithDetails, index: number = 0) {
|
||||
let input: any = {};
|
||||
try {
|
||||
input = JSON.parse(block.input);
|
||||
} catch (e) {}
|
||||
} catch (_e) {}
|
||||
const workflowBlock: WorkflowBlockDto = {
|
||||
id: block.id,
|
||||
index,
|
||||
@@ -129,12 +129,7 @@ function getBlockErrors({ workflow, block, validationContext }: { workflow: Work
|
||||
if (workflowBlock?.value === "manual" && block.input.validation) {
|
||||
const { error } = WorkflowsValidationService.parseJsonSchema(block.input.validation);
|
||||
if (error) {
|
||||
errors.push(
|
||||
i18nT("workflows.validation.errors.invalidManualValidationSchema", {
|
||||
error,
|
||||
defaultValue: "Manual trigger validation must be valid JSON Schema: {{error}}",
|
||||
})
|
||||
);
|
||||
errors.push(i18nT("workflows.validation.errors.invalidManualValidationSchemaSummary"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { WorkflowConditionOperators, WorkflowConditionsDto } from "../dtos/WorkflowConditionDtos";
|
||||
|
||||
type WorkflowConditionTranslator = (key: string, values?: Record<string, unknown>) => string;
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { type Node, type Edge, Position, MarkerType } from "@xyflow/react";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import dagre from "dagre";
|
||||
import { WorkflowDto } from "../dtos/WorkflowDto";
|
||||
import { WorkflowBlockDto } from "../dtos/WorkflowBlockDto";
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { Colors } from "~/application/enums/shared/Colors";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { WorkflowDto } from "../dtos/WorkflowDto";
|
||||
import { WorkflowBlockDto } from "../dtos/WorkflowBlockDto";
|
||||
import WorkflowBlockUtils from "./WorkflowBlockUtils";
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { LoaderFunctionArgs } from "react-router";
|
||||
import { MetaTagsDto } from "~/application/dtos/seo/MetaTagsDto";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { featureKeys } from "@hivegrid/entitlements";
|
||||
import { requireTenantProductAccess } from "~/utils/entitlements/.server/productAccess.server";
|
||||
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import WorkflowsService from "~/modules/workflowEngine/services/WorkflowsService
|
||||
import UrlUtils from "~/utils/app/UrlUtils";
|
||||
import { requireAuth } from "~/utils/loaders.middleware";
|
||||
import { getTenantIdOrNull } from "~/utils/services/.server/urlService";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
|
||||
export namespace WorkflowsIdExecutionsApi {
|
||||
export type LoaderData = {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { Link, useLoaderData, useParams, useSearchParams } from "react-router";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { useEffect, useState } from "react";
|
||||
import "@xyflow/react/dist/style.css";
|
||||
import BreadcrumbSimple from "~/components/ui/breadcrumbs/BreadcrumbSimple";
|
||||
|
||||
+2
-1
@@ -12,7 +12,8 @@ import { requireAuth } from "~/utils/loaders.middleware";
|
||||
import { safeRedirectPathFromRequest } from "~/utils/app/RedirectSafety.server";
|
||||
import { validateCSRFToken } from "~/utils/session.server";
|
||||
import { requireWorkflowMutationAccess } from "../workflowAccess.server";
|
||||
import { t as i18nT, type TFunction } from "i18next";
|
||||
import type { TFunction } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { getTranslations } from "~/locale/i18next.server";
|
||||
import { formatWorkflowBuilderActionError } from "../workflowRunActionErrors.server";
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { Link, useActionData, useLoaderData, useParams, useSubmit } from "react-router";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { useEffect, useState } from "react";
|
||||
import "@xyflow/react/dist/style.css";
|
||||
import { toast } from "sonner";
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ import { getTenantIdOrNull } from "~/utils/services/.server/urlService";
|
||||
import { validateCSRFToken } from "~/utils/session.server";
|
||||
import { getAbsoluteApiUrl } from "~/utils/url.server";
|
||||
import { requireWorkflowMutationAccess } from "../workflowAccess.server";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { getTranslations } from "~/locale/i18next.server";
|
||||
import { formatWorkflowRunActionError, workflowActionText } from "../workflowRunActionErrors.server";
|
||||
|
||||
|
||||
+4
-7
@@ -1,7 +1,7 @@
|
||||
import { Form, Link, useActionData, useLoaderData, useNavigation, useParams, useSubmit } from "react-router";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { useEffect, useId, useRef, useState } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
import { toast } from "sonner";
|
||||
import MonacoEditor from "~/components/editors/MonacoEditor";
|
||||
import BreadcrumbSimple from "~/components/ui/breadcrumbs/BreadcrumbSimple";
|
||||
import LoadingButton from "~/components/ui/buttons/LoadingButton";
|
||||
@@ -85,10 +85,7 @@ export default function WorkflowsIdRunApiApiView() {
|
||||
<div>
|
||||
<div className="border-border bg-background w-full border-b px-4 py-2 shadow-2xs">
|
||||
<BreadcrumbSimple
|
||||
menu={[
|
||||
{ title: i18nT("workflows.title"), routePath: UrlUtils.getModulePath(params, `workflow-engine/workflows`) },
|
||||
{ title: data.workflow.name },
|
||||
]}
|
||||
menu={[{ title: i18nT("workflows.title"), routePath: UrlUtils.getModulePath(params, `workflow-engine/workflows`) }, { title: data.workflow.name }]}
|
||||
/>
|
||||
</div>
|
||||
<div className="border-border bg-background w-full border-b px-4 py-2 shadow-2xs">
|
||||
@@ -229,7 +226,7 @@ export default function WorkflowsIdRunApiApiView() {
|
||||
<div>{actionData.error}</div>
|
||||
{actionData.errorCode === "noValidApiKey" && params.tenant && (
|
||||
<div>
|
||||
<Link className="underline" target="_blank" to={appPath({ tenantSlug: params.tenant, path: "settings/api/keys", mode: "host-aware" })}>
|
||||
<Link className="underline" target="_blank" to={appPath({ tenantSlug: params.tenant, path: "api/keys", mode: "host-aware" })}>
|
||||
{i18nT("workflows.run.createApiKeyLink")}
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ import { requireAuth } from "~/utils/loaders.middleware";
|
||||
import { getTenantIdOrNull } from "~/utils/services/.server/urlService";
|
||||
import { getUserInfo, validateCSRFToken } from "~/utils/session.server";
|
||||
import { requireWorkflowMutationAccess } from "../workflowAccess.server";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { getTranslations } from "~/locale/i18next.server";
|
||||
import { formatWorkflowRunActionError, workflowActionText } from "../workflowRunActionErrors.server";
|
||||
|
||||
|
||||
+6
-6
@@ -1,8 +1,8 @@
|
||||
import { Form, Link, useActionData, useLoaderData, useNavigation, useParams, useSubmit } from "react-router";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import clsx from "clsx";
|
||||
import { useEffect, useId, useMemo, useRef, useState } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
import { toast } from "sonner";
|
||||
import { Colors } from "~/application/enums/shared/Colors";
|
||||
import MonacoEditor from "~/components/editors/MonacoEditor";
|
||||
import SimpleBadge from "~/components/ui/badges/SimpleBadge";
|
||||
@@ -21,6 +21,7 @@ import ErrorBanner from "~/components/ui/banners/ErrorBanner";
|
||||
import { appendCSRFToken } from "~/utils/csrf";
|
||||
import { formatWorkflowExecutionErrorText } from "~/modules/workflowEngine/utils/workflowExecutionErrorText";
|
||||
import { SendIcon } from "~/components/ui/icons/vendor";
|
||||
import { useCopyToast } from "~/hooks/use-copy-toast";
|
||||
|
||||
export default function WorkflowsIdRunManualView() {
|
||||
const data = useLoaderData<WorkflowsIdRunManualApi.LoaderData>();
|
||||
@@ -64,12 +65,10 @@ export default function WorkflowsIdRunManualView() {
|
||||
actionData?.execution?.executionAlerts.forEach((executionAlert) => {
|
||||
if (executionAlert.type === "error") {
|
||||
toast.error(executionAlert.message, {
|
||||
position: "bottom-right",
|
||||
duration: 10000,
|
||||
});
|
||||
} else {
|
||||
toast.success(executionAlert.message, {
|
||||
position: "bottom-right",
|
||||
duration: 10000,
|
||||
});
|
||||
}
|
||||
@@ -342,6 +341,7 @@ function WorkflowRun({ workflow }: { workflow: WorkflowExecutionDto }) {
|
||||
}
|
||||
|
||||
function InputOutput({ input, output }: { input?: any; output?: any }) {
|
||||
const copyText = useCopyToast();
|
||||
const compactInput = useMemo(() => (input ? JSON.stringify(input) : ""), [input]);
|
||||
const compactOutput = useMemo(() => (output ? JSON.stringify(output) : ""), [output]);
|
||||
const formattedInput = useMemo(() => (input ? JSON.stringify(input, null, 2) : ""), [input]);
|
||||
@@ -362,7 +362,7 @@ function InputOutput({ input, output }: { input?: any; output?: any }) {
|
||||
<button
|
||||
type="button"
|
||||
className="hover:text-muted-foreground text-foreground/80 text-xs font-medium"
|
||||
onClick={() => navigator.clipboard.writeText(compactInput)}
|
||||
onClick={() => void copyText(compactInput, { successKey: "workflows.run.inputCopied" })}
|
||||
>
|
||||
{i18nT("workflows.actions.copy")}
|
||||
</button>
|
||||
@@ -384,7 +384,7 @@ function InputOutput({ input, output }: { input?: any; output?: any }) {
|
||||
<button
|
||||
type="button"
|
||||
className="hover:text-muted-foreground text-foreground/80 text-xs font-medium"
|
||||
onClick={() => navigator.clipboard.writeText(compactOutput)}
|
||||
onClick={() => void copyText(compactOutput, { successKey: "workflows.run.outputCopied" })}
|
||||
>
|
||||
{i18nT("workflows.actions.copy")}
|
||||
</button>
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import { getTenantIdOrNull } from "~/utils/services/.server/urlService";
|
||||
import { getUserInfo, validateCSRFToken } from "~/utils/session.server";
|
||||
import { requireAuth } from "~/utils/loaders.middleware";
|
||||
import { requireWorkflowMutationAccess } from "../workflowAccess.server";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { getTranslations } from "~/locale/i18next.server";
|
||||
import { formatWorkflowRunActionError, workflowActionText } from "../workflowRunActionErrors.server";
|
||||
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { Link, useActionData, useLoaderData, useParams, useSubmit } from "react-router";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { useEffect, useState } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
import { toast } from "sonner";
|
||||
import MonacoEditor from "~/components/editors/MonacoEditor";
|
||||
import BreadcrumbSimple from "~/components/ui/breadcrumbs/BreadcrumbSimple";
|
||||
import LoadingButton from "~/components/ui/buttons/LoadingButton";
|
||||
|
||||
+22
-5
@@ -1,16 +1,22 @@
|
||||
import { WorkflowCredential } from "@hivegrid/db/prisma-browser";
|
||||
import { ActionFunctionArgs, LoaderFunctionArgs, redirect } from "react-router";
|
||||
import { ActionFunctionArgs, LoaderFunctionArgs } from "react-router";
|
||||
import { MetaTagsDto } from "~/application/dtos/seo/MetaTagsDto";
|
||||
import { deleteWorkflowCredential, getAllWorkflowCredentials } from "~/modules/workflowEngine/db/workflowCredentials.db.server";
|
||||
import UrlUtils from "~/utils/app/UrlUtils";
|
||||
import { requireAuth } from "~/utils/loaders.middleware";
|
||||
import { validateCSRFToken } from "~/utils/session.server";
|
||||
import { getTenantIdOrNull } from "~/utils/services/.server/urlService";
|
||||
import { requireWorkflowMutationAccess } from "./workflowAccess.server";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { getTranslations } from "~/locale/i18next.server";
|
||||
|
||||
export namespace WorkflowsCredentialsApi {
|
||||
export type ActionData = {
|
||||
intent: "delete";
|
||||
ok?: true;
|
||||
messageKey?: string;
|
||||
errorKey?: string;
|
||||
};
|
||||
|
||||
export type LoaderData = {
|
||||
metatags: MetaTagsDto;
|
||||
items: WorkflowCredential[];
|
||||
@@ -37,8 +43,19 @@ export namespace WorkflowsCredentialsApi {
|
||||
const action = form.get("action")?.toString();
|
||||
if (action === "delete") {
|
||||
const id = form.get("id")?.toString() ?? "";
|
||||
await deleteWorkflowCredential(id, { tenantId });
|
||||
throw redirect(UrlUtils.getModulePath(params, `workflow-engine/credentials`));
|
||||
try {
|
||||
await deleteWorkflowCredential(id, { tenantId });
|
||||
return Response.json({
|
||||
intent: "delete",
|
||||
ok: true,
|
||||
messageKey: "workflows.toast.credentialDeleted",
|
||||
} satisfies ActionData);
|
||||
} catch {
|
||||
return Response.json(
|
||||
{ intent: "delete", errorKey: "workflows.errors.credentialDeleteFailed" } satisfies ActionData,
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return Response.json({ error: t("workflows.errors.invalidForm") }, { status: 400 });
|
||||
}
|
||||
|
||||
+7
-3
@@ -1,6 +1,6 @@
|
||||
import { WorkflowCredential } from "@hivegrid/db/prisma-browser";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { MetaFunction, useLoaderData } from "react-router";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { MetaFunction, useActionData, useLoaderData } from "react-router";
|
||||
import { Outlet, useSubmit } from "react-router";
|
||||
import { useRef } from "react";
|
||||
import ButtonPrimary from "~/components/ui/buttons/ButtonPrimary";
|
||||
@@ -11,13 +11,17 @@ import TableSimple from "~/components/ui/tables/TableSimple";
|
||||
import { WorkflowDto } from "~/modules/workflowEngine/dtos/WorkflowDto";
|
||||
import { WorkflowsCredentialsApi } from "./credentials.api.server";
|
||||
import { appendCSRFToken } from "~/utils/csrf";
|
||||
import { useSaveToast } from "~/hooks/use-save-toast";
|
||||
|
||||
export const meta: MetaFunction = () => [{ title: i18nT("workflows.credentials.title") }];
|
||||
|
||||
export default function WorkflowsCredentialsView() {
|
||||
const data = useLoaderData<WorkflowsCredentialsApi.LoaderData>();
|
||||
const actionData = useActionData<WorkflowsCredentialsApi.ActionData>();
|
||||
const submit = useSubmit();
|
||||
|
||||
useSaveToast(actionData);
|
||||
|
||||
const confirmDelete = useRef<RefConfirmModal>(null);
|
||||
|
||||
function onDelete(item: WorkflowCredential) {
|
||||
@@ -59,7 +63,7 @@ export default function WorkflowsCredentialsView() {
|
||||
title: i18nT("workflows.columns.value"),
|
||||
name: "value",
|
||||
className: "w-full",
|
||||
value: (item) => <div className="max-w-sm truncate">{"".padEnd(36, "*")}</div>,
|
||||
value: (_item) => <div className="max-w-sm truncate">{"".padEnd(36, "*")}</div>,
|
||||
},
|
||||
{
|
||||
title: i18nT("shared.createdAt"),
|
||||
|
||||
+31
-14
@@ -1,5 +1,4 @@
|
||||
import { ActionFunctionArgs, LoaderFunctionArgs, redirect } from "react-router";
|
||||
import UrlUtils from "~/utils/app/UrlUtils";
|
||||
import { ActionFunctionArgs, LoaderFunctionArgs } from "react-router";
|
||||
import { createWorkflowCredential, getWorkflowCredentialByName } from "~/modules/workflowEngine/db/workflowCredentials.db.server";
|
||||
import { getTenantIdOrNull } from "~/utils/services/.server/urlService";
|
||||
import CryptoApi from "~/utils/api/.server/CryptoApi";
|
||||
@@ -7,10 +6,18 @@ import { MetaTagsDto } from "~/application/dtos/seo/MetaTagsDto";
|
||||
import { getUserInfo, validateCSRFToken } from "~/utils/session.server";
|
||||
import { requireAuth } from "~/utils/loaders.middleware";
|
||||
import { requireWorkflowMutationAccess } from "../workflowAccess.server";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { getTranslations } from "~/locale/i18next.server";
|
||||
|
||||
export namespace WorkflowsCredentialsNewApi {
|
||||
export type ActionData = {
|
||||
intent: "create";
|
||||
ok?: true;
|
||||
messageKey?: string;
|
||||
errorKey?: string;
|
||||
errorValues?: Readonly<Record<string, string>>;
|
||||
};
|
||||
|
||||
export type LoaderData = {
|
||||
metatags: MetaTagsDto;
|
||||
};
|
||||
@@ -35,15 +42,18 @@ export namespace WorkflowsCredentialsNewApi {
|
||||
let value = form.get("credential-value")?.toString() ?? "";
|
||||
|
||||
if (action === "create") {
|
||||
const existing = await getWorkflowCredentialByName(name, { tenantId });
|
||||
if (existing) {
|
||||
return Response.json(
|
||||
{
|
||||
intent: "create",
|
||||
errorKey: "workflows.errors.credentialAlreadyExists",
|
||||
errorValues: { value0: name },
|
||||
} satisfies ActionData,
|
||||
{ status: 409 }
|
||||
);
|
||||
}
|
||||
try {
|
||||
const existing = await getWorkflowCredentialByName(name, { tenantId });
|
||||
if (existing) {
|
||||
throw Error(
|
||||
t("workflows.errors.credentialAlreadyExists", {
|
||||
value0: name,
|
||||
})
|
||||
);
|
||||
}
|
||||
value = CryptoApi.encrypt(value);
|
||||
await createWorkflowCredential({
|
||||
tenantId,
|
||||
@@ -51,9 +61,16 @@ export namespace WorkflowsCredentialsNewApi {
|
||||
name,
|
||||
value,
|
||||
});
|
||||
throw redirect(UrlUtils.getModulePath(params, `workflow-engine/credentials`));
|
||||
} catch (e: any) {
|
||||
return Response.json({ error: e.message }, { status: 400 });
|
||||
return Response.json({
|
||||
intent: "create",
|
||||
ok: true,
|
||||
messageKey: "workflows.toast.credentialCreated",
|
||||
} satisfies ActionData);
|
||||
} catch {
|
||||
return Response.json(
|
||||
{ intent: "create", errorKey: "workflows.errors.credentialCreateFailed" } satisfies ActionData,
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
}
|
||||
return Response.json({ error: t("workflows.errors.invalidAction") }, { status: 400 });
|
||||
|
||||
+15
-3
@@ -1,14 +1,26 @@
|
||||
import { useNavigate, useParams } from "react-router";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { useActionData, useNavigate, useParams } from "react-router";
|
||||
import { useEffect } from "react";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import WorkflowCredentialForm from "~/modules/workflowEngine/components/workflowVariables/WorkflowCredentialForm";
|
||||
import UrlUtils from "~/utils/app/UrlUtils";
|
||||
import SlideOverWideEmpty from "~/components/ui/slideOvers/SlideOverWideEmpty";
|
||||
import { WorkflowsCredentialsNewApi } from "./credentials.new.api.server";
|
||||
import { useSaveToast } from "~/hooks/use-save-toast";
|
||||
|
||||
export default function WorkflowsCredentialsNewView() {
|
||||
const params = useParams();
|
||||
const navigate = useNavigate();
|
||||
const actionData = useActionData<WorkflowsCredentialsNewApi.ActionData>();
|
||||
const listPath = UrlUtils.getModulePath(params, `workflow-engine/credentials`);
|
||||
|
||||
useSaveToast(actionData);
|
||||
|
||||
useEffect(() => {
|
||||
if (actionData?.ok) navigate(listPath);
|
||||
}, [actionData, listPath, navigate]);
|
||||
|
||||
function close() {
|
||||
navigate(UrlUtils.getModulePath(params, `workflow-engine/credentials`));
|
||||
navigate(listPath);
|
||||
}
|
||||
return (
|
||||
<SlideOverWideEmpty title={i18nT("workflows.credentials.newTitle")} className="sm:max-w-sm" open={true} onClose={close}>
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import { requireAuth } from "~/utils/loaders.middleware";
|
||||
import { validateCSRFToken } from "~/utils/session.server";
|
||||
import { getTenantIdOrNull } from "~/utils/services/.server/urlService";
|
||||
import { requireWorkflowMutationAccess } from "./workflowAccess.server";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { getTranslations } from "~/locale/i18next.server";
|
||||
|
||||
export namespace WorkflowsDangerApi {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { useActionData, useLoaderData, useSubmit } from "react-router";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { useEffect, useRef } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { WorkflowsDangerApi } from "./danger.api.server";
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ import { MetaTagsDto } from "~/application/dtos/seo/MetaTagsDto";
|
||||
import { requireAuth } from "~/utils/loaders.middleware";
|
||||
import { validateCSRFToken } from "~/utils/session.server";
|
||||
import { requireWorkflowMutationAccess } from "./workflowAccess.server";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { getTranslations } from "~/locale/i18next.server";
|
||||
|
||||
export namespace WorkflowsExecutionsApi {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { Link, useLoaderData, useNavigation, useParams, useSubmit } from "react-router";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { useRef } from "react";
|
||||
import TenantBadge from "~/components/core/tenants/TenantBadge";
|
||||
import DateCell from "~/components/ui/dates/DateCell";
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import { db } from "~/utils/db.server";
|
||||
import { requireAuth } from "~/utils/loaders.middleware";
|
||||
import { getTenantIdOrNull } from "~/utils/services/.server/urlService";
|
||||
import { countWorkflowExecutions } from "../../db/workflowExecutions.db.server";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
|
||||
export namespace WorkflowEngineIndexApi {
|
||||
export type LoaderData = {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { useLoaderData } from "react-router";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { useLocaleFormatters } from "~/locale/format";
|
||||
import { WorkflowEngineIndexApi } from "./index.api.server";
|
||||
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import { requireAuth } from "~/utils/loaders.middleware";
|
||||
import { getTenantIdOrNull } from "~/utils/services/.server/urlService";
|
||||
import { getUserInfo, validateCSRFToken } from "~/utils/session.server";
|
||||
import { requireWorkflowMutationAccess } from "./workflowAccess.server";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { getTranslations } from "~/locale/i18next.server";
|
||||
import { localizeWorkflowTemplate } from "../../utils/workflowTemplateI18n";
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { Form, Link, useActionData, useParams, useSubmit } from "react-router";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { useEffect, useState } from "react";
|
||||
import LoadingButton from "~/components/ui/buttons/LoadingButton";
|
||||
import InputText from "~/components/ui/input/InputText";
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import { getAllWorkflowVariables } from "~/modules/workflowEngine/db/workflowVar
|
||||
import { requireAuth } from "~/utils/loaders.middleware";
|
||||
import { getTenantIdOrNull } from "~/utils/services/.server/urlService";
|
||||
import { requireWorkflowMutationAccess } from "./workflowAccess.server";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
|
||||
export namespace WorkflowsVariablesApi {
|
||||
export type LoaderData = {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { Outlet, useLoaderData } from "react-router";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import ButtonPrimary from "~/components/ui/buttons/ButtonPrimary";
|
||||
import DateCell from "~/components/ui/dates/DateCell";
|
||||
import EditPageLayout from "~/components/ui/layouts/EditPageLayout";
|
||||
|
||||
+31
-6
@@ -7,10 +7,17 @@ import { MetaTagsDto } from "~/application/dtos/seo/MetaTagsDto";
|
||||
import { requireAuth } from "~/utils/loaders.middleware";
|
||||
import { validateCSRFToken } from "~/utils/session.server";
|
||||
import { requireWorkflowMutationAccess } from "../workflowAccess.server";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { getTranslations } from "~/locale/i18next.server";
|
||||
|
||||
export namespace WorkflowsVariablesIdApi {
|
||||
export type ActionData = {
|
||||
intent: "edit" | "delete";
|
||||
ok?: true;
|
||||
messageKey?: string;
|
||||
errorKey?: string;
|
||||
};
|
||||
|
||||
export type LoaderData = {
|
||||
metatags: MetaTagsDto;
|
||||
item: WorkflowVariable;
|
||||
@@ -51,13 +58,31 @@ export namespace WorkflowsVariablesIdApi {
|
||||
tenantId,
|
||||
value,
|
||||
});
|
||||
throw redirect(UrlUtils.getModulePath(params, `workflow-engine/variables`));
|
||||
} catch (e: any) {
|
||||
return Response.json({ error: e.message }, { status: 400 });
|
||||
return Response.json({
|
||||
intent: "edit",
|
||||
ok: true,
|
||||
messageKey: "workflows.toast.variableSaved",
|
||||
} satisfies ActionData);
|
||||
} catch {
|
||||
return Response.json(
|
||||
{ intent: "edit", errorKey: "workflows.errors.variableSaveFailed" } satisfies ActionData,
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
} else if (action === "delete") {
|
||||
await deleteWorkflowVariable(existing.id, { tenantId });
|
||||
throw redirect(UrlUtils.getModulePath(params, `workflow-engine/variables`));
|
||||
try {
|
||||
await deleteWorkflowVariable(existing.id, { tenantId });
|
||||
return Response.json({
|
||||
intent: "delete",
|
||||
ok: true,
|
||||
messageKey: "workflows.toast.variableDeleted",
|
||||
} satisfies ActionData);
|
||||
} catch {
|
||||
return Response.json(
|
||||
{ intent: "delete", errorKey: "workflows.errors.variableDeleteFailed" } satisfies ActionData,
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
}
|
||||
return Response.json({ error: t("workflows.errors.invalidAction") }, { status: 400 });
|
||||
};
|
||||
|
||||
+14
-3
@@ -1,16 +1,27 @@
|
||||
import { useLoaderData, useNavigate, useParams } from "react-router";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { useActionData, useLoaderData, useNavigate, useParams } from "react-router";
|
||||
import { useEffect } from "react";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import WorkflowVariableForm from "~/modules/workflowEngine/components/workflowVariables/WorkflowVariableForm";
|
||||
import UrlUtils from "~/utils/app/UrlUtils";
|
||||
import SlideOverWideEmpty from "~/components/ui/slideOvers/SlideOverWideEmpty";
|
||||
import { WorkflowsVariablesIdApi } from "./variables.$id.api.server";
|
||||
import { useSaveToast } from "~/hooks/use-save-toast";
|
||||
|
||||
export default function WorkflowsVariablesIdView() {
|
||||
const data = useLoaderData<WorkflowsVariablesIdApi.LoaderData>();
|
||||
const actionData = useActionData<WorkflowsVariablesIdApi.ActionData>();
|
||||
const params = useParams();
|
||||
const navigate = useNavigate();
|
||||
const listPath = UrlUtils.getModulePath(params, `workflow-engine/variables`);
|
||||
|
||||
useSaveToast(actionData);
|
||||
|
||||
useEffect(() => {
|
||||
if (actionData?.ok) navigate(listPath);
|
||||
}, [actionData, listPath, navigate]);
|
||||
|
||||
function close() {
|
||||
navigate(UrlUtils.getModulePath(params, `workflow-engine/variables`));
|
||||
navigate(listPath);
|
||||
}
|
||||
return (
|
||||
<SlideOverWideEmpty title={i18nT("workflows.variables.editTitle")} className="sm:max-w-sm" open={true} onClose={close}>
|
||||
|
||||
+31
-14
@@ -1,15 +1,22 @@
|
||||
import { ActionFunctionArgs, LoaderFunctionArgs, redirect } from "react-router";
|
||||
import UrlUtils from "~/utils/app/UrlUtils";
|
||||
import { ActionFunctionArgs, LoaderFunctionArgs } from "react-router";
|
||||
import { createWorkflowVariable, getWorkflowVariableByName } from "~/modules/workflowEngine/db/workflowVariable.db.server";
|
||||
import { getTenantIdOrNull } from "~/utils/services/.server/urlService";
|
||||
import { MetaTagsDto } from "~/application/dtos/seo/MetaTagsDto";
|
||||
import { getUserInfo, validateCSRFToken } from "~/utils/session.server";
|
||||
import { requireAuth } from "~/utils/loaders.middleware";
|
||||
import { requireWorkflowMutationAccess } from "../workflowAccess.server";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { getTranslations } from "~/locale/i18next.server";
|
||||
|
||||
export namespace WorkflowsVariablesNewApi {
|
||||
export type ActionData = {
|
||||
intent: "create";
|
||||
ok?: true;
|
||||
messageKey?: string;
|
||||
errorKey?: string;
|
||||
errorValues?: Readonly<Record<string, string>>;
|
||||
};
|
||||
|
||||
export type LoaderData = {
|
||||
metatags: MetaTagsDto;
|
||||
};
|
||||
@@ -34,24 +41,34 @@ export namespace WorkflowsVariablesNewApi {
|
||||
const value = form.get("value")?.toString() ?? "";
|
||||
|
||||
if (action === "create") {
|
||||
const existing = await getWorkflowVariableByName(name, { tenantId });
|
||||
if (existing) {
|
||||
return Response.json(
|
||||
{
|
||||
intent: "create",
|
||||
errorKey: "workflows.errors.variableAlreadyExists",
|
||||
errorValues: { value0: name },
|
||||
} satisfies ActionData,
|
||||
{ status: 409 }
|
||||
);
|
||||
}
|
||||
try {
|
||||
const existing = await getWorkflowVariableByName(name, { tenantId });
|
||||
if (existing) {
|
||||
throw Error(
|
||||
t("workflows.errors.variableAlreadyExists", {
|
||||
value0: name,
|
||||
})
|
||||
);
|
||||
}
|
||||
await createWorkflowVariable({
|
||||
tenantId,
|
||||
createdByUserId: userInfo.userId,
|
||||
name,
|
||||
value,
|
||||
});
|
||||
throw redirect(UrlUtils.getModulePath(params, `workflow-engine/variables`));
|
||||
} catch (e: any) {
|
||||
return Response.json({ error: e.message }, { status: 400 });
|
||||
return Response.json({
|
||||
intent: "create",
|
||||
ok: true,
|
||||
messageKey: "workflows.toast.variableCreated",
|
||||
} satisfies ActionData);
|
||||
} catch {
|
||||
return Response.json(
|
||||
{ intent: "create", errorKey: "workflows.errors.variableCreateFailed" } satisfies ActionData,
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
}
|
||||
return Response.json({ error: t("workflows.errors.invalidAction") }, { status: 400 });
|
||||
|
||||
+15
-3
@@ -1,14 +1,26 @@
|
||||
import { useNavigate, useParams } from "react-router";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { useActionData, useNavigate, useParams } from "react-router";
|
||||
import { useEffect } from "react";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import WorkflowVariableForm from "~/modules/workflowEngine/components/workflowVariables/WorkflowVariableForm";
|
||||
import UrlUtils from "~/utils/app/UrlUtils";
|
||||
import SlideOverWideEmpty from "~/components/ui/slideOvers/SlideOverWideEmpty";
|
||||
import { WorkflowsVariablesNewApi } from "./variables.new.api.server";
|
||||
import { useSaveToast } from "~/hooks/use-save-toast";
|
||||
|
||||
export default function WorkflowsVariablesNewView() {
|
||||
const params = useParams();
|
||||
const navigate = useNavigate();
|
||||
const actionData = useActionData<WorkflowsVariablesNewApi.ActionData>();
|
||||
const listPath = UrlUtils.getModulePath(params, `workflow-engine/variables`);
|
||||
|
||||
useSaveToast(actionData);
|
||||
|
||||
useEffect(() => {
|
||||
if (actionData?.ok) navigate(listPath);
|
||||
}, [actionData, listPath, navigate]);
|
||||
|
||||
function close() {
|
||||
navigate(UrlUtils.getModulePath(params, `workflow-engine/variables`));
|
||||
navigate(listPath);
|
||||
}
|
||||
return (
|
||||
<SlideOverWideEmpty title={i18nT("workflows.variables.newTitle")} className="sm:max-w-sm" open={true} onClose={close}>
|
||||
|
||||
+10
-6
@@ -506,9 +506,13 @@ describe("workflow producer inventory", () => {
|
||||
expect(eventsServiceSource).toContain("buildWorkflowTriggerOutboxEvent");
|
||||
expect(eventsServiceSource).toContain("sourceId: item.id");
|
||||
expect(eventsServiceSource).not.toContain('type: "workflow.trigger.event"');
|
||||
expect(eventsServiceSource.indexOf("const item = await tx.event.create")).toBeLessThan(
|
||||
eventsServiceSource.indexOf("await publishOutboxEvent(tx, buildWorkflowTriggerOutboxEvent")
|
||||
);
|
||||
const eventCreateIndex = eventsServiceSource.indexOf("(await tx.event.create({");
|
||||
const outboxBuildIndex = eventsServiceSource.indexOf("const outboxEvent = buildWorkflowTriggerOutboxEvent({");
|
||||
const outboxPublishIndex = eventsServiceSource.indexOf("await publishOutboxEvent(");
|
||||
expect(eventCreateIndex).toBeGreaterThanOrEqual(0);
|
||||
expect(outboxBuildIndex).toBeGreaterThan(eventCreateIndex);
|
||||
expect(outboxPublishIndex).toBeGreaterThanOrEqual(0);
|
||||
expect(outboxBuildIndex).toBeLessThan(outboxPublishIndex);
|
||||
});
|
||||
|
||||
it("keeps the workflow outbox documentation honest after the entity-builder removal", () => {
|
||||
@@ -516,9 +520,9 @@ describe("workflow producer inventory", () => {
|
||||
const workerQueuesDoc = readSource(path.join(repoRoot, "docs/ops/worker-queues.md"));
|
||||
const workflowBlockSource = readSource(path.join(repoRoot, "apps/web/app/modules/workflowEngine/services/blocks/WorkflowBlockProService.ts"));
|
||||
|
||||
// R-P6B-β (AD-2): the generic entity-builder row.* outbox producers (RowsApi)
|
||||
// were removed; workflow row blocks address typed models through the typed
|
||||
// model registry. The docs must say so, not advertise the deleted producers.
|
||||
// R-P6B-β (AD-2): the generic entity-builder row.* outbox producers were
|
||||
// removed; workflow row blocks address typed models through the typed model
|
||||
// registry. The docs must say so, not advertise the deleted producers.
|
||||
expect(outboxDoc).toContain("removed with the entity-builder");
|
||||
expect(outboxDoc).toContain("the typed model registry");
|
||||
expect(outboxDoc).toContain("`row.*` outbox events");
|
||||
|
||||
+3
-3
@@ -9,8 +9,8 @@ function t(key: string, options?: Record<string, unknown>) {
|
||||
"workflows.errors.missingRequiredInputOnBlock": "Missing required input on block {{blockId}}: {{name}}",
|
||||
"workflows.errors.missingWorkflowCredential": "Missing workflow credential: {{name}}",
|
||||
"workflows.errors.missingWorkflowVariable": "Missing workflow variable: {{name}}",
|
||||
"workflows.errors.invalidManualValidationSchema": "Invalid manual trigger validation schema on block {{blockId}}: {{error}}",
|
||||
"workflows.errors.nativeCapabilityUnsupported": "Worker-native execution does not support this workflow yet: {{error}}",
|
||||
"workflows.errors.invalidManualValidationSchemaSummary": "The validation schema on manual trigger block {{blockId}} is invalid.",
|
||||
"workflows.errors.nativeCapabilityUnsupportedCredential": "Block {{blockId}} references credential {{credential}}, which worker execution cannot access.",
|
||||
"workflows.errors.preflightFailed": "Workflow preflight failed: {{errors}}",
|
||||
"workflows.errors.workflowContinueFailed": "Workflow continuation failed. Check the execution input and try again.",
|
||||
"workflows.errors.workflowRunFailed": "Workflow run failed. Check the workflow setup and try again.",
|
||||
@@ -43,7 +43,7 @@ describe("workflow run action errors", () => {
|
||||
});
|
||||
|
||||
expect(formatWorkflowRunActionError(t, preflightError, "run")).toBe(
|
||||
'Workflow preflight failed: Missing workflow variable: recipient; Missing workflow credential: mail; Missing required input on block email: body; Invalid manual trigger validation schema on block manual: Expected property name; Worker-native execution does not support this workflow yet: unsupported credential reference "mail" on block email'
|
||||
"Workflow preflight failed: Missing workflow variable: recipient; Missing workflow credential: mail; Missing required input on block email: body; The validation schema on manual trigger block manual is invalid.; Block email references credential mail, which worker execution cannot access."
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
+3
-16
@@ -1,5 +1,6 @@
|
||||
import type { TFunction } from "i18next";
|
||||
import type { WorkflowPreflightResult } from "../../services/WorkflowPreflightService";
|
||||
import { formatWorkflowInvalidSchemaText, formatWorkflowNativeCapabilityErrorText } from "../../utils/workflowPreflightErrorText";
|
||||
|
||||
export function workflowActionText(t: TFunction, key: string, fallback: string, values?: Record<string, unknown>) {
|
||||
const translated = t(key, { defaultValue: fallback, ...(values ?? {}) });
|
||||
@@ -39,24 +40,10 @@ function formatPreflightError(t: TFunction, preflight: Partial<WorkflowPreflight
|
||||
)
|
||||
: []),
|
||||
...(isValidationSchemaIssueArray(preflight.invalidValidationSchemas)
|
||||
? preflight.invalidValidationSchemas.map((issue) =>
|
||||
workflowActionText(
|
||||
t,
|
||||
"workflows.errors.invalidManualValidationSchema",
|
||||
"Invalid manual trigger validation schema on block {{blockId}}: {{error}}",
|
||||
{
|
||||
blockId: issue.blockId,
|
||||
error: issue.error,
|
||||
}
|
||||
)
|
||||
)
|
||||
? preflight.invalidValidationSchemas.map((issue) => formatWorkflowInvalidSchemaText(t, issue.blockId))
|
||||
: []),
|
||||
...(isStringArray(preflight.nativeCapabilityErrors)
|
||||
? preflight.nativeCapabilityErrors.map((error) =>
|
||||
workflowActionText(t, "workflows.errors.nativeCapabilityUnsupported", "Worker-native execution does not support this workflow yet: {{error}}", {
|
||||
error,
|
||||
})
|
||||
)
|
||||
? preflight.nativeCapabilityErrors.map((error) => formatWorkflowNativeCapabilityErrorText(t, error))
|
||||
: []),
|
||||
];
|
||||
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import { MetaTagsDto } from "~/application/dtos/seo/MetaTagsDto";
|
||||
import { getUserInfo, validateCSRFToken } from "~/utils/session.server";
|
||||
import { requireAuth } from "~/utils/loaders.middleware";
|
||||
import { requireWorkflowMutationAccess } from "./workflowAccess.server";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { getTranslations } from "~/locale/i18next.server";
|
||||
|
||||
export namespace WorkflowsIndexApi {
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
import { Link, Outlet, useActionData, useLoaderData, useParams, useSearchParams, useSubmit } from "react-router";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import TabsWithIcons from "~/components/ui/tabs/TabsWithIcons";
|
||||
import ButtonPrimary from "~/components/ui/buttons/ButtonPrimary";
|
||||
import PlusIcon from "~/components/ui/icons/PlusIcon";
|
||||
@@ -12,7 +12,7 @@ import ConfirmModal, { RefConfirmModal } from "~/components/ui/modals/ConfirmMod
|
||||
import { WorkflowDto } from "~/modules/workflowEngine/dtos/WorkflowDto";
|
||||
import { WorkflowsIndexApi } from "./workflows.index.api.server";
|
||||
import UrlUtils from "~/utils/app/UrlUtils";
|
||||
import toast from "react-hot-toast";
|
||||
import { toast } from "sonner";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import TenantBadge from "~/components/core/tenants/TenantBadge";
|
||||
import { appendCSRFToken } from "~/utils/csrf";
|
||||
@@ -49,9 +49,9 @@ export default function WorkflowsIndexView() {
|
||||
|
||||
useEffect(() => {
|
||||
if (actionData?.success) {
|
||||
toast.success(actionData.success, { position: "bottom-right" });
|
||||
toast.success(actionData.success);
|
||||
} else if (actionData?.error) {
|
||||
toast.error(actionData.error, { position: "bottom-right" });
|
||||
toast.error(actionData.error);
|
||||
}
|
||||
}, [actionData]);
|
||||
|
||||
|
||||
+2
-2
@@ -186,7 +186,7 @@ describe("WorkflowPreflightService", () => {
|
||||
expect(result.ok).toBe(false);
|
||||
expect(result.invalidValidationSchemas).toHaveLength(1);
|
||||
expect(result.invalidValidationSchemas[0]).toMatchObject({ blockId: "manual_1" });
|
||||
expect(result.errors[0]).toContain("Invalid manual trigger validation schema on block manual_1:");
|
||||
expect(result.errors[0]).toBe("The manual trigger validation schema is invalid.");
|
||||
});
|
||||
|
||||
it("reports worker-native credential references as capability errors", async () => {
|
||||
@@ -229,7 +229,7 @@ describe("WorkflowPreflightService", () => {
|
||||
});
|
||||
|
||||
expect(result.nativeCapabilityErrors).toEqual(['unsupported credential reference "apiBase" on block http']);
|
||||
expect(result.errors).toContain('Worker-native execution does not support this workflow yet: unsupported credential reference "apiBase" on block http');
|
||||
expect(result.errors).toContain("At least one block uses credentials that are not supported by worker-native execution.");
|
||||
});
|
||||
|
||||
it("reports worker-native if edge shape errors before queueing manual execution", async () => {
|
||||
|
||||
+4
-8
@@ -1,7 +1,8 @@
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import { getNativeWorkflowTriggerCapabilityErrors } from "@hivegrid/foundation";
|
||||
import { WorkflowDto } from "../dtos/WorkflowDto";
|
||||
import { preflightWorkflow, type WorkflowRequiredInputIssue } from "../helpers/WorkflowReferenceUtils";
|
||||
import { formatWorkflowInvalidSchemaText, formatWorkflowNativeCapabilityErrorText } from "../utils/workflowPreflightErrorText";
|
||||
import WorkflowVariablesAndCredentialsService from "./WorkflowVariablesAndCredentialsService";
|
||||
import WorkflowsValidationService from "./WorkflowsValidationService";
|
||||
|
||||
@@ -44,13 +45,8 @@ function formatMissingReferences({
|
||||
})
|
||||
)
|
||||
),
|
||||
...invalidValidationSchemas.map((issue) =>
|
||||
i18nT("workflows.errors.invalidManualValidationSchema", {
|
||||
blockId: issue.blockId,
|
||||
error: issue.error,
|
||||
})
|
||||
),
|
||||
...nativeCapabilityErrors.map((error) => i18nT("workflows.errors.nativeCapabilityUnsupported", { error })),
|
||||
...invalidValidationSchemas.map((issue) => formatWorkflowInvalidSchemaText(i18nT, issue.blockId)),
|
||||
...nativeCapabilityErrors.map((error) => formatWorkflowNativeCapabilityErrorText(i18nT, error)),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -545,7 +545,7 @@ async function stream(
|
||||
status: "error",
|
||||
output: "{}",
|
||||
duration: 0,
|
||||
error: error instanceof Error ? error.message : "Workflow stream execution failed.",
|
||||
error: error instanceof Error ? error.message : "workflows.executionErrors.streamFailed",
|
||||
waitingBlockId: null,
|
||||
});
|
||||
});
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ const source = fs.readFileSync(path.join(path.dirname(fileURLToPath(import.meta.
|
||||
|
||||
describe("WorkflowsService DTO conversion", () => {
|
||||
it("does not repair missing condition groups with database writes during reads", () => {
|
||||
const workflowToDtoBody = source.slice(source.indexOf("async function workflowToDto"), source.indexOf("async function addConditionGroup"));
|
||||
const workflowToDtoBody = source.slice(source.indexOf("async function workflowToDto"), source.indexOf("async function update("));
|
||||
|
||||
expect(workflowToDtoBody).not.toContain("await addConditionGroup");
|
||||
expect(workflowToDtoBody).not.toContain("db.workflowBlockConditionGroup.create");
|
||||
@@ -17,7 +17,7 @@ describe("WorkflowsService DTO conversion", () => {
|
||||
|
||||
describe("WorkflowsService tenant scope guards", () => {
|
||||
it("keeps workflow child mutations scoped through the parent workflow tenant", () => {
|
||||
expect(source).toContain("updateWorkflowBlock({ id, workflowId: workflow.id, tenantId: workflow.tenantId }");
|
||||
expect(source).toMatch(/updateWorkflowBlock\(\s*\{\s*id,\s*workflowId:\s*workflow\.id,\s*tenantId:\s*workflow\.tenantId\s*\}/);
|
||||
expect(source).toContain("createInputExample({ workflowId, tenantId, title, input }");
|
||||
expect(source).toContain("updateInputExample(scope: { id: string; workflowId: string; tenantId: string | null }");
|
||||
expect(source).toContain("deleteInputExample(scope: { id: string; workflowId: string; tenantId: string | null }");
|
||||
|
||||
+45
-55
@@ -20,7 +20,7 @@ import { getWorkflowExecution, getWorkflowExecutions } from "../db/workflowExecu
|
||||
import { getAllWorkflowVariables } from "../db/workflowVariable.db.server";
|
||||
import { getAllWorkflowCredentials } from "../db/workflowCredentials.db.server";
|
||||
import WorkflowBlockUtils from "../helpers/WorkflowBlockUtils";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import {
|
||||
PLUGIN_HOOK_WORKFLOW_CREATED,
|
||||
PLUGIN_HOOK_WORKFLOW_DELETED,
|
||||
@@ -160,34 +160,6 @@ async function workflowToDto(
|
||||
return workflow;
|
||||
}
|
||||
|
||||
async function addConditionGroup(workflowBlock: WorkflowBlockDto, workflow: WorkflowDto, data: WorkflowConditionsGroupDto[]) {
|
||||
await requireWorkflowBlocksInWorkflow({ workflowId: workflow.id, tenantId: workflow.tenantId }, [workflowBlock.id]);
|
||||
return await Promise.all(
|
||||
data.map(async (conditionGroup) => {
|
||||
const conditions = conditionGroup.conditions.map((condition) => {
|
||||
return {
|
||||
index: condition.index,
|
||||
variable: condition.variable,
|
||||
operator: condition.operator,
|
||||
value: condition.value,
|
||||
};
|
||||
});
|
||||
await db.workflowBlockConditionGroup.create({
|
||||
data: {
|
||||
workflowBlockId: workflowBlock.id,
|
||||
index: conditionGroup.index,
|
||||
type: conditionGroup.type,
|
||||
conditions: {
|
||||
create: conditions,
|
||||
},
|
||||
},
|
||||
});
|
||||
workflowBlock.conditionGroups.push(conditionGroup);
|
||||
return conditionGroup;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
async function update(
|
||||
id: string,
|
||||
workflow: {
|
||||
@@ -210,11 +182,14 @@ async function update(
|
||||
}
|
||||
const changedFields = getChangedWorkflowFields(item, workflow);
|
||||
|
||||
const updatedItem = await updateWorkflow({ id, tenantId: session.tenantId }, {
|
||||
name: workflow.name,
|
||||
description: workflow.description,
|
||||
status: workflow.status,
|
||||
});
|
||||
const updatedItem = await updateWorkflow(
|
||||
{ id, tenantId: session.tenantId },
|
||||
{
|
||||
name: workflow.name,
|
||||
description: workflow.description,
|
||||
status: workflow.status,
|
||||
}
|
||||
);
|
||||
await emitWorkflowDefinitionHook(PLUGIN_HOOK_WORKFLOW_UPDATED, updatedItem, {
|
||||
userId: session.userId ?? null,
|
||||
changedFields,
|
||||
@@ -343,23 +318,29 @@ function toWorkflowDefinitionHookStatus(status: string): PluginHookWorkflowDefin
|
||||
|
||||
async function updateBlock(id: string, block: WorkflowBlockDto, { workflow, userId = null }: { workflow: WorkflowDto; userId?: string | null }) {
|
||||
const changedFields = ["blocks"];
|
||||
const item = await updateWorkflowBlock({ id, workflowId: workflow.id, tenantId: workflow.tenantId }, {
|
||||
type: block.type,
|
||||
input: JSON.stringify(block.input),
|
||||
description: block.description,
|
||||
isTrigger: block.isTrigger,
|
||||
isBlock: block.isBlock,
|
||||
// positionX: block.position.x,
|
||||
// positionY: block.position.y,
|
||||
});
|
||||
const item = await updateWorkflowBlock(
|
||||
{ id, workflowId: workflow.id, tenantId: workflow.tenantId },
|
||||
{
|
||||
type: block.type,
|
||||
input: JSON.stringify(block.input),
|
||||
description: block.description,
|
||||
isTrigger: block.isTrigger,
|
||||
isBlock: block.isBlock,
|
||||
// positionX: block.position.x,
|
||||
// positionY: block.position.y,
|
||||
}
|
||||
);
|
||||
if (workflow.tenantId === null) {
|
||||
await updateWorkflowApplyToAllTenants(item.workflowId, workflow.tenantId);
|
||||
}
|
||||
if (block.type === "event" && block.input.event) {
|
||||
if (isGeneratedUntitledWorkflowName(workflow.name)) {
|
||||
await updateWorkflow({ id: item.workflowId, tenantId: workflow.tenantId }, {
|
||||
name: `${GENERATED_APP_EVENT_WORKFLOW_PREFIX}: ${block.input.event}`,
|
||||
});
|
||||
await updateWorkflow(
|
||||
{ id: item.workflowId, tenantId: workflow.tenantId },
|
||||
{
|
||||
name: `${GENERATED_APP_EVENT_WORKFLOW_PREFIX}: ${block.input.event}`,
|
||||
}
|
||||
);
|
||||
changedFields.push("name");
|
||||
}
|
||||
}
|
||||
@@ -459,14 +440,20 @@ async function updateWorkflowApplyToAllTenants(workflowId: string, tenantId: str
|
||||
appliesToAllTenants = true;
|
||||
}
|
||||
});
|
||||
const item = await updateWorkflow({ id: workflowId, tenantId }, {
|
||||
appliesToAllTenants,
|
||||
});
|
||||
const item = await updateWorkflow(
|
||||
{ id: workflowId, tenantId },
|
||||
{
|
||||
appliesToAllTenants,
|
||||
}
|
||||
);
|
||||
if (item.tenantId && item.appliesToAllTenants) {
|
||||
// just for good measure
|
||||
await updateWorkflow({ id: workflowId, tenantId: item.tenantId }, {
|
||||
appliesToAllTenants: false,
|
||||
});
|
||||
await updateWorkflow(
|
||||
{ id: workflowId, tenantId: item.tenantId },
|
||||
{
|
||||
appliesToAllTenants: false,
|
||||
}
|
||||
);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
@@ -621,9 +608,12 @@ async function emitWorkflowBuilderMutationHook(
|
||||
if (!workflow.tenantId) {
|
||||
return;
|
||||
}
|
||||
const updatedWorkflow = await updateWorkflow({ id: workflow.id, tenantId: workflow.tenantId }, {
|
||||
status: workflow.status,
|
||||
});
|
||||
const updatedWorkflow = await updateWorkflow(
|
||||
{ id: workflow.id, tenantId: workflow.tenantId },
|
||||
{
|
||||
status: workflow.status,
|
||||
}
|
||||
);
|
||||
await emitWorkflowDefinitionHook(PLUGIN_HOOK_WORKFLOW_UPDATED, updatedWorkflow, {
|
||||
userId,
|
||||
changedFields,
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { parseVariable } from "./WorkflowsVariablesService";
|
||||
|
||||
describe("parseVariable", () => {
|
||||
it("fails malformed templates with a translatable execution error", () => {
|
||||
expect(() => parseVariable("{{#if active}}", { active: true })).toThrow("workflows.executionErrors.variableParsingFailed");
|
||||
});
|
||||
});
|
||||
+2
-2
@@ -74,7 +74,7 @@ export function parseVariable(value: string | null, workflowContext: { [key: str
|
||||
result = JSON.stringify(result);
|
||||
}
|
||||
return result;
|
||||
} catch (e: any) {
|
||||
return "Error parsing string: " + e.message;
|
||||
} catch {
|
||||
throw new Error("workflows.executionErrors.variableParsingFailed");
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -99,12 +99,12 @@ describe("WorkflowBlockProService row blocks (typed model registry)", () => {
|
||||
expect(result.output).toEqual({ row: { id: "k-deleted" } });
|
||||
});
|
||||
|
||||
test("an unaddressable model yields a Klartext error, not a silent fail", async () => {
|
||||
test("an unaddressable model yields a translatable error, not a silent fail", async () => {
|
||||
const result = await WorkflowBlockProService.executeBlock(
|
||||
params(block({ type: "rowCreate", input: { entity: "projekt", row: JSON.stringify({}) } }))
|
||||
);
|
||||
expect(result.throwsError).toBe(true);
|
||||
expect(result.error).toContain("projekt");
|
||||
expect(result.error).toBe("workflows.errors.unknownModel");
|
||||
expect(mocks.adapter.create).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -114,6 +114,6 @@ describe("WorkflowBlockProService row blocks (typed model registry)", () => {
|
||||
params(block({ type: "rowCreate", input: { entity: "kontakt", row: JSON.stringify({ vorname: "Max" }) } }))
|
||||
);
|
||||
expect(result.throwsError).toBe(true);
|
||||
expect(result.error).toContain("kontaktTyp");
|
||||
expect(result.error).toBe("workflows.errors.invalidFieldValue");
|
||||
});
|
||||
});
|
||||
+20
-13
@@ -7,9 +7,11 @@ import { TypedModelError, type ModelCtx, type TypedModelAdapter } from "~/servic
|
||||
import EmailService from "~/modules/emails/services/EmailService.server";
|
||||
import { WorkflowBlockType } from "../../dtos/WorkflowBlockTypes";
|
||||
|
||||
// AD-2 / R-P14D: the row* blocks address a TYPED model from the registry
|
||||
const WORKFLOW_INVALID_INPUT_ERROR_KEY = "workflows.executionErrors.invalidInput";
|
||||
|
||||
// AD-2 / R-P14D: the row* blocks address a typed model from the registry
|
||||
// (Kontakt today; the kern chain registers more) instead of resolving a generic
|
||||
// entity by name and CRUDing through the polymorphic RowsApi. The block JSON keeps
|
||||
// entity by name and CRUDing through the removed polymorphic row store. The block JSON keeps
|
||||
// `entity: "<key>"`, but the key now resolves to a typed adapter; an unaddressable
|
||||
// key surfaces as a Klartext error (M002), never a silent fail.
|
||||
|
||||
@@ -18,7 +20,7 @@ function resolveModel(entityName: string): { adapter: TypedModelAdapter } | { er
|
||||
try {
|
||||
return { adapter: getModelAdapterOrThrow(entityName) };
|
||||
} catch (error) {
|
||||
if (error instanceof TypedModelError) return { error: error.message };
|
||||
if (error instanceof TypedModelError) return { error: error.messageKey };
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -76,15 +78,15 @@ async function executeRowGetBlock({ block, workflowContext, session }: BlockExec
|
||||
}
|
||||
);
|
||||
if (error) {
|
||||
return { output: null, error, throwsError: true, toBlockIds: [] };
|
||||
return { output: null, error: WORKFLOW_INVALID_INPUT_ERROR_KEY, throwsError: true, toBlockIds: [] };
|
||||
}
|
||||
const resolved = resolveModel(entityName);
|
||||
if ("error" in resolved) {
|
||||
return { output: null, error: resolved.error, throwsError: true, toBlockIds: [] };
|
||||
}
|
||||
|
||||
// read() returns null when the record is absent/not visible (parity with the
|
||||
// old RowsApi.get(...).catch(() => null)).
|
||||
// read() returns null when the record is absent/not visible; writes still
|
||||
// surface typed model errors explicitly.
|
||||
const row = await resolved.adapter.read(id, modelCtx(session)).catch(() => null);
|
||||
|
||||
return {
|
||||
@@ -110,7 +112,7 @@ async function executeRowCreateBlock({ block, workflowContext, session }: BlockE
|
||||
}
|
||||
);
|
||||
if (error) {
|
||||
return { output: null, error, throwsError: true, toBlockIds: [] };
|
||||
return { output: null, error: WORKFLOW_INVALID_INPUT_ERROR_KEY, throwsError: true, toBlockIds: [] };
|
||||
}
|
||||
const resolved = resolveModel(entityName);
|
||||
if ("error" in resolved) {
|
||||
@@ -124,7 +126,7 @@ async function executeRowCreateBlock({ block, workflowContext, session }: BlockE
|
||||
};
|
||||
} catch (e) {
|
||||
if (e instanceof TypedModelError) {
|
||||
return { output: null, error: e.message, throwsError: true, toBlockIds: [] };
|
||||
return { output: null, error: e.messageKey, throwsError: true, toBlockIds: [] };
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
@@ -149,7 +151,7 @@ async function executeRowUpdateBlock({ block, workflowContext, session }: BlockE
|
||||
}
|
||||
);
|
||||
if (error) {
|
||||
return { output: null, error, throwsError: true, toBlockIds: [] };
|
||||
return { output: null, error: WORKFLOW_INVALID_INPUT_ERROR_KEY, throwsError: true, toBlockIds: [] };
|
||||
}
|
||||
const resolved = resolveModel(entityName);
|
||||
if ("error" in resolved) {
|
||||
@@ -163,7 +165,7 @@ async function executeRowUpdateBlock({ block, workflowContext, session }: BlockE
|
||||
};
|
||||
} catch (e) {
|
||||
if (e instanceof TypedModelError) {
|
||||
return { output: null, error: e.message, throwsError: true, toBlockIds: [] };
|
||||
return { output: null, error: e.messageKey, throwsError: true, toBlockIds: [] };
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
@@ -186,7 +188,7 @@ async function executeRowDeleteBlock({ block, workflowContext, session }: BlockE
|
||||
}
|
||||
);
|
||||
if (error) {
|
||||
return { output: null, error, throwsError: true, toBlockIds: [] };
|
||||
return { output: null, error: WORKFLOW_INVALID_INPUT_ERROR_KEY, throwsError: true, toBlockIds: [] };
|
||||
}
|
||||
const resolved = resolveModel(entityName);
|
||||
if ("error" in resolved) {
|
||||
@@ -201,11 +203,16 @@ async function executeRowDeleteBlock({ block, workflowContext, session }: BlockE
|
||||
toBlockIds: block.toBlocks.map((f) => f.toBlockId),
|
||||
};
|
||||
} catch (e: any) {
|
||||
return { output: null, error: e.message, throwsError: true, toBlockIds: block.toBlocks.map((f) => f.toBlockId) };
|
||||
return {
|
||||
output: null,
|
||||
error: e instanceof TypedModelError ? e.messageKey : e.message,
|
||||
throwsError: true,
|
||||
toBlockIds: block.toBlocks.map((f) => f.toBlockId),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
async function executeEmailBlock({ block, workflowContext, session }: BlockExecutionParamsDto): Promise<BlockExecutionResultDto> {
|
||||
async function executeEmailBlock({ block, workflowContext, session: _session }: BlockExecutionParamsDto): Promise<BlockExecutionResultDto> {
|
||||
const provider = parseVariable(block.input.provider, workflowContext);
|
||||
const to = parseVariable(block.input.to, workflowContext)!;
|
||||
const subject = parseVariable(block.input.subject, workflowContext)!;
|
||||
|
||||
+2
-2
@@ -517,13 +517,13 @@ describe("WorkflowBlockService.execute", () => {
|
||||
fromBlock: null,
|
||||
session,
|
||||
})
|
||||
).rejects.toThrow(/Expected property name|JSON/u);
|
||||
).rejects.toThrow("workflows.executionErrors.invalidValidationSchema");
|
||||
|
||||
expect(mocks.updateBlockExecution).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
data: expect.objectContaining({
|
||||
status: "error",
|
||||
error: expect.any(String),
|
||||
error: "workflows.executionErrors.invalidValidationSchema",
|
||||
}),
|
||||
})
|
||||
);
|
||||
|
||||
+6
-4
@@ -18,6 +18,8 @@ import { fetchOutboundHttpWithRedirects, readLimitedResponseText, type OutboundH
|
||||
|
||||
const MAX_WORKFLOW_EXECUTION_DEPTH = 200;
|
||||
const WORKFLOW_HTTP_RESPONSE_BODY_LIMIT_BYTES = 16_384;
|
||||
const WORKFLOW_INVALID_INPUT_ERROR_KEY = "workflows.executionErrors.invalidInput";
|
||||
const WORKFLOW_INVALID_VALIDATION_SCHEMA_ERROR_KEY = "workflows.executionErrors.invalidValidationSchema";
|
||||
export const CORE_WORKFLOW_BLOCK_TYPES = [
|
||||
"manual",
|
||||
"doNothing",
|
||||
@@ -207,7 +209,7 @@ async function executeManualBlock({ block, workflowContext }: BlockExecutionPara
|
||||
if (block.input.validation) {
|
||||
const parsed = WorkflowsValidationService.parseJsonSchema(block.input.validation);
|
||||
if (parsed.error) {
|
||||
return { output: null, error: parsed.error, throwsError: true, toBlockIds: [] };
|
||||
return { output: null, error: WORKFLOW_INVALID_VALIDATION_SCHEMA_ERROR_KEY, throwsError: true, toBlockIds: [] };
|
||||
}
|
||||
if (parsed.schema === null) {
|
||||
return {
|
||||
@@ -217,7 +219,7 @@ async function executeManualBlock({ block, workflowContext }: BlockExecutionPara
|
||||
}
|
||||
const error = WorkflowsValidationService.validate(workflowContext["$params"], parsed.schema);
|
||||
if (error) {
|
||||
return { output: null, error, throwsError: true, toBlockIds: [] };
|
||||
return { output: null, error: WORKFLOW_INVALID_INPUT_ERROR_KEY, throwsError: true, toBlockIds: [] };
|
||||
}
|
||||
block.input.validation = undefined;
|
||||
}
|
||||
@@ -469,7 +471,7 @@ async function executeEventBlock({ block, workflowContext }: BlockExecutionParam
|
||||
required: ["data"],
|
||||
});
|
||||
if (error) {
|
||||
return { output: null, error, throwsError: true, toBlockIds: [] };
|
||||
return { output: null, error: WORKFLOW_INVALID_INPUT_ERROR_KEY, throwsError: true, toBlockIds: [] };
|
||||
}
|
||||
|
||||
if (["row.created", "row.updated", "row.deleted"].includes(block.input.event)) {
|
||||
@@ -484,7 +486,7 @@ async function executeEventBlock({ block, workflowContext }: BlockExecutionParam
|
||||
required: ["id", "title", "row", "entity"],
|
||||
});
|
||||
if (error) {
|
||||
return { output: null, error, throwsError: true, toBlockIds: [] };
|
||||
return { output: null, error: WORKFLOW_INVALID_INPUT_ERROR_KEY, throwsError: true, toBlockIds: [] };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+28
@@ -25,6 +25,34 @@ describe("formatWorkflowExecutionErrorText", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("translates semantic errors persisted by background execution", () => {
|
||||
expect(formatWorkflowExecutionErrorText("workflows.executionErrors.streamFailed", t)).toBe(
|
||||
JSON.stringify({ key: "workflows.executionErrors.streamFailed", options: undefined })
|
||||
);
|
||||
});
|
||||
|
||||
it("translates semantic typed-model errors persisted by workflow blocks", () => {
|
||||
expect(formatWorkflowExecutionErrorText("workflows.errors.invalidFieldValue", t)).toBe(
|
||||
JSON.stringify({ key: "workflows.errors.invalidFieldValue", options: undefined })
|
||||
);
|
||||
});
|
||||
|
||||
it.each([
|
||||
"workflows.executionErrors.invalidInput",
|
||||
"workflows.executionErrors.invalidValidationSchema",
|
||||
"workflows.executionErrors.variableParsingFailed",
|
||||
])(
|
||||
"translates semantic validation error %s",
|
||||
(error) => {
|
||||
expect(formatWorkflowExecutionErrorText(error, t)).toBe(JSON.stringify({ key: error, options: undefined }));
|
||||
}
|
||||
);
|
||||
|
||||
it("uses localized generic copy instead of rendering a missing semantic key", () => {
|
||||
const missingKeyT = (key: string) => (key === "workflows.errors.unknown" ? "Something went wrong" : key);
|
||||
expect(formatWorkflowExecutionErrorText("workflows.executionErrors.futureFailure", missingKeyT)).toBe("Something went wrong");
|
||||
});
|
||||
|
||||
it("keeps unknown provider errors unchanged", () => {
|
||||
expect(formatWorkflowExecutionErrorText("Provider failed for https://api.example.test", t)).toBe("Provider failed for https://api.example.test");
|
||||
});
|
||||
|
||||
+5
@@ -65,6 +65,11 @@ export function formatWorkflowExecutionErrorText(error: string | null | undefine
|
||||
return "";
|
||||
}
|
||||
|
||||
if (/^workflows\.(?:executionErrors|errors)\.[A-Za-z0-9_]+$/u.test(error)) {
|
||||
const translated = t(error);
|
||||
return translated === error ? t("workflows.errors.unknown") : translated;
|
||||
}
|
||||
|
||||
for (const rule of WORKFLOW_ERROR_RULES) {
|
||||
if (typeof rule.match === "string") {
|
||||
if (rule.match === error) {
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { formatWorkflowInvalidSchemaText, formatWorkflowNativeCapabilityErrorText } from "./workflowPreflightErrorText";
|
||||
|
||||
const nativeCapabilityCases: Array<[string, string, Record<string, string> | undefined]> = [
|
||||
["missing trigger block", "workflows.errors.nativeCapabilityMissingTrigger", undefined],
|
||||
['unsupported block type "rowCreate" on block create_1', "workflows.errors.nativeCapabilityUnsupportedBlock", { type: "rowCreate", blockId: "create_1" }],
|
||||
['unsupported credential reference "mail" on block email_1', "workflows.errors.nativeCapabilityUnsupportedCredential", { credential: "mail", blockId: "email_1" }],
|
||||
["if block if_1 must have exactly one condition group", "workflows.errors.nativeCapabilityIfConditionGroupCount", { blockId: "if_1" }],
|
||||
["if block if_1 must have at least one condition", "workflows.errors.nativeCapabilityIfConditionRequired", { blockId: "if_1" }],
|
||||
["if block if_1 is missing false edge", "workflows.errors.nativeCapabilityIfMissingEdge", { blockId: "if_1", edge: "false" }],
|
||||
["switch block switch_1 is missing case2 edge", "workflows.errors.nativeCapabilitySwitchMissingEdge", { blockId: "switch_1", edge: "case2" }],
|
||||
["switch block switch_1 condition group 2 must have at least one condition", "workflows.errors.nativeCapabilitySwitchConditionRequired", { blockId: "switch_1", index: "2" }],
|
||||
['unsupported conditional edge "edge_1" from block log_1', "workflows.errors.nativeCapabilityUnsupportedConditionalEdge", { edgeId: "edge_1", blockId: "log_1" }],
|
||||
];
|
||||
|
||||
function t(key: string, options?: Record<string, unknown>) {
|
||||
return JSON.stringify({ key, options });
|
||||
}
|
||||
|
||||
describe("workflow preflight error text", () => {
|
||||
it("replaces raw schema parser details with a semantic summary", () => {
|
||||
expect(formatWorkflowInvalidSchemaText(t, "manual_1")).toBe(
|
||||
JSON.stringify({ key: "workflows.errors.invalidManualValidationSchemaSummary", options: { blockId: "manual_1" } })
|
||||
);
|
||||
});
|
||||
|
||||
it.each(nativeCapabilityCases)("maps %s to request-local copy", (error, key, options) => {
|
||||
expect(formatWorkflowNativeCapabilityErrorText(t, error)).toBe(JSON.stringify({ key, options }));
|
||||
});
|
||||
|
||||
it("never exposes an unknown native capability detail", () => {
|
||||
expect(formatWorkflowNativeCapabilityErrorText(t, "provider secret: sk_live_123")).toBe(
|
||||
JSON.stringify({ key: "workflows.errors.nativeCapabilityUnknown" })
|
||||
);
|
||||
});
|
||||
});
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
type WorkflowPreflightErrorT = (key: string, options?: Record<string, unknown>) => unknown;
|
||||
|
||||
type NativeCapabilityRule = {
|
||||
key: string;
|
||||
match: string | RegExp;
|
||||
params?: (match: RegExpMatchArray) => Record<string, string>;
|
||||
};
|
||||
|
||||
const NATIVE_CAPABILITY_RULES: NativeCapabilityRule[] = [
|
||||
{ match: "missing trigger block", key: "workflows.errors.nativeCapabilityMissingTrigger" },
|
||||
{
|
||||
match: /^unsupported block type "(.+)" on block (.+)$/u,
|
||||
key: "workflows.errors.nativeCapabilityUnsupportedBlock",
|
||||
params: ([, type, blockId]) => ({ type, blockId }),
|
||||
},
|
||||
{
|
||||
match: /^unsupported credential reference "(.+)" on block (.+)$/u,
|
||||
key: "workflows.errors.nativeCapabilityUnsupportedCredential",
|
||||
params: ([, credential, blockId]) => ({ credential, blockId }),
|
||||
},
|
||||
{
|
||||
match: /^if block (.+) must have exactly one condition group$/u,
|
||||
key: "workflows.errors.nativeCapabilityIfConditionGroupCount",
|
||||
params: ([, blockId]) => ({ blockId }),
|
||||
},
|
||||
{
|
||||
match: /^if block (.+) must have at least one condition$/u,
|
||||
key: "workflows.errors.nativeCapabilityIfConditionRequired",
|
||||
params: ([, blockId]) => ({ blockId }),
|
||||
},
|
||||
{
|
||||
match: /^if block (.+) is missing (true|false) edge$/u,
|
||||
key: "workflows.errors.nativeCapabilityIfMissingEdge",
|
||||
params: ([, blockId, edge]) => ({ blockId, edge }),
|
||||
},
|
||||
{
|
||||
match: /^switch block (.+) is missing (default|case\d+) edge$/u,
|
||||
key: "workflows.errors.nativeCapabilitySwitchMissingEdge",
|
||||
params: ([, blockId, edge]) => ({ blockId, edge }),
|
||||
},
|
||||
{
|
||||
match: /^switch block (.+) condition group (\d+) must have at least one condition$/u,
|
||||
key: "workflows.errors.nativeCapabilitySwitchConditionRequired",
|
||||
params: ([, blockId, index]) => ({ blockId, index }),
|
||||
},
|
||||
{
|
||||
match: /^unsupported conditional edge "(.+)" from block (.+)$/u,
|
||||
key: "workflows.errors.nativeCapabilityUnsupportedConditionalEdge",
|
||||
params: ([, edgeId, blockId]) => ({ edgeId, blockId }),
|
||||
},
|
||||
];
|
||||
|
||||
export function formatWorkflowInvalidSchemaText(t: WorkflowPreflightErrorT, blockId: string): string {
|
||||
return String(t("workflows.errors.invalidManualValidationSchemaSummary", { blockId }));
|
||||
}
|
||||
|
||||
export function formatWorkflowNativeCapabilityErrorText(t: WorkflowPreflightErrorT, error: string): string {
|
||||
for (const rule of NATIVE_CAPABILITY_RULES) {
|
||||
if (typeof rule.match === "string") {
|
||||
if (rule.match === error) {
|
||||
return String(t(rule.key));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
const match = error.match(rule.match);
|
||||
if (match) {
|
||||
return String(t(rule.key, rule.params?.(match)));
|
||||
}
|
||||
}
|
||||
|
||||
return String(t("workflows.errors.nativeCapabilityUnknown"));
|
||||
}
|
||||
Reference in new issue
Block a user