@powerhousedao/vetra 6.0.0-dev.8 → 6.0.0-dev.81
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 +4 -2
- 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 +4 -2
- 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 +6 -2
- 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 +4 -2
- 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 +4 -2
- 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 +66 -42
- package/dist/processors/codegen/document-handlers/generators/app-generator.d.ts +4 -0
- package/dist/processors/codegen/document-handlers/generators/app-generator.d.ts.map +1 -1
- package/dist/processors/codegen/document-handlers/generators/app-generator.js +31 -11
- package/dist/processors/codegen/document-handlers/generators/constants.d.ts +1 -1
- package/dist/processors/codegen/document-handlers/generators/constants.d.ts.map +1 -1
- package/dist/processors/codegen/document-handlers/generators/constants.js +2 -1
- package/dist/processors/codegen/document-handlers/generators/document-editor-generator.d.ts +4 -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 +30 -10
- 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 +4 -0
- package/dist/processors/codegen/document-handlers/generators/processor-generator.d.ts.map +1 -1
- package/dist/processors/codegen/document-handlers/generators/processor-generator.js +59 -10
- package/dist/processors/codegen/document-handlers/generators/subgraph-generator.d.ts +4 -0
- package/dist/processors/codegen/document-handlers/generators/subgraph-generator.d.ts.map +1 -1
- package/dist/processors/codegen/document-handlers/generators/subgraph-generator.js +27 -7
- 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/codegen/logger.d.ts.map +1 -1
- package/dist/processors/codegen/logger.js +18 -7
- 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 +13680 -81
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/vite.config.d.ts.map +1 -1
- package/dist/vite.config.js +1 -13
- package/dist/vitest.config.d.ts.map +1 -1
- package/dist/vitest.config.js +1 -0
- package/package.json +48 -63
- package/dist/subgraphs/app-module/index.d.ts +0 -11
- package/dist/subgraphs/app-module/index.d.ts.map +0 -1
- package/dist/subgraphs/app-module/index.js +0 -11
- package/dist/subgraphs/app-module/resolvers.d.ts +0 -3
- package/dist/subgraphs/app-module/resolvers.d.ts.map +0 -1
- package/dist/subgraphs/app-module/resolvers.js +0 -144
- package/dist/subgraphs/app-module/schema.d.ts +0 -3
- package/dist/subgraphs/app-module/schema.d.ts.map +0 -1
- package/dist/subgraphs/app-module/schema.js +0 -78
- package/dist/subgraphs/document-editor/index.d.ts +0 -11
- package/dist/subgraphs/document-editor/index.d.ts.map +0 -1
- package/dist/subgraphs/document-editor/index.js +0 -11
- package/dist/subgraphs/document-editor/resolvers.d.ts +0 -3
- package/dist/subgraphs/document-editor/resolvers.d.ts.map +0 -1
- package/dist/subgraphs/document-editor/resolvers.js +0 -120
- package/dist/subgraphs/document-editor/schema.d.ts +0 -3
- package/dist/subgraphs/document-editor/schema.d.ts.map +0 -1
- package/dist/subgraphs/document-editor/schema.js +0 -59
- package/dist/subgraphs/index.d.ts +0 -7
- package/dist/subgraphs/index.d.ts.map +0 -1
- package/dist/subgraphs/index.js +0 -6
- package/dist/subgraphs/processor-module/index.d.ts +0 -10
- package/dist/subgraphs/processor-module/index.d.ts.map +0 -1
- package/dist/subgraphs/processor-module/index.js +0 -11
- package/dist/subgraphs/processor-module/resolvers.d.ts +0 -3
- package/dist/subgraphs/processor-module/resolvers.d.ts.map +0 -1
- package/dist/subgraphs/processor-module/resolvers.js +0 -132
- package/dist/subgraphs/processor-module/schema.d.ts +0 -3
- package/dist/subgraphs/processor-module/schema.d.ts.map +0 -1
- package/dist/subgraphs/processor-module/schema.js +0 -67
- package/dist/subgraphs/subgraph-module/index.d.ts +0 -10
- package/dist/subgraphs/subgraph-module/index.d.ts.map +0 -1
- package/dist/subgraphs/subgraph-module/index.js +0 -11
- package/dist/subgraphs/subgraph-module/resolvers.d.ts +0 -3
- package/dist/subgraphs/subgraph-module/resolvers.d.ts.map +0 -1
- package/dist/subgraphs/subgraph-module/resolvers.js +0 -96
- package/dist/subgraphs/subgraph-module/schema.d.ts +0 -3
- package/dist/subgraphs/subgraph-module/schema.d.ts.map +0 -1
- package/dist/subgraphs/subgraph-module/schema.js +0 -42
- package/dist/subgraphs/vetra-package/index.d.ts +0 -10
- package/dist/subgraphs/vetra-package/index.d.ts.map +0 -1
- package/dist/subgraphs/vetra-package/index.js +0 -11
- package/dist/subgraphs/vetra-package/resolvers.d.ts +0 -3
- package/dist/subgraphs/vetra-package/resolvers.d.ts.map +0 -1
- package/dist/subgraphs/vetra-package/resolvers.js +0 -192
- package/dist/subgraphs/vetra-package/schema.d.ts +0 -3
- package/dist/subgraphs/vetra-package/schema.d.ts.map +0 -1
- package/dist/subgraphs/vetra-package/schema.js +0 -108
- package/dist/subgraphs/vetra-read-model/index.d.ts +0 -8
- package/dist/subgraphs/vetra-read-model/index.d.ts.map +0 -1
- package/dist/subgraphs/vetra-read-model/index.js +0 -8
- package/dist/subgraphs/vetra-read-model/resolvers.d.ts +0 -3
- package/dist/subgraphs/vetra-read-model/resolvers.d.ts.map +0 -1
- package/dist/subgraphs/vetra-read-model/resolvers.js +0 -36
- package/dist/subgraphs/vetra-read-model/schema.d.ts +0 -3
- package/dist/subgraphs/vetra-read-model/schema.d.ts.map +0 -1
- package/dist/subgraphs/vetra-read-model/schema.js +0 -25
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
export declare const actions: {
|
|
3
3
|
setSubgraphName: (input: import("./index.js").SetSubgraphNameInput) => import("./index.js").SetSubgraphNameAction;
|
|
4
4
|
setSubgraphStatus: (input: import("./index.js").SetSubgraphStatusInput) => import("./index.js").SetSubgraphStatusAction;
|
|
5
|
-
setName: (name: string
|
|
6
|
-
|
|
5
|
+
setName: (name: string | {
|
|
6
|
+
name: string;
|
|
7
|
+
}) => import("document-model").SetNameAction;
|
|
8
|
+
undo: (count?: number, scope?: string) => import("document-model").UndoAction;
|
|
7
9
|
redo: (count?: number, scope?: string) => import("document-model").RedoAction;
|
|
8
10
|
prune: (start?: number, end?: number, scope?: string) => import("document-model").SchemaPruneAction;
|
|
9
11
|
loadState: <TState extends import("document-model").PHBaseState = import("document-model").PHBaseState>(state: TState & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../document-models/subgraph-module/actions.ts"],"names":[],"mappings":"AAGA,oDAAoD;AAEpD,eAAO,MAAM,OAAO;sBACwG,gDAA2B;wBAA4L,kDAA6B
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../document-models/subgraph-module/actions.ts"],"names":[],"mappings":"AAGA,oDAAoD;AAEpD,eAAO,MAAM,OAAO;sBACwG,gDAA2B;wBAA4L,kDAA6B;;;;gBAAmmN,CAAC,eAAe,CAAC;gBAAkE,CAAC,eAAe,CAAC;iBAAmE,CAAC,aAAa,CAAC,eAAe,CAAC;;;;gBAAqS,CAAC;CAD53O,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../document-models/subgraph-module/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAOvE,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,sDAAsD,CAAC;AAM9D,sDAAsD;AACtD,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAEnC,CAAC,sBAAsB,EAAE,gBAAgB,CAAC,oBAAoB,CAAC,CAAC,GAChE,CAAC,SAAS,EAAE,SAAS,CAAC,CAIzB;AAED,uDAAuD;AACvD,wBAAgB,iCAAiC,IAAI;IACnD,sBAAsB;IACtB,gBAAgB,CAAC,oBAAoB,CAAC;CACvC,
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../document-models/subgraph-module/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAOvE,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,sDAAsD,CAAC;AAM9D,sDAAsD;AACtD,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAEnC,CAAC,sBAAsB,EAAE,gBAAgB,CAAC,oBAAoB,CAAC,CAAC,GAChE,CAAC,SAAS,EAAE,SAAS,CAAC,CAIzB;AAED,uDAAuD;AACvD,wBAAgB,iCAAiC,IAAI;IACnD,sBAAsB;IACtB,gBAAgB,CAAC,oBAAoB,CAAC;CACvC,CAKA;AAED,qEAAqE;AACrE,wBAAgB,yCAAyC,yCAGxD;AAED,sEAAsE;AACtE,wBAAgB,0CAA0C,yCAGzD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../document-models/subgraph-module/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAG1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sDAAsD,CAAC;AAQlG,4DAA4D;AAC5D,eAAO,MAAM,cAAc,EAAE,mBAAmB,CAAC,qBAAqB,
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../document-models/subgraph-module/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAG1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sDAAsD,CAAC;AAQlG,4DAA4D;AAC5D,eAAO,MAAM,cAAc,EAAE,mBAAmB,CAAC,qBAAqB,CAMrE,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { defaultBaseState } from "document-model/core";
|
|
|
3
3
|
import { actions, documentModel, reducer, utils, } from "@powerhousedao/vetra/document-models/subgraph-module";
|
|
4
4
|
/** Document model module for the Todo List document type */
|
|
5
5
|
export const SubgraphModule = {
|
|
6
|
+
version: 1,
|
|
6
7
|
reducer,
|
|
7
8
|
actions,
|
|
8
9
|
utils,
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* This is a scaffold file meant for customization:
|
|
3
3
|
* - change it by adding new tests or modifying the existing ones
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { generateMock } from "@powerhousedao/common/utils";
|
|
6
|
+
import { isSubgraphModuleDocument, reducer, setSubgraphName, SetSubgraphNameInputSchema, setSubgraphStatus, SetSubgraphStatusInputSchema, utils, } from "@powerhousedao/vetra/document-models/subgraph-module";
|
|
6
7
|
import { beforeEach, describe, expect, it } from "vitest";
|
|
7
|
-
import { generateMock } from "@powerhousedao/codegen";
|
|
8
8
|
describe("BaseOperations Operations", () => {
|
|
9
9
|
let document;
|
|
10
10
|
beforeEach(() => {
|
|
@@ -10,8 +10,10 @@ export declare const actions: {
|
|
|
10
10
|
removePackageKeyword: (input: import("./index.js").RemovePackageKeywordInput) => import("./index.js").RemovePackageKeywordAction;
|
|
11
11
|
setPackageGithubUrl: (input: import("./index.js").SetPackageGithubUrlInput) => import("./index.js").SetPackageGithubUrlAction;
|
|
12
12
|
setPackageNpmUrl: (input: import("./index.js").SetPackageNpmUrlInput) => import("./index.js").SetPackageNpmUrlAction;
|
|
13
|
-
setName: (name: string
|
|
14
|
-
|
|
13
|
+
setName: (name: string | {
|
|
14
|
+
name: string;
|
|
15
|
+
}) => import("document-model").SetNameAction;
|
|
16
|
+
undo: (count?: number, scope?: string) => import("document-model").UndoAction;
|
|
15
17
|
redo: (count?: number, scope?: string) => import("document-model").RedoAction;
|
|
16
18
|
prune: (start?: number, end?: number, scope?: string) => import("document-model").SchemaPruneAction;
|
|
17
19
|
loadState: <TState extends import("document-model").PHBaseState = import("document-model").PHBaseState>(state: TState & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../document-models/vetra-package/actions.ts"],"names":[],"mappings":"AAGA,kDAAkD;AAElD,eAAO,MAAM,OAAO;qBACs0B,+CAA0B;4BAA6L,sDAAiC;yBAA+M,mDAA8B;uBAAoM,iDAA4B;2BAAkM,qDAAgC;8BAAkN,wDAAmC;wBAAqN,kDAA6B;2BAAqM,qDAAgC;0BAA6M,oDAA+B;uBAAwM,iDAA4B
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../document-models/vetra-package/actions.ts"],"names":[],"mappings":"AAGA,kDAAkD;AAElD,eAAO,MAAM,OAAO;qBACs0B,+CAA0B;4BAA6L,sDAAiC;yBAA+M,mDAA8B;uBAAoM,iDAA4B;2BAAkM,qDAAgC;8BAAkN,wDAAmC;wBAAqN,kDAA6B;2BAAqM,qDAAgC;0BAA6M,oDAA+B;uBAAwM,iDAA4B;;;;gBAAwjI,CAAC,eAAe,CAAC;gBAAkE,CAAC,eAAe,CAAC;iBAAmE,CAAC,aAAa,CAAC,eAAe,CAAC;;;;gBAAqS,CAAC;CAD93O,CAAC"}
|
|
@@ -13,7 +13,7 @@ export function AuthorSchema() {
|
|
|
13
13
|
return z.object({
|
|
14
14
|
__typename: z.literal("Author").optional(),
|
|
15
15
|
name: z.string().nullish(),
|
|
16
|
-
website: z.
|
|
16
|
+
website: z.url().nullish(),
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
export function KeywordSchema() {
|
|
@@ -31,7 +31,7 @@ export function RemovePackageKeywordInputSchema() {
|
|
|
31
31
|
export function SetPackageAuthorInputSchema() {
|
|
32
32
|
return z.object({
|
|
33
33
|
name: z.string().nullish(),
|
|
34
|
-
website: z.
|
|
34
|
+
website: z.url().nullish(),
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
export function SetPackageAuthorNameInputSchema() {
|
|
@@ -41,7 +41,7 @@ export function SetPackageAuthorNameInputSchema() {
|
|
|
41
41
|
}
|
|
42
42
|
export function SetPackageAuthorWebsiteInputSchema() {
|
|
43
43
|
return z.object({
|
|
44
|
-
website: z.
|
|
44
|
+
website: z.url(),
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
export function SetPackageCategoryInputSchema() {
|
|
@@ -56,7 +56,7 @@ export function SetPackageDescriptionInputSchema() {
|
|
|
56
56
|
}
|
|
57
57
|
export function SetPackageGithubUrlInputSchema() {
|
|
58
58
|
return z.object({
|
|
59
|
-
url: z.
|
|
59
|
+
url: z.url(),
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
export function SetPackageNameInputSchema() {
|
|
@@ -66,7 +66,7 @@ export function SetPackageNameInputSchema() {
|
|
|
66
66
|
}
|
|
67
67
|
export function SetPackageNpmUrlInputSchema() {
|
|
68
68
|
return z.object({
|
|
69
|
-
url: z.
|
|
69
|
+
url: z.url(),
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
export function VetraPackageStateSchema() {
|
|
@@ -75,9 +75,9 @@ export function VetraPackageStateSchema() {
|
|
|
75
75
|
author: z.lazy(() => AuthorSchema()),
|
|
76
76
|
category: z.string().nullish(),
|
|
77
77
|
description: z.string().nullish(),
|
|
78
|
-
githubUrl: z.
|
|
78
|
+
githubUrl: z.url().nullish(),
|
|
79
79
|
keywords: z.array(z.lazy(() => KeywordSchema())),
|
|
80
80
|
name: z.string().nullish(),
|
|
81
|
-
npmUrl: z.
|
|
81
|
+
npmUrl: z.url().nullish(),
|
|
82
82
|
});
|
|
83
83
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../document-models/vetra-package/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAOvE,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,oDAAoD,CAAC;AAM5D,oDAAoD;AACpD,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAEnC,CAAC,oBAAoB,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC,GAC5D,CAAC,SAAS,EAAE,SAAS,CAAC,CAIzB;AAED,qDAAqD;AACrD,wBAAgB,+BAA+B,IAAI;IACjD,oBAAoB;IACpB,gBAAgB,CAAC,kBAAkB,CAAC;CACrC,
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../document-models/vetra-package/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAOvE,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,oDAAoD,CAAC;AAM5D,oDAAoD;AACpD,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAEnC,CAAC,oBAAoB,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC,GAC5D,CAAC,SAAS,EAAE,SAAS,CAAC,CAIzB;AAED,qDAAqD;AACrD,wBAAgB,+BAA+B,IAAI;IACjD,oBAAoB;IACpB,gBAAgB,CAAC,kBAAkB,CAAC;CACrC,CAKA;AAED,mEAAmE;AACnE,wBAAgB,uCAAuC,uCAGtD;AAED,oEAAoE;AACpE,wBAAgB,wCAAwC,uCAGvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../document-models/vetra-package/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAG1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AAQ9F,4DAA4D;AAC5D,eAAO,MAAM,YAAY,EAAE,mBAAmB,CAAC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../document-models/vetra-package/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAG1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AAQ9F,4DAA4D;AAC5D,eAAO,MAAM,YAAY,EAAE,mBAAmB,CAAC,mBAAmB,CAMjE,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { defaultBaseState } from "document-model/core";
|
|
|
3
3
|
import { actions, documentModel, reducer, utils, } from "@powerhousedao/vetra/document-models/vetra-package";
|
|
4
4
|
/** Document model module for the Todo List document type */
|
|
5
5
|
export const VetraPackage = {
|
|
6
|
+
version: 1,
|
|
6
7
|
reducer,
|
|
7
8
|
actions,
|
|
8
9
|
utils,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* This is a scaffold file meant for customization:
|
|
3
3
|
* - change it by adding new tests or modifying the existing ones
|
|
4
4
|
*/
|
|
5
|
-
import { generateMock } from "@powerhousedao/
|
|
5
|
+
import { generateMock } from "@powerhousedao/common/utils";
|
|
6
6
|
import { addPackageKeyword, AddPackageKeywordInputSchema, isVetraPackageDocument, reducer, removePackageKeyword, RemovePackageKeywordInputSchema, setPackageAuthor, SetPackageAuthorInputSchema, setPackageAuthorName, SetPackageAuthorNameInputSchema, setPackageAuthorWebsite, SetPackageAuthorWebsiteInputSchema, setPackageCategory, SetPackageCategoryInputSchema, setPackageDescription, SetPackageDescriptionInputSchema, setPackageGithubUrl, SetPackageGithubUrlInputSchema, setPackageName, SetPackageNameInputSchema, setPackageNpmUrl, SetPackageNpmUrlInputSchema, utils, } from "@powerhousedao/vetra/document-models/vetra-package";
|
|
7
7
|
import { beforeEach, describe, expect, it } from "vitest";
|
|
8
8
|
describe("BaseOperations Operations", () => {
|
|
@@ -97,7 +97,7 @@ export const AppEditorForm = () => {
|
|
|
97
97
|
handleAddDocumentType(selectedValue);
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
|
-
return (_jsxs("div", { className: "space-y-6
|
|
100
|
+
return (_jsxs("div", { className: "space-y-6 p-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("h2", { className: "text-lg font-medium text-gray-900", children: "App Configuration" }), _jsx(StatusPill, { status: status === "CONFIRMED" ? "confirmed" : "draft", label: status === "CONFIRMED" ? "Confirmed" : "Draft" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "app-name", className: "mb-2 block text-sm font-medium text-gray-700", children: "App Name" }), _jsx("input", { id: "app-name", type: "text", value: appName, onChange: (e) => setAppName(e.target.value), disabled: isReadOnly, className: `w-full rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500 ${isReadOnly ? "cursor-not-allowed bg-gray-100" : ""}`, placeholder: "Enter app name" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "document-types", className: "mb-2 block text-sm font-medium text-gray-700", children: "Document Types" }), _jsxs("div", { className: "space-y-2", children: [!isReadOnly && (_jsxs("select", { onChange: (e) => handleDocumentTypeSelection(e.target.value), className: "w-full rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500", children: [_jsx("option", { children: "Select a document type to add" }), _jsx("option", { children: "--- Vetra drive document types ---" }), _jsx("option", { value: ALL_IN_DRIVE, children: "Add all document types in Vetra drive" }), documentTypesInSelectedDrive
|
|
101
101
|
?.filter((dt) => !selectedDocumentTypes.includes(dt))
|
|
102
102
|
.map((docType) => (_jsx("option", { value: docType, children: docType }, docType))), _jsx("option", { children: "--- Reactor document types ---" }), _jsx("option", { value: ALL_IN_REACTOR, children: "Add all document types in Reactor" }), supportedDocumentTypesInReactor
|
|
103
103
|
?.filter((dt) => !selectedDocumentTypes.includes(dt))
|
|
@@ -5,5 +5,5 @@ import { AppEditorForm } from "./components/AppEditorForm.js";
|
|
|
5
5
|
import { editorConfig } from "./config.js";
|
|
6
6
|
export default function Editor() {
|
|
7
7
|
useSetPHDocumentEditorConfig(editorConfig);
|
|
8
|
-
return (_jsxs("div", { children: [_jsx(DocumentToolbar, {}), _jsx(AppEditorForm, {})] }));
|
|
8
|
+
return (_jsxs("div", { className: "bg-gray-50 p-6", children: [_jsx(DocumentToolbar, {}), _jsx(AppEditorForm, {})] }));
|
|
9
9
|
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { render, screen, waitFor } from "@testing-library/react";
|
|
3
3
|
import { userEvent } from "@testing-library/user-event";
|
|
4
|
-
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
4
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
5
5
|
import { useSelectedAppModuleDocument } from "../../document-models/app-module/hooks.js";
|
|
6
6
|
import Editor from "./editor.js";
|
|
7
7
|
vi.mock("../../document-models/app-module/hooks.js", () => ({
|
|
8
8
|
useSelectedAppModuleDocument: vi.fn(),
|
|
9
9
|
}));
|
|
10
|
+
vi.mock("@powerhousedao/design-system/connect", () => ({
|
|
11
|
+
DocumentToolbar: () => null,
|
|
12
|
+
}));
|
|
10
13
|
vi.mock("@powerhousedao/reactor-browser", async (importOriginal) => {
|
|
11
14
|
const actual = await importOriginal();
|
|
12
15
|
return {
|
|
@@ -34,6 +37,7 @@ vi.mock("@powerhousedao/reactor-browser", async (importOriginal) => {
|
|
|
34
37
|
describe("AppModule Editor", () => {
|
|
35
38
|
let mockDispatch;
|
|
36
39
|
beforeEach(() => {
|
|
40
|
+
window.ph = {};
|
|
37
41
|
mockDispatch = vi.fn();
|
|
38
42
|
vi.mocked(useSelectedAppModuleDocument).mockReturnValue([
|
|
39
43
|
{
|
|
@@ -49,6 +53,9 @@ describe("AppModule Editor", () => {
|
|
|
49
53
|
mockDispatch,
|
|
50
54
|
]);
|
|
51
55
|
});
|
|
56
|
+
afterEach(() => {
|
|
57
|
+
delete window.ph;
|
|
58
|
+
});
|
|
52
59
|
describe("Core Rendering", () => {
|
|
53
60
|
it("should render all main form sections and labels", () => {
|
|
54
61
|
render(_jsx(Editor, {}));
|
|
@@ -59,7 +59,7 @@ export const DocumentEditorForm = ({ editorName: initialEditorName = "", documen
|
|
|
59
59
|
onConfirm?.();
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
|
-
return (_jsxs("div", { className: "space-y-6
|
|
62
|
+
return (_jsxs("div", { className: "space-y-6 p-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("h2", { className: "text-lg font-medium text-gray-900", children: "Editor Configuration" }), _jsx(StatusPill, { status: status === "CONFIRMED" ? "confirmed" : "draft", label: status === "CONFIRMED" ? "Confirmed" : "Draft" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "editor-name", className: "mb-2 block text-sm font-medium text-gray-700", children: "Editor Name" }), _jsx("input", { id: "editor-name", type: "text", value: editorName, onChange: (e) => setEditorName(e.target.value), disabled: isReadOnly, className: `w-full rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500 ${isReadOnly ? "cursor-not-allowed bg-gray-100" : ""}` })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "supported-document-types", className: "mb-2 block text-sm font-medium text-gray-700", children: "Supported Document Types" }), _jsxs("div", { className: "space-y-2", children: [!isReadOnly && (_jsx(Suspense, { fallback: _jsx(DocumentTypeSelectUI, {}), children: _jsx(DocumentTypeSelect, { documentTypes: documentTypes, setDocumentTypes: setDocumentTypes, onAddDocumentType: onAddDocumentType, onRemoveDocumentType: onRemoveDocumentType }) })), _jsx("div", { className: "space-y-1", children: documentTypes.map((type) => (_jsxs("div", { className: "flex items-center py-1", children: [_jsx("span", { className: "text-sm text-gray-700", children: type.documentType }), !isReadOnly && (_jsx("button", { onClick: () => {
|
|
63
63
|
setDocumentTypes([]);
|
|
64
64
|
onRemoveDocumentType?.({ id: type.id });
|
|
65
65
|
}, className: "ml-2 text-gray-400 hover:text-gray-600 focus:outline-none", children: "\u00D7" }))] }, type.id))) })] })] }), !isReadOnly && (_jsx("div", { children: _jsx("button", { onClick: handleConfirm, disabled: !editorName.trim() || documentTypes.length === 0, className: "rounded-md bg-blue-600 px-4 py-2 text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:bg-gray-300", children: "Confirm" }) }))] }));
|
|
@@ -25,5 +25,5 @@ export default function Editor() {
|
|
|
25
25
|
const onConfirm = useCallback(() => {
|
|
26
26
|
dispatch(actions.setEditorStatus({ status: "CONFIRMED" }));
|
|
27
27
|
}, [dispatch]);
|
|
28
|
-
return (_jsxs("div", { children: [_jsx(DocumentToolbar, {}), _jsx(DocumentEditorForm, { status: document.state.global.status, editorName: document.state.global.name ?? "", documentTypes: document.state.global.documentTypes, onEditorNameChange: onEditorNameChange, onAddDocumentType: onAddDocumentType, onRemoveDocumentType: onRemoveDocumentType, onConfirm: onConfirm })] }));
|
|
28
|
+
return (_jsxs("div", { className: "bg-gray-50 p-6", children: [_jsx(DocumentToolbar, {}), _jsx(DocumentEditorForm, { status: document.state.global.status, editorName: document.state.global.name ?? "", documentTypes: document.state.global.documentTypes, onEditorNameChange: onEditorNameChange, onAddDocumentType: onAddDocumentType, onRemoveDocumentType: onRemoveDocumentType, onConfirm: onConfirm })] }));
|
|
29
29
|
}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
import { type ProcessorApp, type ProcessorApps } from "@powerhousedao/shared/processors";
|
|
1
2
|
import type { DocumentTypeItem } from "../../../document-models/processor-module/index.js";
|
|
2
3
|
export interface ProcessorEditorFormProps {
|
|
3
4
|
processorName?: string;
|
|
4
5
|
processorType?: string;
|
|
5
6
|
documentTypes?: DocumentTypeItem[];
|
|
7
|
+
processorApps?: ProcessorApps;
|
|
6
8
|
status?: string;
|
|
7
9
|
onNameChange?: (name: string) => void;
|
|
8
10
|
onTypeChange?: (type: string) => void;
|
|
9
11
|
onAddDocumentType?: (id: string, documentType: string) => void;
|
|
10
12
|
onRemoveDocumentType?: (id: string) => void;
|
|
13
|
+
onAddProcessorApp?: (processorApp: ProcessorApp) => void;
|
|
14
|
+
onRemoveProcessorApp?: (processorApp: ProcessorApp) => void;
|
|
11
15
|
onConfirm?: () => void;
|
|
12
16
|
}
|
|
13
17
|
export declare const ProcessorEditorForm: React.FC<ProcessorEditorFormProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProcessorEditorForm.d.ts","sourceRoot":"","sources":["../../../../editors/processor-editor/components/ProcessorEditorForm.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ProcessorEditorForm.d.ts","sourceRoot":"","sources":["../../../../editors/processor-editor/components/ProcessorEditorForm.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,aAAa,EACnB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oDAAoD,CAAC;AAI3F,MAAM,WAAW,wBAAwB;IACvC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACnC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,iBAAiB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/D,oBAAoB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,iBAAiB,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;IACzD,oBAAoB,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;IAC5D,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAsQlE,CAAC"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { PROCESSOR_APPS, } from "@powerhousedao/shared/processors";
|
|
2
3
|
import { useEffect, useState } from "react";
|
|
3
4
|
import { StatusPill } from "../../components/index.js";
|
|
4
5
|
import { useAvailableDocumentTypes, useDebounce } from "../../hooks/index.js";
|
|
5
|
-
export const ProcessorEditorForm = ({ processorName: initialProcessorName = "", processorType: initialProcessorType = "", documentTypes: initialDocumentTypes = [], status = "DRAFT", onNameChange, onTypeChange, onAddDocumentType, onRemoveDocumentType, onConfirm, }) => {
|
|
6
|
+
export const ProcessorEditorForm = ({ processorName: initialProcessorName = "", processorType: initialProcessorType = "", documentTypes: initialDocumentTypes = [], processorApps: initialProcessorApps = [], status = "DRAFT", onNameChange, onTypeChange, onAddDocumentType, onRemoveDocumentType, onAddProcessorApp, onRemoveProcessorApp, onConfirm, }) => {
|
|
6
7
|
const [processorName, setProcessorName] = useState(initialProcessorName);
|
|
7
8
|
const [processorType, setProcessorType] = useState(initialProcessorType);
|
|
8
9
|
const [documentTypes, setDocumentTypes] = useState(initialDocumentTypes);
|
|
9
10
|
const [selectedDocumentType, setSelectedDocumentType] = useState("");
|
|
11
|
+
const [processorApps, setProcessorApps] = useState(initialProcessorApps);
|
|
10
12
|
const [isConfirmed, setIsConfirmed] = useState(false);
|
|
11
13
|
// Get available document types from the hook (combines reactor and vetra drive)
|
|
12
14
|
const availableDocumentTypes = useAvailableDocumentTypes();
|
|
@@ -23,6 +25,9 @@ export const ProcessorEditorForm = ({ processorName: initialProcessorName = "",
|
|
|
23
25
|
useEffect(() => {
|
|
24
26
|
setDocumentTypes(initialDocumentTypes);
|
|
25
27
|
}, [initialDocumentTypes]);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
setProcessorApps(initialProcessorApps);
|
|
30
|
+
}, [initialProcessorApps]);
|
|
26
31
|
// Reset confirmation state if status changes back to DRAFT
|
|
27
32
|
useEffect(() => {
|
|
28
33
|
if (status === "DRAFT") {
|
|
@@ -32,7 +37,10 @@ export const ProcessorEditorForm = ({ processorName: initialProcessorName = "",
|
|
|
32
37
|
// Check if form should be read-only
|
|
33
38
|
const isReadOnly = isConfirmed || status === "CONFIRMED";
|
|
34
39
|
const handleConfirm = () => {
|
|
35
|
-
if (processorName.trim() &&
|
|
40
|
+
if (processorName.trim() &&
|
|
41
|
+
processorType &&
|
|
42
|
+
documentTypes.length > 0 &&
|
|
43
|
+
processorApps.length > 0) {
|
|
36
44
|
setIsConfirmed(true); // Immediate UI update
|
|
37
45
|
onConfirm?.();
|
|
38
46
|
}
|
|
@@ -41,8 +49,11 @@ export const ProcessorEditorForm = ({ processorName: initialProcessorName = "",
|
|
|
41
49
|
setDocumentTypes(documentTypes.filter((dt) => dt.id !== id));
|
|
42
50
|
onRemoveDocumentType?.(id);
|
|
43
51
|
};
|
|
44
|
-
const canConfirm = processorName.trim() &&
|
|
45
|
-
|
|
52
|
+
const canConfirm = !!processorName.trim() &&
|
|
53
|
+
!!processorType &&
|
|
54
|
+
documentTypes.length > 0 &&
|
|
55
|
+
processorApps.length > 0;
|
|
56
|
+
return (_jsxs("div", { className: "space-y-6 p-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("h2", { className: "text-lg font-medium text-gray-900", children: "Processor Configuration" }), _jsx(StatusPill, { status: status === "CONFIRMED" ? "confirmed" : "draft", label: status === "CONFIRMED" ? "Confirmed" : "Draft" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "processor-name", className: "mb-2 block text-sm font-medium text-gray-700", children: "Processor Name" }), _jsx("input", { id: "processor-name", type: "text", value: processorName, onChange: (e) => setProcessorName(e.target.value), disabled: isReadOnly, className: `w-full rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500 ${isReadOnly ? "cursor-not-allowed bg-gray-100" : ""}`, placeholder: "Enter processor name" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "processor-type", className: "mb-2 block text-sm font-medium text-gray-700", children: "Type" }), _jsxs("select", { id: "processor-type", value: processorType, onChange: (e) => setProcessorType(e.target.value), disabled: isReadOnly, className: `w-full rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500 ${isReadOnly ? "cursor-not-allowed bg-gray-100" : ""}`, children: [_jsx("option", { value: "", children: "Select type..." }), _jsx("option", { value: "analytics", children: "Analytics" }), _jsx("option", { value: "relational", children: "Relational Database" })] })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "document-types", className: "mb-2 block text-sm font-medium text-gray-700", children: "Document Types" }), _jsxs("div", { className: "space-y-2", children: [!isReadOnly && availableDocumentTypes.length > 0 && (_jsxs("select", { id: "document-types", value: selectedDocumentType, onChange: (e) => {
|
|
46
57
|
const selectedValue = e.target.value;
|
|
47
58
|
if (selectedValue &&
|
|
48
59
|
!documentTypes.some((dt) => dt.documentType === selectedValue)) {
|
|
@@ -57,5 +68,20 @@ export const ProcessorEditorForm = ({ processorName: initialProcessorName = "",
|
|
|
57
68
|
setSelectedDocumentType("");
|
|
58
69
|
}, className: "w-full rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500", children: [_jsx("option", { value: "", children: "Select a document type to add" }), availableDocumentTypes
|
|
59
70
|
.filter((docType) => !documentTypes.some((dt) => dt.documentType === docType))
|
|
60
|
-
.map((docType) => (_jsx("option", { value: docType, children: docType }, docType)))] })), _jsx("div", { className: "space-y-1", children: documentTypes.map((type) => (_jsxs("div", { className: "flex items-center py-1", children: [_jsx("span", { className: "text-sm text-gray-700", children: type.documentType }), !isReadOnly && (_jsx("button", { onClick: () => handleRemoveDocumentType(type.id), className: "ml-2 text-gray-400 hover:text-gray-600 focus:outline-none", children: "\u00D7" }))] }, type.id))) })] })] }),
|
|
71
|
+
.map((docType) => (_jsx("option", { value: docType, children: docType }, docType)))] })), _jsx("div", { className: "space-y-1", children: documentTypes.map((type) => (_jsxs("div", { className: "flex items-center py-1", children: [_jsx("span", { className: "text-sm text-gray-700", children: type.documentType }), !isReadOnly && (_jsx("button", { onClick: () => handleRemoveDocumentType(type.id), className: "ml-2 text-gray-400 hover:text-gray-600 focus:outline-none", children: "\u00D7" }))] }, type.id))) })] })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "processor-apps", className: "mb-2 block text-sm font-medium text-gray-700", children: "Processor Apps" }), _jsxs("div", { className: "space-y-2", children: [!isReadOnly && (_jsx(_Fragment, { children: PROCESSOR_APPS.map((processorApp) => (_jsxs("div", { className: "flex gap-1", children: [_jsx("input", { type: "checkbox", name: processorApp, id: processorApp, checked: processorApps.includes(processorApp), onChange: (event) => {
|
|
72
|
+
const isChecked = event.target.checked;
|
|
73
|
+
if (isChecked) {
|
|
74
|
+
setProcessorApps((processorApps) => [
|
|
75
|
+
...new Set([...processorApps, processorApp]),
|
|
76
|
+
]);
|
|
77
|
+
onAddProcessorApp?.(processorApp);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
if (processorApps.length > 1) {
|
|
81
|
+
setProcessorApps((processorApps) => processorApps.filter((p) => p !== processorApp));
|
|
82
|
+
onRemoveProcessorApp?.(processorApp);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
} }), _jsx("label", { htmlFor: processorApp, children: processorApp })] }, processorApp))) })), _jsx("div", { className: "space-y-1", children: isReadOnly &&
|
|
86
|
+
processorApps.map((processorApp) => (_jsx("span", { className: "text-sm text-gray-700", children: processorApp }, processorApp))) })] })] }), !isReadOnly && (_jsx("div", { children: _jsx("button", { onClick: handleConfirm, disabled: !canConfirm, className: "rounded-md bg-blue-600 px-4 py-2 text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:bg-gray-300", children: "Confirm" }) }))] }));
|
|
61
87
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/processor-editor/editor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/processor-editor/editor.tsx"],"names":[],"mappings":"AAYA,MAAM,CAAC,OAAO,UAAU,MAAM,4CAwE7B"}
|
|
@@ -29,5 +29,11 @@ export default function Editor() {
|
|
|
29
29
|
const onRemoveDocumentType = useCallback((id) => {
|
|
30
30
|
dispatch(actions.removeDocumentType({ id }));
|
|
31
31
|
}, [dispatch]);
|
|
32
|
-
|
|
32
|
+
const onAddProcessorApp = useCallback((processorApp) => {
|
|
33
|
+
dispatch(actions.addProcessorApp({ processorApp }));
|
|
34
|
+
}, [dispatch]);
|
|
35
|
+
const onRemoveProcessorApp = useCallback((processorApp) => {
|
|
36
|
+
dispatch(actions.removeProcessorApp({ processorApp }));
|
|
37
|
+
}, [dispatch]);
|
|
38
|
+
return (_jsxs("div", { className: "bg-gray-50 p-6", children: [_jsx(DocumentToolbar, {}), _jsx(ProcessorEditorForm, { onNameChange: onNameChange, onTypeChange: onTypeChange, onAddDocumentType: onAddDocumentType, onRemoveDocumentType: onRemoveDocumentType, onAddProcessorApp: onAddProcessorApp, onRemoveProcessorApp: onRemoveProcessorApp, status: document.state.global.status, processorName: document.state.global.name ?? "", processorType: document.state.global.type ?? "", documentTypes: document.state.global.documentTypes ?? [], processorApps: document.state.global.processorApps, onConfirm: onConfirm })] }));
|
|
33
39
|
}
|