@powerhousedao/vetra 6.0.0-dev.2 → 6.0.0-dev.20

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.
Files changed (57) hide show
  1. package/dist/editors/app-editor/components/AppEditorForm.js +1 -1
  2. package/dist/editors/app-editor/editor.js +1 -1
  3. package/dist/editors/app-editor/editor.test.js +8 -1
  4. package/dist/editors/document-editor/components/DocumentEditorForm.js +1 -1
  5. package/dist/editors/document-editor/editor.js +1 -1
  6. package/dist/editors/processor-editor/components/ProcessorEditorForm.js +1 -1
  7. package/dist/editors/processor-editor/editor.js +1 -1
  8. package/dist/editors/subgraph-editor/components/SubgraphEditorForm.js +1 -1
  9. package/dist/editors/subgraph-editor/editor.js +1 -1
  10. package/dist/editors/vetra-drive-app/DriveExplorer.js +1 -1
  11. package/dist/editors/vetra-drive-app/components/DriveHeader.js +1 -1
  12. package/dist/editors/vetra-drive-app/editor.js +1 -1
  13. package/dist/editors/vetra-package/components/MetaForm.js +1 -1
  14. package/dist/editors/vetra-package/editor.js +1 -1
  15. package/dist/processors/codegen/__tests__/codegen-processor-e2e.test.js +25 -22
  16. package/dist/processors/codegen/document-handlers/generators/app-generator.js +4 -4
  17. package/dist/processors/codegen/document-handlers/generators/document-editor-generator.js +2 -2
  18. package/dist/processors/codegen/document-handlers/generators/document-model-generator.d.ts +4 -0
  19. package/dist/processors/codegen/document-handlers/generators/document-model-generator.d.ts.map +1 -1
  20. package/dist/processors/codegen/document-handlers/generators/document-model-generator.js +35 -19
  21. package/dist/processors/codegen/document-handlers/generators/processor-generator.js +1 -1
  22. package/dist/processors/codegen/factory.d.ts +2 -1
  23. package/dist/processors/codegen/factory.d.ts.map +1 -1
  24. package/dist/processors/codegen/factory.legacy.d.ts +4 -0
  25. package/dist/processors/codegen/factory.legacy.d.ts.map +1 -0
  26. package/dist/processors/codegen/factory.legacy.js +53 -0
  27. package/dist/processors/codegen/index.d.ts +2 -2
  28. package/dist/processors/codegen/index.d.ts.map +1 -1
  29. package/dist/processors/codegen/index.js +22 -21
  30. package/dist/processors/codegen/index.legacy.d.ts +11 -0
  31. package/dist/processors/codegen/index.legacy.d.ts.map +1 -0
  32. package/dist/processors/codegen/index.legacy.js +57 -0
  33. package/dist/processors/factory.d.ts +4 -4
  34. package/dist/processors/factory.d.ts.map +1 -1
  35. package/dist/processors/factory.js +4 -3
  36. package/dist/processors/factory.legacy.d.ts +7 -0
  37. package/dist/processors/factory.legacy.d.ts.map +1 -0
  38. package/dist/processors/factory.legacy.js +20 -0
  39. package/dist/processors/index.d.ts +8 -2
  40. package/dist/processors/index.d.ts.map +1 -1
  41. package/dist/processors/index.js +10 -2
  42. package/dist/processors/vetra-read-model/factory.d.ts +3 -2
  43. package/dist/processors/vetra-read-model/factory.d.ts.map +1 -1
  44. package/dist/processors/vetra-read-model/factory.js +13 -16
  45. package/dist/processors/vetra-read-model/factory.legacy.d.ts +4 -0
  46. package/dist/processors/vetra-read-model/factory.legacy.d.ts.map +1 -0
  47. package/dist/processors/vetra-read-model/factory.legacy.js +24 -0
  48. package/dist/processors/vetra-read-model/index.d.ts +6 -5
  49. package/dist/processors/vetra-read-model/index.d.ts.map +1 -1
  50. package/dist/processors/vetra-read-model/index.js +20 -37
  51. package/dist/processors/vetra-read-model/index.legacy.d.ts +9 -0
  52. package/dist/processors/vetra-read-model/index.legacy.d.ts.map +1 -0
  53. package/dist/processors/vetra-read-model/index.legacy.js +75 -0
  54. package/dist/subgraphs/vetra-read-model/resolvers.d.ts.map +1 -1
  55. package/dist/subgraphs/vetra-read-model/resolvers.js +2 -3
  56. package/dist/tsconfig.tsbuildinfo +1 -1
  57. package/package.json +15 -14
@@ -97,7 +97,7 @@ export const AppEditorForm = () => {
97
97
  handleAddDocumentType(selectedValue);
98
98
  }
99
99
  };
