@powerhousedao/vetra 6.0.0-dev.9 → 6.0.0-dev.90

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 (198) hide show
  1. package/dist/document-models/app-module/actions.d.ts +4 -2
  2. package/dist/document-models/app-module/actions.d.ts.map +1 -1
  3. package/dist/document-models/app-module/hooks.d.ts.map +1 -1
  4. package/dist/document-models/app-module/module.d.ts.map +1 -1
  5. package/dist/document-models/app-module/module.js +1 -0
  6. package/dist/document-models/app-module/src/tests/base-operations.test.js +2 -2
  7. package/dist/document-models/app-module/src/tests/dnd-operations.test.js +1 -1
  8. package/dist/document-models/document-editor/actions.d.ts +4 -2
  9. package/dist/document-models/document-editor/actions.d.ts.map +1 -1
  10. package/dist/document-models/document-editor/hooks.d.ts.map +1 -1
  11. package/dist/document-models/document-editor/module.d.ts.map +1 -1
  12. package/dist/document-models/document-editor/module.js +1 -0
  13. package/dist/document-models/document-editor/src/tests/base-operations.test.js +2 -2
  14. package/dist/document-models/processor-module/actions.d.ts +6 -2
  15. package/dist/document-models/processor-module/actions.d.ts.map +1 -1
  16. package/dist/document-models/processor-module/gen/base-operations/actions.d.ts +10 -2
  17. package/dist/document-models/processor-module/gen/base-operations/actions.d.ts.map +1 -1
  18. package/dist/document-models/processor-module/gen/base-operations/creators.d.ts +4 -2
  19. package/dist/document-models/processor-module/gen/base-operations/creators.d.ts.map +1 -1
  20. package/dist/document-models/processor-module/gen/base-operations/creators.js +3 -1
  21. package/dist/document-models/processor-module/gen/base-operations/operations.d.ts +3 -1
  22. package/dist/document-models/processor-module/gen/base-operations/operations.d.ts.map +1 -1
  23. package/dist/document-models/processor-module/gen/document-model.d.ts.map +1 -1
  24. package/dist/document-models/processor-module/gen/document-model.js +24 -2
  25. package/dist/document-models/processor-module/gen/document-schema.d.ts +3 -0
  26. package/dist/document-models/processor-module/gen/document-schema.d.ts.map +1 -1
  27. package/dist/document-models/processor-module/gen/ph-factories.d.ts.map +1 -1
  28. package/dist/document-models/processor-module/gen/ph-factories.js +1 -0
  29. package/dist/document-models/processor-module/gen/reducer.d.ts.map +1 -1
  30. package/dist/document-models/processor-module/gen/reducer.js +11 -1
  31. package/dist/document-models/processor-module/gen/schema/types.d.ts +7 -0
  32. package/dist/document-models/processor-module/gen/schema/types.d.ts.map +1 -1
  33. package/dist/document-models/processor-module/gen/schema/zod.d.ts +3 -1
  34. package/dist/document-models/processor-module/gen/schema/zod.d.ts.map +1 -1
  35. package/dist/document-models/processor-module/gen/schema/zod.js +11 -0
  36. package/dist/document-models/processor-module/gen/utils.d.ts.map +1 -1
  37. package/dist/document-models/processor-module/gen/utils.js +1 -0
  38. package/dist/document-models/processor-module/hooks.d.ts.map +1 -1
  39. package/dist/document-models/processor-module/module.d.ts.map +1 -1
  40. package/dist/document-models/processor-module/module.js +1 -0
  41. package/dist/document-models/processor-module/src/reducers/base-operations.d.ts.map +1 -1
  42. package/dist/document-models/processor-module/src/reducers/base-operations.js +14 -0
  43. package/dist/document-models/processor-module/src/tests/base-operations.test.js +26 -2
  44. package/dist/document-models/subgraph-module/actions.d.ts +4 -2
  45. package/dist/document-models/subgraph-module/actions.d.ts.map +1 -1
  46. package/dist/document-models/subgraph-module/hooks.d.ts.map +1 -1
  47. package/dist/document-models/subgraph-module/module.d.ts.map +1 -1
  48. package/dist/document-models/subgraph-module/module.js +1 -0
  49. package/dist/document-models/subgraph-module/src/tests/base-operations.test.js +2 -2
  50. package/dist/document-models/vetra-package/actions.d.ts +4 -2
  51. package/dist/document-models/vetra-package/actions.d.ts.map +1 -1
  52. package/dist/document-models/vetra-package/gen/schema/zod.js +7 -7
  53. package/dist/document-models/vetra-package/hooks.d.ts.map +1 -1
  54. package/dist/document-models/vetra-package/module.d.ts.map +1 -1
  55. package/dist/document-models/vetra-package/module.js +1 -0
  56. package/dist/document-models/vetra-package/src/tests/base-operations.test.js +1 -1
  57. package/dist/editors/app-editor/components/AppEditorForm.js +1 -1
  58. package/dist/editors/app-editor/editor.js +1 -1
  59. package/dist/editors/app-editor/editor.test.js +8 -1
  60. package/dist/editors/document-editor/components/DocumentEditorForm.js +1 -1
  61. package/dist/editors/document-editor/editor.js +1 -1
  62. package/dist/editors/processor-editor/components/ProcessorEditorForm.d.ts +4 -0
  63. package/dist/editors/processor-editor/components/ProcessorEditorForm.d.ts.map +1 -1
  64. package/dist/editors/processor-editor/components/ProcessorEditorForm.js +32 -6
  65. package/dist/editors/processor-editor/editor.d.ts.map +1 -1
  66. package/dist/editors/processor-editor/editor.js +7 -1
  67. package/dist/editors/processor-editor/editor.test.js +166 -173
  68. package/dist/editors/subgraph-editor/components/SubgraphEditorForm.js +1 -1
  69. package/dist/editors/subgraph-editor/editor.js +1 -1
  70. package/dist/editors/vetra-drive-app/DriveExplorer.js +1 -1
  71. package/dist/editors/vetra-drive-app/components/DriveHeader.js +1 -1
  72. package/dist/editors/vetra-drive-app/editor.js +1 -1
  73. package/dist/editors/vetra-package/components/MetaForm.js +1 -1
  74. package/dist/editors/vetra-package/editor.js +1 -1
  75. package/dist/processors/codegen/__tests__/codegen-processor-e2e.test.js +66 -42
  76. package/dist/processors/codegen/document-handlers/generators/app-generator.d.ts +4 -0
  77. package/dist/processors/codegen/document-handlers/generators/app-generator.d.ts.map +1 -1
  78. package/dist/processors/codegen/document-handlers/generators/app-generator.js +31 -11
  79. package/dist/processors/codegen/document-handlers/generators/constants.d.ts +1 -1
  80. package/dist/processors/codegen/document-handlers/generators/constants.d.ts.map +1 -1
  81. package/dist/processors/codegen/document-handlers/generators/constants.js +2 -1
  82. package/dist/processors/codegen/document-handlers/generators/document-editor-generator.d.ts +4 -0
  83. package/dist/processors/codegen/document-handlers/generators/document-editor-generator.d.ts.map +1 -1
  84. package/dist/processors/codegen/document-handlers/generators/document-editor-generator.js +30 -10
  85. package/dist/processors/codegen/document-handlers/generators/document-model-generator.d.ts +4 -0
  86. package/dist/processors/codegen/document-handlers/generators/document-model-generator.d.ts.map +1 -1
  87. package/dist/processors/codegen/document-handlers/generators/document-model-generator.js +42 -20
  88. package/dist/processors/codegen/document-handlers/generators/package-generator.d.ts.map +1 -1
  89. package/dist/processors/codegen/document-handlers/generators/package-generator.js +8 -2
  90. package/dist/processors/codegen/document-handlers/generators/processor-generator.d.ts +4 -0
  91. package/dist/processors/codegen/document-handlers/generators/processor-generator.d.ts.map +1 -1
  92. package/dist/processors/codegen/document-handlers/generators/processor-generator.js +59 -10
  93. package/dist/processors/codegen/document-handlers/generators/subgraph-generator.d.ts +4 -0
  94. package/dist/processors/codegen/document-handlers/generators/subgraph-generator.d.ts.map +1 -1
  95. package/dist/processors/codegen/document-handlers/generators/subgraph-generator.js +27 -7
  96. package/dist/processors/codegen/document-handlers/generators/utils.d.ts +7 -0
  97. package/dist/processors/codegen/document-handlers/generators/utils.d.ts.map +1 -1
  98. package/dist/processors/codegen/document-handlers/generators/utils.js +18 -1
  99. package/dist/processors/codegen/factory.d.ts +1 -1
  100. package/dist/processors/codegen/factory.d.ts.map +1 -1
  101. package/dist/processors/codegen/factory.legacy.d.ts +4 -0
  102. package/dist/processors/codegen/factory.legacy.d.ts.map +1 -0
  103. package/dist/processors/codegen/factory.legacy.js +53 -0
  104. package/dist/processors/codegen/index.d.ts +2 -2
  105. package/dist/processors/codegen/index.d.ts.map +1 -1
  106. package/dist/processors/codegen/index.js +22 -21
  107. package/dist/processors/codegen/index.legacy.d.ts +11 -0
  108. package/dist/processors/codegen/index.legacy.d.ts.map +1 -0
  109. package/dist/processors/codegen/index.legacy.js +57 -0
  110. package/dist/processors/codegen/logger.d.ts.map +1 -1
  111. package/dist/processors/codegen/logger.js +18 -7
  112. package/dist/processors/factory.d.ts +3 -4
  113. package/dist/processors/factory.d.ts.map +1 -1
  114. package/dist/processors/factory.js +5 -4
  115. package/dist/processors/factory.legacy.d.ts +7 -0
  116. package/dist/processors/factory.legacy.d.ts.map +1 -0
  117. package/dist/processors/factory.legacy.js +19 -0
  118. package/dist/processors/index.d.ts +8 -2
  119. package/dist/processors/index.d.ts.map +1 -1
  120. package/dist/processors/index.js +10 -2
  121. package/dist/processors/vetra-read-model/factory.d.ts +2 -2
  122. package/dist/processors/vetra-read-model/factory.d.ts.map +1 -1
  123. package/dist/processors/vetra-read-model/factory.js +13 -16
  124. package/dist/processors/vetra-read-model/factory.legacy.d.ts +5 -0
  125. package/dist/processors/vetra-read-model/factory.legacy.d.ts.map +1 -0
  126. package/dist/processors/vetra-read-model/factory.legacy.js +24 -0
  127. package/dist/processors/vetra-read-model/index.d.ts +6 -5
  128. package/dist/processors/vetra-read-model/index.d.ts.map +1 -1
  129. package/dist/processors/vetra-read-model/index.js +20 -37
  130. package/dist/processors/vetra-read-model/index.legacy.d.ts +9 -0
  131. package/dist/processors/vetra-read-model/index.legacy.d.ts.map +1 -0
  132. package/dist/processors/vetra-read-model/index.legacy.js +75 -0
  133. package/dist/processors/vetra-read-model/migrations.d.ts +3 -3
  134. package/dist/processors/vetra-read-model/migrations.d.ts.map +1 -1
  135. package/dist/style.css +13710 -81
  136. package/dist/tsconfig.tsbuildinfo +1 -1
  137. package/dist/vite.config.d.ts.map +1 -1
  138. package/dist/vite.config.js +1 -13
  139. package/dist/vitest.config.d.ts.map +1 -1
  140. package/dist/vitest.config.js +1 -0
  141. package/package.json +48 -63
  142. package/dist/subgraphs/app-module/index.d.ts +0 -11
  143. package/dist/subgraphs/app-module/index.d.ts.map +0 -1
  144. package/dist/subgraphs/app-module/index.js +0 -11
  145. package/dist/subgraphs/app-module/resolvers.d.ts +0 -3
  146. package/dist/subgraphs/app-module/resolvers.d.ts.map +0 -1
  147. package/dist/subgraphs/app-module/resolvers.js +0 -144
  148. package/dist/subgraphs/app-module/schema.d.ts +0 -3
  149. package/dist/subgraphs/app-module/schema.d.ts.map +0 -1
  150. package/dist/subgraphs/app-module/schema.js +0 -78
  151. package/dist/subgraphs/document-editor/index.d.ts +0 -11
  152. package/dist/subgraphs/document-editor/index.d.ts.map +0 -1
  153. package/dist/subgraphs/document-editor/index.js +0 -11
  154. package/dist/subgraphs/document-editor/resolvers.d.ts +0 -3
  155. package/dist/subgraphs/document-editor/resolvers.d.ts.map +0 -1
  156. package/dist/subgraphs/document-editor/resolvers.js +0 -120
  157. package/dist/subgraphs/document-editor/schema.d.ts +0 -3
  158. package/dist/subgraphs/document-editor/schema.d.ts.map +0 -1
  159. package/dist/subgraphs/document-editor/schema.js +0 -59
  160. package/dist/subgraphs/index.d.ts +0 -7
  161. package/dist/subgraphs/index.d.ts.map +0 -1
  162. package/dist/subgraphs/index.js +0 -6
  163. package/dist/subgraphs/processor-module/index.d.ts +0 -10
  164. package/dist/subgraphs/processor-module/index.d.ts.map +0 -1
  165. package/dist/subgraphs/processor-module/index.js +0 -11
  166. package/dist/subgraphs/processor-module/resolvers.d.ts +0 -3
  167. package/dist/subgraphs/processor-module/resolvers.d.ts.map +0 -1
  168. package/dist/subgraphs/processor-module/resolvers.js +0 -132
  169. package/dist/subgraphs/processor-module/schema.d.ts +0 -3
  170. package/dist/subgraphs/processor-module/schema.d.ts.map +0 -1
  171. package/dist/subgraphs/processor-module/schema.js +0 -67
  172. package/dist/subgraphs/subgraph-module/index.d.ts +0 -10
  173. package/dist/subgraphs/subgraph-module/index.d.ts.map +0 -1
  174. package/dist/subgraphs/subgraph-module/index.js +0 -11
  175. package/dist/subgraphs/subgraph-module/resolvers.d.ts +0 -3
  176. package/dist/subgraphs/subgraph-module/resolvers.d.ts.map +0 -1
  177. package/dist/subgraphs/subgraph-module/resolvers.js +0 -96
  178. package/dist/subgraphs/subgraph-module/schema.d.ts +0 -3
  179. package/dist/subgraphs/subgraph-module/schema.d.ts.map +0 -1
  180. package/dist/subgraphs/subgraph-module/schema.js +0 -42
  181. package/dist/subgraphs/vetra-package/index.d.ts +0 -10
  182. package/dist/subgraphs/vetra-package/index.d.ts.map +0 -1
  183. package/dist/subgraphs/vetra-package/index.js +0 -11
  184. package/dist/subgraphs/vetra-package/resolvers.d.ts +0 -3
  185. package/dist/subgraphs/vetra-package/resolvers.d.ts.map +0 -1
  186. package/dist/subgraphs/vetra-package/resolvers.js +0 -192
  187. package/dist/subgraphs/vetra-package/schema.d.ts +0 -3
  188. package/dist/subgraphs/vetra-package/schema.d.ts.map +0 -1
  189. package/dist/subgraphs/vetra-package/schema.js +0 -108
  190. package/dist/subgraphs/vetra-read-model/index.d.ts +0 -8
  191. package/dist/subgraphs/vetra-read-model/index.d.ts.map +0 -1
  192. package/dist/subgraphs/vetra-read-model/index.js +0 -8
  193. package/dist/subgraphs/vetra-read-model/resolvers.d.ts +0 -3
  194. package/dist/subgraphs/vetra-read-model/resolvers.d.ts.map +0 -1
  195. package/dist/subgraphs/vetra-read-model/resolvers.js +0 -36
  196. package/dist/subgraphs/vetra-read-model/schema.d.ts +0 -3
  197. package/dist/subgraphs/vetra-read-model/schema.d.ts.map +0 -1
  198. package/dist/subgraphs/vetra-read-model/schema.js +0 -25
