@powerhousedao/vetra 5.1.0-dev.20 → 5.1.0-dev.21
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/src/tests/base-operations.test.js +52 -1
- package/dist/document-models/document-editor/src/tests/base-operations.test.js +42 -1
- package/dist/document-models/processor-module/src/tests/base-operations.test.js +52 -1
- package/dist/document-models/subgraph-module/src/tests/base-operations.test.js +22 -1
- package/dist/document-models/vetra-package/src/tests/base-operations.test.js +127 -28
- package/dist/processors/codegen/__tests__/codegen-processor-e2e.test.js +53 -41
- package/dist/processors/codegen/document-handlers/generators/app-generator.js +2 -2
- package/dist/processors/codegen/document-handlers/generators/constants.d.ts +1 -1
- package/dist/processors/codegen/document-handlers/generators/constants.d.ts.map +1 -1
- package/dist/processors/codegen/document-handlers/generators/constants.js +1 -1
- package/dist/processors/codegen/document-handlers/generators/document-editor-generator.js +2 -2
- package/dist/processors/codegen/document-handlers/generators/document-model-generator.js +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -14
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
3
|
-
import {
|
|
3
|
+
import { USE_TS_MORPH, USE_VERSIONING, } from "../document-handlers/generators/constants.js";
|
|
4
4
|
import { CodegenProcessor } from "../index.js";
|
|
5
5
|
const defaultManifest = {
|
|
6
6
|
name: "",
|
|
@@ -106,28 +106,35 @@ describe("CodegenProcessor E2E Tests", () => {
|
|
|
106
106
|
await processor.onStrands([strand]);
|
|
107
107
|
// Advance timers to trigger debounced generation
|
|
108
108
|
await vi.runAllTimersAsync();
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
"
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
109
|
+
const generateEditorArgs = [
|
|
110
|
+
{
|
|
111
|
+
name: "Test Editor",
|
|
112
|
+
documentTypes: [
|
|
113
|
+
"powerhouse/document-model",
|
|
114
|
+
"powerhouse/budget-statement",
|
|
115
|
+
],
|
|
116
|
+
config: mockConfig.PH_CONFIG,
|
|
117
|
+
editorId: "test-editor",
|
|
118
|
+
useTsMorph: USE_TS_MORPH,
|
|
119
|
+
},
|
|
120
|
+
];
|
|
121
|
+
expect(generateEditor).toHaveBeenCalledWith(...generateEditorArgs);
|
|
122
|
+
const generateManifestArgs = [
|
|
123
|
+
{
|
|
124
|
+
editors: [
|
|
125
|
+
{
|
|
126
|
+
id: "test-editor",
|
|
127
|
+
name: "Test Editor",
|
|
128
|
+
documentTypes: [
|
|
129
|
+
"powerhouse/document-model",
|
|
130
|
+
"powerhouse/budget-statement",
|
|
131
|
+
],
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
},
|
|
135
|
+
mockConfig.CURRENT_WORKING_DIR,
|
|
136
|
+
];
|
|
137
|
+
expect(generateManifest).toHaveBeenCalledWith(...generateManifestArgs);
|
|
131
138
|
});
|
|
132
139
|
it("should not call codegen functions for invalid document-editor strand (missing name)", async () => {
|
|
133
140
|
const { generateEditor, generateManifest } = await import("@powerhousedao/codegen");
|
|
@@ -199,13 +206,15 @@ describe("CodegenProcessor E2E Tests", () => {
|
|
|
199
206
|
};
|
|
200
207
|
await processor.onStrands([strand]);
|
|
201
208
|
await vi.runAllTimersAsync();
|
|
202
|
-
const generateFromDocumentArgs =
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
+
const generateFromDocumentArgs = [
|
|
210
|
+
{
|
|
211
|
+
useTsMorph: USE_TS_MORPH,
|
|
212
|
+
useVersioning: USE_VERSIONING,
|
|
213
|
+
documentModelState: validState,
|
|
214
|
+
config: mockConfig.PH_CONFIG,
|
|
215
|
+
},
|
|
216
|
+
];
|
|
217
|
+
expect(generateFromDocument).toHaveBeenCalledWith(...generateFromDocumentArgs);
|
|
209
218
|
expect(generateSubgraphFromDocumentModel).toHaveBeenCalledWith("Test Model", validState, mockConfig.PH_CONFIG, { verbose: false });
|
|
210
219
|
expect(generateManifest).toHaveBeenCalledWith({
|
|
211
220
|
documentModels: [
|
|
@@ -356,14 +365,17 @@ describe("CodegenProcessor E2E Tests", () => {
|
|
|
356
365
|
};
|
|
357
366
|
await processor.onStrands([strand]);
|
|
358
367
|
await vi.runAllTimersAsync();
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
368
|
+
const generateDriveEditorArgs = [
|
|
369
|
+
{
|
|
370
|
+
name: "Test App",
|
|
371
|
+
config: mockConfig.PH_CONFIG,
|
|
372
|
+
appId: "test-app",
|
|
373
|
+
allowedDocumentTypes: "",
|
|
374
|
+
isDragAndDropEnabled: false,
|
|
375
|
+
useTsMorph: USE_TS_MORPH,
|
|
376
|
+
},
|
|
377
|
+
];
|
|
378
|
+
expect(generateDriveEditor).toHaveBeenCalledWith(...generateDriveEditorArgs);
|
|
367
379
|
expect(generateManifest).toHaveBeenCalledWith({
|
|
368
380
|
apps: [
|
|
369
381
|
{
|
|
@@ -398,7 +410,7 @@ describe("CodegenProcessor E2E Tests", () => {
|
|
|
398
410
|
appId: "test-app",
|
|
399
411
|
allowedDocumentTypes: "powerhouse/document-model,powerhouse/budget-statement",
|
|
400
412
|
isDragAndDropEnabled: true,
|
|
401
|
-
|
|
413
|
+
useTsMorph: USE_TS_MORPH,
|
|
402
414
|
});
|
|
403
415
|
expect(generateManifest).toHaveBeenCalled();
|
|
404
416
|
});
|
|
@@ -550,7 +562,7 @@ describe("CodegenProcessor E2E Tests", () => {
|
|
|
550
562
|
documentTypes: ["powerhouse/document-model"],
|
|
551
563
|
config: mockConfig.PH_CONFIG,
|
|
552
564
|
editorId: "test-editor",
|
|
553
|
-
|
|
565
|
+
useTsMorph: USE_TS_MORPH,
|
|
554
566
|
});
|
|
555
567
|
expect(generateSubgraph).toHaveBeenCalledWith("Test Subgraph", null, mockConfig.PH_CONFIG);
|
|
556
568
|
// generateManifest should be called twice (once for each strand)
|
|
@@ -589,7 +601,7 @@ describe("CodegenProcessor E2E Tests", () => {
|
|
|
589
601
|
documentTypes: ["powerhouse/document-model"],
|
|
590
602
|
config: mockConfig.PH_CONFIG,
|
|
591
603
|
editorId: "test-editor",
|
|
592
|
-
|
|
604
|
+
useTsMorph: USE_TS_MORPH,
|
|
593
605
|
});
|
|
594
606
|
// Invalid strand should NOT be processed
|
|
595
607
|
expect(generateSubgraph).not.toHaveBeenCalled();
|
|
@@ -2,7 +2,7 @@ import { generateDriveEditor, generateManifest } from "@powerhousedao/codegen";
|
|
|
2
2
|
import { kebabCase } from "change-case";
|
|
3
3
|
import { logger } from "../../logger.js";
|
|
4
4
|
import { BaseDocumentGen } from "../base-document-gen.js";
|
|
5
|
-
import {
|
|
5
|
+
import { USE_TS_MORPH } from "./constants.js";
|
|
6
6
|
import { backupDocument } from "./utils.js";
|
|
7
7
|
/**
|
|
8
8
|
* Generator for app documents
|
|
@@ -48,7 +48,7 @@ export class AppGenerator extends BaseDocumentGen {
|
|
|
48
48
|
appId: appId,
|
|
49
49
|
allowedDocumentTypes: state.allowedDocumentTypes?.join(","),
|
|
50
50
|
isDragAndDropEnabled: state.isDragAndDropEnabled,
|
|
51
|
-
|
|
51
|
+
useTsMorph: USE_TS_MORPH,
|
|
52
52
|
});
|
|
53
53
|
logger.info(`✅ Drive editor generation completed successfully for app: ${state.name}`);
|
|
54
54
|
// Update the manifest with the new app
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../processors/codegen/document-handlers/generators/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../processors/codegen/document-handlers/generators/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,OAAO,CAAC;AACjC,eAAO,MAAM,cAAc,QAAQ,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const USE_TS_MORPH = true;
|
|
2
2
|
export const USE_VERSIONING = false;
|
|
@@ -2,7 +2,7 @@ import { generateEditor, generateManifest } from "@powerhousedao/codegen";
|
|
|
2
2
|
import { kebabCase } from "change-case";
|
|
3
3
|
import { logger } from "../../logger.js";
|
|
4
4
|
import { BaseDocumentGen } from "../base-document-gen.js";
|
|
5
|
-
import {
|
|
5
|
+
import { USE_TS_MORPH } from "./constants.js";
|
|
6
6
|
import { backupDocument } from "./utils.js";
|
|
7
7
|
/**
|
|
8
8
|
* Generator for document editor documents
|
|
@@ -52,7 +52,7 @@ export class DocumentEditorGenerator extends BaseDocumentGen {
|
|
|
52
52
|
documentTypes: documentTypes,
|
|
53
53
|
config: this.config.PH_CONFIG,
|
|
54
54
|
editorId: editorId,
|
|
55
|
-
|
|
55
|
+
useTsMorph: USE_TS_MORPH,
|
|
56
56
|
});
|
|
57
57
|
logger.info(`✅ Editor generation completed successfully for: ${state.name}`);
|
|
58
58
|
// Update the manifest with the new editor
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { generateFromDocument, generateManifest, generateSubgraphFromDocumentModel, validateDocumentModelState, } from "@powerhousedao/codegen";
|
|
2
2
|
import { logger } from "../../logger.js";
|
|
3
3
|
import { BaseDocumentGen } from "../base-document-gen.js";
|
|
4
|
-
import {
|
|
4
|
+
import { USE_TS_MORPH, USE_VERSIONING } from "./constants.js";
|
|
5
5
|
import { backupDocument } from "./utils.js";
|
|
6
6
|
/**
|
|
7
7
|
* Generator for document model documents
|
|
@@ -41,7 +41,7 @@ export class DocumentModelGenerator extends BaseDocumentGen {
|
|
|
41
41
|
await generateFromDocument({
|
|
42
42
|
documentModelState: state,
|
|
43
43
|
config: this.config.PH_CONFIG,
|
|
44
|
-
|
|
44
|
+
useTsMorph: USE_TS_MORPH,
|
|
45
45
|
useVersioning: USE_VERSIONING,
|
|
46
46
|
});
|
|
47
47
|
await generateSubgraphFromDocumentModel(state.name, state, this.config.PH_CONFIG, { verbose: false });
|