100
- return (_jsxs("div", { className: "space-y-6 bg-white p-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("h2", { className: "text-lg font-medium text-gray-900", children: "App Configuration" }), _jsx(StatusPill, { status: status === "CONFIRMED" ? "confirmed" : "draft", label: status === "CONFIRMED" ? "Confirmed" : "Draft" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "app-name", className: "mb-2 block text-sm font-medium text-gray-700", children: "App Name" }), _jsx("input", { id: "app-name", type: "text", value: appName, onChange: (e) => setAppName(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 app name" })] }), _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 && (_jsxs("select", { onChange: (e) => handleDocumentTypeSelection(e.target.value), 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", { children: "Select a document type to add" }), _jsx("option", { children: "--- Vetra drive document types ---" }), _jsx("option", { value: ALL_IN_DRIVE, children: "Add all document types in Vetra drive" }), documentTypesInSelectedDrive
100
+ 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: "App Configuration" }), _jsx(StatusPill, { status: status === "CONFIRMED" ? "confirmed" : "draft", label: status === "CONFIRMED" ? "Confirmed" : "Draft" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "app-name", className: "mb-2 block text-sm font-medium text-gray-700", children: "App Name" }), _jsx("input", { id: "app-name", type: "text", value: appName, onChange: (e) => setAppName(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 app name" })] }), _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 && (_jsxs("select", { onChange: (e) => handleDocumentTypeSelection(e.target.value), 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", { children: "Select a document type to add" }), _jsx("option", { children: "--- Vetra drive document types ---" }), _jsx("option", { value: ALL_IN_DRIVE, children: "Add all document types in Vetra drive" }), documentTypesInSelectedDrive
101
101
  ?.filter((dt) => !selectedDocumentTypes.includes(dt))
102
102
  .map((docType) => (_jsx("option", { value: docType, children: docType }, docType))), _jsx("option", { children: "--- Reactor document types ---" }), _jsx("option", { value: ALL_IN_REACTOR, children: "Add all document types in Reactor" }), supportedDocumentTypesInReactor
103
103
  ?.filter((dt) => !selectedDocumentTypes.includes(dt))
@@ -5,5 +5,5 @@ import { AppEditorForm } from "./components/AppEditorForm.js";
5
5
  import { editorConfig } from "./config.js";
6
6
  export default function Editor() {
7
7
  useSetPHDocumentEditorConfig(editorConfig);
8
- return (_jsxs("div", { children: [_jsx(DocumentToolbar, {}), _jsx(AppEditorForm, {})] }));
8
+ return (_jsxs("div", { className: "bg-gray-50 p-6", children: [_jsx(DocumentToolbar, {}), _jsx(AppEditorForm, {})] }));
9
9
  }
@@ -1,12 +1,15 @@
1
1
  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
- import { beforeEach, describe, expect, it, vi } from "vitest";
4
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
5
5
  import { useSelectedAppModuleDocument } from "../../document-models/app-module/hooks.js";
6
6
  import Editor from "./editor.js";
7
7
  vi.mock("../../document-models/app-module/hooks.js", () => ({
8
8
  useSelectedAppModuleDocument: vi.fn(),
9
9
  }));
10
+ vi.mock("@powerhousedao/design-system/connect", () => ({
11
+ DocumentToolbar: () => null,
12
+ }));
10
13
  vi.mock("@powerhousedao/reactor-browser", async (importOriginal) => {
11
14
  const actual = await importOriginal();
12
15
  return {
@@ -34,6 +37,7 @@ vi.mock("@powerhousedao/reactor-browser", async (importOriginal) => {
34
37
  describe("AppModule Editor", () => {
35
38
  let mockDispatch;
36
39
  beforeEach(() => {
40
+ window.ph = {};
37
41
  mockDispatch = vi.fn();
38
42
  vi.mocked(useSelectedAppModuleDocument).mockReturnValue([
39
43
  {
@@ -49,6 +53,9 @@ describe("AppModule Editor", () => {
49
53
  mockDispatch,
50
54
  ]);
51
55
  });
56
+ afterEach(() => {
57
+ delete window.ph;
58
+ });
52
59
  describe("Core Rendering", () => {
53
60
  it("should render all main form sections and labels", () => {
54
61
  render(_jsx(Editor, {}));
@@ -59,7 +59,7 @@ export const DocumentEditorForm = ({ editorName: initialEditorName = "", documen
59
59
  onConfirm?.();
60
60
  }
61
61
  };
62
- return (_jsxs("div", { className: "space-y-6 bg-white p-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("h2", { className: "text-lg font-medium text-gray-900", children: "Editor Configuration" }), _jsx(StatusPill, { status: status === "CONFIRMED" ? "confirmed" : "draft", label: status === "CONFIRMED" ? "Confirmed" : "Draft" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "editor-name", className: "mb-2 block text-sm font-medium text-gray-700", children: "Editor Name" }), _jsx("input", { id: "editor-name", type: "text", value: editorName, onChange: (e) => setEditorName(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" : ""}` })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "supported-document-types", className: "mb-2 block text-sm font-medium text-gray-700", children: "Supported Document Types" }), _jsxs("div", { className: "space-y-2", children: [!isReadOnly && (_jsx(Suspense, { fallback: _jsx(DocumentTypeSelectUI, {}), children: _jsx(DocumentTypeSelect, { documentTypes: documentTypes, setDocumentTypes: setDocumentTypes, onAddDocumentType: onAddDocumentType, onRemoveDocumentType: onRemoveDocumentType }) })), _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: () => {
62
+ 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: "Editor Configuration" }), _jsx(StatusPill, { status: status === "CONFIRMED" ? "confirmed" : "draft", label: status === "CONFIRMED" ? "Confirmed" : "Draft" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "editor-name", className: "mb-2 block text-sm font-medium text-gray-700", children: "Editor Name" }), _jsx("input", { id: "editor-name", type: "text", value: editorName, onChange: (e) => setEditorName(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" : ""}` })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "supported-document-types", className: "mb-2 block text-sm font-medium text-gray-700", children: "Supported Document Types" }), _jsxs("div", { className: "space-y-2", children: [!isReadOnly && (_jsx(Suspense, { fallback: _jsx(DocumentTypeSelectUI, {}), children: _jsx(DocumentTypeSelect, { documentTypes: documentTypes, setDocumentTypes: setDocumentTypes, onAddDocumentType: onAddDocumentType, onRemoveDocumentType: onRemoveDocumentType }) })), _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: () => {
63
63
  setDocumentTypes([]);
64
64
  onRemoveDocumentType?.({ id: type.id });
65
65
  }, className: "ml-2 text-gray-400 hover:text-gray-600 focus:outline-none", children: "\u00D7" }))] }, type.id))) })] })] }), !isReadOnly && (_jsx("div", { children: _jsx("button", { onClick: handleConfirm, disabled: !editorName.trim() || documentTypes.length === 0, 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" }) }))] }));
@@ -25,5 +25,5 @@ export default function Editor() {
25
25
  const onConfirm = useCallback(() => {
26
26
  dispatch(actions.setEditorStatus({ status: "CONFIRMED" }));
27
27
  }, [dispatch]);
28
- return (_jsxs("div", { children: [_jsx(DocumentToolbar, {}), _jsx(DocumentEditorForm, { status: document.state.global.status, editorName: document.state.global.name ?? "", documentTypes: document.state.global.documentTypes, onEditorNameChange: onEditorNameChange, onAddDocumentType: onAddDocumentType, onRemoveDocumentType: onRemoveDocumentType, onConfirm: onConfirm })] }));
28
+ return (_jsxs("div", { className: "bg-gray-50 p-6", children: [_jsx(DocumentToolbar, {}), _jsx(DocumentEditorForm, { status: document.state.global.status, editorName: document.state.global.name ?? "", documentTypes: document.state.global.documentTypes, onEditorNameChange: onEditorNameChange, onAddDocumentType: onAddDocumentType, onRemoveDocumentType: onRemoveDocumentType, onConfirm: onConfirm })] }));
29
29
  }
@@ -42,7 +42,7 @@ export const ProcessorEditorForm = ({ processorName: initialProcessorName = "",
42
42
  onRemoveDocumentType?.(id);
43
43
  };
44
44
  const canConfirm = processorName.trim() && processorType && documentTypes.length > 0;
45
- return (_jsxs("div", { className: "space-y-6 bg-white 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) => {
45
+ 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
46
  const selectedValue = e.target.value;
47
47
  if (selectedValue &&
48
48
  !documentTypes.some((dt) => dt.documentType === selectedValue)) {
@@ -29,5 +29,5 @@ export default function Editor() {
29
29
  const onRemoveDocumentType = useCallback((id) => {
30
30
  dispatch(actions.removeDocumentType({ id }));
31
31
  }, [dispatch]);
32
- return (_jsxs("div", { children: [_jsx(DocumentToolbar, {}), _jsx(ProcessorEditorForm, { onNameChange: onNameChange, onTypeChange: onTypeChange, onAddDocumentType: onAddDocumentType, onRemoveDocumentType: onRemoveDocumentType, status: document.state.global.status, processorName: document.state.global.name ?? "", processorType: document.state.global.type ?? "", documentTypes: document.state.global.documentTypes ?? [], onConfirm: onConfirm })] }));
32
+ return (_jsxs("div", { className: "bg-gray-50 p-6", children: [_jsx(DocumentToolbar, {}), _jsx(ProcessorEditorForm, { onNameChange: onNameChange, onTypeChange: onTypeChange, onAddDocumentType: onAddDocumentType, onRemoveDocumentType: onRemoveDocumentType, status: document.state.global.status, processorName: document.state.global.name ?? "", processorType: document.state.global.type ?? "", documentTypes: document.state.global.documentTypes ?? [], onConfirm: onConfirm })] }));
33
33
  }
@@ -25,5 +25,5 @@ export const SubgraphEditorForm = ({ subgraphName: initialSubgraphName = "", sta
25
25
  onConfirm?.();
26
26
  }
27
27
  };
28
- return (_jsxs("div", { className: "space-y-6 bg-white p-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("h2", { className: "text-lg font-medium text-gray-900", children: "Subgraph Configuration" }), _jsx(StatusPill, { status: status === "CONFIRMED" ? "confirmed" : "draft", label: status === "CONFIRMED" ? "Confirmed" : "Draft" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "subgraph-name", className: "mb-2 block text-sm font-medium text-gray-700", children: "Subgraph Name" }), _jsx("input", { id: "subgraph-name", type: "text", value: subgraphName, onChange: (e) => setSubgraphName(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 subgraph name" })] }), !isReadOnly && (_jsx("div", { children: _jsx("button", { onClick: handleConfirm, disabled: !subgraphName.trim(), 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" }) }))] }));
28
+ 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: "Subgraph Configuration" }), _jsx(StatusPill, { status: status === "CONFIRMED" ? "confirmed" : "draft", label: status === "CONFIRMED" ? "Confirmed" : "Draft" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "subgraph-name", className: "mb-2 block text-sm font-medium text-gray-700", children: "Subgraph Name" }), _jsx("input", { id: "subgraph-name", type: "text", value: subgraphName, onChange: (e) => setSubgraphName(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 subgraph name" })] }), !isReadOnly && (_jsx("div", { children: _jsx("button", { onClick: handleConfirm, disabled: !subgraphName.trim(), 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" }) }))] }));
29
29
  };
@@ -17,5 +17,5 @@ export default function Editor() {
17
17
  const onConfirm = useCallback(() => {
18
18
  dispatch(actions.setSubgraphStatus({ status: "CONFIRMED" }));
19
19
  }, [dispatch]);
20
- return (_jsxs("div", { children: [_jsx(DocumentToolbar, {}), _jsx(SubgraphEditorForm, { subgraphName: document.state.global.name ?? "", status: document.state.global.status, onNameChange: onNameChange, onConfirm: onConfirm })] }));
20
+ return (_jsxs("div", { className: "bg-gray-50 p-6", children: [_jsx(DocumentToolbar, {}), _jsx(SubgraphEditorForm, { subgraphName: document.state.global.name ?? "", status: document.state.global.status, onNameChange: onNameChange, onConfirm: onConfirm })] }));
21
21
  }
@@ -3,5 +3,5 @@ import { DriveHeader } from "./components/DriveHeader.js";
3
3
  import { ModuleSpecificationsSection } from "./components/ModuleSpecificationsSection.js";
4
4
  import { PackageInformationSection } from "./components/PackageInformationSection.js";
5
5
  export const DriveExplorer = ({ driveId, driveName, driveUrl, documentModels = [], editors = [], apps = [], subgraphs = [], processors = [], codegenProcessors = [], onAddDocumentModel, onAddEditor, onAddApp, onAddSubgraph, onAddProcessor, onAddCodegenProcessor, packageDocumentId, onAddPackageDocument, onOpenPackageDocument, onOpenDocument, onDelete, }) => {
6
- return (_jsxs("div", { className: "min-h-screen bg-white", children: [_jsx(DriveHeader, { driveId: driveId, driveName: driveName, driveUrl: driveUrl }), _jsxs("div", { className: "mx-6 mt-6 bg-white", children: [_jsx(PackageInformationSection, { className: "mb-6", packageDocumentId: packageDocumentId, onAddPackageDocument: onAddPackageDocument, onOpenPackageDocument: onOpenPackageDocument }), _jsx(ModuleSpecificationsSection, { documentModels: documentModels, editors: editors, apps: apps, subgraphs: subgraphs, processors: processors, codegenProcessors: codegenProcessors, onAddDocumentModel: onAddDocumentModel, onAddEditor: onAddEditor, onAddApp: onAddApp, onAddSubgraph: onAddSubgraph, onAddProcessor: onAddProcessor, onAddCodegenProcessor: onAddCodegenProcessor, onOpenDocument: onOpenDocument, onDelete: onDelete })] })] }));
6
+ return (_jsxs("div", { className: "min-h-screen", children: [_jsx(DriveHeader, { driveId: driveId, driveName: driveName, driveUrl: driveUrl }), _jsxs("div", { className: "mx-6 mt-6", children: [_jsx(PackageInformationSection, { className: "mb-6", packageDocumentId: packageDocumentId, onAddPackageDocument: onAddPackageDocument, onOpenPackageDocument: onOpenPackageDocument }), _jsx(ModuleSpecificationsSection, { documentModels: documentModels, editors: editors, apps: apps, subgraphs: subgraphs, processors: processors, codegenProcessors: codegenProcessors, onAddDocumentModel: onAddDocumentModel, onAddEditor: onAddEditor, onAddApp: onAddApp, onAddSubgraph: onAddSubgraph, onAddProcessor: onAddProcessor, onAddCodegenProcessor: onAddCodegenProcessor, onOpenDocument: onOpenDocument, onDelete: onDelete })] })] }));
7
7
  };
@@ -56,5 +56,5 @@ export const DriveHeader = ({ driveId, driveName, driveUrl, }) => {
56
56
  return "";
57
57
  }
58
58
  }, [driveUrl]);
59
- return (_jsx("div", { className: "bg-white px-6 py-4", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(VetraIcon, { width: 20, height: 20 }), _jsx("h1", { className: "text-lg font-semibold text-gray-900", children: "Vetra Studio Drive" }), _jsxs("div", { className: "relative", ref: infoMenuRef, children: [_jsx("button", { "aria-label": "Drive information", "aria-expanded": isInfoMenuOpen, className: "rounded-full p-1 transition-colors hover:bg-gray-100", onClick: toggleInfoMenu, children: _jsx(InfoIcon, { className: "text-gray-500" }) }), isInfoMenuOpen && (_jsxs("div", { role: "menu", className: "absolute left-0 top-full z-10 mt-2 flex flex-col items-start gap-2 rounded-lg bg-white p-3 shadow-lg", children: [_jsx(DriveInfoItem, { label: "Name", value: driveName }), _jsx(DriveInfoItem, { label: "Drive ID", value: driveId })] }))] }), driveUrl && (_jsxs("div", { className: "relative", ref: shareMenuRef, children: [_jsx("button", { "aria-label": "Share drive", "aria-expanded": isShareMenuOpen, className: "rounded-full p-1 transition-colors hover:bg-gray-100", onClick: toggleShareMenu, children: _jsx(ShareIcon, { width: 16, height: 16, stroke: "#343839" }) }), isShareMenuOpen && (_jsxs("div", { role: "menu", className: "absolute left-0 top-full z-10 mt-2 flex w-max flex-col gap-4 rounded-lg bg-white p-4 shadow-lg", children: [_jsx(ShareMenuItem, { label: "Copy the Drive URL", url: driveUrl }), _jsx(ShareMenuItem, { label: "Share this Drive directly in Connect", url: shareUrl })] }))] }))] }), _jsxs("a", { href: "https://academy.vetra.io/", target: "_blank", rel: "noopener noreferrer", className: "flex items-center gap-2 text-sm text-gray-900 underline transition-colors hover:text-gray-700", children: [_jsx(ExternalLinkIcon, { fill: "#111827" }), "Vetra Academy"] })] }) }));
59
+ return (_jsx("div", { className: "bg-gray-50 px-6 py-4", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(VetraIcon, { width: 20, height: 20 }), _jsx("h1", { className: "text-lg font-semibold text-gray-900", children: "Vetra Studio Drive" }), _jsxs("div", { className: "relative", ref: infoMenuRef, children: [_jsx("button", { "aria-label": "Drive information", "aria-expanded": isInfoMenuOpen, className: "rounded-full p-1 transition-colors hover:bg-gray-100", onClick: toggleInfoMenu, children: _jsx(InfoIcon, { className: "text-gray-500" }) }), isInfoMenuOpen && (_jsxs("div", { role: "menu", className: "absolute left-0 top-full z-10 mt-2 flex flex-col items-start gap-2 rounded-lg bg-white p-3 shadow-lg", children: [_jsx(DriveInfoItem, { label: "Name", value: driveName }), _jsx(DriveInfoItem, { label: "Drive ID", value: driveId })] }))] }), driveUrl && (_jsxs("div", { className: "relative", ref: shareMenuRef, children: [_jsx("button", { "aria-label": "Share drive", "aria-expanded": isShareMenuOpen, className: "rounded-full p-1 transition-colors hover:bg-gray-100", onClick: toggleShareMenu, children: _jsx(ShareIcon, { width: 16, height: 16, stroke: "#343839" }) }), isShareMenuOpen && (_jsxs("div", { role: "menu", className: "absolute left-0 top-full z-10 mt-2 flex w-max flex-col gap-4 rounded-lg bg-white p-4 shadow-lg", children: [_jsx(ShareMenuItem, { label: "Copy the Drive URL", url: driveUrl }), _jsx(ShareMenuItem, { label: "Share this Drive directly in Connect", url: shareUrl })] }))] }))] }), _jsxs("a", { href: "https://academy.vetra.io/", target: "_blank", rel: "noopener noreferrer", className: "flex items-center gap-2 text-sm text-gray-900 underline transition-colors hover:text-gray-700", children: [_jsx(ExternalLinkIcon, { fill: "#111827" }), "Vetra Academy"] })] }) }));
60
60
  };