@@ -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();
@@ -101,19 +101,19 @@ describe("CodegenProcessor E2E Tests", () => {
101
101
  const strand = {
102
102
  documentId: "test-doc-1",
103
103
  documentType: "powerhouse/document-editor",
104
- state: validState,
104
+ state: { global: validState },
105
105
  };
106
106
  await processor.onStrands([strand]);
107
107
  // Advance timers to trigger debounced generation
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
  },
@@ -148,7 +148,7 @@ describe("CodegenProcessor E2E Tests", () => {
148
148
  const strand = {
149
149
  documentId: "test-doc-1",
150
150
  documentType: "powerhouse/document-editor",
151
- state: invalidState,
151
+ state: { global: invalidState },
152
152
  };
153
153
  await processor.onStrands([strand]);
154
154
  await vi.runAllTimersAsync();
@@ -167,7 +167,7 @@ describe("CodegenProcessor E2E Tests", () => {
167
167
  const strand = {
168
168
  documentId: "test-doc-1",
169
169
  documentType: "powerhouse/document-editor",
170
- state: invalidState,
170
+ state: { global: invalidState },
171
171
  };
172
172
  await processor.onStrands([strand]);
173
173
  await vi.runAllTimersAsync();
@@ -184,7 +184,7 @@ describe("CodegenProcessor E2E Tests", () => {
184
184
  const strand = {
185
185
  documentId: "test-doc-1",
186
186
  documentType: "powerhouse/document-editor",
187
- state: invalidState,
187
+ state: { global: invalidState },
188
188
  };
189
189
  await processor.onStrands([strand]);
190
190
  await vi.runAllTimersAsync();
@@ -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();
@@ -282,15 +282,26 @@ describe("CodegenProcessor E2E Tests", () => {
282
282
  { id: "dt-2", documentType: "powerhouse/budget-statement" },
283
283
  ],
284
284
  status: "CONFIRMED",
285
+ processorApps: ["connect"],
285
286
  };
286
287
  const strand = {
287
288
  documentId: "test-doc-1",
288
289
  documentType: "powerhouse/processor",
289
- state: validState,
290
+ state: { global: validState },
290
291
  };
291
292
  await processor.onStrands([strand]);
292
293
  await vi.runAllTimersAsync();
293
- expect(generateProcessor).toHaveBeenCalledWith("Test Processor", "analytics", ["powerhouse/document-model", "powerhouse/budget-statement"], mockConfig.PH_CONFIG);
294
+ expect(generateProcessor).toHaveBeenCalledWith({
295
+ processorName: "Test Processor",
296
+ processorType: "analytics",
297
+ documentTypes: [
298
+ "powerhouse/document-model",
299
+ "powerhouse/budget-statement",
300
+ ],
301
+ skipFormat: mockConfig.PH_CONFIG.skipFormat,
302
+ processorApps: ["connect"],
303
+ useTsMorph: USE_TS_MORPH,
304
+ });
294
305
  });
295
306
  it("should map relational type to relationalDb when processing processor strand", async () => {
296
307
  const { generateProcessor } = await import("@powerhousedao/codegen");
@@ -301,15 +312,23 @@ describe("CodegenProcessor E2E Tests", () => {
301
312
  { id: "dt-1", documentType: "powerhouse/document-model" },
302
313
  ],
303
314
  status: "CONFIRMED",
315
+ processorApps: ["switchboard"],
304
316
  };
305
317
  const strand = {
306
318
  documentId: "test-doc-1",
307
319
  documentType: "powerhouse/processor",
308
- state: validState,
320
+ state: { global: validState },
309
321
  };
310
322
  await processor.onStrands([strand]);
311
323
  await vi.runAllTimersAsync();
312
- expect(generateProcessor).toHaveBeenCalledWith("Test Processor", "relationalDb", ["powerhouse/document-model"], mockConfig.PH_CONFIG);
324
+ expect(generateProcessor).toHaveBeenCalledWith({
325
+ processorName: "Test Processor",
326
+ processorType: "relationalDb",
327
+ documentTypes: ["powerhouse/document-model"],
328
+ skipFormat: mockConfig.PH_CONFIG.skipFormat,
329
+ useTsMorph: USE_TS_MORPH,
330
+ processorApps: ["switchboard"],
331
+ });
313
332
  });
314
333
  it("should not call generateProcessor for unsupported processor type", async () => {
315
334
  const { generateProcessor } = await import("@powerhousedao/codegen");
@@ -320,11 +339,12 @@ describe("CodegenProcessor E2E Tests", () => {
320
339
  { id: "dt-1", documentType: "powerhouse/document-model" },
321
340
  ],
322
341
  status: "CONFIRMED",
342
+ processorApps: ["connect"],
323
343
  };
324
344
  const strand = {
325
345
  documentId: "test-doc-1",
326
346
  documentType: "powerhouse/processor",
327
- state: invalidState,
347
+ state: { global: invalidState },
328
348
  };
329
349
  await processor.onStrands([strand]);
330
350
  await vi.runAllTimersAsync();
@@ -337,11 +357,12 @@ describe("CodegenProcessor E2E Tests", () => {
337
357
  type: "analytics",
338
358
  documentTypes: [],
339
359
  status: "CONFIRMED",
360
+ processorApps: ["connect"],
340
361
  };
341
362
  const strand = {
342
363
  documentId: "test-doc-1",
343
364
  documentType: "powerhouse/processor",
344
- state: invalidState,
365
+ state: { global: invalidState },
345
366
  };
346
367
  await processor.onStrands([strand]);
347
368
  await vi.runAllTimersAsync();
@@ -360,16 +381,16 @@ describe("CodegenProcessor E2E Tests", () => {
360
381
  const strand = {
361
382
  documentId: "test-doc-1",
362
383
  documentType: "powerhouse/app",
363
- state: validState,
384
+ state: { global: validState },
364
385
  };
365
386
  await processor.onStrands([strand]);
366
387
  await vi.runAllTimersAsync();
367
388
  const generateDriveEditorArgs = [
368
389
  {
369
- name: "Test App",
370
- config: mockConfig.PH_CONFIG,
371
- appId: "test-app",
372
- allowedDocumentTypes: "",
390
+ driveEditorName: "Test App",
391
+ ...mockConfig.PH_CONFIG,
392
+ driveEditorId: "test-app",
393
+ allowedDocumentTypes: [],
373
394
  isDragAndDropEnabled: false,
374
395
  useTsMorph: USE_TS_MORPH,
375
396
  },
@@ -399,15 +420,18 @@ describe("CodegenProcessor E2E Tests", () => {
399
420
  const strand = {
400
421
  documentId: "test-doc-1",
401
422
  documentType: "powerhouse/app",
402
- state: validState,
423
+ state: { global: validState },
403
424
  };
404
425
  await processor.onStrands([strand]);
405
426
  await vi.runAllTimersAsync();
406
427
  expect(generateDriveEditor).toHaveBeenCalledWith({
407
- name: "Test App",
408
- config: mockConfig.PH_CONFIG,
409
- appId: "test-app",
410
- allowedDocumentTypes: "powerhouse/document-model,powerhouse/budget-statement",
428
+ driveEditorName: "Test App",
429
+ ...mockConfig.PH_CONFIG,
430
+ driveEditorId: "test-app",
431
+ allowedDocumentTypes: [
432
+ "powerhouse/document-model",
433
+ "powerhouse/budget-statement",
434
+ ],
411
435
  isDragAndDropEnabled: true,
412
436
  useTsMorph: USE_TS_MORPH,
413
437
  });
@@ -424,7 +448,7 @@ describe("CodegenProcessor E2E Tests", () => {
424
448
  const strand = {
425
449
  documentId: "test-doc-1",
426
450
  documentType: "powerhouse/app",
427
- state: invalidState,
451
+ state: { global: invalidState },
428
452
  };
429
453
  await processor.onStrands([strand]);
430
454
  await vi.runAllTimersAsync();
@@ -442,7 +466,7 @@ describe("CodegenProcessor E2E Tests", () => {
442
466
  const strand = {
443
467
  documentId: "test-doc-1",
444
468
  documentType: "powerhouse/subgraph",
445
- state: validState,
469
+ state: { global: validState },
446
470
  };
447
471
  await processor.onStrands([strand]);
448
472
  await vi.runAllTimersAsync();
@@ -466,7 +490,7 @@ describe("CodegenProcessor E2E Tests", () => {
466
490
  const strand = {
467
491
  documentId: "test-doc-1",
468
492
  documentType: "powerhouse/subgraph",
469
- state: invalidState,
493
+ state: { global: invalidState },
470
494
  };
471
495
  await processor.onStrands([strand]);
472
496
  await vi.runAllTimersAsync();
@@ -546,20 +570,20 @@ describe("CodegenProcessor E2E Tests", () => {
546
570
  {
547
571
  documentId: "test-doc-1",
548
572
  documentType: "powerhouse/document-editor",
549
- state: editorState,
573
+ state: { global: editorState },
550
574
  },
551
575
  {
552
576
  documentId: "test-doc-2",
553
577
  documentType: "powerhouse/subgraph",
554
- state: subgraphState,
578
+ state: { global: subgraphState },
555
579
  },
556
580
  ];
557
581
  await processor.onStrands(strands);
558
582
  await vi.runAllTimersAsync();
559
583
  expect(generateEditor).toHaveBeenCalledWith({
560
- name: "Test Editor",
584
+ editorName: "Test Editor",
561
585
  documentTypes: ["powerhouse/document-model"],
562
- config: mockConfig.PH_CONFIG,
586
+ ...mockConfig.PH_CONFIG,
563
587
  editorId: "test-editor",
564
588
  useTsMorph: USE_TS_MORPH,
565
589
  });
@@ -584,21 +608,21 @@ describe("CodegenProcessor E2E Tests", () => {
584
608
  {
585
609
  documentId: "test-doc-1",
586
610
  documentType: "powerhouse/document-editor",
587
- state: validEditorState,
611
+ state: { global: validEditorState },
588
612
  },
589
613
  {
590
614
  documentId: "test-doc-2",
591
615
  documentType: "powerhouse/subgraph",
592
- state: invalidSubgraphState,
616
+ state: { global: invalidSubgraphState },
593
617
  },
594
618
  ];
595
619
  await processor.onStrands(strands);
596
620
  await vi.runAllTimersAsync();
597
621
  // Valid strand should be processed
598
622
  expect(generateEditor).toHaveBeenCalledWith({
599
- name: "Test Editor",
623
+ editorName: "Test Editor",
600
624
  documentTypes: ["powerhouse/document-model"],
601
- config: mockConfig.PH_CONFIG,
625
+ ...mockConfig.PH_CONFIG,
602
626
  editorId: "test-editor",
603
627
  useTsMorph: USE_TS_MORPH,
604
628
  });
@@ -622,12 +646,12 @@ describe("CodegenProcessor E2E Tests", () => {
622
646
  {
623
647
  documentId: "test-doc-1",
624
648
  documentType: "powerhouse/document-editor",
625
- state: invalidEditorState,
649
+ state: { global: invalidEditorState },
626
650
  },
627
651
  {
628
652
  documentId: "test-doc-2",
629
653
  documentType: "powerhouse/subgraph",
630
- state: invalidSubgraphState,
654
+ state: { global: invalidSubgraphState },
631
655
  },
632
656
  ];
633
657
  await processor.onStrands(strands);
@@ -665,7 +689,7 @@ describe("CodegenProcessor E2E Tests", () => {
665
689
  const strand = {
666
690
  documentId: "",
667
691
  documentType: "powerhouse/document-editor",
668
- state: validState,
692
+ state: { global: validState },
669
693
  };
670
694
  await processor.onStrands([strand]);
671
695
  await vi.runAllTimersAsync();
@@ -5,6 +5,10 @@ import { BaseDocumentGen } from "../base-document-gen.js";
5
5
  */
6
6
  export declare class AppGenerator extends BaseDocumentGen {
7
7
  readonly supportedDocumentTypes = "powerhouse/app";
8
+ /**
9
+ * Extract the global state from the full document state
10
+ */
11
+ private extractGlobalState;
8
12
  /**
9
13
  * Validate if this app strand should be processed
10
14
  */
@@ -1 +1 @@
1
- {"version":3,"file":"app-generator.d.ts","sourceRoot":"","sources":["../../../../../processors/codegen/document-handlers/generators/app-generator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAI1D;;GAEG;AACH,qBAAa,YAAa,SAAQ,eAAe;IAC/C,QAAQ,CAAC,sBAAsB,oBAAoB;IAEnD;;OAEG;IACH,aAAa,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO;IA4BnD,QAAQ,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;CA8EjE"}
1
+ {"version":3,"file":"app-generator.d.ts","sourceRoot":"","sources":["../../../../../processors/codegen/document-handlers/generators/app-generator.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAI1D;;GAEG;AACH,qBAAa,YAAa,SAAQ,eAAe;IAC/C,QAAQ,CAAC,sBAAsB,oBAAoB;IAEnD;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAU1B;;OAEG;IACH,aAAa,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO;IA4BnD,QAAQ,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;CA2FjE"}
@@ -3,12 +3,22 @@ import { kebabCase } from "change-case";
3
3
  import { logger } from "../../logger.js";
4
4
  import { BaseDocumentGen } from "../base-document-gen.js";
5
5
  import { USE_TS_MORPH } from "./constants.js";
6
- import { backupDocument } from "./utils.js";
6
+ import { minimalBackupDocument } from "./utils.js";
7
7
  /**
8
8
  * Generator for app documents
9
9
  */
10
10
  export class AppGenerator extends BaseDocumentGen {
11
11
  supportedDocumentTypes = "powerhouse/app";
12
+ /**
13
+ * Extract the global state from the full document state
14
+ */
15
+ extractGlobalState(strand) {
16
+ const fullState = strand.state;
17
+ if (!fullState) {
18
+ return undefined;
19
+ }
20
+ return fullState.global;
21
+ }
12
22
  /**
13
23
  * Validate if this app strand should be processed
14
24
  */
@@ -17,24 +27,28 @@ export class AppGenerator extends BaseDocumentGen {
17
27
  if (!super.shouldProcess(strand)) {
18
28
  return false;
19
29
  }
20
- const state = strand.state;
30
+ const state = this.extractGlobalState(strand);
21
31
  if (!state) {
22
- logger.debug(`>>> No state found for app: ${strand.documentId}`);
32
+ logger.debug(`No state found for app: ${strand.documentId}`);
23
33
  return false;
24
34
  }
25
35
  // Check if we have a valid app name and it's confirmed
26
36
  if (!state.name) {
27
- logger.debug(`>>> No name found for app: ${strand.documentId}`);
37
+ logger.debug(`No name found for app: ${strand.documentId}`);
28
38
  return false;
29
39
  }
30
40
  if (state.status !== "CONFIRMED") {
31
- logger.debug(`>>> App not confirmed: ${state.name} (status: ${state.status})`);
41
+ logger.debug(`App not confirmed: ${state.name} (status: ${state.status})`);
32
42
  return false;
33
43
  }
34
44
  return true;
35
45
  }
36
46
  async generate(strand) {
37
- const state = strand.state;
47
+ const state = this.extractGlobalState(strand);
48
+ if (!state) {
49
+ logger.error(`No state found for app: ${strand.documentId}`);
50
+ return;
51
+ }
38
52
  // Check if we have a valid app name and it's confirmed
39
53
  if (state.name && state.status === "CONFIRMED") {
40
54
  logger.info(`🔄 Starting drive editor generation for app: ${state.name}`);
@@ -43,10 +57,10 @@ export class AppGenerator extends BaseDocumentGen {
43
57
  const appId = kebabCase(state.name);
44
58
  // Generate the drive editor using the codegen function
45
59
  await generateDriveEditor({
46
- name: state.name,
47
- config: this.config.PH_CONFIG,
48
- appId: appId,
49
- allowedDocumentTypes: state.allowedDocumentTypes?.join(","),
60
+ ...this.config.PH_CONFIG,
61
+ driveEditorName: state.name,
62
+ driveEditorId: appId,
63
+ allowedDocumentTypes: state.allowedDocumentTypes ?? [],
50
64
  isDragAndDropEnabled: state.isDragAndDropEnabled,
51
65
  useTsMorph: USE_TS_MORPH,
52
66
  });
@@ -70,7 +84,13 @@ export class AppGenerator extends BaseDocumentGen {
70
84
  // Don't throw here - drive editor generation was successful
71
85
  }
72
86
  // Backup the document
73
- await backupDocument(strand.document, this.config.CURRENT_WORKING_DIR);
87
+ await minimalBackupDocument({
88
+ documentId: strand.documentId,
89
+ documentType: strand.documentType,
90
+ branch: strand.branch,
91
+ state: strand.state,
92
+ name: state.name,
93
+ }, this.config.CURRENT_WORKING_DIR);
74
94
  }
75
95
  catch (error) {
76
96
  logger.error(`❌ Error during drive editor generation for app ${state.name}:`, error);
@@ -1,3 +1,3 @@
1
1
  export declare const USE_TS_MORPH = true;
2
- export declare const USE_VERSIONING = false;
2
+ export declare const USE_VERSIONING = true;
3
3
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
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
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../processors/codegen/document-handlers/generators/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,OAAO,CAAC;AACjC,eAAO,MAAM,cAAc,OAAO,CAAC"}
@@ -1,2 +1,3 @@
1
+ import { PROCESSOR_APPS } from "@powerhousedao/shared/processors";
1
2
  export const USE_TS_MORPH = true;
2
- export const USE_VERSIONING = false;
3
+ export const USE_VERSIONING = true;
@@ -5,6 +5,10 @@ import { BaseDocumentGen } from "../base-document-gen.js";
5
5
  */
6
6
  export declare class DocumentEditorGenerator extends BaseDocumentGen {
7
7
  readonly supportedDocumentTypes = "powerhouse/document-editor";
8
+ /**
9
+ * Extract the global state from the full document state
10
+ */
11
+ private extractGlobalState;
8
12
  /**
9
13
  * Validate if this document editor strand should be processed
10
14
  */
@@ -1 +1 @@
1
- {"version":3,"file":"document-editor-generator.d.ts","sourceRoot":"","sources":["../../../../../processors/codegen/document-handlers/generators/document-editor-generator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAGhE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAI1D;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,eAAe;IAC1D,QAAQ,CAAC,sBAAsB,gCAAgC;IAE/D;;OAEG;IACH,aAAa,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO;IAuCnD,QAAQ,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;CA0EjE"}
1
+ {"version":3,"file":"document-editor-generator.d.ts","sourceRoot":"","sources":["../../../../../processors/codegen/document-handlers/generators/document-editor-generator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAMhE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAI1D;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,eAAe;IAC1D,QAAQ,CAAC,sBAAsB,gCAAgC;IAE/D;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAU1B;;OAEG;IACH,aAAa,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO;IAmCnD,QAAQ,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;CAkFjE"}
@@ -3,12 +3,22 @@ import { kebabCase } from "change-case";
3
3
  import { logger } from "../../logger.js";
4
4
  import { BaseDocumentGen } from "../base-document-gen.js";
5
5
  import { USE_TS_MORPH } from "./constants.js";
6
- import { backupDocument } from "./utils.js";
6
+ import { minimalBackupDocument } from "./utils.js";
7
7
  /**
8
8
  * Generator for document editor documents
9
9
  */
10
10
  export class DocumentEditorGenerator extends BaseDocumentGen {
11
11
  supportedDocumentTypes = "powerhouse/document-editor";
12
+ /**
13
+ * Extract the global state from the full document state
14
+ */
15
+ extractGlobalState(strand) {
16
+ const fullState = strand.state;
17
+ if (!fullState) {
18
+ return undefined;
19
+ }
20
+ return fullState.global;
21
+ }
12
22
  /**
13
23
  * Validate if this document editor strand should be processed
14
24
  */
@@ -17,28 +27,32 @@ export class DocumentEditorGenerator extends BaseDocumentGen {
17
27
  if (!super.shouldProcess(strand)) {
18
28
  return false;
19
29
  }
20
- const state = strand.state;
30
+ const state = this.extractGlobalState(strand);
21
31
  if (!state) {
22
- logger.debug(`>>> No state found for document editor: ${strand.documentId}`);
32
+ logger.debug(`No state found for document editor: ${strand.documentId}`);
23
33
  return false;
24
34
  }
25
35
  // Check if we have a valid editor name, document types, and it's confirmed
26
36
  if (!state.name) {
27
- logger.debug(`>>> No name found for document editor: ${strand.documentId}`);
37
+ logger.debug(`No name found for document editor: ${strand.documentId}`);
28
38
  return false;
29
39
  }
30
40
  if (!state.documentTypes || state.documentTypes.length === 0) {
31
- logger.debug(`>>> No document types found for document editor: ${state.name}`);
41
+ logger.debug(`No document types found for document editor: ${state.name}`);
32
42
  return false;
33
43
  }
34
44
  if (state.status !== "CONFIRMED") {
35
- logger.debug(`>>> Document editor not confirmed: ${state.name} (status: ${state.status})`);
45
+ logger.debug(`Document editor not confirmed: ${state.name} (status: ${state.status})`);
36
46
  return false;
37
47
  }
38
48
  return true;
39
49
  }
40
50
  async generate(strand) {
41
- const state = strand.state;
51
+ const state = this.extractGlobalState(strand);
52
+ if (!state) {
53
+ logger.error(`No state found for document editor: ${strand.documentId}`);
54
+ return;
55
+ }
42
56
  // Validation is already done in shouldProcess, so we can proceed directly
43
57
  logger.info(`🔄 Starting editor generation for: ${state.name}`);
44
58
  try {
@@ -48,9 +62,9 @@ export class DocumentEditorGenerator extends BaseDocumentGen {
48
62
  const editorId = kebabCase(state.name);
49
63
  // Generate the editor using the codegen function
50
64
  await generateEditor({
51
- name: state.name,
65
+ ...this.config.PH_CONFIG,
66
+ editorName: state.name,
52
67
  documentTypes: documentTypes,
53
- config: this.config.PH_CONFIG,
54
68
  editorId: editorId,
55
69
  useTsMorph: USE_TS_MORPH,
56
70
  });
@@ -74,7 +88,13 @@ export class DocumentEditorGenerator extends BaseDocumentGen {
74
88
  // Don't throw here - editor generation was successful
75
89
  }
76
90
  // Backup the document
77
- await backupDocument(strand.document, this.config.CURRENT_WORKING_DIR, undefined, state.name);
91
+ await minimalBackupDocument({
92
+ documentId: strand.documentId,
93
+ documentType: strand.documentType,
94
+ branch: strand.branch,
95
+ state: strand.state,
96
+ name: state.name,
97
+ }, this.config.CURRENT_WORKING_DIR);
78
98
  }
79
99
  catch (error) {
80
100
  logger.error(`❌ Error during editor generation for ${state.name}:`, error);
@@ -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;CA0EjE"}