@powerhousedao/vetra 6.0.0-dev.5 → 6.0.0-dev.50
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/actions.d.ts +1 -1
- package/dist/document-models/app-module/actions.d.ts.map +1 -1
- package/dist/document-models/app-module/hooks.d.ts.map +1 -1
- package/dist/document-models/app-module/module.d.ts.map +1 -1
- package/dist/document-models/app-module/module.js +1 -0
- package/dist/document-models/app-module/src/tests/base-operations.test.js +2 -2
- package/dist/document-models/app-module/src/tests/dnd-operations.test.js +1 -1
- package/dist/document-models/document-editor/actions.d.ts +1 -1
- package/dist/document-models/document-editor/actions.d.ts.map +1 -1
- package/dist/document-models/document-editor/hooks.d.ts.map +1 -1
- package/dist/document-models/document-editor/module.d.ts.map +1 -1
- package/dist/document-models/document-editor/module.js +1 -0
- package/dist/document-models/document-editor/src/tests/base-operations.test.js +2 -2
- package/dist/document-models/processor-module/actions.d.ts +3 -1
- package/dist/document-models/processor-module/actions.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/base-operations/actions.d.ts +10 -2
- package/dist/document-models/processor-module/gen/base-operations/actions.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/base-operations/creators.d.ts +4 -2
- package/dist/document-models/processor-module/gen/base-operations/creators.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/base-operations/creators.js +3 -1
- package/dist/document-models/processor-module/gen/base-operations/operations.d.ts +3 -1
- package/dist/document-models/processor-module/gen/base-operations/operations.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/document-model.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/document-model.js +24 -2
- package/dist/document-models/processor-module/gen/document-schema.d.ts +3 -0
- package/dist/document-models/processor-module/gen/document-schema.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/ph-factories.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/ph-factories.js +1 -0
- package/dist/document-models/processor-module/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/reducer.js +11 -1
- package/dist/document-models/processor-module/gen/schema/types.d.ts +7 -0
- package/dist/document-models/processor-module/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/schema/zod.d.ts +3 -1
- package/dist/document-models/processor-module/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/schema/zod.js +11 -0
- package/dist/document-models/processor-module/gen/utils.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/utils.js +1 -0
- package/dist/document-models/processor-module/hooks.d.ts.map +1 -1
- package/dist/document-models/processor-module/module.d.ts.map +1 -1
- package/dist/document-models/processor-module/module.js +1 -0
- package/dist/document-models/processor-module/src/reducers/base-operations.d.ts.map +1 -1
- package/dist/document-models/processor-module/src/reducers/base-operations.js +14 -0
- package/dist/document-models/processor-module/src/tests/base-operations.test.js +26 -2
- package/dist/document-models/subgraph-module/actions.d.ts +1 -1
- package/dist/document-models/subgraph-module/actions.d.ts.map +1 -1
- package/dist/document-models/subgraph-module/hooks.d.ts.map +1 -1
- package/dist/document-models/subgraph-module/module.d.ts.map +1 -1
- package/dist/document-models/subgraph-module/module.js +1 -0
- package/dist/document-models/subgraph-module/src/tests/base-operations.test.js +2 -2
- package/dist/document-models/vetra-package/actions.d.ts +1 -1
- package/dist/document-models/vetra-package/actions.d.ts.map +1 -1
- package/dist/document-models/vetra-package/gen/schema/zod.js +7 -7
- package/dist/document-models/vetra-package/hooks.d.ts.map +1 -1
- package/dist/document-models/vetra-package/module.d.ts.map +1 -1
- package/dist/document-models/vetra-package/module.js +1 -0
- package/dist/document-models/vetra-package/src/tests/base-operations.test.js +1 -1
- package/dist/editors/app-editor/components/AppEditorForm.js +1 -1
- package/dist/editors/app-editor/editor.js +1 -1
- package/dist/editors/app-editor/editor.test.js +8 -1
- package/dist/editors/document-editor/components/DocumentEditorForm.js +1 -1
- package/dist/editors/document-editor/editor.js +1 -1
- package/dist/editors/processor-editor/components/ProcessorEditorForm.d.ts +4 -0
- package/dist/editors/processor-editor/components/ProcessorEditorForm.d.ts.map +1 -1
- package/dist/editors/processor-editor/components/ProcessorEditorForm.js +32 -6
- package/dist/editors/processor-editor/editor.d.ts.map +1 -1
- package/dist/editors/processor-editor/editor.js +7 -1
- package/dist/editors/processor-editor/editor.test.js +166 -173
- package/dist/editors/subgraph-editor/components/SubgraphEditorForm.js +1 -1
- package/dist/editors/subgraph-editor/editor.js +1 -1
- package/dist/editors/vetra-drive-app/DriveExplorer.js +1 -1
- package/dist/editors/vetra-drive-app/components/DriveHeader.js +1 -1
- package/dist/editors/vetra-drive-app/editor.js +1 -1
- package/dist/editors/vetra-package/components/MetaForm.js +1 -1
- package/dist/editors/vetra-package/editor.js +1 -1
- package/dist/processors/codegen/__tests__/codegen-processor-e2e.test.js +46 -22
- package/dist/processors/codegen/document-handlers/generators/app-generator.d.ts.map +1 -1
- package/dist/processors/codegen/document-handlers/generators/app-generator.js +12 -6
- package/dist/processors/codegen/document-handlers/generators/constants.d.ts +1 -0
- package/dist/processors/codegen/document-handlers/generators/constants.d.ts.map +1 -1
- package/dist/processors/codegen/document-handlers/generators/constants.js +2 -0
- package/dist/processors/codegen/document-handlers/generators/document-editor-generator.d.ts.map +1 -1
- package/dist/processors/codegen/document-handlers/generators/document-editor-generator.js +10 -4
- package/dist/processors/codegen/document-handlers/generators/document-model-generator.d.ts +4 -0
- package/dist/processors/codegen/document-handlers/generators/document-model-generator.d.ts.map +1 -1
- package/dist/processors/codegen/document-handlers/generators/document-model-generator.js +42 -20
- package/dist/processors/codegen/document-handlers/generators/package-generator.d.ts.map +1 -1
- package/dist/processors/codegen/document-handlers/generators/package-generator.js +8 -2
- package/dist/processors/codegen/document-handlers/generators/processor-generator.d.ts.map +1 -1
- package/dist/processors/codegen/document-handlers/generators/processor-generator.js +38 -3
- package/dist/processors/codegen/document-handlers/generators/subgraph-generator.d.ts.map +1 -1
- package/dist/processors/codegen/document-handlers/generators/subgraph-generator.js +8 -2
- package/dist/processors/codegen/document-handlers/generators/utils.d.ts +7 -0
- package/dist/processors/codegen/document-handlers/generators/utils.d.ts.map +1 -1
- package/dist/processors/codegen/document-handlers/generators/utils.js +18 -1
- package/dist/processors/codegen/factory.d.ts +1 -1
- package/dist/processors/codegen/factory.d.ts.map +1 -1
- package/dist/processors/codegen/factory.legacy.d.ts +4 -0
- package/dist/processors/codegen/factory.legacy.d.ts.map +1 -0
- package/dist/processors/codegen/factory.legacy.js +53 -0
- package/dist/processors/codegen/index.d.ts +2 -2
- package/dist/processors/codegen/index.d.ts.map +1 -1
- package/dist/processors/codegen/index.js +22 -21
- package/dist/processors/codegen/index.legacy.d.ts +11 -0
- package/dist/processors/codegen/index.legacy.d.ts.map +1 -0
- package/dist/processors/codegen/index.legacy.js +57 -0
- package/dist/processors/factory.d.ts +3 -4
- package/dist/processors/factory.d.ts.map +1 -1
- package/dist/processors/factory.js +5 -4
- package/dist/processors/factory.legacy.d.ts +7 -0
- package/dist/processors/factory.legacy.d.ts.map +1 -0
- package/dist/processors/factory.legacy.js +19 -0
- package/dist/processors/index.d.ts +8 -2
- package/dist/processors/index.d.ts.map +1 -1
- package/dist/processors/index.js +10 -2
- package/dist/processors/vetra-read-model/factory.d.ts +2 -2
- package/dist/processors/vetra-read-model/factory.d.ts.map +1 -1
- package/dist/processors/vetra-read-model/factory.js +13 -16
- package/dist/processors/vetra-read-model/factory.legacy.d.ts +5 -0
- package/dist/processors/vetra-read-model/factory.legacy.d.ts.map +1 -0
- package/dist/processors/vetra-read-model/factory.legacy.js +24 -0
- package/dist/processors/vetra-read-model/index.d.ts +6 -5
- package/dist/processors/vetra-read-model/index.d.ts.map +1 -1
- package/dist/processors/vetra-read-model/index.js +20 -37
- package/dist/processors/vetra-read-model/index.legacy.d.ts +9 -0
- package/dist/processors/vetra-read-model/index.legacy.d.ts.map +1 -0
- package/dist/processors/vetra-read-model/index.legacy.js +75 -0
- package/dist/processors/vetra-read-model/migrations.d.ts +3 -3
- package/dist/processors/vetra-read-model/migrations.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/subgraphs/__tests__/app-module-permissions.test.d.ts +2 -0
- package/dist/subgraphs/__tests__/app-module-permissions.test.d.ts.map +1 -0
- package/dist/subgraphs/__tests__/app-module-permissions.test.js +436 -0
- package/dist/subgraphs/__tests__/permission-utils.test.d.ts +2 -0
- package/dist/subgraphs/__tests__/permission-utils.test.d.ts.map +1 -0
- package/dist/subgraphs/__tests__/permission-utils.test.js +505 -0
- package/dist/subgraphs/__tests__/vetra-read-model-permissions.test.d.ts +2 -0
- package/dist/subgraphs/__tests__/vetra-read-model-permissions.test.d.ts.map +1 -0
- package/dist/subgraphs/__tests__/vetra-read-model-permissions.test.js +319 -0
- package/dist/subgraphs/app-module/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/app-module/resolvers.js +53 -9
- package/dist/subgraphs/document-editor/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/document-editor/resolvers.js +45 -7
- package/dist/subgraphs/permission-utils.d.ts +31 -0
- package/dist/subgraphs/permission-utils.d.ts.map +1 -0
- package/dist/subgraphs/permission-utils.js +101 -0
- package/dist/subgraphs/processor-module/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/processor-module/resolvers.js +49 -8
- package/dist/subgraphs/subgraph-module/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/subgraph-module/resolvers.js +37 -5
- package/dist/subgraphs/vetra-package/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/vetra-package/resolvers.js +69 -13
- package/dist/subgraphs/vetra-read-model/resolvers.d.ts +2 -2
- package/dist/subgraphs/vetra-read-model/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/vetra-read-model/resolvers.js +18 -5
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/vitest.config.d.ts.map +1 -1
- package/dist/vitest.config.js +1 -0
- package/package.json +33 -35
|
@@ -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 {
|
|
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("
|
|
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
|
|
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
|
-
|
|
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();
|
|
@@ -282,6 +282,7 @@ 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",
|
|
@@ -290,7 +291,17 @@ describe("CodegenProcessor E2E Tests", () => {
|
|
|
290
291
|
};
|
|
291
292
|
await processor.onStrands([strand]);
|
|
292
293
|
await vi.runAllTimersAsync();
|
|
293
|
-
expect(generateProcessor).toHaveBeenCalledWith(
|
|
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,6 +312,7 @@ 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",
|
|
@@ -309,7 +321,14 @@ describe("CodegenProcessor E2E Tests", () => {
|
|
|
309
321
|
};
|
|
310
322
|
await processor.onStrands([strand]);
|
|
311
323
|
await vi.runAllTimersAsync();
|
|
312
|
-
expect(generateProcessor).toHaveBeenCalledWith(
|
|
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,6 +339,7 @@ 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",
|
|
@@ -337,6 +357,7 @@ 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",
|
|
@@ -366,10 +387,10 @@ describe("CodegenProcessor E2E Tests", () => {
|
|
|
366
387
|
await vi.runAllTimersAsync();
|
|
367
388
|
const generateDriveEditorArgs = [
|
|
368
389
|
{
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
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
|
},
|
|
@@ -404,10 +425,13 @@ describe("CodegenProcessor E2E Tests", () => {
|
|
|
404
425
|
await processor.onStrands([strand]);
|
|
405
426
|
await vi.runAllTimersAsync();
|
|
406
427
|
expect(generateDriveEditor).toHaveBeenCalledWith({
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
allowedDocumentTypes:
|
|
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
|
});
|
|
@@ -557,9 +581,9 @@ describe("CodegenProcessor E2E Tests", () => {
|
|
|
557
581
|
await processor.onStrands(strands);
|
|
558
582
|
await vi.runAllTimersAsync();
|
|
559
583
|
expect(generateEditor).toHaveBeenCalledWith({
|
|
560
|
-
|
|
584
|
+
editorName: "Test Editor",
|
|
561
585
|
documentTypes: ["powerhouse/document-model"],
|
|
562
|
-
|
|
586
|
+
...mockConfig.PH_CONFIG,
|
|
563
587
|
editorId: "test-editor",
|
|
564
588
|
useTsMorph: USE_TS_MORPH,
|
|
565
589
|
});
|
|
@@ -596,9 +620,9 @@ describe("CodegenProcessor E2E Tests", () => {
|
|
|
596
620
|
await vi.runAllTimersAsync();
|
|
597
621
|
// Valid strand should be processed
|
|
598
622
|
expect(generateEditor).toHaveBeenCalledWith({
|
|
599
|
-
|
|
623
|
+
editorName: "Test Editor",
|
|
600
624
|
documentTypes: ["powerhouse/document-model"],
|
|
601
|
-
|
|
625
|
+
...mockConfig.PH_CONFIG,
|
|
602
626
|
editorId: "test-editor",
|
|
603
627
|
useTsMorph: USE_TS_MORPH,
|
|
604
628
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-generator.d.ts","sourceRoot":"","sources":["../../../../../processors/codegen/document-handlers/generators/app-generator.ts"],"names":[],"mappings":"
|
|
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,aAAa,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO;IA4BnD,QAAQ,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;CAuFjE"}
|
|
@@ -3,7 +3,7 @@ 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 {
|
|
6
|
+
import { minimalBackupDocument } from "./utils.js";
|
|
7
7
|
/**
|
|
8
8
|
* Generator for app documents
|
|
9
9
|
*/
|
|
@@ -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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
allowedDocumentTypes: state.allowedDocumentTypes
|
|
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
|
});
|
|
@@ -70,7 +70,13 @@ export class AppGenerator extends BaseDocumentGen {
|
|
|
70
70
|
// Don't throw here - drive editor generation was successful
|
|
71
71
|
}
|
|
72
72
|
// Backup the document
|
|
73
|
-
await
|
|
73
|
+
await minimalBackupDocument({
|
|
74
|
+
documentId: strand.documentId,
|
|
75
|
+
documentType: strand.documentType,
|
|
76
|
+
branch: strand.branch,
|
|
77
|
+
state: strand.state,
|
|
78
|
+
name: state.name,
|
|
79
|
+
}, this.config.CURRENT_WORKING_DIR);
|
|
74
80
|
}
|
|
75
81
|
catch (error) {
|
|
76
82
|
logger.error(`❌ Error during drive editor generation for app ${state.name}:`, error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../processors/codegen/document-handlers/generators/constants.ts"],"names":[],"mappings":"
|
|
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,QAAQ,CAAC;AACpC,eAAO,MAAM,6BAA6B,qCAAiB,CAAC"}
|
package/dist/processors/codegen/document-handlers/generators/document-editor-generator.d.ts.map
CHANGED
|
@@ -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;
|
|
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,aAAa,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO;IAuCnD,QAAQ,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;CA8EjE"}
|
|
@@ -3,7 +3,7 @@ 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 {
|
|
6
|
+
import { minimalBackupDocument } from "./utils.js";
|
|
7
7
|
/**
|
|
8
8
|
* Generator for document editor documents
|
|
9
9
|
*/
|
|
@@ -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
|
-
|
|
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
|
});
|
|
@@ -74,7 +74,13 @@ export class DocumentEditorGenerator extends BaseDocumentGen {
|
|
|
74
74
|
// Don't throw here - editor generation was successful
|
|
75
75
|
}
|
|
76
76
|
// Backup the document
|
|
77
|
-
await
|
|
77
|
+
await minimalBackupDocument({
|
|
78
|
+
documentId: strand.documentId,
|
|
79
|
+
documentType: strand.documentType,
|
|
80
|
+
branch: strand.branch,
|
|
81
|
+
state: strand.state,
|
|
82
|
+
name: state.name,
|
|
83
|
+
}, this.config.CURRENT_WORKING_DIR);
|
|
78
84
|
}
|
|
79
85
|
catch (error) {
|
|
80
86
|
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
|
*/
|
package/dist/processors/codegen/document-handlers/generators/document-model-generator.d.ts.map
CHANGED
|
@@ -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;
|
|
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"}
|
|
@@ -2,12 +2,24 @@ import { generateFromDocument, generateManifest, validateDocumentModelState, } f
|
|
|
2
2
|
import { logger } from "../../logger.js";
|
|
3
3
|
import { BaseDocumentGen } from "../base-document-gen.js";
|
|
4
4
|
import { USE_TS_MORPH, USE_VERSIONING } from "./constants.js";
|
|
5
|
-
import {
|
|
5
|
+
import { minimalBackupDocument } from "./utils.js";
|
|
6
6
|
/**
|
|
7
7
|
* Generator for document model documents
|
|
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,68 @@ export class DocumentModelGenerator extends BaseDocumentGen {
|
|
|
16
28
|
if (!super.shouldProcess(strand)) {
|
|
17
29
|
return false;
|
|
18
30
|
}
|
|
19
|
-
//
|
|
20
|
-
const
|
|
21
|
-
if (!
|
|
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(
|
|
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 '${
|
|
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 ${
|
|
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
|
|
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: ${
|
|
55
|
+
logger.debug(`🔄 Starting code generation for document model: ${globalState.name}`);
|
|
40
56
|
try {
|
|
41
57
|
await generateFromDocument({
|
|
42
|
-
documentModelState:
|
|
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: ${
|
|
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: ${
|
|
66
|
+
logger.debug(`🔄 Updating manifest with document model: ${globalState.name} (ID: ${globalState.id})`);
|
|
51
67
|
generateManifest({
|
|
52
68
|
documentModels: [
|
|
53
69
|
{
|
|
54
|
-
id:
|
|
55
|
-
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: ${
|
|
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 ${
|
|
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 =
|
|
67
|
-
await
|
|
82
|
+
const extension = globalState.extension?.replace(/^\.+|\.+$/g, "") || "";
|
|
83
|
+
await minimalBackupDocument({
|
|
84
|
+
documentId: strand.documentId,
|
|
85
|
+
documentType: strand.documentType,
|
|
86
|
+
branch: strand.branch,
|
|
87
|
+
state: strand.state,
|
|
88
|
+
name: globalState.name,
|
|
89
|
+
}, this.config.CURRENT_WORKING_DIR, extension);
|
|
68
90
|
}
|
|
69
91
|
catch (error) {
|
|
70
|
-
logger.error(`❌ Error during code generation for ${
|
|
92
|
+
logger.error(`❌ Error during code generation for ${globalState.name}:`, error);
|
|
71
93
|
// Don't throw - let codegen continue with other documents
|
|
72
94
|
return;
|
|
73
95
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-generator.d.ts","sourceRoot":"","sources":["../../../../../processors/codegen/document-handlers/generators/package-generator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"package-generator.d.ts","sourceRoot":"","sources":["../../../../../processors/codegen/document-handlers/generators/package-generator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAMhE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,eAAe;IACnD,QAAQ,CAAC,sBAAsB,wBAAwB;IAEvD;;OAEG;IACH,aAAa,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO;IAenD,QAAQ,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;CA8BjE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { generateManifest } from "@powerhousedao/codegen";
|
|
2
2
|
import { logger } from "../../logger.js";
|
|
3
3
|
import { BaseDocumentGen } from "../base-document-gen.js";
|
|
4
|
-
import {
|
|
4
|
+
import { minimalBackupDocument } from "./utils.js";
|
|
5
5
|
/**
|
|
6
6
|
* Generator for package documents
|
|
7
7
|
*/
|
|
@@ -36,6 +36,12 @@ export class PackageGenerator extends BaseDocumentGen {
|
|
|
36
36
|
}, this.config.CURRENT_WORKING_DIR);
|
|
37
37
|
logger.info("✅ Manifest generated successfully");
|
|
38
38
|
// Backup the document
|
|
39
|
-
await
|
|
39
|
+
await minimalBackupDocument({
|
|
40
|
+
documentId: strand.documentId,
|
|
41
|
+
documentType: strand.documentType,
|
|
42
|
+
branch: strand.branch,
|
|
43
|
+
state: strand.state,
|
|
44
|
+
name: "vetra-package",
|
|
45
|
+
}, this.config.CURRENT_WORKING_DIR);
|
|
40
46
|
}
|
|
41
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processor-generator.d.ts","sourceRoot":"","sources":["../../../../../processors/codegen/document-handlers/generators/processor-generator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"processor-generator.d.ts","sourceRoot":"","sources":["../../../../../processors/codegen/document-handlers/generators/processor-generator.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAMhE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAI1D;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,eAAe;IACrD,QAAQ,CAAC,sBAAsB,0BAA0B;IAEzD;;OAEG;IACH,aAAa,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO;IA2CnD,QAAQ,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;CA8FjE"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { generateProcessor } from "@powerhousedao/codegen";
|
|
2
|
+
import { PROCESSOR_APPS, } from "@powerhousedao/shared/processors";
|
|
2
3
|
import { logger } from "../../logger.js";
|
|
3
4
|
import { BaseDocumentGen } from "../base-document-gen.js";
|
|
4
|
-
import {
|
|
5
|
+
import { USE_TS_MORPH } from "./constants.js";
|
|
6
|
+
import { minimalBackupDocument } from "./utils.js";
|
|
5
7
|
/**
|
|
6
8
|
* Generator for processor documents
|
|
7
9
|
*/
|
|
@@ -33,6 +35,10 @@ export class ProcessorGenerator extends BaseDocumentGen {
|
|
|
33
35
|
logger.debug(`>>> No document types found for processor: ${state.name}`);
|
|
34
36
|
return false;
|
|
35
37
|
}
|
|
38
|
+
if (!state.processorApps || state.processorApps.length === 0) {
|
|
39
|
+
logger.debug(`>>> No processor apps found for processor: ${state.name}`);
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
36
42
|
if (state.status !== "CONFIRMED") {
|
|
37
43
|
logger.debug(`>>> Processor not confirmed: ${state.name} (status: ${state.status})`);
|
|
38
44
|
return false;
|
|
@@ -45,6 +51,7 @@ export class ProcessorGenerator extends BaseDocumentGen {
|
|
|
45
51
|
if (state.name &&
|
|
46
52
|
state.type &&
|
|
47
53
|
state.documentTypes.length > 0 &&
|
|
54
|
+
state.processorApps.length > 0 &&
|
|
48
55
|
state.status === "CONFIRMED") {
|
|
49
56
|
logger.info(`🔄 Starting processor generation for: ${state.name}`);
|
|
50
57
|
try {
|
|
@@ -62,11 +69,29 @@ export class ProcessorGenerator extends BaseDocumentGen {
|
|
|
62
69
|
}
|
|
63
70
|
// Extract document types from the state
|
|
64
71
|
const documentTypes = state.documentTypes.map((dt) => dt.documentType);
|
|
72
|
+
const processorApps = state.processorApps;
|
|
73
|
+
if (!isProcessorApps(processorApps)) {
|
|
74
|
+
logger.error(`❌ Unsupported processor apps: ${processorApps.join(", ")}`);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
65
77
|
// Generate the processor using the codegen function
|
|
66
|
-
await generateProcessor(
|
|
78
|
+
await generateProcessor({
|
|
79
|
+
processorName: state.name,
|
|
80
|
+
processorType,
|
|
81
|
+
documentTypes,
|
|
82
|
+
skipFormat: this.config.PH_CONFIG.skipFormat,
|
|
83
|
+
useTsMorph: USE_TS_MORPH,
|
|
84
|
+
processorApps,
|
|
85
|
+
});
|
|
67
86
|
logger.info(`✅ Processor generation completed successfully for: ${state.name}`);
|
|
68
87
|
// Backup the document
|
|
69
|
-
await
|
|
88
|
+
await minimalBackupDocument({
|
|
89
|
+
documentId: strand.documentId,
|
|
90
|
+
documentType: strand.documentType,
|
|
91
|
+
branch: strand.branch,
|
|
92
|
+
state: strand.state,
|
|
93
|
+
name: state.name,
|
|
94
|
+
}, this.config.CURRENT_WORKING_DIR);
|
|
70
95
|
}
|
|
71
96
|
catch (error) {
|
|
72
97
|
logger.error(`❌ Error during processor generation for ${state.name}:`, error);
|
|
@@ -95,3 +120,13 @@ export class ProcessorGenerator extends BaseDocumentGen {
|
|
|
95
120
|
}
|
|
96
121
|
}
|
|
97
122
|
}
|
|
123
|
+
function isProcessorApps(input) {
|
|
124
|
+
if (input.length === 0)
|
|
125
|
+
return false;
|
|
126
|
+
if (new Set(input).size !== input.length) {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
if (!input.every((i) => PROCESSOR_APPS.includes(i)))
|
|
130
|
+
return false;
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subgraph-generator.d.ts","sourceRoot":"","sources":["../../../../../processors/codegen/document-handlers/generators/subgraph-generator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"subgraph-generator.d.ts","sourceRoot":"","sources":["../../../../../processors/codegen/document-handlers/generators/subgraph-generator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAMhE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,eAAe;IACpD,QAAQ,CAAC,sBAAsB,yBAAyB;IAExD;;OAEG;IACH,aAAa,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO;IA4BnD,QAAQ,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;CA4EjE"}
|
|
@@ -2,7 +2,7 @@ import { generateManifest, generateSubgraph } 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 { minimalBackupDocument } from "./utils.js";
|
|
6
6
|
/**
|
|
7
7
|
* Generator for subgraph documents
|
|
8
8
|
*/
|
|
@@ -61,7 +61,13 @@ export class SubgraphGenerator extends BaseDocumentGen {
|
|
|
61
61
|
// Don't throw here - subgraph generation was successful
|
|
62
62
|
}
|
|
63
63
|
// Backup the document
|
|
64
|
-
await
|
|
64
|
+
await minimalBackupDocument({
|
|
65
|
+
documentId: strand.documentId,
|
|
66
|
+
documentType: strand.documentType,
|
|
67
|
+
branch: strand.branch,
|
|
68
|
+
state: strand.state,
|
|
69
|
+
name: state.name,
|
|
70
|
+
}, this.config.CURRENT_WORKING_DIR);
|
|
65
71
|
}
|
|
66
72
|
catch (error) {
|
|
67
73
|
logger.error(`❌ Error during subgraph generation for ${state.name}:`, error);
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { PHDocument } from "document-model";
|
|
2
|
+
import { type MinimalBackupData } from "document-model/node";
|
|
3
|
+
export type { MinimalBackupData };
|
|
2
4
|
/**
|
|
3
5
|
* Exports a document to the backup directory.
|
|
4
6
|
* Creates the backup directory if it doesn't exist.
|
|
@@ -10,4 +12,9 @@ import type { PHDocument } from "document-model";
|
|
|
10
12
|
* @returns Promise resolving to the backup file path, or undefined if backup failed
|
|
11
13
|
*/
|
|
12
14
|
export declare function backupDocument(document: PHDocument, workingDir: string, extension?: string, name?: string): Promise<string | undefined>;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a minimal backup of a document from strand data.
|
|
17
|
+
* Used when the full document is not available (e.g., in onOperations handler).
|
|
18
|
+
*/
|
|
19
|
+
export declare function minimalBackupDocument(data: MinimalBackupData, workingDir: string, extension?: string): Promise<string | undefined>;
|
|
13
20
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../processors/codegen/document-handlers/generators/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../processors/codegen/document-handlers/generators/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,qBAAqB,CAAC;AAK7B,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAIlC;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAClC,QAAQ,EAAE,UAAU,EACpB,UAAU,EAAE,MAAM,EAClB,SAAS,GAAE,MAAW,EACtB,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAoB7B;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,iBAAiB,EACvB,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAiB7B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { baseSaveToFile } from "document-model/node";
|
|
1
|
+
import { baseMinimalSaveToFile, baseSaveToFile, } from "document-model/node";
|
|
2
2
|
import { mkdir } from "node:fs/promises";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { logger } from "../../logger.js";
|
|
@@ -27,3 +27,20 @@ export async function backupDocument(document, workingDir, extension = "", name)
|
|
|
27
27
|
return undefined;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Creates a minimal backup of a document from strand data.
|
|
32
|
+
* Used when the full document is not available (e.g., in onOperations handler).
|
|
33
|
+
*/
|
|
34
|
+
export async function minimalBackupDocument(data, workingDir, extension) {
|
|
35
|
+
try {
|
|
36
|
+
const backupPath = join(workingDir, BACKUP_FOLDER);
|
|
37
|
+
await mkdir(backupPath, { recursive: true });
|
|
38
|
+
const filePath = await baseMinimalSaveToFile(data, backupPath, extension ?? "");
|
|
39
|
+
logger.debug(`Document backed up to: ${filePath}`);
|
|
40
|
+
return filePath;
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
logger.warn(`Failed to backup document "${data.name}":`, error);
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IProcessorHostModule, ProcessorRecord } from "
|
|
1
|
+
import type { IProcessorHostModule, ProcessorRecord } from "@powerhousedao/reactor";
|
|
2
2
|
import type { PHDocumentHeader } from "document-model";
|
|
3
3
|
export declare const codegenProcessorFactory: (module: IProcessorHostModule) => (driveHeader: PHDocumentHeader) => ProcessorRecord[];
|
|
4
4
|
//# 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,
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../processors/codegen/factory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,oBAAoB,EACpB,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAChC,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 { IProcessorHostModuleLegacy, ProcessorRecordLegacy } from "document-drive";
|
|
2
|
+
import type { PHDocumentHeader } from "document-model";
|
|
3
|
+
export declare const codegenProcessorFactoryLegacy: (module: IProcessorHostModuleLegacy) => (driveHeader: PHDocumentHeader) => ProcessorRecordLegacy[];
|
|
4
|
+
//# sourceMappingURL=factory.legacy.d.ts.map
|