@@ -41,7 +41,7 @@ export function BaseEditor(props) {
41
41
  }
42
42
  }, [packageNode]);
43
43
  const showDocumentEditor = !!children;
44
- return showDocumentEditor ? (children) : (_jsx("div", { style: { height: "100%" }, className: "bg-white after:pointer-events-none after:absolute after:inset-0 after:bg-blue-500 after:opacity-0 after:transition after:content-['']", children: _jsx(DriveExplorer, { driveId: driveId, driveName: driveName, driveUrl: driveUrl, documentModels: docModelsNodes, editors: docEditorsNodes, apps: docAppsNodes, subgraphs: docSubgraphsNodes, processors: docProcessorsNodes, codegenProcessors: [], onAddDocumentModel: () => onCreateDocument(DOCUMENT_TYPES.documentModel), onAddEditor: () => onCreateDocument(DOCUMENT_TYPES.documentEditor), onAddApp: () => onCreateDocument(DOCUMENT_TYPES.documentApp), onAddSubgraph: () => onCreateDocument(DOCUMENT_TYPES.documentSubgraph), onAddProcessor: () => onCreateDocument(DOCUMENT_TYPES.documentProcessor), onAddCodegenProcessor: () => console.log("add codegen processor"), packageDocumentId: packageDocumentId, onAddPackageDocument: onCreatePackageFile, onOpenPackageDocument: onOpenPackageDocument, onOpenDocument: (node) => setSelectedNode(node), onDelete: onDeleteDocument }) }));
44
+ return showDocumentEditor ? (children) : (_jsx("div", { style: { height: "100%" }, className: "bg-gray-50 p-6 after:pointer-events-none after:absolute after:inset-0 after:bg-blue-500 after:opacity-0 after:transition after:content-['']", children: _jsx(DriveExplorer, { driveId: driveId, driveName: driveName, driveUrl: driveUrl, documentModels: docModelsNodes, editors: docEditorsNodes, apps: docAppsNodes, subgraphs: docSubgraphsNodes, processors: docProcessorsNodes, codegenProcessors: [], onAddDocumentModel: () => onCreateDocument(DOCUMENT_TYPES.documentModel), onAddEditor: () => onCreateDocument(DOCUMENT_TYPES.documentEditor), onAddApp: () => onCreateDocument(DOCUMENT_TYPES.documentApp), onAddSubgraph: () => onCreateDocument(DOCUMENT_TYPES.documentSubgraph), onAddProcessor: () => onCreateDocument(DOCUMENT_TYPES.documentProcessor), onAddCodegenProcessor: () => console.log("add codegen processor"), packageDocumentId: packageDocumentId, onAddPackageDocument: onCreatePackageFile, onOpenPackageDocument: onOpenPackageDocument, onOpenDocument: (node) => setSelectedNode(node), onDelete: onDeleteDocument }) }));
45
45
  }
