@powerhousedao/vetra 4.1.0-dev.85 → 4.1.0-dev.87

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 (26) hide show
  1. package/dist/editors/app-editor/editor.d.ts.map +1 -1
  2. package/dist/editors/app-editor/editor.js +3 -2
  3. package/dist/editors/app-editor/editor.test.js +22 -9
  4. package/dist/editors/document-editor/editor.d.ts.map +1 -1
  5. package/dist/editors/document-editor/editor.js +3 -2
  6. package/dist/editors/processor-editor/editor.d.ts.map +1 -1
  7. package/dist/editors/processor-editor/editor.js +3 -2
  8. package/dist/editors/subgraph-editor/editor.d.ts.map +1 -1
  9. package/dist/editors/subgraph-editor/editor.js +3 -2
  10. package/dist/editors/vetra-drive-app/components/EditorContainer.js +1 -1
  11. package/dist/editors/vetra-package/editor.d.ts +4 -1
  12. package/dist/editors/vetra-package/editor.d.ts.map +1 -1
  13. package/dist/editors/vetra-package/editor.js +5 -3
  14. package/dist/editors/vetra-package/index.d.ts +2 -1
  15. package/dist/editors/vetra-package/index.d.ts.map +1 -1
  16. package/dist/processors/codegen/__tests__/codegen-processor-e2e.test.js +37 -0
  17. package/dist/processors/codegen/document-handlers/document-codegen-manager.d.ts.map +1 -1
  18. package/dist/processors/codegen/document-handlers/document-codegen-manager.js +5 -3
  19. package/dist/processors/codegen/document-handlers/generators/app-generator.js +2 -2
  20. package/dist/processors/codegen/document-handlers/generators/document-editor-generator.js +2 -2
  21. package/dist/processors/codegen/document-handlers/generators/document-model-generator.js +4 -4
  22. package/dist/processors/codegen/document-handlers/generators/subgraph-generator.js +2 -2
  23. package/dist/processors/codegen/logger.js +4 -4
  24. package/dist/setupTests.js +44 -0
  25. package/dist/tsconfig.tsbuildinfo +1 -1
  26. package/package.json +14 -14
