@powerhousedao/vetra 6.0.0-dev.4 → 6.0.0-dev.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/document-models/app-module/actions.d.ts +1 -1
- package/dist/document-models/app-module/actions.d.ts.map +1 -1
- package/dist/document-models/app-module/hooks.d.ts.map +1 -1
- package/dist/document-models/app-module/module.d.ts.map +1 -1
- package/dist/document-models/app-module/module.js +1 -0
- package/dist/document-models/app-module/src/tests/base-operations.test.js +2 -2
- package/dist/document-models/app-module/src/tests/dnd-operations.test.js +1 -1
- package/dist/document-models/document-editor/actions.d.ts +1 -1
- package/dist/document-models/document-editor/actions.d.ts.map +1 -1
- package/dist/document-models/document-editor/hooks.d.ts.map +1 -1
- package/dist/document-models/document-editor/module.d.ts.map +1 -1
- package/dist/document-models/document-editor/module.js +1 -0
- package/dist/document-models/document-editor/src/tests/base-operations.test.js +2 -2
- package/dist/document-models/processor-module/actions.d.ts +3 -1
- package/dist/document-models/processor-module/actions.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/base-operations/actions.d.ts +10 -2
- package/dist/document-models/processor-module/gen/base-operations/actions.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/base-operations/creators.d.ts +4 -2
- package/dist/document-models/processor-module/gen/base-operations/creators.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/base-operations/creators.js +3 -1
- package/dist/document-models/processor-module/gen/base-operations/operations.d.ts +3 -1
- package/dist/document-models/processor-module/gen/base-operations/operations.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/document-model.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/document-model.js +24 -2
- package/dist/document-models/processor-module/gen/document-schema.d.ts +3 -0
- package/dist/document-models/processor-module/gen/document-schema.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/ph-factories.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/ph-factories.js +1 -0
- package/dist/document-models/processor-module/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/reducer.js +11 -1
- package/dist/document-models/processor-module/gen/schema/types.d.ts +7 -0
- package/dist/document-models/processor-module/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/schema/zod.d.ts +3 -1
- package/dist/document-models/processor-module/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/schema/zod.js +11 -0
- package/dist/document-models/processor-module/gen/utils.d.ts.map +1 -1
- package/dist/document-models/processor-module/gen/utils.js +1 -0
- package/dist/document-models/processor-module/hooks.d.ts.map +1 -1
- package/dist/document-models/processor-module/module.d.ts.map +1 -1
- package/dist/document-models/processor-module/module.js +1 -0
- package/dist/document-models/processor-module/src/reducers/base-operations.d.ts.map +1 -1
- package/dist/document-models/processor-module/src/reducers/base-operations.js +14 -0
- package/dist/document-models/processor-module/src/tests/base-operations.test.js +26 -2
- package/dist/document-models/subgraph-module/actions.d.ts +1 -1
- package/dist/document-models/subgraph-module/actions.d.ts.map +1 -1
- package/dist/document-models/subgraph-module/hooks.d.ts.map +1 -1
- package/dist/document-models/subgraph-module/module.d.ts.map +1 -1
- package/dist/document-models/subgraph-module/module.js +1 -0
- package/dist/document-models/subgraph-module/src/tests/base-operations.test.js +2 -2
- package/dist/document-models/vetra-package/actions.d.ts +1 -1
- package/dist/document-models/vetra-package/actions.d.ts.map +1 -1
- package/dist/document-models/vetra-package/gen/schema/zod.js +7 -7
- package/dist/document-models/vetra-package/hooks.d.ts.map +1 -1
- package/dist/document-models/vetra-package/module.d.ts.map +1 -1
- package/dist/document-models/vetra-package/module.js +1 -0
- package/dist/document-models/vetra-package/src/tests/base-operations.test.js +1 -1
- package/dist/editors/app-editor/components/AppEditorForm.js +1 -1
- package/dist/editors/app-editor/editor.js +1 -1
- package/dist/editors/app-editor/editor.test.js +8 -1
- package/dist/editors/document-editor/components/DocumentEditorForm.js +1 -1
- package/dist/editors/document-editor/editor.js +1 -1
- package/dist/editors/processor-editor/components/ProcessorEditorForm.d.ts +4 -0
- package/dist/editors/processor-editor/components/ProcessorEditorForm.d.ts.map +1 -1
- package/dist/editors/processor-editor/components/ProcessorEditorForm.js +32 -6
- package/dist/editors/processor-editor/editor.d.ts.map +1 -1
- package/dist/editors/processor-editor/editor.js +7 -1
- package/dist/editors/processor-editor/editor.test.js +166 -173
- package/dist/editors/subgraph-editor/components/SubgraphEditorForm.js +1 -1
- package/dist/editors/subgraph-editor/editor.js +1 -1
- package/dist/editors/vetra-drive-app/DriveExplorer.js +1 -1
- package/dist/editors/vetra-drive-app/components/DriveHeader.js +1 -1
- package/dist/editors/vetra-drive-app/editor.js +1 -1
- package/dist/editors/vetra-package/components/MetaForm.js +1 -1
- package/dist/editors/vetra-package/editor.js +1 -1
- package/dist/processors/codegen/__tests__/codegen-processor-e2e.test.js +46 -22
- package/dist/processors/codegen/document-handlers/generators/app-generator.d.ts.map +1 -1
- package/dist/processors/codegen/document-handlers/generators/app-generator.js +12 -6
- package/dist/processors/codegen/document-handlers/generators/constants.d.ts +1 -0
- package/dist/processors/codegen/document-handlers/generators/constants.d.ts.map +1 -1
- package/dist/processors/codegen/document-handlers/generators/constants.js +2 -0
- package/dist/processors/codegen/document-handlers/generators/document-editor-generator.d.ts.map +1 -1
- package/dist/processors/codegen/document-handlers/generators/document-editor-generator.js +10 -4
- package/dist/processors/codegen/document-handlers/generators/document-model-generator.d.ts +4 -0
- package/dist/processors/codegen/document-handlers/generators/document-model-generator.d.ts.map +1 -1
- package/dist/processors/codegen/document-handlers/generators/document-model-generator.js +42 -20
- package/dist/processors/codegen/document-handlers/generators/package-generator.d.ts.map +1 -1
- package/dist/processors/codegen/document-handlers/generators/package-generator.js +8 -2
- package/dist/processors/codegen/document-handlers/generators/processor-generator.d.ts.map +1 -1
- package/dist/processors/codegen/document-handlers/generators/processor-generator.js +38 -3
- package/dist/processors/codegen/document-handlers/generators/subgraph-generator.d.ts.map +1 -1
- package/dist/processors/codegen/document-handlers/generators/subgraph-generator.js +8 -2
- package/dist/processors/codegen/document-handlers/generators/utils.d.ts +7 -0
- package/dist/processors/codegen/document-handlers/generators/utils.d.ts.map +1 -1
- package/dist/processors/codegen/document-handlers/generators/utils.js +18 -1
- package/dist/processors/codegen/factory.d.ts +1 -1
- package/dist/processors/codegen/factory.d.ts.map +1 -1
- package/dist/processors/codegen/factory.legacy.d.ts +4 -0
- package/dist/processors/codegen/factory.legacy.d.ts.map +1 -0
- package/dist/processors/codegen/factory.legacy.js +53 -0
- package/dist/processors/codegen/index.d.ts +2 -2
- package/dist/processors/codegen/index.d.ts.map +1 -1
- package/dist/processors/codegen/index.js +22 -21
- package/dist/processors/codegen/index.legacy.d.ts +11 -0
- package/dist/processors/codegen/index.legacy.d.ts.map +1 -0
- package/dist/processors/codegen/index.legacy.js +57 -0
- package/dist/processors/factory.d.ts +3 -4
- package/dist/processors/factory.d.ts.map +1 -1
- package/dist/processors/factory.js +5 -4
- package/dist/processors/factory.legacy.d.ts +7 -0
- package/dist/processors/factory.legacy.d.ts.map +1 -0
- package/dist/processors/factory.legacy.js +19 -0
- package/dist/processors/index.d.ts +8 -2
- package/dist/processors/index.d.ts.map +1 -1
- package/dist/processors/index.js +10 -2
- package/dist/processors/vetra-read-model/factory.d.ts +2 -2
- package/dist/processors/vetra-read-model/factory.d.ts.map +1 -1
- package/dist/processors/vetra-read-model/factory.js +13 -16
- package/dist/processors/vetra-read-model/factory.legacy.d.ts +5 -0
- package/dist/processors/vetra-read-model/factory.legacy.d.ts.map +1 -0
- package/dist/processors/vetra-read-model/factory.legacy.js +24 -0
- package/dist/processors/vetra-read-model/index.d.ts +6 -5
- package/dist/processors/vetra-read-model/index.d.ts.map +1 -1
- package/dist/processors/vetra-read-model/index.js +20 -37
- package/dist/processors/vetra-read-model/index.legacy.d.ts +9 -0
- package/dist/processors/vetra-read-model/index.legacy.d.ts.map +1 -0
- package/dist/processors/vetra-read-model/index.legacy.js +75 -0
- package/dist/processors/vetra-read-model/migrations.d.ts +3 -3
- package/dist/processors/vetra-read-model/migrations.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/subgraphs/__tests__/app-module-permissions.test.d.ts +2 -0
- package/dist/subgraphs/__tests__/app-module-permissions.test.d.ts.map +1 -0
- package/dist/subgraphs/__tests__/app-module-permissions.test.js +436 -0
- package/dist/subgraphs/__tests__/permission-utils.test.d.ts +2 -0
- package/dist/subgraphs/__tests__/permission-utils.test.d.ts.map +1 -0
- package/dist/subgraphs/__tests__/permission-utils.test.js +505 -0
- package/dist/subgraphs/__tests__/vetra-read-model-permissions.test.d.ts +2 -0
- package/dist/subgraphs/__tests__/vetra-read-model-permissions.test.d.ts.map +1 -0
- package/dist/subgraphs/__tests__/vetra-read-model-permissions.test.js +319 -0
- package/dist/subgraphs/app-module/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/app-module/resolvers.js +53 -9
- package/dist/subgraphs/document-editor/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/document-editor/resolvers.js +45 -7
- package/dist/subgraphs/permission-utils.d.ts +31 -0
- package/dist/subgraphs/permission-utils.d.ts.map +1 -0
- package/dist/subgraphs/permission-utils.js +101 -0
- package/dist/subgraphs/processor-module/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/processor-module/resolvers.js +49 -8
- package/dist/subgraphs/subgraph-module/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/subgraph-module/resolvers.js +37 -5
- package/dist/subgraphs/vetra-package/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/vetra-package/resolvers.js +69 -13
- package/dist/subgraphs/vetra-read-model/resolvers.d.ts +2 -2
- package/dist/subgraphs/vetra-read-model/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/vetra-read-model/resolvers.js +18 -5
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/vitest.config.d.ts.map +1 -1
- package/dist/vitest.config.js +1 -0
- package/package.json +33 -35
|
@@ -2,6 +2,7 @@ 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
4
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
5
|
+
import { utils } from "../../document-models/processor-module/utils.js";
|
|
5
6
|
import { useSelectedProcessorModuleDocument } from "../hooks/useVetraDocument.js";
|
|
6
7
|
import Editor from "./editor.js";
|
|
7
8
|
vi.mock("../hooks/useVetraDocument.js", () => ({
|
|
@@ -16,19 +17,11 @@ vi.mock("../hooks/useAvailableDocumentTypes.js", () => ({
|
|
|
16
17
|
}));
|
|
17
18
|
describe("ProcessorModule Editor", () => {
|
|
18
19
|
let mockDispatch;
|
|
20
|
+
const document = utils.createDocument();
|
|
19
21
|
beforeEach(() => {
|
|
20
22
|
mockDispatch = vi.fn();
|
|
21
23
|
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
22
|
-
|
|
23
|
-
state: {
|
|
24
|
-
global: {
|
|
25
|
-
name: "",
|
|
26
|
-
type: "",
|
|
27
|
-
status: "DRAFT",
|
|
28
|
-
documentTypes: [],
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
24
|
+
document,
|
|
32
25
|
mockDispatch,
|
|
33
26
|
]);
|
|
34
27
|
});
|
|
@@ -42,20 +35,20 @@ describe("ProcessorModule Editor", () => {
|
|
|
42
35
|
expect(screen.getByText("Confirm")).toBeInTheDocument();
|
|
43
36
|
});
|
|
44
37
|
it("should display existing processor data when document has values", () => {
|
|
45
|
-
|
|
46
|
-
{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
],
|
|
56
|
-
},
|
|
57
|
-
},
|
|
38
|
+
const document = utils.createDocument({
|
|
39
|
+
global: {
|
|
40
|
+
name: "test-processor",
|
|
41
|
+
type: "analytics",
|
|
42
|
+
status: "DRAFT",
|
|
43
|
+
documentTypes: [
|
|
44
|
+
{ id: "dt-1", documentType: "powerhouse/document-model" },
|
|
45
|
+
{ id: "dt-2", documentType: "powerhouse/budget-statement" },
|
|
46
|
+
],
|
|
47
|
+
processorApps: ["connect"],
|
|
58
48
|
},
|
|
49
|
+
});
|
|
50
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
51
|
+
document,
|
|
59
52
|
mockDispatch,
|
|
60
53
|
]);
|
|
61
54
|
render(_jsx(Editor, {}));
|
|
@@ -81,17 +74,17 @@ describe("ProcessorModule Editor", () => {
|
|
|
81
74
|
}, { timeout: 500 });
|
|
82
75
|
});
|
|
83
76
|
it("should dispatch when clearing a non-empty field", async () => {
|
|
84
|
-
|
|
85
|
-
{
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
documentTypes: [],
|
|
92
|
-
},
|
|
93
|
-
},
|
|
77
|
+
const document = utils.createDocument({
|
|
78
|
+
global: {
|
|
79
|
+
name: "existing-processor",
|
|
80
|
+
type: "",
|
|
81
|
+
status: "DRAFT",
|
|
82
|
+
documentTypes: [],
|
|
83
|
+
processorApps: [],
|
|
94
84
|
},
|
|
85
|
+
});
|
|
86
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
87
|
+
document,
|
|
95
88
|
mockDispatch,
|
|
96
89
|
]);
|
|
97
90
|
const user = userEvent.setup();
|
|
@@ -106,17 +99,17 @@ describe("ProcessorModule Editor", () => {
|
|
|
106
99
|
}, { timeout: 500 });
|
|
107
100
|
});
|
|
108
101
|
it("should NOT dispatch when typing identical value without clearing", async () => {
|
|
109
|
-
|
|
110
|
-
{
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
documentTypes: [],
|
|
117
|
-
},
|
|
118
|
-
},
|
|
102
|
+
const document = utils.createDocument({
|
|
103
|
+
global: {
|
|
104
|
+
name: "test",
|
|
105
|
+
type: "",
|
|
106
|
+
status: "DRAFT",
|
|
107
|
+
documentTypes: [],
|
|
108
|
+
processorApps: [],
|
|
119
109
|
},
|
|
110
|
+
});
|
|
111
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
112
|
+
document,
|
|
120
113
|
mockDispatch,
|
|
121
114
|
]);
|
|
122
115
|
const user = userEvent.setup();
|
|
@@ -153,17 +146,17 @@ describe("ProcessorModule Editor", () => {
|
|
|
153
146
|
}, { timeout: 500 });
|
|
154
147
|
});
|
|
155
148
|
it("should NOT dispatch when selecting same type", async () => {
|
|
156
|
-
|
|
157
|
-
{
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
documentTypes: [],
|
|
164
|
-
},
|
|
165
|
-
},
|
|
149
|
+
const document = utils.createDocument({
|
|
150
|
+
global: {
|
|
151
|
+
name: "test-processor",
|
|
152
|
+
type: "analytics",
|
|
153
|
+
status: "DRAFT",
|
|
154
|
+
documentTypes: [],
|
|
155
|
+
processorApps: [],
|
|
166
156
|
},
|
|
157
|
+
});
|
|
158
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
159
|
+
document,
|
|
167
160
|
mockDispatch,
|
|
168
161
|
]);
|
|
169
162
|
const user = userEvent.setup();
|
|
@@ -199,20 +192,20 @@ describe("ProcessorModule Editor", () => {
|
|
|
199
192
|
}));
|
|
200
193
|
});
|
|
201
194
|
it("should remove document type", async () => {
|
|
202
|
-
|
|
203
|
-
{
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
],
|
|
213
|
-
},
|
|
214
|
-
},
|
|
195
|
+
const document = utils.createDocument({
|
|
196
|
+
global: {
|
|
197
|
+
name: "test-processor",
|
|
198
|
+
type: "analytics",
|
|
199
|
+
status: "DRAFT",
|
|
200
|
+
documentTypes: [
|
|
201
|
+
{ id: "dt-1", documentType: "powerhouse/document-model" },
|
|
202
|
+
{ id: "dt-2", documentType: "powerhouse/budget-statement" },
|
|
203
|
+
],
|
|
204
|
+
processorApps: [],
|
|
215
205
|
},
|
|
206
|
+
});
|
|
207
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
208
|
+
document,
|
|
216
209
|
mockDispatch,
|
|
217
210
|
]);
|
|
218
211
|
const user = userEvent.setup();
|
|
@@ -228,19 +221,19 @@ describe("ProcessorModule Editor", () => {
|
|
|
228
221
|
}));
|
|
229
222
|
});
|
|
230
223
|
it("should NOT show duplicate document type in dropdown", () => {
|
|
231
|
-
|
|
232
|
-
{
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
],
|
|
241
|
-
},
|
|
242
|
-
},
|
|
224
|
+
const document = utils.createDocument({
|
|
225
|
+
global: {
|
|
226
|
+
name: "test-processor",
|
|
227
|
+
type: "analytics",
|
|
228
|
+
status: "DRAFT",
|
|
229
|
+
documentTypes: [
|
|
230
|
+
{ id: "dt-1", documentType: "powerhouse/document-model" },
|
|
231
|
+
],
|
|
232
|
+
processorApps: [],
|
|
243
233
|
},
|
|
234
|
+
});
|
|
235
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
236
|
+
document,
|
|
244
237
|
mockDispatch,
|
|
245
238
|
]);
|
|
246
239
|
render(_jsx(Editor, {}));
|
|
@@ -270,20 +263,20 @@ describe("ProcessorModule Editor", () => {
|
|
|
270
263
|
}));
|
|
271
264
|
});
|
|
272
265
|
it("should display existing document types list", () => {
|
|
273
|
-
|
|
274
|
-
{
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
],
|
|
284
|
-
},
|
|
285
|
-
},
|
|
266
|
+
const document = utils.createDocument({
|
|
267
|
+
global: {
|
|
268
|
+
name: "test-processor",
|
|
269
|
+
type: "analytics",
|
|
270
|
+
status: "DRAFT",
|
|
271
|
+
documentTypes: [
|
|
272
|
+
{ id: "dt-1", documentType: "powerhouse/document-model" },
|
|
273
|
+
{ id: "dt-2", documentType: "powerhouse/budget-statement" },
|
|
274
|
+
],
|
|
275
|
+
processorApps: [],
|
|
286
276
|
},
|
|
277
|
+
});
|
|
278
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
279
|
+
document,
|
|
287
280
|
mockDispatch,
|
|
288
281
|
]);
|
|
289
282
|
render(_jsx(Editor, {}));
|
|
@@ -293,19 +286,19 @@ describe("ProcessorModule Editor", () => {
|
|
|
293
286
|
});
|
|
294
287
|
describe("Confirm Button", () => {
|
|
295
288
|
it("should dispatch setProcessorStatus when confirm clicked", async () => {
|
|
296
|
-
|
|
297
|
-
{
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
],
|
|
306
|
-
},
|
|
307
|
-
},
|
|
289
|
+
const document = utils.createDocument({
|
|
290
|
+
global: {
|
|
291
|
+
name: "test-processor",
|
|
292
|
+
type: "analytics",
|
|
293
|
+
status: "DRAFT",
|
|
294
|
+
documentTypes: [
|
|
295
|
+
{ id: "dt-1", documentType: "powerhouse/document-model" },
|
|
296
|
+
],
|
|
297
|
+
processorApps: ["connect"],
|
|
308
298
|
},
|
|
299
|
+
});
|
|
300
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
301
|
+
document,
|
|
309
302
|
mockDispatch,
|
|
310
303
|
]);
|
|
311
304
|
const user = userEvent.setup();
|
|
@@ -320,19 +313,19 @@ describe("ProcessorModule Editor", () => {
|
|
|
320
313
|
]);
|
|
321
314
|
});
|
|
322
315
|
it("should be disabled when processor name is empty", () => {
|
|
323
|
-
|
|
324
|
-
{
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
],
|
|
333
|
-
},
|
|
334
|
-
},
|
|
316
|
+
const document = utils.createDocument({
|
|
317
|
+
global: {
|
|
318
|
+
name: "",
|
|
319
|
+
type: "analytics",
|
|
320
|
+
status: "DRAFT",
|
|
321
|
+
documentTypes: [
|
|
322
|
+
{ id: "dt-1", documentType: "powerhouse/document-model" },
|
|
323
|
+
],
|
|
324
|
+
processorApps: ["connect"],
|
|
335
325
|
},
|
|
326
|
+
});
|
|
327
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
328
|
+
document,
|
|
336
329
|
mockDispatch,
|
|
337
330
|
]);
|
|
338
331
|
render(_jsx(Editor, {}));
|
|
@@ -340,19 +333,19 @@ describe("ProcessorModule Editor", () => {
|
|
|
340
333
|
expect(confirmButton).toBeDisabled();
|
|
341
334
|
});
|
|
342
335
|
it("should be disabled when processor type is empty", () => {
|
|
343
|
-
|
|
344
|
-
{
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
],
|
|
353
|
-
},
|
|
354
|
-
},
|
|
336
|
+
const document = utils.createDocument({
|
|
337
|
+
global: {
|
|
338
|
+
name: "test-processor",
|
|
339
|
+
type: "",
|
|
340
|
+
status: "DRAFT",
|
|
341
|
+
documentTypes: [
|
|
342
|
+
{ id: "dt-1", documentType: "powerhouse/document-model" },
|
|
343
|
+
],
|
|
344
|
+
processorApps: ["connect"],
|
|
355
345
|
},
|
|
346
|
+
});
|
|
347
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
348
|
+
document,
|
|
356
349
|
mockDispatch,
|
|
357
350
|
]);
|
|
358
351
|
render(_jsx(Editor, {}));
|
|
@@ -360,17 +353,17 @@ describe("ProcessorModule Editor", () => {
|
|
|
360
353
|
expect(confirmButton).toBeDisabled();
|
|
361
354
|
});
|
|
362
355
|
it("should be disabled when no document types selected", () => {
|
|
363
|
-
|
|
364
|
-
{
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
documentTypes: [],
|
|
371
|
-
},
|
|
372
|
-
},
|
|
356
|
+
const document = utils.createDocument({
|
|
357
|
+
global: {
|
|
358
|
+
name: "test-processor",
|
|
359
|
+
type: "analytics",
|
|
360
|
+
status: "DRAFT",
|
|
361
|
+
documentTypes: [],
|
|
362
|
+
processorApps: ["connect"],
|
|
373
363
|
},
|
|
364
|
+
});
|
|
365
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
366
|
+
document,
|
|
374
367
|
mockDispatch,
|
|
375
368
|
]);
|
|
376
369
|
render(_jsx(Editor, {}));
|
|
@@ -378,19 +371,19 @@ describe("ProcessorModule Editor", () => {
|
|
|
378
371
|
expect(confirmButton).toBeDisabled();
|
|
379
372
|
});
|
|
380
373
|
it("should be hidden when status is CONFIRMED", () => {
|
|
381
|
-
|
|
382
|
-
{
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
],
|
|
391
|
-
},
|
|
392
|
-
},
|
|
374
|
+
const document = utils.createDocument({
|
|
375
|
+
global: {
|
|
376
|
+
name: "test-processor",
|
|
377
|
+
type: "analytics",
|
|
378
|
+
status: "CONFIRMED",
|
|
379
|
+
documentTypes: [
|
|
380
|
+
{ id: "dt-1", documentType: "powerhouse/document-model" },
|
|
381
|
+
],
|
|
382
|
+
processorApps: ["connect"],
|
|
393
383
|
},
|
|
384
|
+
});
|
|
385
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
386
|
+
document,
|
|
394
387
|
mockDispatch,
|
|
395
388
|
]);
|
|
396
389
|
render(_jsx(Editor, {}));
|
|
@@ -400,19 +393,19 @@ describe("ProcessorModule Editor", () => {
|
|
|
400
393
|
});
|
|
401
394
|
describe("Read-only Mode", () => {
|
|
402
395
|
it("should disable form fields when status is CONFIRMED", () => {
|
|
403
|
-
|
|
404
|
-
{
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
],
|
|
413
|
-
},
|
|
414
|
-
},
|
|
396
|
+
const document = utils.createDocument({
|
|
397
|
+
global: {
|
|
398
|
+
name: "test-processor",
|
|
399
|
+
type: "analytics",
|
|
400
|
+
status: "CONFIRMED",
|
|
401
|
+
documentTypes: [
|
|
402
|
+
{ id: "dt-1", documentType: "powerhouse/document-model" },
|
|
403
|
+
],
|
|
404
|
+
processorApps: ["connect"],
|
|
415
405
|
},
|
|
406
|
+
});
|
|
407
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
408
|
+
document,
|
|
416
409
|
mockDispatch,
|
|
417
410
|
]);
|
|
418
411
|
render(_jsx(Editor, {}));
|
|
@@ -428,19 +421,19 @@ describe("ProcessorModule Editor", () => {
|
|
|
428
421
|
expect(removeButtons).toHaveLength(0);
|
|
429
422
|
});
|
|
430
423
|
it("should enable form fields when status is DRAFT", () => {
|
|
431
|
-
|
|
432
|
-
{
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
],
|
|
441
|
-
},
|
|
442
|
-
},
|
|
424
|
+
const document = utils.createDocument({
|
|
425
|
+
global: {
|
|
426
|
+
name: "test-processor",
|
|
427
|
+
type: "analytics",
|
|
428
|
+
status: "DRAFT",
|
|
429
|
+
documentTypes: [
|
|
430
|
+
{ id: "dt-1", documentType: "powerhouse/document-model" },
|
|
431
|
+
],
|
|
432
|
+
processorApps: [],
|
|
443
433
|
},
|
|
434
|
+
});
|
|
435
|
+
vi.mocked(useSelectedProcessorModuleDocument).mockReturnValue([
|
|
436
|
+
document,
|
|
444
437
|
mockDispatch,
|
|
445
438
|
]);
|
|
446
439
|
render(_jsx(Editor, {}));
|
|
@@ -25,5 +25,5 @@ export const SubgraphEditorForm = ({ subgraphName: initialSubgraphName = "", sta
|
|
|
25
25
|
onConfirm?.();
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
-
return (_jsxs("div", { className: "space-y-6
|
|
28
|
+
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: "Subgraph Configuration" }), _jsx(StatusPill, { status: status === "CONFIRMED" ? "confirmed" : "draft", label: status === "CONFIRMED" ? "Confirmed" : "Draft" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "subgraph-name", className: "mb-2 block text-sm font-medium text-gray-700", children: "Subgraph Name" }), _jsx("input", { id: "subgraph-name", type: "text", value: subgraphName, onChange: (e) => setSubgraphName(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 subgraph name" })] }), !isReadOnly && (_jsx("div", { children: _jsx("button", { onClick: handleConfirm, disabled: !subgraphName.trim(), 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" }) }))] }));
|
|
29
29
|
};
|
|
@@ -17,5 +17,5 @@ export default function Editor() {
|
|
|
17
17
|
const onConfirm = useCallback(() => {
|
|
18
18
|
dispatch(actions.setSubgraphStatus({ status: "CONFIRMED" }));
|
|
19
19
|
}, [dispatch]);
|
|
20
|
-
return (_jsxs("div", { children: [_jsx(DocumentToolbar, {}), _jsx(SubgraphEditorForm, { subgraphName: document.state.global.name ?? "", status: document.state.global.status, onNameChange: onNameChange, onConfirm: onConfirm })] }));
|
|
20
|
+
return (_jsxs("div", { className: "bg-gray-50 p-6", children: [_jsx(DocumentToolbar, {}), _jsx(SubgraphEditorForm, { subgraphName: document.state.global.name ?? "", status: document.state.global.status, onNameChange: onNameChange, onConfirm: onConfirm })] }));
|
|
21
21
|
}
|
|
@@ -3,5 +3,5 @@ import { DriveHeader } from "./components/DriveHeader.js";
|
|
|
3
3
|
import { ModuleSpecificationsSection } from "./components/ModuleSpecificationsSection.js";
|
|
4
4
|
import { PackageInformationSection } from "./components/PackageInformationSection.js";
|
|
5
5
|
export const DriveExplorer = ({ driveId, driveName, driveUrl, documentModels = [], editors = [], apps = [], subgraphs = [], processors = [], codegenProcessors = [], onAddDocumentModel, onAddEditor, onAddApp, onAddSubgraph, onAddProcessor, onAddCodegenProcessor, packageDocumentId, onAddPackageDocument, onOpenPackageDocument, onOpenDocument, onDelete, }) => {
|
|
6
|
-
return (_jsxs("div", { className: "min-h-screen
|
|
6
|
+
return (_jsxs("div", { className: "min-h-screen", children: [_jsx(DriveHeader, { driveId: driveId, driveName: driveName, driveUrl: driveUrl }), _jsxs("div", { className: "mx-6 mt-6", children: [_jsx(PackageInformationSection, { className: "mb-6", packageDocumentId: packageDocumentId, onAddPackageDocument: onAddPackageDocument, onOpenPackageDocument: onOpenPackageDocument }), _jsx(ModuleSpecificationsSection, { documentModels: documentModels, editors: editors, apps: apps, subgraphs: subgraphs, processors: processors, codegenProcessors: codegenProcessors, onAddDocumentModel: onAddDocumentModel, onAddEditor: onAddEditor, onAddApp: onAddApp, onAddSubgraph: onAddSubgraph, onAddProcessor: onAddProcessor, onAddCodegenProcessor: onAddCodegenProcessor, onOpenDocument: onOpenDocument, onDelete: onDelete })] })] }));
|
|
7
7
|
};
|
|
@@ -56,5 +56,5 @@ export const DriveHeader = ({ driveId, driveName, driveUrl, }) => {
|
|
|
56
56
|
return "";
|
|
57
57
|
}
|
|
58
58
|
}, [driveUrl]);
|
|
59
|
-
return (_jsx("div", { className: "bg-
|
|
59
|
+
return (_jsx("div", { className: "bg-gray-50 px-6 py-4", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(VetraIcon, { width: 20, height: 20 }), _jsx("h1", { className: "text-lg font-semibold text-gray-900", children: "Vetra Studio Drive" }), _jsxs("div", { className: "relative", ref: infoMenuRef, children: [_jsx("button", { "aria-label": "Drive information", "aria-expanded": isInfoMenuOpen, className: "rounded-full p-1 transition-colors hover:bg-gray-100", onClick: toggleInfoMenu, children: _jsx(InfoIcon, { className: "text-gray-500" }) }), isInfoMenuOpen && (_jsxs("div", { role: "menu", className: "absolute left-0 top-full z-10 mt-2 flex flex-col items-start gap-2 rounded-lg bg-white p-3 shadow-lg", children: [_jsx(DriveInfoItem, { label: "Name", value: driveName }), _jsx(DriveInfoItem, { label: "Drive ID", value: driveId })] }))] }), driveUrl && (_jsxs("div", { className: "relative", ref: shareMenuRef, children: [_jsx("button", { "aria-label": "Share drive", "aria-expanded": isShareMenuOpen, className: "rounded-full p-1 transition-colors hover:bg-gray-100", onClick: toggleShareMenu, children: _jsx(ShareIcon, { width: 16, height: 16, stroke: "#343839" }) }), isShareMenuOpen && (_jsxs("div", { role: "menu", className: "absolute left-0 top-full z-10 mt-2 flex w-max flex-col gap-4 rounded-lg bg-white p-4 shadow-lg", children: [_jsx(ShareMenuItem, { label: "Copy the Drive URL", url: driveUrl }), _jsx(ShareMenuItem, { label: "Share this Drive directly in Connect", url: shareUrl })] }))] }))] }), _jsxs("a", { href: "https://academy.vetra.io/", target: "_blank", rel: "noopener noreferrer", className: "flex items-center gap-2 text-sm text-gray-900 underline transition-colors hover:text-gray-700", children: [_jsx(ExternalLinkIcon, { fill: "#111827" }), "Vetra Academy"] })] }) }));
|
|
60
60
|
};
|
|
@@ -41,7 +41,7 @@ export function BaseEditor(props) {
|
|
|
41
41
|
}
|
|
42
42
|
}, [packageNode]);
|
|
43
43
|
const showDocumentEditor = !!children;
|
|
44
|
-
return showDocumentEditor ? (children) : (_jsx("div", { style: { height: "100%" }, className: "bg-
|
|
44
|
+
return showDocumentEditor ? (children) : (_jsx("div", { style: { height: "100%" }, className: "bg-gray-50 p-6 after:pointer-events-none after:absolute after:inset-0 after:bg-blue-500 after:opacity-0 after:transition after:content-['']", children: _jsx(DriveExplorer, { driveId: driveId, driveName: driveName, driveUrl: driveUrl, 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"), packageDocumentId: packageDocumentId, onAddPackageDocument: onCreatePackageFile, onOpenPackageDocument: onOpenPackageDocument, onOpenDocument: (node) => setSelectedNode(node), onDelete: onDeleteDocument }) }));
|
|
45
45
|
}
|
|
46
46
|
export default function Editor(props) {
|
|
47
47
|
useSetPHDriveEditorConfig(editorConfig);
|
|
@@ -20,7 +20,7 @@ export const MetaForm = (props) => {
|
|
|
20
20
|
useDebounce(publisherUrl, onPublisherUrlChange, 300);
|
|
21
21
|
useDebounce(githubRepository, onGithubRepositoryChange, 300);
|
|
22
22
|
useDebounce(npmPackage, onNpmPackageChange, 300);
|
|
23
|
-
return (_jsxs("div", { className: "grid grid-cols-1 gap-6
|
|
23
|
+
return (_jsxs("div", { className: "grid grid-cols-1 gap-6 p-6 lg:grid-cols-3", children: [_jsxs("div", { className: "space-y-6", children: [_jsxs("div", { children: [_jsx("label", { htmlFor: "package-name", className: "mb-2 block text-sm font-medium text-gray-700", children: "Name" }), _jsx("input", { id: "package-name", type: "text", value: name, onChange: (e) => setName(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" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "package-description", className: "mb-2 block text-sm font-medium text-gray-700", children: "Description" }), _jsx("textarea", { id: "package-description", rows: 6, value: description, onChange: (e) => setDescription(e.target.value), className: "w-full resize-none rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500" })] })] }), _jsxs("div", { className: "space-y-6", children: [_jsxs("div", { children: [_jsx("label", { htmlFor: "package-category", className: "mb-2 block text-sm font-medium text-gray-700", children: "Category" }), _jsxs("select", { id: "package-category", value: category, onChange: (e) => {
|
|
24
24
|
const newValue = e.target.value;
|
|
25
25
|
setCategory(newValue);
|
|
26
26
|
onCategoryChange?.(newValue);
|
|
@@ -65,5 +65,5 @@ export default function Editor(props) {
|
|
|
65
65
|
const onRemoveKeyword = useCallback((id) => {
|
|
66
66
|
dispatch(actions.removePackageKeyword({ id }));
|
|
67
67
|
}, []);
|
|
68
|
-
return (_jsxs("div", { children: [displayToolbar && _jsx(DocumentToolbar, {}), _jsx(MetaForm, { name: document.state.global.name ?? "", description: document.state.global.description ?? "", category: document.state.global.category ?? "", publisher: document.state.global.author.name ?? "", publisherUrl: document.state.global.author.website ?? "", githubRepository: document.state.global.githubUrl ?? "", npmPackage: document.state.global.npmUrl ?? "", keywords: document.state.global.keywords, onNameChange: onNameChange, onDescriptionChange: onDescriptionChange, onCategoryChange: onCategoryChange, onPublisherChange: onPublisherChange, onPublisherUrlChange: onPublisherUrlChange, onGithubRepositoryChange: onGithubRepositoryChange, onNpmPackageChange: onNpmPackageChange, onAddKeyword: onAddKeyword, onRemoveKeyword: onRemoveKeyword })] }));
|
|
68
|
+
return (_jsxs("div", { className: "bg-gray-50 p-6", children: [displayToolbar && _jsx(DocumentToolbar, {}), _jsx(MetaForm, { name: document.state.global.name ?? "", description: document.state.global.description ?? "", category: document.state.global.category ?? "", publisher: document.state.global.author.name ?? "", publisherUrl: document.state.global.author.website ?? "", githubRepository: document.state.global.githubUrl ?? "", npmPackage: document.state.global.npmUrl ?? "", keywords: document.state.global.keywords, onNameChange: onNameChange, onDescriptionChange: onDescriptionChange, onCategoryChange: onCategoryChange, onPublisherChange: onPublisherChange, onPublisherUrlChange: onPublisherUrlChange, onGithubRepositoryChange: onGithubRepositoryChange, onNpmPackageChange: onNpmPackageChange, onAddKeyword: onAddKeyword, onRemoveKeyword: onRemoveKeyword })] }));
|
|
69
69
|
}
|