@powerhousedao/vetra 6.0.0-dev.40 → 6.0.0-dev.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/document-models/app-module/hooks.d.ts.map +1 -1
- package/dist/document-models/app-module/module.d.ts.map +1 -1
- package/dist/document-models/app-module/module.js +1 -0
- package/dist/document-models/document-editor/hooks.d.ts.map +1 -1
- package/dist/document-models/document-editor/module.d.ts.map +1 -1
- package/dist/document-models/document-editor/module.js +1 -0
- package/dist/document-models/processor-module/actions.d.ts +2 -0
- package/dist/document-models/processor-module/actions.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/base-operations/actions.d.ts +10 -2
- package/dist/document-models/processor-module/gen/base-operations/actions.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/base-operations/creators.d.ts +4 -2
- package/dist/document-models/processor-module/gen/base-operations/creators.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/base-operations/creators.js +3 -1
- package/dist/document-models/processor-module/gen/base-operations/operations.d.ts +3 -1
- package/dist/document-models/processor-module/gen/base-operations/operations.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/document-model.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/document-model.js +24 -2
- package/dist/document-models/processor-module/gen/document-schema.d.ts +3 -0
- package/dist/document-models/processor-module/gen/document-schema.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/ph-factories.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/ph-factories.js +1 -0
- package/dist/document-models/processor-module/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/reducer.js +11 -1
- package/dist/document-models/processor-module/gen/schema/types.d.ts +7 -0
- package/dist/document-models/processor-module/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/schema/zod.d.ts +3 -1
- package/dist/document-models/processor-module/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/schema/zod.js +11 -0
- package/dist/document-models/processor-module/gen/utils.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/utils.js +1 -0
- package/dist/document-models/processor-module/hooks.d.ts.map +1 -1
- package/dist/document-models/processor-module/module.d.ts.map +1 -1
- package/dist/document-models/processor-module/module.js +1 -0
- package/dist/document-models/processor-module/src/reducers/base-operations.d.ts.map +1 -1
- package/dist/document-models/processor-module/src/reducers/base-operations.js +14 -0
- package/dist/document-models/processor-module/src/tests/base-operations.test.js +25 -1
- package/dist/document-models/subgraph-module/hooks.d.ts.map +1 -1
- package/dist/document-models/subgraph-module/module.d.ts.map +1 -1
- package/dist/document-models/subgraph-module/module.js +1 -0
- package/dist/document-models/vetra-package/gen/schema/zod.js +7 -7
- package/dist/document-models/vetra-package/hooks.d.ts.map +1 -1
- package/dist/document-models/vetra-package/module.d.ts.map +1 -1
- package/dist/document-models/vetra-package/module.js +1 -0
- package/dist/editors/processor-editor/components/ProcessorEditorForm.d.ts +4 -0
- package/dist/editors/processor-editor/components/ProcessorEditorForm.d.ts.map +1 -1
- package/dist/editors/processor-editor/components/ProcessorEditorForm.js +31 -5
- package/dist/editors/processor-editor/editor.d.ts.map +1 -1
- package/dist/editors/processor-editor/editor.js +7 -1
- package/dist/editors/processor-editor/editor.test.js +166 -173
- package/dist/processors/codegen/__tests__/codegen-processor-e2e.test.js +6 -2
- package/dist/processors/codegen/document-handlers/generators/processor-generator.d.ts.map +1 -1
- package/dist/processors/codegen/document-handlers/generators/processor-generator.js +23 -2
- package/dist/style.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +31 -35
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
import { type ProcessorApp, type ProcessorApps } from "shared";
|
|
1
2
|
import type { DocumentTypeItem } from "../../../document-models/processor-module/index.js";
|
|
2
3
|
export interface ProcessorEditorFormProps {
|
|
3
4
|
processorName?: string;
|
|
4
5
|
processorType?: string;
|
|
5
6
|
documentTypes?: DocumentTypeItem[];
|
|
7
|
+
processorApps?: ProcessorApps;
|
|
6
8
|
status?: string;
|
|
7
9
|
onNameChange?: (name: string) => void;
|
|
8
10
|
onTypeChange?: (type: string) => void;
|
|
9
11
|
onAddDocumentType?: (id: string, documentType: string) => void;
|
|
10
12
|
onRemoveDocumentType?: (id: string) => void;
|
|
13
|
+
onAddProcessorApp?: (processorApp: ProcessorApp) => void;
|
|
14
|
+
onRemoveProcessorApp?: (processorApp: ProcessorApp) => void;
|
|
11
15
|
onConfirm?: () => void;
|
|
12
16
|
}
|
|
13
17
|
export declare const ProcessorEditorForm: React.FC<ProcessorEditorFormProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProcessorEditorForm.d.ts","sourceRoot":"","sources":["../../../../editors/processor-editor/components/ProcessorEditorForm.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oDAAoD,CAAC;AAI3F,MAAM,WAAW,wBAAwB;IACvC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,iBAAiB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/D,oBAAoB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,
|
|
1
|
+
{"version":3,"file":"ProcessorEditorForm.d.ts","sourceRoot":"","sources":["../../../../editors/processor-editor/components/ProcessorEditorForm.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC/E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oDAAoD,CAAC;AAI3F,MAAM,WAAW,wBAAwB;IACvC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACnC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,iBAAiB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/D,oBAAoB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,iBAAiB,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;IACzD,oBAAoB,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;IAC5D,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAsQlE,CAAC"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
|
+
import { PROCESSOR_APPS } from "shared";
|
|
3
4
|
import { StatusPill } from "../../components/index.js";
|
|
4
5
|
import { useAvailableDocumentTypes, useDebounce } from "../../hooks/index.js";
|
|
5
|
-
export const ProcessorEditorForm = ({ processorName: initialProcessorName = "", processorType: initialProcessorType = "", documentTypes: initialDocumentTypes = [], status = "DRAFT", onNameChange, onTypeChange, onAddDocumentType, onRemoveDocumentType, onConfirm, }) => {
|
|
6
|
+
export const ProcessorEditorForm = ({ processorName: initialProcessorName = "", processorType: initialProcessorType = "", documentTypes: initialDocumentTypes = [], processorApps: initialProcessorApps = [], status = "DRAFT", onNameChange, onTypeChange, onAddDocumentType, onRemoveDocumentType, onAddProcessorApp, onRemoveProcessorApp, onConfirm, }) => {
|
|
6
7
|
const [processorName, setProcessorName] = useState(initialProcessorName);
|
|
7
8
|
const [processorType, setProcessorType] = useState(initialProcessorType);
|
|
8
9
|
const [documentTypes, setDocumentTypes] = useState(initialDocumentTypes);
|
|
9
10
|
const [selectedDocumentType, setSelectedDocumentType] = useState("");
|
|
11
|
+
const [processorApps, setProcessorApps] = useState(initialProcessorApps);
|
|
10
12
|
const [isConfirmed, setIsConfirmed] = useState(false);
|
|
11
13
|
// Get available document types from the hook (combines reactor and vetra drive)
|
|
12
14
|
const availableDocumentTypes = useAvailableDocumentTypes();
|
|
@@ -23,6 +25,9 @@ export const ProcessorEditorForm = ({ processorName: initialProcessorName = "",
|
|
|
23
25
|
useEffect(() => {
|
|
24
26
|
setDocumentTypes(initialDocumentTypes);
|
|
25
27
|
}, [initialDocumentTypes]);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
setProcessorApps(initialProcessorApps);
|
|
30
|
+
}, [initialProcessorApps]);
|
|
26
31
|
// Reset confirmation state if status changes back to DRAFT
|
|
27
32
|
useEffect(() => {
|
|
28
33
|
if (status === "DRAFT") {
|
|
@@ -32,7 +37,10 @@ export const ProcessorEditorForm = ({ processorName: initialProcessorName = "",
|
|
|
32
37
|
// Check if form should be read-only
|
|
33
38
|
const isReadOnly = isConfirmed || status === "CONFIRMED";
|
|
34
39
|
const handleConfirm = () => {
|
|
35
|
-
if (processorName.trim() &&
|
|
40
|
+
if (processorName.trim() &&
|
|
41
|
+
processorType &&
|
|
42
|
+
documentTypes.length > 0 &&
|
|
43
|
+
processorApps.length > 0) {
|
|
36
44
|
setIsConfirmed(true); // Immediate UI update
|
|
37
45
|
onConfirm?.();
|
|
38
46
|
}
|
|
@@ -41,7 +49,10 @@ export const ProcessorEditorForm = ({ processorName: initialProcessorName = "",
|
|
|
41
49
|
setDocumentTypes(documentTypes.filter((dt) => dt.id !== id));
|
|
42
50
|
onRemoveDocumentType?.(id);
|
|
43
51
|
};
|
|
44
|
-
const canConfirm = processorName.trim() &&
|
|
52
|
+
const canConfirm = !!processorName.trim() &&
|
|
53
|
+
!!processorType &&
|
|
54
|
+
documentTypes.length > 0 &&
|
|
55
|
+
processorApps.length > 0;
|
|
45
56
|
return (_jsxs("div", { className: "space-y-6 p-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("h2", { className: "text-lg font-medium text-gray-900", children: "Processor Configuration" }), _jsx(StatusPill, { status: status === "CONFIRMED" ? "confirmed" : "draft", label: status === "CONFIRMED" ? "Confirmed" : "Draft" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "processor-name", className: "mb-2 block text-sm font-medium text-gray-700", children: "Processor Name" }), _jsx("input", { id: "processor-name", type: "text", value: processorName, onChange: (e) => setProcessorName(e.target.value), disabled: isReadOnly, className: `w-full rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500 ${isReadOnly ? "cursor-not-allowed bg-gray-100" : ""}`, placeholder: "Enter processor name" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "processor-type", className: "mb-2 block text-sm font-medium text-gray-700", children: "Type" }), _jsxs("select", { id: "processor-type", value: processorType, onChange: (e) => setProcessorType(e.target.value), disabled: isReadOnly, className: `w-full rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500 ${isReadOnly ? "cursor-not-allowed bg-gray-100" : ""}`, children: [_jsx("option", { value: "", children: "Select type..." }), _jsx("option", { value: "analytics", children: "Analytics" }), _jsx("option", { value: "relational", children: "Relational Database" })] })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "document-types", className: "mb-2 block text-sm font-medium text-gray-700", children: "Document Types" }), _jsxs("div", { className: "space-y-2", children: [!isReadOnly && availableDocumentTypes.length > 0 && (_jsxs("select", { id: "document-types", value: selectedDocumentType, onChange: (e) => {
|
|
46
57
|
const selectedValue = e.target.value;
|
|
47
58
|
if (selectedValue &&
|
|
@@ -57,5 +68,20 @@ export const ProcessorEditorForm = ({ processorName: initialProcessorName = "",
|
|
|
57
68
|
setSelectedDocumentType("");
|
|
58
69
|
}, className: "w-full rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500", children: [_jsx("option", { value: "", children: "Select a document type to add" }), availableDocumentTypes
|
|
59
70
|
.filter((docType) => !documentTypes.some((dt) => dt.documentType === docType))
|
|
60
|
-
.map((docType) => (_jsx("option", { value: docType, children: docType }, docType)))] })), _jsx("div", { className: "space-y-1", children: documentTypes.map((type) => (_jsxs("div", { className: "flex items-center py-1", children: [_jsx("span", { className: "text-sm text-gray-700", children: type.documentType }), !isReadOnly && (_jsx("button", { onClick: () => handleRemoveDocumentType(type.id), className: "ml-2 text-gray-400 hover:text-gray-600 focus:outline-none", children: "\u00D7" }))] }, type.id))) })] })] }),
|
|
71
|
+
.map((docType) => (_jsx("option", { value: docType, children: docType }, docType)))] })), _jsx("div", { className: "space-y-1", children: documentTypes.map((type) => (_jsxs("div", { className: "flex items-center py-1", children: [_jsx("span", { className: "text-sm text-gray-700", children: type.documentType }), !isReadOnly && (_jsx("button", { onClick: () => handleRemoveDocumentType(type.id), className: "ml-2 text-gray-400 hover:text-gray-600 focus:outline-none", children: "\u00D7" }))] }, type.id))) })] })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "processor-apps", className: "mb-2 block text-sm font-medium text-gray-700", children: "Processor Apps" }), _jsxs("div", { className: "space-y-2", children: [!isReadOnly && (_jsx(_Fragment, { children: PROCESSOR_APPS.map((processorApp) => (_jsxs("div", { className: "flex gap-1", children: [_jsx("input", { type: "checkbox", name: processorApp, id: processorApp, checked: processorApps.includes(processorApp), onChange: (event) => {
|
|
72
|
+
const isChecked = event.target.checked;
|
|
73
|
+
if (isChecked) {
|
|
74
|
+
setProcessorApps((processorApps) => [
|
|
75
|
+
...new Set([...processorApps, processorApp]),
|
|
76
|
+
]);
|
|
77
|
+
onAddProcessorApp?.(processorApp);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
if (processorApps.length > 1) {
|
|
81
|
+
setProcessorApps((processorApps) => processorApps.filter((p) => p !== processorApp));
|
|
82
|
+
onRemoveProcessorApp?.(processorApp);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
} }), _jsx("label", { htmlFor: processorApp, children: processorApp })] }, processorApp))) })), _jsx("div", { className: "space-y-1", children: isReadOnly &&
|
|
86
|
+
processorApps.map((processorApp) => (_jsx("span", { className: "text-sm text-gray-700", children: processorApp }, processorApp))) })] })] }), !isReadOnly && (_jsx("div", { children: _jsx("button", { onClick: handleConfirm, disabled: !canConfirm, className: "rounded-md bg-blue-600 px-4 py-2 text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:bg-gray-300", children: "Confirm" }) }))] }));
|
|
61
87
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/processor-editor/editor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/processor-editor/editor.tsx"],"names":[],"mappings":"AASA,MAAM,CAAC,OAAO,UAAU,MAAM,4CAwE7B"}
|
|
@@ -29,5 +29,11 @@ export default function Editor() {
|
|
|
29
29
|
const onRemoveDocumentType = useCallback((id) => {
|
|
30
30
|
dispatch(actions.removeDocumentType({ id }));
|
|
31
31
|
}, [dispatch]);
|
|
32
|
-
|
|
32
|
+
const onAddProcessorApp = useCallback((processorApp) => {
|
|
33
|
+
dispatch(actions.addProcessorApp({ processorApp }));
|
|
34
|
+
}, [dispatch]);
|
|
35
|
+
const onRemoveProcessorApp = useCallback((processorApp) => {
|
|
36
|
+
dispatch(actions.removeProcessorApp({ processorApp }));
|
|
37
|
+
}, [dispatch]);
|
|
38
|
+
return (_jsxs("div", { className: "bg-gray-50 p-6", children: [_jsx(DocumentToolbar, {}), _jsx(ProcessorEditorForm, { onNameChange: onNameChange, onTypeChange: onTypeChange, onAddDocumentType: onAddDocumentType, onRemoveDocumentType: onRemoveDocumentType, onAddProcessorApp: onAddProcessorApp, onRemoveProcessorApp: onRemoveProcessorApp, status: document.state.global.status, processorName: document.state.global.name ?? "", processorType: document.state.global.type ?? "", documentTypes: document.state.global.documentTypes ?? [], processorApps: document.state.global.processorApps, onConfirm: onConfirm })] }));
|
|
33
39
|
}
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { render, screen, waitFor } from "@testing-library/react";
|
|
3
3
|
import { userEvent } from "@testing-library/user-event";
|
|
4
4
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
5
|
+
import { utils } from "../../document-models/processor-module/utils.js";
|
|
5
6
|
import { useSelectedProcessorModuleDocument } from "../hooks/useVetraDocument.js";
|
|
6
7
|
import Editor from "./editor.js";
|
|
7
8
|
vi.mock("../hooks/useVetraDocument.js", () => ({
|
|
@@ -16,19 +17,11 @@ vi.mock("../hooks/useAvailableDocumentTypes.js", () => ({
|
|
|
16
17
|
}));
|
|
17
18
|
describe("ProcessorModule Editor", () => {
|
|
18
19
|
let mockDispatch;
|
|
20
|
+
const document = utils.createDocument();
|
|
19
21
|
beforeEach(() => {
|
|
20
22
|
mockDispatch = vi.fn();
|
|
21
23
|
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
22
|
-
|
|
23
|
-
state: {
|
|
24
|
-
global: {
|
|
25
|
-
name: "",
|
|
26
|
-
type: "",
|
|
27
|
-
status: "DRAFT",
|
|
28
|
-
documentTypes: [],
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
24
|
+
document,
|
|
32
25
|
mockDispatch,
|
|
33
26
|
]);
|
|
34
27
|
});
|
|
@@ -42,20 +35,20 @@ describe("ProcessorModule Editor", () => {
|
|
|
42
35
|
expect(screen.getByText("Confirm")).toBeInTheDocument();
|
|
43
36
|
});
|
|
44
37
|
it("should display existing processor data when document has values", () => {
|
|
45
|
-
|
|
46
|
-
{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
],
|
|
56
|
-
},
|
|
57
|
-
},
|
|
38
|
+
const document = utils.createDocument({
|
|
39
|
+
global: {
|
|
40
|
+
name: "test-processor",
|
|
41
|
+
type: "analytics",
|
|
42
|
+
status: "DRAFT",
|
|
43
|
+
documentTypes: [
|
|
44
|
+
{ id: "dt-1", documentType: "powerhouse/document-model" },
|
|
45
|
+
{ id: "dt-2", documentType: "powerhouse/budget-statement" },
|
|
46
|
+
],
|
|
47
|
+
processorApps: ["connect"],
|
|
58
48
|
},
|
|
49
|
+
});
|
|
50
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
51
|
+
document,
|
|
59
52
|
mockDispatch,
|
|
60
53
|
]);
|
|
61
54
|
render(_jsx(Editor, {}));
|
|
@@ -81,17 +74,17 @@ describe("ProcessorModule Editor", () => {
|
|
|
81
74
|
}, { timeout: 500 });
|
|
82
75
|
});
|
|
83
76
|
it("should dispatch when clearing a non-empty field", async () => {
|
|
84
|
-
|
|
85
|
-
{
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
documentTypes: [],
|
|
92
|
-
},
|
|
93
|
-
},
|
|
77
|
+
const document = utils.createDocument({
|
|
78
|
+
global: {
|
|
79
|
+
name: "existing-processor",
|
|
80
|
+
type: "",
|
|
81
|
+
status: "DRAFT",
|
|
82
|
+
documentTypes: [],
|
|
83
|
+
processorApps: [],
|
|
94
84
|
},
|
|
85
|
+
});
|
|
86
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
87
|
+
document,
|
|
95
88
|
mockDispatch,
|
|
96
89
|
]);
|
|
97
90
|
const user = userEvent.setup();
|
|
@@ -106,17 +99,17 @@ describe("ProcessorModule Editor", () => {
|
|
|
106
99
|
}, { timeout: 500 });
|
|
107
100
|
});
|
|
108
101
|
it("should NOT dispatch when typing identical value without clearing", async () => {
|
|
109
|
-
|
|
110
|
-
{
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
documentTypes: [],
|
|
117
|
-
},
|
|
118
|
-
},
|
|
102
|
+
const document = utils.createDocument({
|
|
103
|
+
global: {
|
|
104
|
+
name: "test",
|
|
105
|
+
type: "",
|
|
106
|
+
status: "DRAFT",
|
|
107
|
+
documentTypes: [],
|
|
108
|
+
processorApps: [],
|
|
119
109
|
},
|
|
110
|
+
});
|
|
111
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
112
|
+
document,
|
|
120
113
|
mockDispatch,
|
|
121
114
|
]);
|
|
122
115
|
const user = userEvent.setup();
|
|
@@ -153,17 +146,17 @@ describe("ProcessorModule Editor", () => {
|
|
|
153
146
|
}, { timeout: 500 });
|
|
154
147
|
});
|
|
155
148
|
it("should NOT dispatch when selecting same type", async () => {
|
|
156
|
-
|
|
157
|
-
{
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
documentTypes: [],
|
|
164
|
-
},
|
|
165
|
-
},
|
|
149
|
+
const document = utils.createDocument({
|
|
150
|
+
global: {
|
|
151
|
+
name: "test-processor",
|
|
152
|
+
type: "analytics",
|
|
153
|
+
status: "DRAFT",
|
|
154
|
+
documentTypes: [],
|
|
155
|
+
processorApps: [],
|
|
166
156
|
},
|
|
157
|
+
});
|
|
158
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
159
|
+
document,
|
|
167
160
|
mockDispatch,
|
|
168
161
|
]);
|
|
169
162
|
const user = userEvent.setup();
|
|
@@ -199,20 +192,20 @@ describe("ProcessorModule Editor", () => {
|
|
|
199
192
|
}));
|
|
200
193
|
});
|
|
201
194
|
it("should remove document type", async () => {
|
|
202
|
-
|
|
203
|
-
{
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
],
|
|
213
|
-
},
|
|
214
|
-
},
|
|
195
|
+
const document = utils.createDocument({
|
|
196
|
+
global: {
|
|
197
|
+
name: "test-processor",
|
|
198
|
+
type: "analytics",
|
|
199
|
+
status: "DRAFT",
|
|
200
|
+
documentTypes: [
|
|
201
|
+
{ id: "dt-1", documentType: "powerhouse/document-model" },
|
|
202
|
+
{ id: "dt-2", documentType: "powerhouse/budget-statement" },
|
|
203
|
+
],
|
|
204
|
+
processorApps: [],
|
|
215
205
|
},
|
|
206
|
+
});
|
|
207
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
208
|
+
document,
|
|
216
209
|
mockDispatch,
|
|
217
210
|
]);
|
|
218
211
|
const user = userEvent.setup();
|
|
@@ -228,19 +221,19 @@ describe("ProcessorModule Editor", () => {
|
|
|
228
221
|
}));
|
|
229
222
|
});
|
|
230
223
|
it("should NOT show duplicate document type in dropdown", () => {
|
|
231
|
-
|
|
232
|
-
{
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
],
|
|
241
|
-
},
|
|
242
|
-
},
|
|
224
|
+
const document = utils.createDocument({
|
|
225
|
+
global: {
|
|
226
|
+
name: "test-processor",
|
|
227
|
+
type: "analytics",
|
|
228
|
+
status: "DRAFT",
|
|
229
|
+
documentTypes: [
|
|
230
|
+
{ id: "dt-1", documentType: "powerhouse/document-model" },
|
|
231
|
+
],
|
|
232
|
+
processorApps: [],
|
|
243
233
|
},
|
|
234
|
+
});
|
|
235
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
236
|
+
document,
|
|
244
237
|
mockDispatch,
|
|
245
238
|
]);
|
|
246
239
|
render(_jsx(Editor, {}));
|
|
@@ -270,20 +263,20 @@ describe("ProcessorModule Editor", () => {
|
|
|
270
263
|
}));
|
|
271
264
|
});
|
|
272
265
|
it("should display existing document types list", () => {
|
|
273
|
-
|
|
274
|
-
{
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
],
|
|
284
|
-
},
|
|
285
|
-
},
|
|
266
|
+
const document = utils.createDocument({
|
|
267
|
+
global: {
|
|
268
|
+
name: "test-processor",
|
|
269
|
+
type: "analytics",
|
|
270
|
+
status: "DRAFT",
|
|
271
|
+
documentTypes: [
|
|
272
|
+
{ id: "dt-1", documentType: "powerhouse/document-model" },
|
|
273
|
+
{ id: "dt-2", documentType: "powerhouse/budget-statement" },
|
|
274
|
+
],
|
|
275
|
+
processorApps: [],
|
|
286
276
|
},
|
|
277
|
+
});
|
|
278
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
279
|
+
document,
|
|
287
280
|
mockDispatch,
|
|
288
281
|
]);
|
|
289
282
|
render(_jsx(Editor, {}));
|
|
@@ -293,19 +286,19 @@ describe("ProcessorModule Editor", () => {
|
|
|
293
286
|
});
|
|
294
287
|
describe("Confirm Button", () => {
|
|
295
288
|
it("should dispatch setProcessorStatus when confirm clicked", async () => {
|
|
296
|
-
|
|
297
|
-
{
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
],
|
|
306
|
-
},
|
|
307
|
-
},
|
|
289
|
+
const document = utils.createDocument({
|
|
290
|
+
global: {
|
|
291
|
+
name: "test-processor",
|
|
292
|
+
type: "analytics",
|
|
293
|
+
status: "DRAFT",
|
|
294
|
+
documentTypes: [
|
|
295
|
+
{ id: "dt-1", documentType: "powerhouse/document-model" },
|
|
296
|
+
],
|
|
297
|
+
processorApps: ["connect"],
|
|
308
298
|
},
|
|
299
|
+
});
|
|
300
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
301
|
+
document,
|
|
309
302
|
mockDispatch,
|
|
310
303
|
]);
|
|
311
304
|
const user = userEvent.setup();
|
|
@@ -320,19 +313,19 @@ describe("ProcessorModule Editor", () => {
|
|
|
320
313
|
]);
|
|
321
314
|
});
|
|
322
315
|
it("should be disabled when processor name is empty", () => {
|
|
323
|
-
|
|
324
|
-
{
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
],
|
|
333
|
-
},
|
|
334
|
-
},
|
|
316
|
+
const document = utils.createDocument({
|
|
317
|
+
global: {
|
|
318
|
+
name: "",
|
|
319
|
+
type: "analytics",
|
|
320
|
+
status: "DRAFT",
|
|
321
|
+
documentTypes: [
|
|
322
|
+
{ id: "dt-1", documentType: "powerhouse/document-model" },
|
|
323
|
+
],
|
|
324
|
+
processorApps: ["connect"],
|
|
335
325
|
},
|
|
326
|
+
});
|
|
327
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
328
|
+
document,
|
|
336
329
|
mockDispatch,
|
|
337
330
|
]);
|
|
338
331
|
render(_jsx(Editor, {}));
|
|
@@ -340,19 +333,19 @@ describe("ProcessorModule Editor", () => {
|
|
|
340
333
|
expect(confirmButton).toBeDisabled();
|
|
341
334
|
});
|
|
342
335
|
it("should be disabled when processor type is empty", () => {
|
|
343
|
-
|
|
344
|
-
{
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
],
|
|
353
|
-
},
|
|
354
|
-
},
|
|
336
|
+
const document = utils.createDocument({
|
|
337
|
+
global: {
|
|
338
|
+
name: "test-processor",
|
|
339
|
+
type: "",
|
|
340
|
+
status: "DRAFT",
|
|
341
|
+
documentTypes: [
|
|
342
|
+
{ id: "dt-1", documentType: "powerhouse/document-model" },
|
|
343
|
+
],
|
|
344
|
+
processorApps: ["connect"],
|
|
355
345
|
},
|
|
346
|
+
});
|
|
347
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
348
|
+
document,
|
|
356
349
|
mockDispatch,
|
|
357
350
|
]);
|
|
358
351
|
render(_jsx(Editor, {}));
|
|
@@ -360,17 +353,17 @@ describe("ProcessorModule Editor", () => {
|
|
|
360
353
|
expect(confirmButton).toBeDisabled();
|
|
361
354
|
});
|
|
362
355
|
it("should be disabled when no document types selected", () => {
|
|
363
|
-
|
|
364
|
-
{
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
documentTypes: [],
|
|
371
|
-
},
|
|
372
|
-
},
|
|
356
|
+
const document = utils.createDocument({
|
|
357
|
+
global: {
|
|
358
|
+
name: "test-processor",
|
|
359
|
+
type: "analytics",
|
|
360
|
+
status: "DRAFT",
|
|
361
|
+
documentTypes: [],
|
|
362
|
+
processorApps: ["connect"],
|
|
373
363
|
},
|
|
364
|
+
});
|
|
365
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
366
|
+
document,
|
|
374
367
|
mockDispatch,
|
|
375
368
|
]);
|
|
376
369
|
render(_jsx(Editor, {}));
|
|
@@ -378,19 +371,19 @@ describe("ProcessorModule Editor", () => {
|
|
|
378
371
|
expect(confirmButton).toBeDisabled();
|
|
379
372
|
});
|
|
380
373
|
it("should be hidden when status is CONFIRMED", () => {
|
|
381
|
-
|
|
382
|
-
{
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
],
|
|
391
|
-
},
|
|
392
|
-
},
|
|
374
|
+
const document = utils.createDocument({
|
|
375
|
+
global: {
|
|
376
|
+
name: "test-processor",
|
|
377
|
+
type: "analytics",
|
|
378
|
+
status: "CONFIRMED",
|
|
379
|
+
documentTypes: [
|
|
380
|
+
{ id: "dt-1", documentType: "powerhouse/document-model" },
|
|
381
|
+
],
|
|
382
|
+
processorApps: ["connect"],
|
|
393
383
|
},
|
|
384
|
+
});
|
|
385
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
386
|
+
document,
|
|
394
387
|
mockDispatch,
|
|
395
388
|
]);
|
|
396
389
|
render(_jsx(Editor, {}));
|
|
@@ -400,19 +393,19 @@ describe("ProcessorModule Editor", () => {
|
|
|
400
393
|
});
|
|
401
394
|
describe("Read-only Mode", () => {
|
|
402
395
|
it("should disable form fields when status is CONFIRMED", () => {
|
|
403
|
-
|
|
404
|
-
{
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
],
|
|
413
|
-
},
|
|
414
|
-
},
|
|
396
|
+
const document = utils.createDocument({
|
|
397
|
+
global: {
|
|
398
|
+
name: "test-processor",
|
|
399
|
+
type: "analytics",
|
|
400
|
+
status: "CONFIRMED",
|
|
401
|
+
documentTypes: [
|
|
402
|
+
{ id: "dt-1", documentType: "powerhouse/document-model" },
|
|
403
|
+
],
|
|
404
|
+
processorApps: ["connect"],
|
|
415
405
|
},
|
|
406
|
+
});
|
|
407
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
408
|
+
document,
|
|
416
409
|
mockDispatch,
|
|
417
410
|
]);
|
|
418
411
|
render(_jsx(Editor, {}));
|
|
@@ -428,19 +421,19 @@ describe("ProcessorModule Editor", () => {
|
|
|
428
421
|
expect(removeButtons).toHaveLength(0);
|
|
429
422
|
});
|
|
430
423
|
it("should enable form fields when status is DRAFT", () => {
|
|
431
|
-
|
|
432
|
-
{
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
],
|
|
441
|
-
},
|
|
442
|
-
},
|
|
424
|
+
const document = utils.createDocument({
|
|
425
|
+
global: {
|
|
426
|
+
name: "test-processor",
|
|
427
|
+
type: "analytics",
|
|
428
|
+
status: "DRAFT",
|
|
429
|
+
documentTypes: [
|
|
430
|
+
{ id: "dt-1", documentType: "powerhouse/document-model" },
|
|
431
|
+
],
|
|
432
|
+
processorApps: [],
|
|
443
433
|
},
|
|
434
|
+
});
|
|
435
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
436
|
+
document,
|
|
444
437
|
mockDispatch,
|
|
445
438
|
]);
|
|
446
439
|
render(_jsx(Editor, {}));
|
|
@@ -282,6 +282,7 @@ describe("CodegenProcessorLegacy E2E Tests", () => {
|
|
|
282
282
|
{ id: "dt-2", documentType: "powerhouse/budget-statement" },
|
|
283
283
|
],
|
|
284
284
|
status: "CONFIRMED",
|
|
285
|
+
processorApps: ["connect"],
|
|
285
286
|
};
|
|
286
287
|
const strand = {
|
|
287
288
|
documentId: "test-doc-1",
|
|
@@ -298,7 +299,7 @@ describe("CodegenProcessorLegacy E2E Tests", () => {
|
|
|
298
299
|
"powerhouse/budget-statement",
|
|
299
300
|
],
|
|
300
301
|
skipFormat: mockConfig.PH_CONFIG.skipFormat,
|
|
301
|
-
processorApps: ["connect"
|
|
302
|
+
processorApps: ["connect"],
|
|
302
303
|
useTsMorph: USE_TS_MORPH,
|
|
303
304
|
});
|
|
304
305
|
});
|
|
@@ -311,6 +312,7 @@ describe("CodegenProcessorLegacy E2E Tests", () => {
|
|
|
311
312
|
{ id: "dt-1", documentType: "powerhouse/document-model" },
|
|
312
313
|
],
|
|
313
314
|
status: "CONFIRMED",
|
|
315
|
+
processorApps: ["switchboard"],
|
|
314
316
|
};
|
|
315
317
|
const strand = {
|
|
316
318
|
documentId: "test-doc-1",
|
|
@@ -325,7 +327,7 @@ describe("CodegenProcessorLegacy E2E Tests", () => {
|
|
|
325
327
|
documentTypes: ["powerhouse/document-model"],
|
|
326
328
|
skipFormat: mockConfig.PH_CONFIG.skipFormat,
|
|
327
329
|
useTsMorph: USE_TS_MORPH,
|
|
328
|
-
processorApps: ["
|
|
330
|
+
processorApps: ["switchboard"],
|
|
329
331
|
});
|
|
330
332
|
});
|
|
331
333
|
it("should not call generateProcessor for unsupported processor type", async () => {
|
|
@@ -337,6 +339,7 @@ describe("CodegenProcessorLegacy E2E Tests", () => {
|
|
|
337
339
|
{ id: "dt-1", documentType: "powerhouse/document-model" },
|
|
338
340
|
],
|
|
339
341
|
status: "CONFIRMED",
|
|
342
|
+
processorApps: ["connect"],
|
|
340
343
|
};
|
|
341
344
|
const strand = {
|
|
342
345
|
documentId: "test-doc-1",
|
|
@@ -354,6 +357,7 @@ describe("CodegenProcessorLegacy E2E Tests", () => {
|
|
|
354
357
|
type: "analytics",
|
|
355
358
|
documentTypes: [],
|
|
356
359
|
status: "CONFIRMED",
|
|
360
|
+
processorApps: ["connect"],
|
|
357
361
|
};
|
|
358
362
|
const strand = {
|
|
359
363
|
documentId: "test-doc-1",
|