@@ -1 +1 @@
1
- {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/app-editor/editor.tsx"],"names":[],"mappings":"AAIA,wBAAgB,MAAM,4CAIrB"}
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/app-editor/editor.tsx"],"names":[],"mappings":"AAKA,wBAAgB,MAAM,4CASrB"}
@@ -1,8 +1,9 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { DocumentToolbar } from "@powerhousedao/design-system";
2
3
  import { useSetPHDocumentEditorConfig } from "@powerhousedao/reactor-browser";
3
4
  import { AppEditorForm } from "./components/AppEditorForm.js";
4
5
  import { editorConfig } from "./config.js";
5
6
  export function Editor() {
6
7
  useSetPHDocumentEditorConfig(editorConfig);
7
- return _jsx(AppEditorForm, {});
8
+ return (_jsxs("div", { children: [_jsx(DocumentToolbar, {}), _jsx(AppEditorForm, {})] }));
8
9
  }
@@ -7,15 +7,28 @@ import { Editor } from "./editor.js";
7
7
  vi.mock("../hooks/useVetraDocument.js", () => ({
8
8
  useSelectedAppModuleDocument: vi.fn(),
9
9
  }));
10
- vi.mock("@powerhousedao/reactor-browser", () => ({
11
- useDocumentTypesInSelectedDrive: vi.fn(() => [
12
- "powerhouse/document-model",
13
- "powerhouse/budget-statement",
14
- "powerhouse/project-tracker",
15
- ]),
16
- useSupportedDocumentTypesInReactor: vi.fn(() => []),
17
- useSetPHDocumentEditorConfig: vi.fn(),
18
- }));
10
+ vi.mock("@powerhousedao/reactor-browser", async (importOriginal) => {
11
+ const actual = await importOriginal();
12
+ return {
13
+ ...actual,
14
+ useDocumentTypesInSelectedDrive: vi.fn(() => [
15
+ "powerhouse/document-model",
16
+ "powerhouse/budget-statement",
17
+ "powerhouse/project-tracker",
18
+ ]),
19
+ useSupportedDocumentTypesInReactor: vi.fn(() => []),
20
+ useSetPHDocumentEditorConfig: vi.fn(),
21
+ // These are needed by DocumentToolbar but mocked in setupTests
22
+ useSelectedDocument: vi.fn(() => [null, vi.fn()]),
23
+ useDocumentById: vi.fn(() => [null, vi.fn()]),
24
+ useDocumentTimeline: vi.fn(() => []),
25
+ useNodeParentFolderById: vi.fn(() => null),
26
+ setSelectedNode: vi.fn(),
27
+ setSelectedTimelineItem: vi.fn(),
28
+ showRevisionHistory: vi.fn(),
29
+ exportDocument: vi.fn(),
30
+ };
31
+ });
19
32
  describe("AppModule Editor", () => {
20
33
  let mockDispatch;
21
34
  beforeEach(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/document-editor/editor.tsx"],"names":[],"mappings":"AAWA,wBAAgB,MAAM,4CA6CrB"}
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/document-editor/editor.tsx"],"names":[],"mappings":"AAYA,wBAAgB,MAAM,4CA8CrB"}
@@ -1,4 +1,5 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { DocumentToolbar } from "@powerhousedao/design-system";
2
3
  import { useSetPHDocumentEditorConfig } from "@powerhousedao/reactor-browser";
3
4
  import { useCallback } from "react";
4
5
  import { actions } from "../../document-models/document-editor/index.js";
@@ -24,5 +25,5 @@ export function Editor() {
24
25
  const onConfirm = useCallback(() => {
25
26
  dispatch(actions.setEditorStatus({ status: "CONFIRMED" }));
26
27
  }, [dispatch]);
27
- return (_jsx("div", { children: _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", { 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
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/processor-editor/editor.tsx"],"names":[],"mappings":"AAOA,wBAAgB,MAAM,4CAsDrB"}
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/processor-editor/editor.tsx"],"names":[],"mappings":"AAQA,wBAAgB,MAAM,4CAuDrB"}
@@ -1,4 +1,5 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { DocumentToolbar } from "@powerhousedao/design-system";
2
3
  import { useSetPHDocumentEditorConfig } from "@powerhousedao/reactor-browser";
3
4
  import { useCallback } from "react";
4
5
  import { actions } from "../../document-models/processor-module/index.js";
@@ -28,5 +29,5 @@ export function Editor() {
28
29
  const onRemoveDocumentType = useCallback((id) => {
29
30
  dispatch(actions.removeDocumentType({ id }));
30
31
  }, [dispatch]);
31
- return (_jsx("div", { children: _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", { 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
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/subgraph-editor/editor.tsx"],"names":[],"mappings":"AAOA,wBAAgB,MAAM,4CA0BrB"}
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/subgraph-editor/editor.tsx"],"names":[],"mappings":"AAQA,wBAAgB,MAAM,4CA2BrB"}
@@ -1,4 +1,5 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { DocumentToolbar } from "@powerhousedao/design-system";
2
3
  import { useSetPHDocumentEditorConfig } from "@powerhousedao/reactor-browser";
3
4
  import { useCallback } from "react";
4
5
  import { actions } from "../../document-models/subgraph-module/index.js";
@@ -16,5 +17,5 @@ export function Editor() {
16
17
  const onConfirm = useCallback(() => {
17
18
  dispatch(actions.setSubgraphStatus({ status: "CONFIRMED" }));
18
19
  }, [dispatch]);
19
- return (_jsx("div", { children: _jsx(SubgraphEditorForm, { subgraphName: document.state.global.name ?? "", status: document.state.global.status, onNameChange: onNameChange, onConfirm: onConfirm }) }));
20
+ return (_jsxs("div", { children: [_jsx(DocumentToolbar, {}), _jsx(SubgraphEditorForm, { subgraphName: document.state.global.name ?? "", status: document.state.global.status, onNameChange: onNameChange, onConfirm: onConfirm })] }));
20
21
  }
@@ -9,5 +9,5 @@ export const EditorContainer = (props) => {
9
9
  if (!editorModule)
10
10
  return loadingContent;
11
11
  const EditorComponent = editorModule.Component;
12
- return (_jsx(Suspense, { fallback: loadingContent, children: _jsx(EditorComponent, { documentId: documentId }) }));
12
+ return (_jsx(Suspense, { fallback: loadingContent, children: _jsx(EditorComponent, { documentId: documentId, displayToolbar: false }) }));
13
13
  };
@@ -1,2 +1,5 @@
1
- export declare function Editor(): import("react/jsx-runtime").JSX.Element;
1
+ export type EditorProps = {
2
+ displayToolbar?: boolean;
3
+ };
4
+ export declare function Editor(props: EditorProps): import("react/jsx-runtime").JSX.Element;
2
5
  //# sourceMappingURL=editor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/vetra-package/editor.tsx"],"names":[],"mappings":"AAOA,wBAAgB,MAAM,4CAyGrB"}
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/vetra-package/editor.tsx"],"names":[],"mappings":"AAQA,MAAM,MAAM,WAAW,GAAG;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,2CA2GxC"}
@@ -1,11 +1,13 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { DocumentToolbar } from "@powerhousedao/design-system";
2
3
  import { useSetPHDocumentEditorConfig } from "@powerhousedao/reactor-browser";
3
4
  import { useCallback } from "react";
4
5
  import { actions } from "../../document-models/vetra-package/index.js";
5
6
  import { useSelectedDriveVetraPackage } from "../hooks/useVetraDocument.js";
6
7
  import { MetaForm } from "./components/MetaForm.js";
7
8
  import { editorConfig } from "./config.js";
8
- export function Editor() {
9
+ export function Editor(props) {
10
+ const { displayToolbar = true } = props;
9
11
  useSetPHDocumentEditorConfig(editorConfig);
10
12
  const [document, dispatch] = useSelectedDriveVetraPackage();
11
13
  const onNameChange = useCallback((name) => {
@@ -63,5 +65,5 @@ export function Editor() {
63
65
  const onRemoveKeyword = useCallback((id) => {
64
66
  dispatch(actions.removePackageKeyword({ id }));
65
67
  }, []);
66
- return (_jsx("div", { children: _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", { 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 })] }));
67
69
  }
@@ -1,4 +1,5 @@
1
1
  import type { EditorModule } from "document-model";
2
- export declare const module: EditorModule;
2
+ import { type EditorProps } from "./editor.js";
3
+ export declare const module: EditorModule<EditorProps>;
3
4
  export default module;
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../editors/vetra-package/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,eAAO,MAAM,MAAM,EAAE,YAOpB,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../editors/vetra-package/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAEvD,eAAO,MAAM,MAAM,EAAE,YAAY,CAAC,WAAW,CAO5C,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -611,5 +611,42 @@ describe("CodegenProcessor E2E Tests", () => {
611
611
  expect(generateEditor).not.toHaveBeenCalled();
612
612
  expect(generateManifest).not.toHaveBeenCalled();
613
613
  });
614
+ it("should debounce generate calls for same strand", async () => {
615
+ const { generateManifest } = await import("@powerhousedao/codegen");
616
+ const firstState = {
617
+ name: "Test Package",
618
+ category: "utility",
619
+ description: "A test package",
620
+ author: {
621
+ name: "Test Author",
622
+ website: "https://example.com",
623
+ },
624
+ };
625
+ const secondState = {
626
+ ...firstState,
627
+ name: "Test Package 2",
628
+ };
629
+ const firstStrand = {
630
+ documentId: "test-doc-1",
631
+ documentType: "powerhouse/package",
632
+ state: firstState,
633
+ };
634
+ const secondStrand = {
635
+ ...firstStrand,
636
+ state: secondState,
637
+ };
638
+ await processor.onStrands([firstStrand]);
639
+ await processor.onStrands([secondStrand]);
640
+ await vi.runAllTimersAsync();
641
+ expect(generateManifest).toHaveBeenCalledExactlyOnceWith({
642
+ name: "Test Package 2",
643
+ category: "utility",
644
+ description: "A test package",
645
+ publisher: {
646
+ name: "Test Author",
647
+ url: "https://example.com",
648
+ },
649
+ }, mockConfig.CURRENT_WORKING_DIR);
650
+ });
614
651
  });
615
652
  });
@@ -1 +1 @@
1
- {"version":3,"file":"document-codegen-manager.d.ts","sourceRoot":"","sources":["../../../../processors/codegen/document-handlers/document-codegen-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAIhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAIzC;;;GAGG;AACH,qBAAa,sBAAsB;IAO/B,OAAO,CAAC,MAAM;IANhB,OAAO,CAAC,UAAU,CAAsC;IACxD,OAAO,CAAC,cAAc,CAAqC;IAC3D,OAAO,CAAC,eAAe,CAAoC;IAC3D,OAAO,CAAC,kBAAkB,CAAqB;gBAGrC,MAAM,EAAE,MAAM,EACtB,eAAe,UAAQ;IAKzB;;OAEG;IACH,iBAAiB,CACf,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,KAAK,MAAM,EAAE,MAAM,KAAK,eAAe,GACtD,IAAI;IAWP;;OAEG;IACH,0BAA0B,CACxB,cAAc,EAAE,KAAK,MAAM,EAAE,MAAM,KAAK,eAAe,GACtD,IAAI;IAkBP;;;OAGG;IACI,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAItE;;OAEG;IACH,0BAA0B,IAAI,MAAM,EAAE;IAItC;;OAEG;IACH,uBAAuB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;IAItD;;;OAGG;IACG,gBAAgB,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IAoGxE;;OAEG;YACW,oBAAoB;IA8BlC;;OAEG;YACW,aAAa;IA0B3B;;OAEG;IACH,eAAe,IAAI,IAAI;IAKvB;;OAEG;IACH,QAAQ,IAAI;QAAE,eAAe,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,EAAE,CAAA;KAAE;IAOjE;;OAEG;IACH,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAI1C;;OAEG;IACH,iBAAiB,IAAI,OAAO;IAI5B;;OAEG;IACH,uBAAuB,IAAI,OAAO;CAGnC"}
1
+ {"version":3,"file":"document-codegen-manager.d.ts","sourceRoot":"","sources":["../../../../processors/codegen/document-handlers/document-codegen-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAIhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAIzC;;;GAGG;AACH,qBAAa,sBAAsB;IAO/B,OAAO,CAAC,MAAM;IANhB,OAAO,CAAC,UAAU,CAAsC;IACxD,OAAO,CAAC,cAAc,CAAqC;IAC3D,OAAO,CAAC,eAAe,CAAoC;IAC3D,OAAO,CAAC,kBAAkB,CAAqB;gBAGrC,MAAM,EAAE,MAAM,EACtB,eAAe,UAAQ;IAKzB;;OAEG;IACH,iBAAiB,CACf,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,KAAK,MAAM,EAAE,MAAM,KAAK,eAAe,GACtD,IAAI;IAWP;;OAEG;IACH,0BAA0B,CACxB,cAAc,EAAE,KAAK,MAAM,EAAE,MAAM,KAAK,eAAe,GACtD,IAAI;IAkBP;;;OAGG;IACI,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAItE;;OAEG;IACH,0BAA0B,IAAI,MAAM,EAAE;IAItC;;OAEG;IACH,uBAAuB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;IAItD;;;OAGG;IACG,gBAAgB,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IAsGxE;;OAEG;YACW,oBAAoB;IA8BlC;;OAEG;YACW,aAAa;IA0B3B;;OAEG;IACH,eAAe,IAAI,IAAI;IAKvB;;OAEG;IACH,QAAQ,IAAI;QAAE,eAAe,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,EAAE,CAAA;KAAE;IAOjE;;OAEG;IACH,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAI1C;;OAEG;IACH,iBAAiB,IAAI,OAAO;IAI5B;;OAEG;IACH,uBAAuB,IAAI,OAAO;CAGnC"}
@@ -37,7 +37,7 @@ export class DocumentCodegenManager {
37
37
  }
38
38
  this.generators.set(documentType, generator);
39
39
  }
40
- logger.info(`✅ Registered multi-type generator for document types: ${supportedTypes.join(", ")}`);
40
+ logger.debug(`✅ Registered multi-type generator for document types: ${supportedTypes.join(", ")}`);
41
41
  }
42
42
  /**
43
43
  * Get a generator instance for the given document type
@@ -91,6 +91,7 @@ export class DocumentCodegenManager {
91
91
  clearTimeout(existingTimer);
92
92
  }
93
93
  // Set up debounce timer for batch interactive processing
94
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
94
95
  const debounceTimer = setTimeout(async () => {
95
96
  try {
96
97
  await this.interactiveManager.processQueueWithConfirmation(async (queuedStrands) => {
@@ -118,12 +119,13 @@ export class DocumentCodegenManager {
118
119
  clearTimeout(existingTimer);
119
120
  }
120
121
  // Set up new debounced generation (no interactive confirmation)
122
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
121
123
  const debounceTimer = setTimeout(async () => {
122
124
  try {
123
125
  logger.debug(`🔄 Routing document type "${documentType}" to generator (debounced)`);
124
126
  // Direct generation, no interactive confirmation
125
127
  await generator.generate(strand);
126
- logger.info(`✅ Successfully generated code for document type: ${documentType}`);
128
+ logger.debug(`✅ Successfully generated code for document type: ${documentType}`);
127
129
  }
128
130
  catch (error) {
129
131
  logger.error(`❌ Error generating code for document type "${documentType}":`, error);
@@ -169,7 +171,7 @@ export class DocumentCodegenManager {
169
171
  try {
170
172
  logger.debug(`🔄 Generating code for document type: ${documentType}`);
171
173
  await generator.generate(strand);
172
- logger.info(`✅ Successfully generated code for document type: ${documentType}`);
174
+ logger.debug(`✅ Successfully generated code for document type: ${documentType}`);
173
175
  }
174
176
  catch (error) {
175
177
  logger.error(`❌ Error generating code for document type "${documentType}":`, error);
@@ -50,7 +50,7 @@ export class AppGenerator extends BaseDocumentGen {
50
50
  logger.info(`✅ Drive editor generation completed successfully for app: ${state.name}`);
51
51
  // Update the manifest with the new app
52
52
  try {
53
- logger.info(`🔄 Updating manifest with app: ${state.name} (ID: ${appId})`);
53
+ logger.debug(`🔄 Updating manifest with app: ${state.name} (ID: ${appId})`);
54
54
  generateManifest({
55
55
  apps: [
56
56
  {
@@ -60,7 +60,7 @@ export class AppGenerator extends BaseDocumentGen {
60
60
  },
61
61
  ],
62
62
  }, this.config.CURRENT_WORKING_DIR);
63
- logger.info(`✅ Manifest updated successfully for app: ${state.name}`);
63
+ logger.debug(`✅ Manifest updated successfully for app: ${state.name}`);
64
64
  }
65
65
  catch (manifestError) {
66
66
  logger.error(`⚠️ Failed to update manifest for app ${state.name}:`, manifestError);
@@ -49,7 +49,7 @@ export class DocumentEditorGenerator extends BaseDocumentGen {
49
49
  logger.info(`✅ Editor generation completed successfully for: ${state.name}`);
50
50
  // Update the manifest with the new editor
51
51
  try {
52
- logger.info(`🔄 Updating manifest with editor: ${state.name} (ID: ${editorId})`);
52
+ logger.debug(`🔄 Updating manifest with editor: ${state.name} (ID: ${editorId})`);
53
53
  generateManifest({
54
54
  editors: [
55
55
  {
@@ -59,7 +59,7 @@ export class DocumentEditorGenerator extends BaseDocumentGen {
59
59
  },
60
60
  ],
61
61
  }, this.config.CURRENT_WORKING_DIR);
62
- logger.info(`✅ Manifest updated successfully for editor: ${state.name}`);
62
+ logger.debug(`✅ Manifest updated successfully for editor: ${state.name}`);
63
63
  }
64
64
  catch (manifestError) {
65
65
  logger.error(`⚠️ Failed to update manifest for editor ${state.name}:`, manifestError);
@@ -25,7 +25,7 @@ export class DocumentModelGenerator extends BaseDocumentGen {
25
25
  const errorList = validationResult.errors
26
26
  .map((error) => ` - ${error}`)
27
27
  .join("\n");
28
- logger.info(`⚠️ Skipped code generation for '${state.name || strand.documentId}' due to validation errors:\n${errorList}`);
28
+ logger.info(`⚠️ Skipped code generation for '${state.name || strand.documentId}' due to validation errors:\n${errorList}`);
29
29
  return false;
30
30
  }
31
31
  return true;
@@ -33,7 +33,7 @@ export class DocumentModelGenerator extends BaseDocumentGen {
33
33
  async generate(strand) {
34
34
  const state = strand.state;
35
35
  // Validation is already done in shouldProcess, so we can proceed directly
36
- logger.info(`🔄 Starting code generation for document model: ${state.name}`);
36
+ logger.debug(`🔄 Starting code generation for document model: ${state.name}`);
37
37
  try {
38
38
  await generateFromDocument(state, this.config.PH_CONFIG, {
39
39
  verbose: false,
@@ -42,7 +42,7 @@ export class DocumentModelGenerator extends BaseDocumentGen {
42
42
  logger.info(`✅ Code generation completed successfully for: ${state.name}`);
43
43
  // Update the manifest with the new document model
44
44
  try {
45
- logger.info(`🔄 Updating manifest with document model: ${state.name} (ID: ${state.id})`);
45
+ logger.debug(`🔄 Updating manifest with document model: ${state.name} (ID: ${state.id})`);
46
46
  generateManifest({
47
47
  documentModels: [
48
48
  {
@@ -51,7 +51,7 @@ export class DocumentModelGenerator extends BaseDocumentGen {
51
51
  },
52
52
  ],
53
53
  }, this.config.CURRENT_WORKING_DIR);
54
- logger.info(`✅ Manifest updated successfully for document model: ${state.name}`);
54
+ logger.debug(`✅ Manifest updated successfully for document model: ${state.name}`);
55
55
  }
56
56
  catch (manifestError) {
57
57
  logger.error(`⚠️ Failed to update manifest for document model ${state.name}:`, manifestError);
@@ -43,7 +43,7 @@ export class SubgraphGenerator extends BaseDocumentGen {
43
43
  logger.info(`✅ Subgraph generation completed successfully for: ${state.name}`);
44
44
  // Update the manifest with the new subgraph
45
45
  try {
46
- logger.info(`🔄 Updating manifest with subgraph: ${state.name} (ID: ${subgraphId})`);
46
+ logger.debug(`🔄 Updating manifest with subgraph: ${state.name} (ID: ${subgraphId})`);
47
47
  generateManifest({
48
48
  subgraphs: [
49
49
  {
@@ -53,7 +53,7 @@ export class SubgraphGenerator extends BaseDocumentGen {
53
53
  },
54
54
  ],
55
55
  }, this.config.CURRENT_WORKING_DIR);
56
- logger.info(`✅ Manifest updated successfully for subgraph: ${state.name}`);
56
+ logger.debug(`✅ Manifest updated successfully for subgraph: ${state.name}`);
57
57
  }
58
58
  catch (manifestError) {
59
59
  logger.error(`⚠️ Failed to update manifest for subgraph ${state.name}:`, manifestError);
@@ -3,8 +3,8 @@ import { childLogger } from "document-drive";
3
3
  // Create empty childLogger and manually prepend colored tag
4
4
  const baseLogger = childLogger([]); // No automatic tags
5
5
  export const logger = {
6
- debug: (...args) => baseLogger.debug(cyan("[CodegenProcessor]"), ...args.map((arg) => typeof arg === "string" ? cyan(arg) : arg)),
7
- info: (...args) => baseLogger.info(cyan("[CodegenProcessor]"), ...args.map((arg) => typeof arg === "string" ? cyan(arg) : arg)),
8
- warn: (...args) => baseLogger.warn(cyan("[CodegenProcessor]"), ...args.map((arg) => typeof arg === "string" ? cyan(arg) : arg)),
9
- error: (...args) => baseLogger.error(cyan("[CodegenProcessor]"), ...args.map((arg) => typeof arg === "string" ? cyan(arg) : arg)),
6
+ debug: (...args) => baseLogger.debug(cyan("[Vetra]"), ...args.map((arg) => typeof arg === "string" ? cyan(arg) : arg)),
7
+ info: (...args) => baseLogger.info(cyan("[Vetra]"), ...args.map((arg) => typeof arg === "string" ? cyan(arg) : arg)),
8
+ warn: (...args) => baseLogger.warn(cyan("[Vetra]"), ...args.map((arg) => typeof arg === "string" ? cyan(arg) : arg)),
9
+ error: (...args) => baseLogger.error(cyan("[Vetra]"), ...args.map((arg) => typeof arg === "string" ? cyan(arg) : arg)),
10
10
  };
@@ -1 +1,45 @@
1
1
  import "@testing-library/jest-dom";
2
+ import { vi } from "vitest";
3
+ vi.mock("@powerhousedao/reactor-browser", () => ({
4
+ // Mock hooks
5
+ useSelectedDocument: vi.fn(() => [null, vi.fn()]),
6
+ useSetPHDocumentEditorConfig: vi.fn(),
7
+ useSetPHDriveEditorConfig: vi.fn(),
8
+ useDocumentById: vi.fn(() => [null, vi.fn()]),
9
+ useDocumentTimeline: vi.fn(() => []),
10
+ useNodeParentFolderById: vi.fn(() => null),
11
+ useSelectedNode: vi.fn(() => null),
12
+ useSelectedDrive: vi.fn(() => null),
13
+ useSelectedDocumentId: vi.fn(() => null),
14
+ useAllDocuments: vi.fn(() => []),
15
+ useDrives: vi.fn(() => []),
16
+ useFolderById: vi.fn(() => null),
17
+ useNodeById: vi.fn(() => null),
18
+ usePHModal: vi.fn(() => null),
19
+ useReactor: vi.fn(() => null),
20
+ useNodeActions: vi.fn(() => ({
21
+ addDocument: vi.fn(),
22
+ addFolder: vi.fn(),
23
+ deleteNode: vi.fn(),
24
+ renameNode: vi.fn(),
25
+ })),
26
+ // Mock action functions
27
+ setSelectedNode: vi.fn(),
28
+ setSelectedTimelineItem: vi.fn(),
29
+ showRevisionHistory: vi.fn(),
30
+ exportDocument: vi.fn(),
31
+ setSelectedDrive: vi.fn(),
32
+ showPHModal: vi.fn(),
33
+ closePHModal: vi.fn(),
34
+ addFolder: vi.fn(() => Promise.resolve()),
35
+ addDocument: vi.fn(() => Promise.resolve()),
36
+ deleteNode: vi.fn(() => Promise.resolve()),
37
+ exportFile: vi.fn(() => Promise.resolve()),
38
+ setAllDocuments: vi.fn(),
39
+ setDrives: vi.fn(),
40
+ setVetraPackages: vi.fn(),
41
+ // Mock config setters
42
+ setPHDocumentEditorConfig: vi.fn(),
43
+ setPHDriveEditorConfig: vi.fn(),
44
+ setPHGlobalConfig: vi.fn(),
45
+ }));