46
46
  export default function Editor(props) {
47
47
  useSetPHDriveEditorConfig(editorConfig);
@@ -20,7 +20,7 @@ export const MetaForm = (props) => {
20
20
  useDebounce(publisherUrl, onPublisherUrlChange, 300);
21
21
  useDebounce(githubRepository, onGithubRepositoryChange, 300);
22
22
  useDebounce(npmPackage, onNpmPackageChange, 300);
23
- return (_jsxs("div", { className: "grid grid-cols-1 gap-6 bg-white p-6 lg:grid-cols-3", children: [_jsxs("div", { className: "space-y-6", children: [_jsxs("div", { children: [_jsx("label", { htmlFor: "package-name", className: "mb-2 block text-sm font-medium text-gray-700", children: "Name" }), _jsx("input", { id: "package-name", type: "text", value: name, onChange: (e) => setName(e.target.value), 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" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "package-description", className: "mb-2 block text-sm font-medium text-gray-700", children: "Description" }), _jsx("textarea", { id: "package-description", rows: 6, value: description, onChange: (e) => setDescription(e.target.value), className: "w-full resize-none rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500" })] })] }), _jsxs("div", { className: "space-y-6", children: [_jsxs("div", { children: [_jsx("label", { htmlFor: "package-category", className: "mb-2 block text-sm font-medium text-gray-700", children: "Category" }), _jsxs("select", { id: "package-category", value: category, onChange: (e) => {
23
+ return (_jsxs("div", { className: "grid grid-cols-1 gap-6 p-6 lg:grid-cols-3", children: [_jsxs("div", { className: "space-y-6", children: [_jsxs("div", { children: [_jsx("label", { htmlFor: "package-name", className: "mb-2 block text-sm font-medium text-gray-700", children: "Name" }), _jsx("input", { id: "package-name", type: "text", value: name, onChange: (e) => setName(e.target.value), 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" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "package-description", className: "mb-2 block text-sm font-medium text-gray-700", children: "Description" }), _jsx("textarea", { id: "package-description", rows: 6, value: description, onChange: (e) => setDescription(e.target.value), className: "w-full resize-none rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500" })] })] }), _jsxs("div", { className: "space-y-6", children: [_jsxs("div", { children: [_jsx("label", { htmlFor: "package-category", className: "mb-2 block text-sm font-medium text-gray-700", children: "Category" }), _jsxs("select", { id: "package-category", value: category, onChange: (e) => {
24
24
  const newValue = e.target.value;
25
25
  setCategory(newValue);
26
26
  onCategoryChange?.(newValue);
@@ -65,5 +65,5 @@ export default function Editor(props) {
65
65
  const onRemoveKeyword = useCallback((id) => {
66
66
  dispatch(actions.removePackageKeyword({ id }));
67
67
  }, []);
68
- return (_jsxs("div", { children: [displayToolbar && _jsx(DocumentToolbar, {}), _jsx(MetaForm, { name: document.state.global.name ?? "", description: document.state.global.description ?? "", category: document.state.global.category ?? "", publisher: document.state.global.author.name ?? "", publisherUrl: document.state.global.author.website ?? "", githubRepository: document.state.global.githubUrl ?? "", npmPackage: document.state.global.npmUrl ?? "", keywords: document.state.global.keywords, onNameChange: onNameChange, onDescriptionChange: onDescriptionChange, onCategoryChange: onCategoryChange, onPublisherChange: onPublisherChange, onPublisherUrlChange: onPublisherUrlChange, onGithubRepositoryChange: onGithubRepositoryChange, onNpmPackageChange: onNpmPackageChange, onAddKeyword: onAddKeyword, onRemoveKeyword: onRemoveKeyword })] }));
68
+ return (_jsxs("div", { className: "bg-gray-50 p-6", children: [displayToolbar && _jsx(DocumentToolbar, {}), _jsx(MetaForm, { name: document.state.global.name ?? "", description: document.state.global.description ?? "", category: document.state.global.category ?? "", publisher: document.state.global.author.name ?? "", publisherUrl: document.state.global.author.website ?? "", githubRepository: document.state.global.githubUrl ?? "", npmPackage: document.state.global.npmUrl ?? "", keywords: document.state.global.keywords, onNameChange: onNameChange, onDescriptionChange: onDescriptionChange, onCategoryChange: onCategoryChange, onPublisherChange: onPublisherChange, onPublisherUrlChange: onPublisherUrlChange, onGithubRepositoryChange: onGithubRepositoryChange, onNpmPackageChange: onNpmPackageChange, onAddKeyword: onAddKeyword, onRemoveKeyword: onRemoveKeyword })] }));
69
69
  }
@@ -1,7 +1,7 @@
1
1
  import path from "path";
2
2
  import { beforeEach, describe, expect, it, vi } from "vitest";
3
3
  import { USE_TS_MORPH, USE_VERSIONING, } from "../document-handlers/generators/constants.js";
4
- import { CodegenProcessor } from "../index.js";
4
+ import { CodegenProcessorLegacy } from "../index.legacy.js";
5
5
  const defaultManifest = {
6
6
  name: "",
7
7
  description: "",
@@ -55,7 +55,7 @@ vi.mock("../logger.js", () => ({
55
55
  error: vi.fn(),
56
56
  },
57
57
  }));
58
- describe("CodegenProcessor E2E Tests", () => {
58
+ describe("CodegenProcessorLegacy E2E Tests", () => {
59
59
  let processor;
60
60
  let mockConfig;
61
61
  beforeEach(async () => {
@@ -68,7 +68,7 @@ describe("CodegenProcessor E2E Tests", () => {
68
68
  CURRENT_WORKING_DIR: process.cwd(),
69
69
  };
70
70
  // Create a REAL processor instance (not mocked)
71
- processor = new CodegenProcessor();
71
+ processor = new CodegenProcessorLegacy();
72
72
  // Reset all codegen function mocks to resolve successfully
73
73
  const codegen = await import("@powerhousedao/codegen");
74
74
  vi.mocked(codegen.generateEditor).mockResolvedValue();
@@ -108,12 +108,12 @@ describe("CodegenProcessor E2E Tests", () => {
108
108
  await vi.runAllTimersAsync();
109
109
  const generateEditorArgs = [
110
110
  {
111
- name: "Test Editor",
111
+ ...mockConfig.PH_CONFIG,
112
+ editorName: "Test Editor",
112
113
  documentTypes: [
113
114
  "powerhouse/document-model",
114
115
  "powerhouse/budget-statement",
115
116
  ],
116
- config: mockConfig.PH_CONFIG,
117
117
  editorId: "test-editor",
118
118
  useTsMorph: USE_TS_MORPH,
119
119
  },
@@ -202,7 +202,7 @@ describe("CodegenProcessor E2E Tests", () => {
202
202
  const strand = {
203
203
  documentId: "test-doc-1",
204
204
  documentType: "powerhouse/document-model",
205
- state: validState,
205
+ state: { global: validState },
206
206
  };
207
207
  await processor.onStrands([strand]);
208
208
  await vi.runAllTimersAsync();
@@ -236,7 +236,7 @@ describe("CodegenProcessor E2E Tests", () => {
236
236
  const strand = {
237
237
  documentId: "test-doc-1",
238
238
  documentType: "powerhouse/document-model",
239
- state: invalidState,
239
+ state: { global: invalidState },
240
240
  };
241
241
  await processor.onStrands([strand]);
242
242
  await vi.runAllTimersAsync();
@@ -261,7 +261,7 @@ describe("CodegenProcessor E2E Tests", () => {
261
261
  const strand = {
262
262
  documentId: "test-doc-1",
263
263
  documentType: "powerhouse/document-model",
264
- state: validState,
264
+ state: { global: validState },
265
265
  };
266
266
  await processor.onStrands([strand]);
267
267
  await vi.runAllTimersAsync();
@@ -290,7 +290,7 @@ describe("CodegenProcessor E2E Tests", () => {
290
290
  };
291
291
  await processor.onStrands([strand]);
292
292
  await vi.runAllTimersAsync();
293
- expect(generateProcessor).toHaveBeenCalledWith("Test Processor", "analytics", ["powerhouse/document-model", "powerhouse/budget-statement"], mockConfig.PH_CONFIG);
293
+ expect(generateProcessor).toHaveBeenCalledWith("Test Processor", "analytics", ["powerhouse/document-model", "powerhouse/budget-statement"], mockConfig.PH_CONFIG.skipFormat);
294
294
  });
295
295
  it("should map relational type to relationalDb when processing processor strand", async () => {
296
296
  const { generateProcessor } = await import("@powerhousedao/codegen");
@@ -309,7 +309,7 @@ describe("CodegenProcessor E2E Tests", () => {
309
309
  };
310
310
  await processor.onStrands([strand]);
311
311
  await vi.runAllTimersAsync();
312
- expect(generateProcessor).toHaveBeenCalledWith("Test Processor", "relationalDb", ["powerhouse/document-model"], mockConfig.PH_CONFIG);
312
+ expect(generateProcessor).toHaveBeenCalledWith("Test Processor", "relationalDb", ["powerhouse/document-model"], mockConfig.PH_CONFIG.skipFormat);
313
313
  });
314
314
  it("should not call generateProcessor for unsupported processor type", async () => {
315
315
  const { generateProcessor } = await import("@powerhousedao/codegen");
@@ -366,10 +366,10 @@ describe("CodegenProcessor E2E Tests", () => {
366
366
  await vi.runAllTimersAsync();
367
367
  const generateDriveEditorArgs = [
368
368
  {
369
- name: "Test App",
370
- config: mockConfig.PH_CONFIG,
371
- appId: "test-app",
372
- allowedDocumentTypes: "",
369
+ driveEditorName: "Test App",
370
+ ...mockConfig.PH_CONFIG,
371
+ driveEditorId: "test-app",
372
+ allowedDocumentTypes: [],
373
373
  isDragAndDropEnabled: false,
374
374
  useTsMorph: USE_TS_MORPH,
375
375
  },
@@ -404,10 +404,13 @@ describe("CodegenProcessor E2E Tests", () => {
404
404
  await processor.onStrands([strand]);
405
405
  await vi.runAllTimersAsync();
406
406
  expect(generateDriveEditor).toHaveBeenCalledWith({
407
- name: "Test App",
408
- config: mockConfig.PH_CONFIG,
409
- appId: "test-app",
410
- allowedDocumentTypes: "powerhouse/document-model,powerhouse/budget-statement",
407
+ driveEditorName: "Test App",
408
+ ...mockConfig.PH_CONFIG,
409
+ driveEditorId: "test-app",
410
+ allowedDocumentTypes: [
411
+ "powerhouse/document-model",
412
+ "powerhouse/budget-statement",
413
+ ],
411
414
  isDragAndDropEnabled: true,
412
415
  useTsMorph: USE_TS_MORPH,
413
416
  });
@@ -557,9 +560,9 @@ describe("CodegenProcessor E2E Tests", () => {
557
560
  await processor.onStrands(strands);
558
561
  await vi.runAllTimersAsync();
559
562
  expect(generateEditor).toHaveBeenCalledWith({
560
- name: "Test Editor",
563
+ editorName: "Test Editor",
561
564
  documentTypes: ["powerhouse/document-model"],
562
- config: mockConfig.PH_CONFIG,
565
+ ...mockConfig.PH_CONFIG,
563
566
  editorId: "test-editor",
564
567
  useTsMorph: USE_TS_MORPH,
565
568
  });
@@ -596,9 +599,9 @@ describe("CodegenProcessor E2E Tests", () => {
596
599
  await vi.runAllTimersAsync();
597
600
  // Valid strand should be processed
598
601
  expect(generateEditor).toHaveBeenCalledWith({
599
- name: "Test Editor",
602
+ editorName: "Test Editor",
600
603
  documentTypes: ["powerhouse/document-model"],
601
- config: mockConfig.PH_CONFIG,
604
+ ...mockConfig.PH_CONFIG,
602
605
  editorId: "test-editor",
603
606
  useTsMorph: USE_TS_MORPH,
604
607
  });
@@ -43,10 +43,10 @@ export class AppGenerator extends BaseDocumentGen {
43
43
  const appId = kebabCase(state.name);
44
44
  // Generate the drive editor using the codegen function
45
45
  await generateDriveEditor({
46
- name: state.name,
47
- config: this.config.PH_CONFIG,
48
- appId: appId,
49
- allowedDocumentTypes: state.allowedDocumentTypes?.join(","),
46
+ ...this.config.PH_CONFIG,
47
+ driveEditorName: state.name,
48
+ driveEditorId: appId,
49
+ allowedDocumentTypes: state.allowedDocumentTypes ?? [],
50
50
  isDragAndDropEnabled: state.isDragAndDropEnabled,
51
51
  useTsMorph: USE_TS_MORPH,
52
52
  });
@@ -48,9 +48,9 @@ export class DocumentEditorGenerator extends BaseDocumentGen {
48
48
  const editorId = kebabCase(state.name);
49
49
  // Generate the editor using the codegen function
50
50
  await generateEditor({
51
- name: state.name,
51
+ ...this.config.PH_CONFIG,
52
+ editorName: state.name,
52
53
  documentTypes: documentTypes,
53
- config: this.config.PH_CONFIG,
54
54
  editorId: editorId,
55
55
  useTsMorph: USE_TS_MORPH,
56
56
  });
@@ -5,6 +5,10 @@ import { BaseDocumentGen } from "../base-document-gen.js";
5
5
  */
6
6
  export declare class DocumentModelGenerator extends BaseDocumentGen {
7
7
  readonly supportedDocumentTypes = "powerhouse/document-model";
8
+ /**
9
+ * Extract the global state from the full document state
10
+ */
11
+ private extractGlobalState;
8
12
  /**
9
13
  * Validate if this document model strand should be processed
10
14
  */
@@ -1 +1 @@
1
- {"version":3,"file":"document-model-generator.d.ts","sourceRoot":"","sources":["../../../../../processors/codegen/document-handlers/generators/document-model-generator.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAGhE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAI1D;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,eAAe;IACzD,QAAQ,CAAC,sBAAsB,+BAA+B;IAE9D;;OAEG;IACH,aAAa,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO;IAiCnD,QAAQ,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;CA4DjE"}
1
+ {"version":3,"file":"document-model-generator.d.ts","sourceRoot":"","sources":["../../../../../processors/codegen/document-handlers/generators/document-model-generator.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAMhE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAI1D;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,eAAe;IACzD,QAAQ,CAAC,sBAAsB,+BAA+B;IAE9D;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAY1B;;OAEG;IACH,aAAa,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO;IAiCnD,QAAQ,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;CAqEjE"}
@@ -8,6 +8,18 @@ import { backupDocument } from "./utils.js";
8
8
  */
9
9
  export class DocumentModelGenerator extends BaseDocumentGen {
10
10
  supportedDocumentTypes = "powerhouse/document-model";
11
+ /**
12
+ * Extract the global state from the full document state
13
+ */
14
+ extractGlobalState(strand) {
15
+ const fullState = strand.state;
16
+ if (!fullState) {
17
+ return undefined;
18
+ }
19
+ // The state is the full document state with {auth, document, local, global, header}
20
+ // We need the global property which contains the DocumentModelGlobalState
21
+ return fullState.global;
22
+ }
11
23
  /**
12
24
  * Validate if this document model strand should be processed
13
25
  */
@@ -16,58 +28,62 @@ export class DocumentModelGenerator extends BaseDocumentGen {
16
28
  if (!super.shouldProcess(strand)) {
17
29
  return false;
18
30
  }
19
- // Validate document model state
20
- const state = strand.state;
21
- if (!state) {
22
- logger.debug(`>>> No state found for document model: ${strand.documentId}`);
31
+ // Extract the global state from the full document state
32
+ const globalState = this.extractGlobalState(strand);
33
+ if (!globalState) {
34
+ logger.debug(`>>> No global state found for document model: ${strand.documentId}`);
23
35
  return false;
24
36
  }
25
- const validationResult = validateDocumentModelState(state);
37
+ const validationResult = validateDocumentModelState(globalState);
26
38
  if (!validationResult.isValid) {
27
39
  const errorList = validationResult.errors
28
40
  .map((error) => ` - ${error}`)
29
41
  .join("\n");
30
- logger.info(`⚠️ Skipped code generation for '${state.name || strand.documentId}' due to validation errors:\n${errorList}`);
42
+ logger.info(`⚠️ Skipped code generation for '${globalState.name || strand.documentId}' due to validation errors:\n${errorList}`);
31
43
  return false;
32
44
  }
33
- logger.info(`Document model ${state.name} is valid, proceeding with code generation`);
45
+ logger.info(`Document model ${globalState.name} is valid, proceeding with code generation`);
34
46
  return true;
35
47
  }
36
48
  async generate(strand) {
37
- const state = strand.state;
49
+ const globalState = this.extractGlobalState(strand);
50
+ if (!globalState) {
51
+ logger.error(`❌ No global state found for document model: ${strand.documentId}`);
52
+ return;
53
+ }
38
54
  // Validation is already done in shouldProcess, so we can proceed directly
39
- logger.debug(`🔄 Starting code generation for document model: ${state.name}`);
55
+ logger.debug(`🔄 Starting code generation for document model: ${globalState.name}`);
40
56
  try {
41
57
  await generateFromDocument({
42
- documentModelState: state,
58
+ documentModelState: globalState,
43
59
  config: this.config.PH_CONFIG,
44
60
  useTsMorph: USE_TS_MORPH,
45
61
  useVersioning: USE_VERSIONING,
46
62
  });
47
- logger.info(`✅ Code generation completed successfully for: ${state.name}`);
63
+ logger.info(`✅ Code generation completed successfully for: ${globalState.name}`);
48
64
  // Update the manifest with the new document model
49
65
  try {
50
- logger.debug(`🔄 Updating manifest with document model: ${state.name} (ID: ${state.id})`);
66
+ logger.debug(`🔄 Updating manifest with document model: ${globalState.name} (ID: ${globalState.id})`);
51
67
  generateManifest({
52
68
  documentModels: [
53
69
  {
54
- id: state.id,
55
- name: state.name,
70
+ id: globalState.id,
71
+ name: globalState.name,
56
72
  },
57
73
  ],
58
74
  }, this.config.CURRENT_WORKING_DIR);
59
- logger.debug(`✅ Manifest updated successfully for document model: ${state.name}`);
75
+ logger.debug(`✅ Manifest updated successfully for document model: ${globalState.name}`);
60
76
  }
61
77
  catch (manifestError) {
62
- logger.error(`⚠️ Failed to update manifest for document model ${state.name}:`, manifestError);
78
+ logger.error(`⚠️ Failed to update manifest for document model ${globalState.name}:`, manifestError);
63
79
  // Don't throw here - code generation was successful
64
80
  }
65
81
  // Backup the document
66
- const extension = state.extension?.replace(/^\.+|\.+$/g, "") || "";
67
- await backupDocument(strand.document, this.config.CURRENT_WORKING_DIR, extension, state.name);
82
+ const extension = globalState.extension?.replace(/^\.+|\.+$/g, "") || "";
83
+ await backupDocument(strand.document, this.config.CURRENT_WORKING_DIR, extension, globalState.name);
68
84
  }
69
85
  catch (error) {
70
- logger.error(`❌ Error during code generation for ${state.name}:`, error);
86
+ logger.error(`❌ Error during code generation for ${globalState.name}:`, error);
71
87
  // Don't throw - let codegen continue with other documents
72
88
  return;
73
89
  }
@@ -63,7 +63,7 @@ export class ProcessorGenerator extends BaseDocumentGen {
63
63
  // Extract document types from the state
64
64
  const documentTypes = state.documentTypes.map((dt) => dt.documentType);
65
65
  // Generate the processor using the codegen function
66
- await generateProcessor(state.name, processorType, documentTypes, this.config.PH_CONFIG);
66
+ await generateProcessor(state.name, processorType, documentTypes, this.config.PH_CONFIG.skipFormat);
67
67
  logger.info(`✅ Processor generation completed successfully for: ${state.name}`);
68
68
  // Backup the document
69
69
  await backupDocument(strand.document, this.config.CURRENT_WORKING_DIR, undefined, state.name);
@@ -1,4 +1,5 @@
1
- import type { IProcessorHostModule, ProcessorRecord } from "document-drive";
1
+ import type { ProcessorRecord } from "@powerhousedao/reactor";
2
+ import type { IProcessorHostModule } from "document-drive";
2
3
  import type { PHDocumentHeader } from "document-model";
3
4
  export declare const codegenProcessorFactory: (module: IProcessorHostModule) => (driveHeader: PHDocumentHeader) => ProcessorRecord[];
4
5
  //# sourceMappingURL=factory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../processors/codegen/factory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAgCvD,eAAO,MAAM,uBAAuB,GACjC,QAAQ,oBAAoB,MAC5B,aAAa,gBAAgB,KAAG,eAAe,EAsC/C,CAAC"}
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../processors/codegen/factory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAgCvD,eAAO,MAAM,uBAAuB,GACjC,QAAQ,oBAAoB,MAC5B,aAAa,gBAAgB,KAAG,eAAe,EAsC/C,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { IProcessorHostModule, ProcessorRecord } from "document-drive";
2
+ import type { PHDocumentHeader } from "document-model";
3
+ export declare const codegenProcessorFactoryLegacy: (module: IProcessorHostModule) => (driveHeader: PHDocumentHeader) => ProcessorRecord[];
4
+ //# sourceMappingURL=factory.legacy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.legacy.d.ts","sourceRoot":"","sources":["../../../processors/codegen/factory.legacy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAgCvD,eAAO,MAAM,6BAA6B,GACvC,QAAQ,oBAAoB,MAC5B,aAAa,gBAAgB,KAAG,eAAe,EAsC/C,CAAC"}
@@ -0,0 +1,53 @@
1
+ import { VETRA_PROCESSOR_CONFIG_KEY } from "@powerhousedao/config";
2
+ import { CodegenProcessorLegacy } from "./index.legacy.js";
3
+ import { logger } from "./logger.js";
4
+ /**
5
+ * Determines if a drive header matches the Vetra drive criteria.
6
+ * @param driveHeader - The drive header to check
7
+ * @param explicitDriveId - Optional explicit drive ID from config (if set, uses exact match)
8
+ * @returns true if the drive is a Vetra drive, false otherwise
9
+ */
10
+ function isDriveVetra(driveHeader, driveIdFromConfig) {
11
+ // If explicit drive ID is configured, use exact match
12
+ if (driveIdFromConfig) {
13
+ return (driveHeader.slug === driveIdFromConfig ||
14
+ driveHeader.id === driveIdFromConfig);
15
+ }
16
+ // Otherwise, check if slug/id matches Vetra pattern
17
+ // Matches "vetra" exactly or IDs starting with "vetra-" (case-insensitive)
18
+ const matchesPattern = (identifier) => {
19
+ const lower = identifier.toLowerCase();
20
+ return lower === "vetra" || lower.startsWith("vetra-");
21
+ };
22
+ return matchesPattern(driveHeader.slug) || matchesPattern(driveHeader.id);
23
+ }
24
+ export const codegenProcessorFactoryLegacy = (module) => (driveHeader) => {
25
+ // Create the processor
26
+ const processorsConfig = module.config ?? new Map();
27
+ const vetraConfig = processorsConfig.get(VETRA_PROCESSOR_CONFIG_KEY);
28
+ // Check if this drive should use the Vetra processor
29
+ if (!isDriveVetra(driveHeader, vetraConfig?.driveId)) {
30
+ logger.info(`Drive ${driveHeader.slug} is not a Vetra drive, skipping codegen processor`);
31
+ return [];
32
+ }
33
+ logger.info(`Drive ${driveHeader.slug} is a Vetra drive, using codegen processor (legacy)`);
34
+ const processor = new CodegenProcessorLegacy(vetraConfig?.interactive);
35
+ return [
36
+ {
37
+ processor,
38
+ filter: {
39
+ branch: ["main"],
40
+ documentId: ["*"],
41
+ documentType: [
42
+ "powerhouse/document-model",
43
+ "powerhouse/package",
44
+ "powerhouse/document-editor",
45
+ "powerhouse/subgraph",
46
+ "powerhouse/processor",
47
+ "powerhouse/app",
48
+ ],
49
+ scope: ["global"],
50
+ },
51
+ },
52
+ ];
53
+ };
@@ -1,8 +1,8 @@
1
- import type { InternalTransmitterUpdate, IProcessor } from "document-drive";
1
+ import type { IProcessor, OperationWithContext } from "@powerhousedao/reactor";
2
2
  export declare class CodegenProcessor implements IProcessor {
3
3
  private manager;
4
4
  constructor(interactiveMode?: boolean);
5
- onStrands(strands: InternalTransmitterUpdate[]): Promise<void>;
5
+ onOperations(operations: OperationWithContext[]): Promise<void>;
6
6
  onDisconnect(): Promise<void>;
7
7
  setInteractiveMode(enabled: boolean): void;
8
8
  isInteractive(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../processors/codegen/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAQ5E,qBAAa,gBAAiB,YAAW,UAAU;IACjD,OAAO,CAAC,OAAO,CAAyB;gBAE5B,eAAe,UAAQ;IAoB7B,SAAS,CAAC,OAAO,EAAE,yBAAyB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAqC9D,YAAY;IAGX,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAI1C,aAAa,IAAI,OAAO;IAIxB,uBAAuB,IAAI,OAAO;CAG1C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../processors/codegen/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAS/E,qBAAa,gBAAiB,YAAW,UAAU;IACjD,OAAO,CAAC,OAAO,CAAyB;gBAE5B,eAAe,UAAQ;IAkB7B,YAAY,CAAC,UAAU,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAiC/D,YAAY;IAGX,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAI1C,aAAa,IAAI,OAAO;IAIxB,uBAAuB,IAAI,OAAO;CAG1C"}