@powerhousedao/vetra 4.1.0-dev.23 → 4.1.0-dev.24
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/editors/app-editor/editor.d.ts +1 -2
- package/dist/editors/app-editor/editor.d.ts.map +1 -1
- package/dist/editors/app-editor/editor.js +8 -5
- package/dist/editors/app-editor/editor.js.map +1 -1
- package/dist/editors/app-editor/index.d.ts +1 -2
- package/dist/editors/app-editor/index.d.ts.map +1 -1
- package/dist/editors/app-editor/index.js.map +1 -1
- package/dist/editors/document-editor/components/DocumentEditorForm.d.ts.map +1 -1
- package/dist/editors/document-editor/components/DocumentEditorForm.js +20 -3
- package/dist/editors/document-editor/components/DocumentEditorForm.js.map +1 -1
- package/dist/editors/document-editor/editor.d.ts +1 -2
- package/dist/editors/document-editor/editor.d.ts.map +1 -1
- package/dist/editors/document-editor/editor.js +12 -6
- package/dist/editors/document-editor/editor.js.map +1 -1
- package/dist/editors/document-editor/index.d.ts +1 -2
- package/dist/editors/document-editor/index.d.ts.map +1 -1
- package/dist/editors/document-editor/index.js.map +1 -1
- package/dist/editors/processor-editor/components/ProcessorEditorForm.d.ts.map +1 -1
- package/dist/editors/processor-editor/components/ProcessorEditorForm.js +1 -1
- package/dist/editors/processor-editor/components/ProcessorEditorForm.js.map +1 -1
- package/dist/editors/processor-editor/editor.d.ts +1 -2
- package/dist/editors/processor-editor/editor.d.ts.map +1 -1
- package/dist/editors/processor-editor/editor.js +17 -11
- package/dist/editors/processor-editor/editor.js.map +1 -1
- package/dist/editors/processor-editor/index.d.ts +1 -2
- package/dist/editors/processor-editor/index.d.ts.map +1 -1
- package/dist/editors/processor-editor/index.js.map +1 -1
- package/dist/editors/subgraph-editor/editor.d.ts +1 -2
- package/dist/editors/subgraph-editor/editor.d.ts.map +1 -1
- package/dist/editors/subgraph-editor/editor.js +8 -5
- package/dist/editors/subgraph-editor/editor.js.map +1 -1
- package/dist/editors/subgraph-editor/index.d.ts +1 -2
- package/dist/editors/subgraph-editor/index.d.ts.map +1 -1
- package/dist/editors/subgraph-editor/index.js.map +1 -1
- package/dist/editors/vetra-drive-app/DriveExplorer.d.ts +2 -2
- package/dist/editors/vetra-drive-app/DriveExplorer.d.ts.map +1 -1
- package/dist/editors/vetra-drive-app/DriveExplorer.js +3 -7
- package/dist/editors/vetra-drive-app/DriveExplorer.js.map +1 -1
- package/dist/editors/vetra-drive-app/components/EditorContainer.d.ts +4 -5
- package/dist/editors/vetra-drive-app/components/EditorContainer.d.ts.map +1 -1
- package/dist/editors/vetra-drive-app/components/EditorContainer.js +6 -14
- package/dist/editors/vetra-drive-app/components/EditorContainer.js.map +1 -1
- package/dist/editors/vetra-drive-app/components/PackageInformationSection.d.ts +4 -5
- package/dist/editors/vetra-drive-app/components/PackageInformationSection.d.ts.map +1 -1
- package/dist/editors/vetra-drive-app/components/PackageInformationSection.js.map +1 -1
- package/dist/editors/vetra-drive-app/editor.d.ts +1 -2
- package/dist/editors/vetra-drive-app/editor.d.ts.map +1 -1
- package/dist/editors/vetra-drive-app/editor.js +13 -17
- package/dist/editors/vetra-drive-app/editor.js.map +1 -1
- package/dist/editors/vetra-drive-app/index.d.ts +1 -2
- package/dist/editors/vetra-drive-app/index.d.ts.map +1 -1
- package/dist/editors/vetra-drive-app/index.js.map +1 -1
- package/dist/editors/vetra-package/editor.d.ts +1 -2
- package/dist/editors/vetra-package/editor.d.ts.map +1 -1
- package/dist/editors/vetra-package/editor.js +29 -26
- package/dist/editors/vetra-package/editor.js.map +1 -1
- package/dist/editors/vetra-package/index.d.ts +1 -2
- package/dist/editors/vetra-package/index.d.ts.map +1 -1
- package/dist/editors/vetra-package/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/processors/codegen/document-handlers/base-document-gen.d.ts +30 -0
- package/dist/processors/codegen/document-handlers/base-document-gen.d.ts.map +1 -0
- package/dist/processors/codegen/document-handlers/base-document-gen.js +29 -0
- package/dist/processors/codegen/document-handlers/base-document-gen.js.map +1 -0
- package/dist/processors/codegen/document-handlers/document-codegen-factory.d.ts +29 -0
- package/dist/processors/codegen/document-handlers/document-codegen-factory.d.ts.map +1 -0
- package/dist/processors/codegen/document-handlers/document-codegen-factory.js +50 -0
- package/dist/processors/codegen/document-handlers/document-codegen-factory.js.map +1 -0
- package/dist/processors/codegen/document-handlers/document-codegen-manager.d.ts +50 -0
- package/dist/processors/codegen/document-handlers/document-codegen-manager.d.ts.map +1 -0
- package/dist/processors/codegen/document-handlers/document-codegen-manager.js +111 -0
- package/dist/processors/codegen/document-handlers/document-codegen-manager.js.map +1 -0
- package/dist/processors/codegen/document-handlers/generators/app-generator.d.ts +11 -0
- package/dist/processors/codegen/document-handlers/generators/app-generator.d.ts.map +1 -0
- package/dist/processors/codegen/document-handlers/{app-handler.js → generators/app-generator.js} +17 -12
- package/dist/processors/codegen/document-handlers/generators/app-generator.js.map +1 -0
- package/dist/processors/codegen/document-handlers/generators/document-editor-generator.d.ts +11 -0
- package/dist/processors/codegen/document-handlers/generators/document-editor-generator.d.ts.map +1 -0
- package/dist/processors/codegen/document-handlers/{document-editor-handler.js → generators/document-editor-generator.js} +21 -13
- package/dist/processors/codegen/document-handlers/generators/document-editor-generator.js.map +1 -0
- package/dist/processors/codegen/document-handlers/generators/document-model-generator.d.ts +11 -0
- package/dist/processors/codegen/document-handlers/generators/document-model-generator.d.ts.map +1 -0
- package/dist/processors/codegen/document-handlers/{document-model-handler.js → generators/document-model-generator.js} +21 -15
- package/dist/processors/codegen/document-handlers/generators/document-model-generator.js.map +1 -0
- package/dist/processors/codegen/document-handlers/generators/index.d.ts +7 -0
- package/dist/processors/codegen/document-handlers/generators/index.d.ts.map +1 -0
- package/dist/processors/codegen/document-handlers/generators/index.js +7 -0
- package/dist/processors/codegen/document-handlers/generators/index.js.map +1 -0
- package/dist/processors/codegen/document-handlers/generators/package-generator.d.ts +11 -0
- package/dist/processors/codegen/document-handlers/generators/package-generator.d.ts.map +1 -0
- package/dist/processors/codegen/document-handlers/{package-handler.js → generators/package-generator.js} +9 -9
- package/dist/processors/codegen/document-handlers/generators/package-generator.js.map +1 -0
- package/dist/processors/codegen/document-handlers/generators/processor-generator.d.ts +11 -0
- package/dist/processors/codegen/document-handlers/generators/processor-generator.d.ts.map +1 -0
- package/dist/processors/codegen/document-handlers/{processor-handler.js → generators/processor-generator.js} +18 -10
- package/dist/processors/codegen/document-handlers/generators/processor-generator.js.map +1 -0
- package/dist/processors/codegen/document-handlers/generators/subgraph-generator.d.ts +11 -0
- package/dist/processors/codegen/document-handlers/generators/subgraph-generator.d.ts.map +1 -0
- package/dist/processors/codegen/document-handlers/{subgraph-handler.js → generators/subgraph-generator.js} +18 -13
- package/dist/processors/codegen/document-handlers/generators/subgraph-generator.js.map +1 -0
- package/dist/processors/codegen/document-handlers/index.d.ts +5 -7
- package/dist/processors/codegen/document-handlers/index.d.ts.map +1 -1
- package/dist/processors/codegen/document-handlers/index.js +5 -6
- package/dist/processors/codegen/document-handlers/index.js.map +1 -1
- package/dist/processors/codegen/factory.d.ts +2 -1
- package/dist/processors/codegen/factory.d.ts.map +1 -1
- package/dist/processors/codegen/factory.js +4 -1
- package/dist/processors/codegen/factory.js.map +1 -1
- package/dist/processors/codegen/index.d.ts +0 -2
- package/dist/processors/codegen/index.d.ts.map +1 -1
- package/dist/processors/codegen/index.js +7 -36
- package/dist/processors/codegen/index.js.map +1 -1
- package/dist/processors/codegen/utils.d.ts +5 -0
- package/dist/processors/codegen/utils.d.ts.map +1 -0
- package/dist/processors/codegen/utils.js +19 -0
- package/dist/processors/codegen/utils.js.map +1 -0
- package/dist/processors/factory.d.ts +2 -1
- package/dist/processors/factory.d.ts.map +1 -1
- package/dist/processors/factory.js +3 -3
- package/dist/processors/factory.js.map +1 -1
- package/dist/style.css +8 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -14
- package/dist/package.json +0 -114
- package/dist/powerhouse.config.json +0 -12
- package/dist/processors/codegen/document-handlers/app-handler.d.ts +0 -10
- package/dist/processors/codegen/document-handlers/app-handler.d.ts.map +0 -1
- package/dist/processors/codegen/document-handlers/app-handler.js.map +0 -1
- package/dist/processors/codegen/document-handlers/document-editor-handler.d.ts +0 -10
- package/dist/processors/codegen/document-handlers/document-editor-handler.d.ts.map +0 -1
- package/dist/processors/codegen/document-handlers/document-editor-handler.js.map +0 -1
- package/dist/processors/codegen/document-handlers/document-model-handler.d.ts +0 -10
- package/dist/processors/codegen/document-handlers/document-model-handler.d.ts.map +0 -1
- package/dist/processors/codegen/document-handlers/document-model-handler.js.map +0 -1
- package/dist/processors/codegen/document-handlers/package-handler.d.ts +0 -10
- package/dist/processors/codegen/document-handlers/package-handler.d.ts.map +0 -1
- package/dist/processors/codegen/document-handlers/package-handler.js.map +0 -1
- package/dist/processors/codegen/document-handlers/processor-handler.d.ts +0 -10
- package/dist/processors/codegen/document-handlers/processor-handler.d.ts.map +0 -1
- package/dist/processors/codegen/document-handlers/processor-handler.js.map +0 -1
- package/dist/processors/codegen/document-handlers/subgraph-handler.d.ts +0 -10
- package/dist/processors/codegen/document-handlers/subgraph-handler.d.ts.map +0 -1
- package/dist/processors/codegen/document-handlers/subgraph-handler.js.map +0 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type DriveEditorProps } from "@powerhousedao/reactor-browser";
|
|
2
|
-
|
|
3
|
-
export type IProps = DriveEditorProps<DocumentDriveDocument>;
|
|
2
|
+
export type IProps = DriveEditorProps;
|
|
4
3
|
export declare function BaseEditor(props: IProps): import("react/jsx-runtime").JSX.Element;
|
|
5
4
|
export default function Editor(props: IProps): import("react/jsx-runtime").JSX.Element;
|
|
6
5
|
//# sourceMappingURL=editor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/vetra-drive-app/editor.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/vetra-drive-app/editor.tsx"],"names":[],"mappings":"AACA,OAAO,EAA0H,KAAK,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAU/L,MAAM,MAAM,MAAM,GAAG,gBAAgB,CAAC;AAEtC,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,2CA0DvC;AAED,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,MAAM,2CAW3C"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { WagmiContext } from "@powerhousedao/design-system";
|
|
3
|
+
import { addDocument, DriveContextProvider, setSelectedNode, useAnalyticsDatabaseName, useDocumentModelModules, useDriveContext } from "@powerhousedao/reactor-browser";
|
|
3
4
|
import { AnalyticsProvider } from "@powerhousedao/reactor-browser/analytics/context";
|
|
4
|
-
import { DriveContextProvider, useDriveContext } from "@powerhousedao/reactor-browser/hooks/useDriveContext";
|
|
5
|
-
import { useInitializePHApp, useSetSelectedNode } from '@powerhousedao/state';
|
|
6
5
|
import { useCallback } from "react";
|
|
7
6
|
import { DriveExplorer } from "./DriveExplorer.js";
|
|
8
7
|
import { DOCUMENT_TYPES } from "./document-types.js";
|
|
9
8
|
export function BaseEditor(props) {
|
|
10
|
-
const {
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
9
|
+
const { context, document } = props;
|
|
10
|
+
const unsafeCastOfDocument = document;
|
|
11
|
+
const { showCreateDocumentModal, } = useDriveContext();
|
|
12
|
+
const driveId = unsafeCastOfDocument.header.id;
|
|
13
|
+
const documentModels = useDocumentModelModules();
|
|
14
|
+
const fileNodes = unsafeCastOfDocument.state.global.nodes.filter((node) => node.kind === 'file');
|
|
15
15
|
const packageDocumentId = fileNodes.find((node) => node.documentType === DOCUMENT_TYPES.documentPackage)?.id;
|
|
16
16
|
const docModelsNodes = fileNodes.filter((node) => node.documentType === DOCUMENT_TYPES.documentModel);
|
|
17
17
|
const docEditorsNodes = fileNodes.filter((node) => node.documentType === DOCUMENT_TYPES.documentEditor);
|
|
@@ -19,22 +19,18 @@ export function BaseEditor(props) {
|
|
|
19
19
|
const docProcessorsNodes = fileNodes.filter((node) => node.documentType === DOCUMENT_TYPES.documentProcessor);
|
|
20
20
|
const docAppsNodes = fileNodes.filter((node) => node.documentType === DOCUMENT_TYPES.documentApp);
|
|
21
21
|
const onCreateDocument = useCallback((documentType) => {
|
|
22
|
-
const documentModel = documentModels
|
|
22
|
+
const documentModel = documentModels?.find((model) => model.documentModel.id === documentType);
|
|
23
23
|
if (documentModel) {
|
|
24
24
|
showCreateDocumentModal(documentModel);
|
|
25
25
|
}
|
|
26
|
-
}, [showCreateDocumentModal, documentModels
|
|
26
|
+
}, [showCreateDocumentModal, documentModels?.length]);
|
|
27
27
|
const onCreatePackageFile = useCallback(() => {
|
|
28
28
|
addDocument(driveId, 'vetra-package', DOCUMENT_TYPES.documentPackage);
|
|
29
|
-
}, [
|
|
30
|
-
|
|
31
|
-
const onOpenDocument = useCallback((node) => {
|
|
32
|
-
setSelectedNode(node.id);
|
|
33
|
-
}, [setSelectedNode]);
|
|
34
|
-
return (_jsx("div", { className: "bg-white", style: { height: "100%" }, children: _jsx(DriveExplorer, { documentModels: docModelsNodes, editors: docEditorsNodes, apps: docAppsNodes, subgraphs: docSubgraphsNodes, processors: docProcessorsNodes, codegenProcessors: [], onAddDocumentModel: () => onCreateDocument(DOCUMENT_TYPES.documentModel), onAddEditor: () => onCreateDocument(DOCUMENT_TYPES.documentEditor), onAddApp: () => onCreateDocument(DOCUMENT_TYPES.documentApp), onAddSubgraph: () => onCreateDocument(DOCUMENT_TYPES.documentSubgraph), onAddProcessor: () => onCreateDocument(DOCUMENT_TYPES.documentProcessor), onAddCodegenProcessor: () => console.log('add codegen processor'), context: context, packageDocumentId: packageDocumentId, onAddPackageDocument: onCreatePackageFile, driveId: document.header.id, onOpenDocument: onOpenDocument }) }));
|
|
29
|
+
}, [driveId]);
|
|
30
|
+
return (_jsx("div", { className: "bg-white", style: { height: "100%" }, children: _jsx(DriveExplorer, { documentModels: docModelsNodes, editors: docEditorsNodes, apps: docAppsNodes, subgraphs: docSubgraphsNodes, processors: docProcessorsNodes, codegenProcessors: [], onAddDocumentModel: () => onCreateDocument(DOCUMENT_TYPES.documentModel), onAddEditor: () => onCreateDocument(DOCUMENT_TYPES.documentEditor), onAddApp: () => onCreateDocument(DOCUMENT_TYPES.documentApp), onAddSubgraph: () => onCreateDocument(DOCUMENT_TYPES.documentSubgraph), onAddProcessor: () => onCreateDocument(DOCUMENT_TYPES.documentProcessor), onAddCodegenProcessor: () => console.log('add codegen processor'), context: context, packageDocumentId: packageDocumentId, onAddPackageDocument: onCreatePackageFile, driveId: document.header.id, onOpenDocument: (node) => setSelectedNode(node) }) }));
|
|
35
31
|
}
|
|
36
32
|
export default function Editor(props) {
|
|
37
|
-
|
|
38
|
-
return (_jsx(DriveContextProvider, { value: props.context, children: _jsx(WagmiContext, { children: _jsx(AnalyticsProvider, { databaseName:
|
|
33
|
+
const analyticsDatabaseName = useAnalyticsDatabaseName();
|
|
34
|
+
return (_jsx(DriveContextProvider, { value: props.context, children: _jsx(WagmiContext, { children: _jsx(AnalyticsProvider, { databaseName: analyticsDatabaseName, children: _jsx(BaseEditor, { ...props }) }) }) }));
|
|
39
35
|
}
|
|
40
36
|
//# sourceMappingURL=editor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.js","sourceRoot":"","sources":["../../../editors/vetra-drive-app/editor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"editor.js","sourceRoot":"","sources":["../../../editors/vetra-drive-app/editor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,oBAAoB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,gBAAgB,CAAC,cAAc,CAAC,cAAc,CAAC,EAClE,QAAQ,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,cAAc,CAAC,WAAW,CAAC,EAC5D,aAAa,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,cAAc,CAAC,gBAAgB,CAAC,EACtE,cAAc,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,cAAc,CAAC,iBAAiB,CAAC,EACxE,qBAAqB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,EACjE,OAAO,EAAE,OAAO,EAChB,iBAAiB,EAAE,iBAAiB,EACpC,oBAAoB,EAAE,mBAAmB,EACzC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,EAC3B,cAAc,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,GAC/C,GACE,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAa;IAC1C,MAAM,qBAAqB,GAAG,wBAAwB,EAAE,CAAC;IACzD,OAAO,CACL,KAAC,oBAAoB,IAAC,KAAK,EAAE,KAAK,CAAC,OAAO,YACxC,KAAC,YAAY,cACX,KAAC,iBAAiB,IAAC,YAAY,EAAE,qBAAqB,YACpD,KAAC,UAAU,OAAK,KAAK,GAAI,GACP,GACP,GACM,CACxB,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type DriveEditorModule } from "@powerhousedao/reactor-browser";
|
|
2
|
-
|
|
3
|
-
export declare const module: DriveEditorModule<DocumentDriveDocument>;
|
|
2
|
+
export declare const module: DriveEditorModule;
|
|
4
3
|
export default module;
|
|
5
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../editors/vetra-drive-app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../editors/vetra-drive-app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGxE,eAAO,MAAM,MAAM,EAAE,iBASpB,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../editors/vetra-drive-app/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../editors/vetra-drive-app/index.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,MAAM,CAAC,MAAM,MAAM,GAAsB;IACvC,SAAS,EAAE,MAAM;IACjB,aAAa,EAAE,CAAC,2BAA2B,CAAC;IAC5C,MAAM,EAAE;QACN,EAAE,EAAE,iBAAiB;QACrB,uBAAuB,EAAE,IAAI;QAC7B,sBAAsB,EAAE,IAAI;QAC5B,mBAAmB,EAAE,IAAI;KAC1B;CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { EditorProps } from "document-model";
|
|
2
|
-
|
|
3
|
-
export type IProps = EditorProps<VetraPackageDocument>;
|
|
2
|
+
export type IProps = EditorProps;
|
|
4
3
|
export default function Editor(props: IProps): import("react/jsx-runtime").JSX.Element;
|
|
5
4
|
//# sourceMappingURL=editor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/vetra-package/editor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/vetra-package/editor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAQlD,MAAM,MAAM,MAAM,GAAG,WAAW,CAAC;AAEjC,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,MAAM,2CA6F3C"}
|
|
@@ -1,65 +1,68 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { MetaForm } from "./components/MetaForm.js";
|
|
2
|
+
import { useDocumentById } from "@powerhousedao/reactor-browser";
|
|
4
3
|
import { useCallback } from "react";
|
|
4
|
+
import { actions } from "../../document-models/vetra-package/index.js";
|
|
5
|
+
import { MetaForm } from "./components/MetaForm.js";
|
|
5
6
|
export default function Editor(props) {
|
|
6
|
-
const { document
|
|
7
|
-
|
|
7
|
+
const { document: initialDocument } = props;
|
|
8
|
+
const [document, dispatch] = useDocumentById(initialDocument.header.id);
|
|
9
|
+
const unsafeCastOfDocument = document;
|
|
10
|
+
console.log(">>>>> document:", unsafeCastOfDocument.state.global);
|
|
8
11
|
const onNameChange = useCallback((name) => {
|
|
9
|
-
if (!
|
|
12
|
+
if (!unsafeCastOfDocument.state.global.name && !name)
|
|
10
13
|
return;
|
|
11
|
-
if (name ===
|
|
14
|
+
if (name === unsafeCastOfDocument.state.global.name)
|
|
12
15
|
return;
|
|
13
16
|
dispatch(actions.setPackageName({ name }));
|
|
14
|
-
}, [
|
|
17
|
+
}, [unsafeCastOfDocument.state.global.name]);
|
|
15
18
|
const onDescriptionChange = useCallback((description) => {
|
|
16
|
-
if (!
|
|
19
|
+
if (!unsafeCastOfDocument.state.global.description && !description)
|
|
17
20
|
return;
|
|
18
|
-
if (description ===
|
|
21
|
+
if (description === unsafeCastOfDocument.state.global.description)
|
|
19
22
|
return;
|
|
20
23
|
dispatch(actions.setPackageDescription({ description }));
|
|
21
|
-
}, [
|
|
24
|
+
}, [unsafeCastOfDocument.state.global.description]);
|
|
22
25
|
const onCategoryChange = useCallback((category) => {
|
|
23
|
-
if (!
|
|
26
|
+
if (!unsafeCastOfDocument.state.global.category && !category)
|
|
24
27
|
return;
|
|
25
|
-
if (category ===
|
|
28
|
+
if (category === unsafeCastOfDocument.state.global.category)
|
|
26
29
|
return;
|
|
27
30
|
dispatch(actions.setPackageCategory({ category }));
|
|
28
|
-
}, [
|
|
31
|
+
}, [unsafeCastOfDocument.state.global.category]);
|
|
29
32
|
const onPublisherChange = useCallback((name) => {
|
|
30
|
-
if (!
|
|
33
|
+
if (!unsafeCastOfDocument.state.global.author.name && !name)
|
|
31
34
|
return;
|
|
32
|
-
if (name ===
|
|
35
|
+
if (name === unsafeCastOfDocument.state.global.author.name)
|
|
33
36
|
return;
|
|
34
37
|
dispatch(actions.setPackageAuthorName({ name }));
|
|
35
|
-
}, [
|
|
38
|
+
}, [unsafeCastOfDocument.state.global.author.name]);
|
|
36
39
|
const onPublisherUrlChange = useCallback((website) => {
|
|
37
|
-
if (!
|
|
40
|
+
if (!unsafeCastOfDocument.state.global.author.website && !website)
|
|
38
41
|
return;
|
|
39
|
-
if (website ===
|
|
42
|
+
if (website === unsafeCastOfDocument.state.global.author.website)
|
|
40
43
|
return;
|
|
41
44
|
dispatch(actions.setPackageAuthorWebsite({ website }));
|
|
42
|
-
}, [
|
|
45
|
+
}, [unsafeCastOfDocument.state.global.author.website]);
|
|
43
46
|
const onGithubRepositoryChange = useCallback((url) => {
|
|
44
|
-
if (!
|
|
47
|
+
if (!unsafeCastOfDocument.state.global.githubUrl && !url)
|
|
45
48
|
return;
|
|
46
|
-
if (url ===
|
|
49
|
+
if (url === unsafeCastOfDocument.state.global.githubUrl)
|
|
47
50
|
return;
|
|
48
51
|
dispatch(actions.setPackageGithubUrl({ url }));
|
|
49
|
-
}, [
|
|
52
|
+
}, [unsafeCastOfDocument.state.global.githubUrl]);
|
|
50
53
|
const onNpmPackageChange = useCallback((url) => {
|
|
51
|
-
if (!
|
|
54
|
+
if (!unsafeCastOfDocument.state.global.npmUrl && !url)
|
|
52
55
|
return;
|
|
53
|
-
if (url ===
|
|
56
|
+
if (url === unsafeCastOfDocument.state.global.npmUrl)
|
|
54
57
|
return;
|
|
55
58
|
dispatch(actions.setPackageNpmUrl({ url }));
|
|
56
|
-
}, [
|
|
59
|
+
}, [unsafeCastOfDocument.state.global.npmUrl]);
|
|
57
60
|
const onAddKeyword = useCallback((keyword) => {
|
|
58
61
|
dispatch(actions.addPackageKeyword(keyword));
|
|
59
62
|
}, []);
|
|
60
63
|
const onRemoveKeyword = useCallback((id) => {
|
|
61
64
|
dispatch(actions.removePackageKeyword({ id }));
|
|
62
65
|
}, []);
|
|
63
|
-
return (_jsx("div", { children: _jsx(MetaForm, { name:
|
|
66
|
+
return (_jsx("div", { children: _jsx(MetaForm, { name: unsafeCastOfDocument.state.global.name ?? "", description: unsafeCastOfDocument.state.global.description ?? "", category: unsafeCastOfDocument.state.global.category ?? "", publisher: unsafeCastOfDocument.state.global.author.name ?? "", publisherUrl: unsafeCastOfDocument.state.global.author.website ?? "", githubRepository: unsafeCastOfDocument.state.global.githubUrl ?? "", npmPackage: unsafeCastOfDocument.state.global.npmUrl ?? "", keywords: unsafeCastOfDocument.state.global.keywords, onNameChange: onNameChange, onDescriptionChange: onDescriptionChange, onCategoryChange: onCategoryChange, onPublisherChange: onPublisherChange, onPublisherUrlChange: onPublisherUrlChange, onGithubRepositoryChange: onGithubRepositoryChange, onNpmPackageChange: onNpmPackageChange, onAddKeyword: onAddKeyword, onRemoveKeyword: onRemoveKeyword }) }));
|
|
64
67
|
}
|
|
65
68
|
//# sourceMappingURL=editor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.js","sourceRoot":"","sources":["../../../editors/vetra-package/editor.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"editor.js","sourceRoot":"","sources":["../../../editors/vetra-package/editor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAA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CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,wBACE,KAAC,QAAQ,IACP,IAAI,EAAE,oBAAoB,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,EAClD,WAAW,EAAE,oBAAoB,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,IAAI,EAAE,EAChE,QAAQ,EAAE,oBAAoB,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,EAC1D,SAAS,EAAE,oBAAoB,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,EAC9D,YAAY,EAAE,oBAAoB,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,EACpE,gBAAgB,EAAE,oBAAoB,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,EACnE,UAAU,EAAE,oBAAoB,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,EAC1D,QAAQ,EAAE,oBAAoB,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EACpD,YAAY,EAAE,YAAY,EAC1B,mBAAmB,EAAE,mBAAmB,EACxC,gBAAgB,EAAE,gBAAgB,EAClC,iBAAiB,EAAE,iBAAiB,EACpC,oBAAoB,EAAE,oBAAoB,EAC1C,wBAAwB,EAAE,wBAAwB,EAClD,kBAAkB,EAAE,kBAAkB,EACtC,YAAY,EAAE,YAAY,EAC1B,eAAe,EAAE,eAAe,GAChC,GACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { EditorModule } from "document-model";
|
|
2
|
-
|
|
3
|
-
export declare const module: EditorModule<VetraPackageDocument>;
|
|
2
|
+
export declare const module: EditorModule;
|
|
4
3
|
export default module;
|
|
5
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../editors/vetra-package/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../editors/vetra-package/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,eAAO,MAAM,MAAM,EAAE,YASpB,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../editors/vetra-package/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../editors/vetra-package/index.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,MAAM,CAAC,MAAM,MAAM,GAAiB;IAClC,SAAS,EAAE,MAAM;IACjB,aAAa,EAAE,CAAC,oBAAoB,CAAC;IACrC,MAAM,EAAE;QACN,EAAE,EAAE,sBAAsB;QAC1B,uBAAuB,EAAE,IAAI;QAC7B,sBAAsB,EAAE,IAAI;QAC5B,mBAAmB,EAAE,IAAI;KAC1B;CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Manifest } from "document-model";
|
|
2
2
|
export declare const manifest: Manifest;
|
|
3
3
|
export declare const documentModels: (import("document-model").DocumentModelModule<import("./document-models/document-editor/index.js").DocumentEditorDocument> | import("document-model").DocumentModelModule<import("./document-models/vetra-package/index.js").VetraPackageDocument> | import("document-model").DocumentModelModule<import("./document-models/subgraph-module/index.js").SubgraphModuleDocument> | import("document-model").DocumentModelModule<import("./document-models/processor-module/index.js").ProcessorModuleDocument> | import("document-model").DocumentModelModule<import("./document-models/app-module/index.js").AppModuleDocument>)[];
|
|
4
|
-
export declare const editors: (import("document-model").EditorModule
|
|
4
|
+
export declare const editors: (import("document-model").EditorModule | import("@powerhousedao/reactor-browser").DriveEditorModule)[];
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAK/C,eAAO,MAAM,QAAQ,EAAE,QAAuB,CAAC;AAC/C,eAAO,MAAM,cAAc,mmBAAuC,CAAC;AACnE,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAK/C,eAAO,MAAM,QAAQ,EAAE,QAAuB,CAAC;AAC/C,eAAO,MAAM,cAAc,mmBAAuC,CAAC;AACnE,eAAO,MAAM,OAAO,wGAAgC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type InternalTransmitterUpdate } from "document-drive/server/listener/transmitter/internal";
|
|
2
|
+
import { type DocumentModelDocument } from "document-model";
|
|
3
|
+
import { type Config } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Abstract base class for document generators
|
|
6
|
+
* Defines the interface that all document-type handlers must implement
|
|
7
|
+
*/
|
|
8
|
+
export declare abstract class BaseDocumentGen {
|
|
9
|
+
protected config: Config;
|
|
10
|
+
/**
|
|
11
|
+
* The document type(s) this generator supports
|
|
12
|
+
* Can be a single string or an array of strings for generators that handle multiple types
|
|
13
|
+
*/
|
|
14
|
+
abstract readonly supportedDocumentTypes: string | string[];
|
|
15
|
+
constructor(config: Config);
|
|
16
|
+
/**
|
|
17
|
+
* Generate code for the given document
|
|
18
|
+
* Must be implemented by each specific document generator
|
|
19
|
+
*/
|
|
20
|
+
abstract generate(strand: InternalTransmitterUpdate<DocumentModelDocument>): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Check if this generator supports the given document type
|
|
23
|
+
*/
|
|
24
|
+
supportsDocumentType(documentType: string): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Get all supported document types as an array
|
|
27
|
+
*/
|
|
28
|
+
getSupportedDocumentTypes(): string[];
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=base-document-gen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-document-gen.d.ts","sourceRoot":"","sources":["../../../../processors/codegen/document-handlers/base-document-gen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,qDAAqD,CAAC;AACrG,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC;;;GAGG;AACH,8BAAsB,eAAe;IAOvB,SAAS,CAAC,MAAM,EAAE,MAAM;IANpC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,sBAAsB,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;gBAEtC,MAAM,EAAE,MAAM;IAEpC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CACf,MAAM,EAAE,yBAAyB,CAAC,qBAAqB,CAAC,GACvD,OAAO,CAAC,IAAI,CAAC;IAEhB;;OAEG;IACH,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;IAOnD;;OAEG;IACH,yBAAyB,IAAI,MAAM,EAAE;CAMtC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abstract base class for document generators
|
|
3
|
+
* Defines the interface that all document-type handlers must implement
|
|
4
|
+
*/
|
|
5
|
+
export class BaseDocumentGen {
|
|
6
|
+
config;
|
|
7
|
+
constructor(config) {
|
|
8
|
+
this.config = config;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Check if this generator supports the given document type
|
|
12
|
+
*/
|
|
13
|
+
supportsDocumentType(documentType) {
|
|
14
|
+
if (typeof this.supportedDocumentTypes === "string") {
|
|
15
|
+
return this.supportedDocumentTypes === documentType;
|
|
16
|
+
}
|
|
17
|
+
return this.supportedDocumentTypes.includes(documentType);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get all supported document types as an array
|
|
21
|
+
*/
|
|
22
|
+
getSupportedDocumentTypes() {
|
|
23
|
+
if (typeof this.supportedDocumentTypes === "string") {
|
|
24
|
+
return [this.supportedDocumentTypes];
|
|
25
|
+
}
|
|
26
|
+
return [...this.supportedDocumentTypes];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=base-document-gen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-document-gen.js","sourceRoot":"","sources":["../../../../processors/codegen/document-handlers/base-document-gen.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,OAAgB,eAAe;IAOb;IAAtB,YAAsB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAUxC;;OAEG;IACH,oBAAoB,CAAC,YAAoB;QACvC,IAAI,OAAO,IAAI,CAAC,sBAAsB,KAAK,QAAQ,EAAE,CAAC;YACpD,OAAO,IAAI,CAAC,sBAAsB,KAAK,YAAY,CAAC;QACtD,CAAC;QACD,OAAO,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC5D,CAAC;IAED;;OAEG;IACH,yBAAyB;QACvB,IAAI,OAAO,IAAI,CAAC,sBAAsB,KAAK,QAAQ,EAAE,CAAC;YACpD,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACvC,CAAC;QACD,OAAO,CAAC,GAAG,IAAI,CAAC,sBAAsB,CAAC,CAAC;IAC1C,CAAC;CACF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DocumentCodegenManager } from "./document-codegen-manager.js";
|
|
2
|
+
import { AppGenerator, DocumentEditorGenerator, DocumentModelGenerator, PackageGenerator, ProcessorGenerator, SubgraphGenerator } from "./generators/index.js";
|
|
3
|
+
import { type Config } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Factory class for creating and configuring DocumentCodegenManager instances
|
|
6
|
+
* with all the standard generators pre-registered
|
|
7
|
+
*/
|
|
8
|
+
export declare class DocumentCodegenFactory {
|
|
9
|
+
/**
|
|
10
|
+
* Create a DocumentCodegenManager with all standard generators registered
|
|
11
|
+
*/
|
|
12
|
+
static createManager(config: Config): DocumentCodegenManager;
|
|
13
|
+
/**
|
|
14
|
+
* Create a DocumentCodegenManager with only specific generators
|
|
15
|
+
*/
|
|
16
|
+
static createManagerWithGenerators(config: Config, generators: Array<new (config: Config) => any>): DocumentCodegenManager;
|
|
17
|
+
/**
|
|
18
|
+
* Get all available generator classes
|
|
19
|
+
*/
|
|
20
|
+
static getAvailableGenerators(): {
|
|
21
|
+
DocumentModelGenerator: typeof DocumentModelGenerator;
|
|
22
|
+
PackageGenerator: typeof PackageGenerator;
|
|
23
|
+
AppGenerator: typeof AppGenerator;
|
|
24
|
+
DocumentEditorGenerator: typeof DocumentEditorGenerator;
|
|
25
|
+
SubgraphGenerator: typeof SubgraphGenerator;
|
|
26
|
+
ProcessorGenerator: typeof ProcessorGenerator;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=document-codegen-factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-codegen-factory.d.ts","sourceRoot":"","sources":["../../../../processors/codegen/document-handlers/document-codegen-factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC;;;GAGG;AACH,qBAAa,sBAAsB;IACjC;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,sBAAsB;IAoB5D;;OAEG;IACH,MAAM,CAAC,2BAA2B,CAChC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,KAAK,CAAC,KAAK,MAAM,EAAE,MAAM,KAAK,GAAG,CAAC,GAC7C,sBAAsB;IAezB;;OAEG;IACH,MAAM,CAAC,sBAAsB;;;;;;;;CAU9B"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { DocumentCodegenManager } from "./document-codegen-manager.js";
|
|
2
|
+
import { AppGenerator, DocumentEditorGenerator, DocumentModelGenerator, PackageGenerator, ProcessorGenerator, SubgraphGenerator, } from "./generators/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Factory class for creating and configuring DocumentCodegenManager instances
|
|
5
|
+
* with all the standard generators pre-registered
|
|
6
|
+
*/
|
|
7
|
+
export class DocumentCodegenFactory {
|
|
8
|
+
/**
|
|
9
|
+
* Create a DocumentCodegenManager with all standard generators registered
|
|
10
|
+
*/
|
|
11
|
+
static createManager(config) {
|
|
12
|
+
const manager = new DocumentCodegenManager(config);
|
|
13
|
+
// Register all the standard generators
|
|
14
|
+
manager.registerGenerator("powerhouse/document-model", DocumentModelGenerator);
|
|
15
|
+
manager.registerGenerator("powerhouse/package", PackageGenerator);
|
|
16
|
+
manager.registerGenerator("powerhouse/app", AppGenerator);
|
|
17
|
+
manager.registerGenerator("powerhouse/document-editor", DocumentEditorGenerator);
|
|
18
|
+
manager.registerGenerator("powerhouse/subgraph", SubgraphGenerator);
|
|
19
|
+
manager.registerGenerator("powerhouse/processor", ProcessorGenerator);
|
|
20
|
+
return manager;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Create a DocumentCodegenManager with only specific generators
|
|
24
|
+
*/
|
|
25
|
+
static createManagerWithGenerators(config, generators) {
|
|
26
|
+
const manager = new DocumentCodegenManager(config);
|
|
27
|
+
for (const generatorClass of generators) {
|
|
28
|
+
const generator = new generatorClass(config);
|
|
29
|
+
const supportedTypes = generator.getSupportedDocumentTypes();
|
|
30
|
+
for (const documentType of supportedTypes) {
|
|
31
|
+
manager.registerGenerator(documentType, generatorClass);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return manager;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get all available generator classes
|
|
38
|
+
*/
|
|
39
|
+
static getAvailableGenerators() {
|
|
40
|
+
return {
|
|
41
|
+
DocumentModelGenerator,
|
|
42
|
+
PackageGenerator,
|
|
43
|
+
AppGenerator,
|
|
44
|
+
DocumentEditorGenerator,
|
|
45
|
+
SubgraphGenerator,
|
|
46
|
+
ProcessorGenerator,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=document-codegen-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-codegen-factory.js","sourceRoot":"","sources":["../../../../processors/codegen/document-handlers/document-codegen-factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAG/B;;;GAGG;AACH,MAAM,OAAO,sBAAsB;IACjC;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,MAAc;QACjC,MAAM,OAAO,GAAG,IAAI,sBAAsB,CAAC,MAAM,CAAC,CAAC;QAEnD,uCAAuC;QACvC,OAAO,CAAC,iBAAiB,CACvB,2BAA2B,EAC3B,sBAAsB,CACvB,CAAC;QACF,OAAO,CAAC,iBAAiB,CAAC,oBAAoB,EAAE,gBAAgB,CAAC,CAAC;QAClE,OAAO,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;QAC1D,OAAO,CAAC,iBAAiB,CACvB,4BAA4B,EAC5B,uBAAuB,CACxB,CAAC;QACF,OAAO,CAAC,iBAAiB,CAAC,qBAAqB,EAAE,iBAAiB,CAAC,CAAC;QACpE,OAAO,CAAC,iBAAiB,CAAC,sBAAsB,EAAE,kBAAkB,CAAC,CAAC;QAEtE,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,2BAA2B,CAChC,MAAc,EACd,UAA8C;QAE9C,MAAM,OAAO,GAAG,IAAI,sBAAsB,CAAC,MAAM,CAAC,CAAC;QAEnD,KAAK,MAAM,cAAc,IAAI,UAAU,EAAE,CAAC;YACxC,MAAM,SAAS,GAAG,IAAI,cAAc,CAAC,MAAM,CAAoB,CAAC;YAChE,MAAM,cAAc,GAAG,SAAS,CAAC,yBAAyB,EAAE,CAAC;YAE7D,KAAK,MAAM,YAAY,IAAI,cAAc,EAAE,CAAC;gBAC1C,OAAO,CAAC,iBAAiB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;YAC1D,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,sBAAsB;QAC3B,OAAO;YACL,sBAAsB;YACtB,gBAAgB;YAChB,YAAY;YACZ,uBAAuB;YACvB,iBAAiB;YACjB,kBAAkB;SACnB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type InternalTransmitterUpdate } from "document-drive/server/listener/transmitter/internal";
|
|
2
|
+
import { type DocumentModelDocument } from "document-model";
|
|
3
|
+
import { type BaseDocumentGen } from "./base-document-gen.js";
|
|
4
|
+
import { type Config } from "./types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Manager class responsible for routing documents to the correct generator
|
|
7
|
+
* and managing generator registration and instantiation
|
|
8
|
+
*/
|
|
9
|
+
export declare class DocumentCodegenManager {
|
|
10
|
+
private config;
|
|
11
|
+
private generators;
|
|
12
|
+
private debounceTimers;
|
|
13
|
+
constructor(config: Config);
|
|
14
|
+
/**
|
|
15
|
+
* Register a generator class for a specific document type
|
|
16
|
+
*/
|
|
17
|
+
registerGenerator(documentType: string, generatorClass: new (config: Config) => BaseDocumentGen): void;
|
|
18
|
+
/**
|
|
19
|
+
* Register a generator class that supports multiple document types
|
|
20
|
+
*/
|
|
21
|
+
registerMultiTypeGenerator(generatorClass: new (config: Config) => BaseDocumentGen): void;
|
|
22
|
+
/**
|
|
23
|
+
* Get a generator instance for the given document type
|
|
24
|
+
*/
|
|
25
|
+
getGenerator(documentType: string): BaseDocumentGen | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Get all registered document types
|
|
28
|
+
*/
|
|
29
|
+
getRegisteredDocumentTypes(): string[];
|
|
30
|
+
/**
|
|
31
|
+
* Check if a document type is supported
|
|
32
|
+
*/
|
|
33
|
+
isDocumentTypeSupported(documentType: string): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Route a document to the appropriate generator and handle the generation
|
|
36
|
+
*/
|
|
37
|
+
routeAndGenerate(strand: InternalTransmitterUpdate<DocumentModelDocument>): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Clear all registered generators
|
|
40
|
+
*/
|
|
41
|
+
clearGenerators(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Get statistics about registered generators
|
|
44
|
+
*/
|
|
45
|
+
getStats(): {
|
|
46
|
+
totalGenerators: number;
|
|
47
|
+
supportedTypes: string[];
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=document-codegen-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-codegen-manager.d.ts","sourceRoot":"","sources":["../../../../processors/codegen/document-handlers/document-codegen-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,qDAAqD,CAAC;AACrG,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE5D,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC;;;GAGG;AACH,qBAAa,sBAAsB;IAIrB,OAAO,CAAC,MAAM;IAH1B,OAAO,CAAC,UAAU,CAAsC;IACxD,OAAO,CAAC,cAAc,CAAqC;gBAEvC,MAAM,EAAE,MAAM;IAElC;;OAEG;IACH,iBAAiB,CACf,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,KAAK,MAAM,EAAE,MAAM,KAAK,eAAe,GACtD,IAAI;IAWP;;OAEG;IACH,0BAA0B,CACxB,cAAc,EAAE,KAAK,MAAM,EAAE,MAAM,KAAK,eAAe,GACtD,IAAI;IAkBP;;OAEG;IACH,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAI/D;;OAEG;IACH,0BAA0B,IAAI,MAAM,EAAE;IAItC;;OAEG;IACH,uBAAuB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;IAItD;;OAEG;IACG,gBAAgB,CACpB,MAAM,EAAE,yBAAyB,CAAC,qBAAqB,CAAC,GACvD,OAAO,CAAC,IAAI,CAAC;IAkDhB;;OAEG;IACH,eAAe,IAAI,IAAI;IAKvB;;OAEG;IACH,QAAQ,IAAI;QAAE,eAAe,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,EAAE,CAAA;KAAE;CAMlE"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { logger } from "../logger.js";
|
|
2
|
+
/**
|
|
3
|
+
* Manager class responsible for routing documents to the correct generator
|
|
4
|
+
* and managing generator registration and instantiation
|
|
5
|
+
*/
|
|
6
|
+
export class DocumentCodegenManager {
|
|
7
|
+
config;
|
|
8
|
+
generators = new Map();
|
|
9
|
+
debounceTimers = new Map();
|
|
10
|
+
constructor(config) {
|
|
11
|
+
this.config = config;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Register a generator class for a specific document type
|
|
15
|
+
*/
|
|
16
|
+
registerGenerator(documentType, generatorClass) {
|
|
17
|
+
if (this.generators.has(documentType)) {
|
|
18
|
+
logger.warn(`⚠️ Generator for document type "${documentType}" is already registered. Overwriting.`);
|
|
19
|
+
}
|
|
20
|
+
this.generators.set(documentType, new generatorClass(this.config));
|
|
21
|
+
logger.info(`✅ Registered generator for document type: ${documentType}`);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Register a generator class that supports multiple document types
|
|
25
|
+
*/
|
|
26
|
+
registerMultiTypeGenerator(generatorClass) {
|
|
27
|
+
const generator = new generatorClass(this.config);
|
|
28
|
+
const supportedTypes = generator.getSupportedDocumentTypes();
|
|
29
|
+
for (const documentType of supportedTypes) {
|
|
30
|
+
if (this.generators.has(documentType)) {
|
|
31
|
+
logger.warn(`⚠️ Generator for document type "${documentType}" is already registered. Overwriting.`);
|
|
32
|
+
}
|
|
33
|
+
this.generators.set(documentType, generator);
|
|
34
|
+
}
|
|
35
|
+
logger.info(`✅ Registered multi-type generator for document types: ${supportedTypes.join(", ")}`);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Get a generator instance for the given document type
|
|
39
|
+
*/
|
|
40
|
+
getGenerator(documentType) {
|
|
41
|
+
return this.generators.get(documentType);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Get all registered document types
|
|
45
|
+
*/
|
|
46
|
+
getRegisteredDocumentTypes() {
|
|
47
|
+
return Array.from(this.generators.keys());
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Check if a document type is supported
|
|
51
|
+
*/
|
|
52
|
+
isDocumentTypeSupported(documentType) {
|
|
53
|
+
return this.generators.has(documentType);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Route a document to the appropriate generator and handle the generation
|
|
57
|
+
*/
|
|
58
|
+
async routeAndGenerate(strand) {
|
|
59
|
+
const documentType = strand.documentType;
|
|
60
|
+
if (!documentType) {
|
|
61
|
+
logger.error("❌ Document type is missing from strand state");
|
|
62
|
+
throw new Error("Document type is missing from strand state");
|
|
63
|
+
}
|
|
64
|
+
const generator = this.getGenerator(documentType);
|
|
65
|
+
if (!generator) {
|
|
66
|
+
logger.warn(`⚠️ No generator found for document type: ${documentType}`);
|
|
67
|
+
logger.info(`ℹ️ Supported document types: ${this.getRegisteredDocumentTypes().join(", ")}`);
|
|
68
|
+
throw new Error(`Unsupported document type: ${documentType}`);
|
|
69
|
+
}
|
|
70
|
+
// Clear any existing debounce timer for this document type
|
|
71
|
+
const existingTimer = this.debounceTimers.get(documentType);
|
|
72
|
+
if (existingTimer) {
|
|
73
|
+
clearTimeout(existingTimer);
|
|
74
|
+
}
|
|
75
|
+
// Set up new debounced generation
|
|
76
|
+
const debounceTimer = setTimeout(async () => {
|
|
77
|
+
try {
|
|
78
|
+
logger.info(`🔄 Routing document type "${documentType}" to generator (debounced)`);
|
|
79
|
+
await generator.generate(strand);
|
|
80
|
+
logger.info(`✅ Successfully generated code for document type: ${documentType}`);
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
logger.error(`❌ Error generating code for document type "${documentType}":`, error);
|
|
84
|
+
throw error;
|
|
85
|
+
}
|
|
86
|
+
finally {
|
|
87
|
+
// Clean up the timer reference
|
|
88
|
+
this.debounceTimers.delete(documentType);
|
|
89
|
+
}
|
|
90
|
+
}, 10000); // 10 second debounce
|
|
91
|
+
// Store the timer reference
|
|
92
|
+
this.debounceTimers.set(documentType, debounceTimer);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Clear all registered generators
|
|
96
|
+
*/
|
|
97
|
+
clearGenerators() {
|
|
98
|
+
this.generators.clear();
|
|
99
|
+
logger.info("🧹 Cleared all registered generators");
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Get statistics about registered generators
|
|
103
|
+
*/
|
|
104
|
+
getStats() {
|
|
105
|
+
return {
|
|
106
|
+
totalGenerators: this.generators.size,
|
|
107
|
+
supportedTypes: this.getRegisteredDocumentTypes(),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=document-codegen-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-codegen-manager.js","sourceRoot":"","sources":["../../../../processors/codegen/document-handlers/document-codegen-manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAItC;;;GAGG;AACH,MAAM,OAAO,sBAAsB;IAIb;IAHZ,UAAU,GAAG,IAAI,GAAG,EAA2B,CAAC;IAChD,cAAc,GAAG,IAAI,GAAG,EAA0B,CAAC;IAE3D,YAAoB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAEtC;;OAEG;IACH,iBAAiB,CACf,YAAoB,EACpB,cAAuD;QAEvD,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;YACtC,MAAM,CAAC,IAAI,CACT,mCAAmC,YAAY,uCAAuC,CACvF,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QACnE,MAAM,CAAC,IAAI,CAAC,6CAA6C,YAAY,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED;;OAEG;IACH,0BAA0B,CACxB,cAAuD;QAEvD,MAAM,SAAS,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClD,MAAM,cAAc,GAAG,SAAS,CAAC,yBAAyB,EAAE,CAAC;QAE7D,KAAK,MAAM,YAAY,IAAI,cAAc,EAAE,CAAC;YAC1C,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,C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