@powerhousedao/vetra 5.2.0-staging.8 → 5.3.0-staging.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/document-models/app-module/hooks.d.ts +5 -2
  2. package/dist/document-models/app-module/hooks.d.ts.map +1 -1
  3. package/dist/document-models/app-module/hooks.js +3 -4
  4. package/dist/document-models/document-editor/hooks.d.ts +5 -2
  5. package/dist/document-models/document-editor/hooks.d.ts.map +1 -1
  6. package/dist/document-models/document-editor/hooks.js +3 -4
  7. package/dist/document-models/processor-module/hooks.d.ts +5 -2
  8. package/dist/document-models/processor-module/hooks.d.ts.map +1 -1
  9. package/dist/document-models/processor-module/hooks.js +3 -4
  10. package/dist/document-models/subgraph-module/hooks.d.ts +5 -2
  11. package/dist/document-models/subgraph-module/hooks.d.ts.map +1 -1
  12. package/dist/document-models/subgraph-module/hooks.js +3 -4
  13. package/dist/document-models/vetra-package/hooks.d.ts +5 -2
  14. package/dist/document-models/vetra-package/hooks.d.ts.map +1 -1
  15. package/dist/document-models/vetra-package/hooks.js +3 -4
  16. package/dist/editors/app-editor/components/AppEditorForm.js +1 -1
  17. package/dist/editors/app-editor/editor.test.js +3 -2
  18. package/dist/editors/document-editor/components/DocumentEditorForm.d.ts.map +1 -1
  19. package/dist/editors/document-editor/components/DocumentEditorForm.js +32 -26
  20. package/dist/editors/document-editor/editor.js +1 -1
  21. package/dist/editors/document-editor/editor.test.js +2 -2
  22. package/dist/processors/codegen/__tests__/codegen-processor-e2e.test.js +2 -3
  23. package/dist/processors/codegen/document-handlers/generators/document-model-generator.d.ts.map +1 -1
  24. package/dist/processors/codegen/document-handlers/generators/document-model-generator.js +1 -2
  25. package/dist/setupTests.js +1 -0
  26. package/dist/tsconfig.tsbuildinfo +1 -1
  27. package/package.json +16 -16
@@ -1,9 +1,12 @@
1
1
  import type { DocumentDispatch } from "@powerhousedao/reactor-browser";
2
- import type { AppModuleDocument, AppModuleAction } from "@powerhousedao/vetra/document-models/app-module";
2
+ import type { AppModuleAction, AppModuleDocument } from "@powerhousedao/vetra/document-models/app-module";
3
3
  /** Hook to get a AppModule document by its id */
4
4
  export declare function useAppModuleDocumentById(documentId: string | null | undefined): [AppModuleDocument, DocumentDispatch<AppModuleAction>] | [undefined, undefined];
5
5
  /** Hook to get the selected AppModule document */
6
- export declare function useSelectedAppModuleDocument(): [AppModuleDocument, DocumentDispatch<AppModuleAction>] | [undefined, undefined];
6
+ export declare function useSelectedAppModuleDocument(): [
7
+ AppModuleDocument,
8
+ DocumentDispatch<AppModuleAction>
9
+ ];
7
10
  /** Hook to get all AppModule documents in the selected drive */
8
11
  export declare function useAppModuleDocumentsInSelectedDrive(): AppModuleDocument[] | undefined;
9
12
  /** Hook to get all AppModule documents in the selected folder */
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../document-models/app-module/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAOvE,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EAChB,MAAM,iDAAiD,CAAC;AAGzD,iDAAiD;AACjD,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAEnC,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAC,GACtD,CAAC,SAAS,EAAE,SAAS,CAAC,CAIzB;AAED,kDAAkD;AAClD,wBAAgB,4BAA4B,IACxC,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAC,GACtD,CAAC,SAAS,EAAE,SAAS,CAAC,CAIzB;AAED,gEAAgE;AAChE,wBAAgB,oCAAoC,oCAGnD;AAED,iEAAiE;AACjE,wBAAgB,qCAAqC,oCAGpD"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../document-models/app-module/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAOvE,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EAClB,MAAM,iDAAiD,CAAC;AAMzD,iDAAiD;AACjD,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAEnC,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAC,GACtD,CAAC,SAAS,EAAE,SAAS,CAAC,CAIzB;AAED,kDAAkD;AAClD,wBAAgB,4BAA4B,IAAI;IAC9C,iBAAiB;IACjB,gBAAgB,CAAC,eAAe,CAAC;CAClC,CAIA;AAED,gEAAgE;AAChE,wBAAgB,oCAAoC,oCAGnD;AAED,iEAAiE;AACjE,wBAAgB,qCAAqC,oCAGpD"}
@@ -1,5 +1,5 @@
1
- import { useDocumentsInSelectedDrive, useDocumentsInSelectedFolder, useDocumentById, useSelectedDocument, } from "@powerhousedao/reactor-browser";
2
- import { isAppModuleDocument } from "./gen/document-schema.js";
1
+ import { useDocumentById, useDocumentsInSelectedDrive, useDocumentsInSelectedFolder, useSelectedDocument, } from "@powerhousedao/reactor-browser";
2
+ import { assertIsAppModuleDocument, isAppModuleDocument, } from "./gen/document-schema.js";
3
3
  /** Hook to get a AppModule document by its id */
4
4
  export function useAppModuleDocumentById(documentId) {
5
5
  const [document, dispatch] = useDocumentById(documentId);
@@ -10,8 +10,7 @@ export function useAppModuleDocumentById(documentId) {
10
10
  /** Hook to get the selected AppModule document */
11
11
  export function useSelectedAppModuleDocument() {
12
12
  const [document, dispatch] = useSelectedDocument();
13
- if (!isAppModuleDocument(document))
14
- return [undefined, undefined];
13
+ assertIsAppModuleDocument(document);
15
14
  return [document, dispatch];
16
15
  }
17
16
  /** Hook to get all AppModule documents in the selected drive */
@@ -1,9 +1,12 @@
1
1
  import type { DocumentDispatch } from "@powerhousedao/reactor-browser";
2
- import type { DocumentEditorDocument, DocumentEditorAction } from "@powerhousedao/vetra/document-models/document-editor";
2
+ import type { DocumentEditorAction, DocumentEditorDocument } from "@powerhousedao/vetra/document-models/document-editor";
3
3
  /** Hook to get a DocumentEditor document by its id */
4
4
  export declare function useDocumentEditorDocumentById(documentId: string | null | undefined): [DocumentEditorDocument, DocumentDispatch<DocumentEditorAction>] | [undefined, undefined];
5
5
  /** Hook to get the selected DocumentEditor document */
6
- export declare function useSelectedDocumentEditorDocument(): [DocumentEditorDocument, DocumentDispatch<DocumentEditorAction>] | [undefined, undefined];
6
+ export declare function useSelectedDocumentEditorDocument(): [
7
+ DocumentEditorDocument,
8
+ DocumentDispatch<DocumentEditorAction>
9
+ ];
7
10
  /** Hook to get all DocumentEditor documents in the selected drive */
8
11
  export declare function useDocumentEditorDocumentsInSelectedDrive(): DocumentEditorDocument[] | undefined;
9
12
  /** Hook to get all DocumentEditor documents in the selected folder */
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../document-models/document-editor/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAOvE,OAAO,KAAK,EACV,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,sDAAsD,CAAC;AAG9D,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,IAC7C,CAAC,sBAAsB,EAAE,gBAAgB,CAAC,oBAAoB,CAAC,CAAC,GAChE,CAAC,SAAS,EAAE,SAAS,CAAC,CAIzB;AAED,qEAAqE;AACrE,wBAAgB,yCAAyC,yCAGxD;AAED,sEAAsE;AACtE,wBAAgB,0CAA0C,yCAGzD"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../document-models/document-editor/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,CAIA;AAED,qEAAqE;AACrE,wBAAgB,yCAAyC,yCAGxD;AAED,sEAAsE;AACtE,wBAAgB,0CAA0C,yCAGzD"}
@@ -1,5 +1,5 @@
1
- import { useDocumentsInSelectedDrive, useDocumentsInSelectedFolder, useDocumentById, useSelectedDocument, } from "@powerhousedao/reactor-browser";
2
- import { isDocumentEditorDocument } from "./gen/document-schema.js";
1
+ import { useDocumentById, useDocumentsInSelectedDrive, useDocumentsInSelectedFolder, useSelectedDocument, } from "@powerhousedao/reactor-browser";
2
+ import { assertIsDocumentEditorDocument, isDocumentEditorDocument, } from "./gen/document-schema.js";
3
3
  /** Hook to get a DocumentEditor document by its id */
4
4
  export function useDocumentEditorDocumentById(documentId) {
5
5
  const [document, dispatch] = useDocumentById(documentId);
@@ -10,8 +10,7 @@ export function useDocumentEditorDocumentById(documentId) {
10
10
  /** Hook to get the selected DocumentEditor document */
11
11
  export function useSelectedDocumentEditorDocument() {
12
12
  const [document, dispatch] = useSelectedDocument();
13
- if (!isDocumentEditorDocument(document))
14
- return [undefined, undefined];
13
+ assertIsDocumentEditorDocument(document);
15
14
  return [document, dispatch];
16
15
  }
17
16
  /** Hook to get all DocumentEditor documents in the selected drive */
@@ -1,9 +1,12 @@
1
1
  import type { DocumentDispatch } from "@powerhousedao/reactor-browser";
2
- import type { ProcessorModuleDocument, ProcessorModuleAction } from "@powerhousedao/vetra/document-models/processor-module";
2
+ import type { ProcessorModuleAction, ProcessorModuleDocument } from "@powerhousedao/vetra/document-models/processor-module";
3
3
  /** Hook to get a ProcessorModule document by its id */
4
4
  export declare function useProcessorModuleDocumentById(documentId: string | null | undefined): [ProcessorModuleDocument, DocumentDispatch<ProcessorModuleAction>] | [undefined, undefined];
5
5
  /** Hook to get the selected ProcessorModule document */
6
- export declare function useSelectedProcessorModuleDocument(): [ProcessorModuleDocument, DocumentDispatch<ProcessorModuleAction>] | [undefined, undefined];
6
+ export declare function useSelectedProcessorModuleDocument(): [
7
+ ProcessorModuleDocument,
8
+ DocumentDispatch<ProcessorModuleAction>
9
+ ];
7
10
  /** Hook to get all ProcessorModule documents in the selected drive */
8
11
  export declare function useProcessorModuleDocumentsInSelectedDrive(): ProcessorModuleDocument[] | undefined;
9
12
  /** Hook to get all ProcessorModule documents in the selected folder */
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../document-models/processor-module/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAOvE,OAAO,KAAK,EACV,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,uDAAuD,CAAC;AAG/D,uDAAuD;AACvD,wBAAgB,8BAA8B,CAC5C,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAEnC,CAAC,uBAAuB,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,CAAC,GAClE,CAAC,SAAS,EAAE,SAAS,CAAC,CAIzB;AAED,wDAAwD;AACxD,wBAAgB,kCAAkC,IAC9C,CAAC,uBAAuB,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,CAAC,GAClE,CAAC,SAAS,EAAE,SAAS,CAAC,CAIzB;AAED,sEAAsE;AACtE,wBAAgB,0CAA0C,0CAGzD;AAED,uEAAuE;AACvE,wBAAgB,2CAA2C,0CAG1D"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../document-models/processor-module/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAOvE,OAAO,KAAK,EACV,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,uDAAuD,CAAC;AAM/D,uDAAuD;AACvD,wBAAgB,8BAA8B,CAC5C,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAEnC,CAAC,uBAAuB,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,CAAC,GAClE,CAAC,SAAS,EAAE,SAAS,CAAC,CAIzB;AAED,wDAAwD;AACxD,wBAAgB,kCAAkC,IAAI;IACpD,uBAAuB;IACvB,gBAAgB,CAAC,qBAAqB,CAAC;CACxC,CAIA;AAED,sEAAsE;AACtE,wBAAgB,0CAA0C,0CAGzD;AAED,uEAAuE;AACvE,wBAAgB,2CAA2C,0CAG1D"}
@@ -1,5 +1,5 @@
1
- import { useDocumentsInSelectedDrive, useDocumentsInSelectedFolder, useDocumentById, useSelectedDocument, } from "@powerhousedao/reactor-browser";
2
- import { isProcessorModuleDocument } from "./gen/document-schema.js";
1
+ import { useDocumentById, useDocumentsInSelectedDrive, useDocumentsInSelectedFolder, useSelectedDocument, } from "@powerhousedao/reactor-browser";
2
+ import { assertIsProcessorModuleDocument, isProcessorModuleDocument, } from "./gen/document-schema.js";
3
3
  /** Hook to get a ProcessorModule document by its id */
4
4
  export function useProcessorModuleDocumentById(documentId) {
5
5
  const [document, dispatch] = useDocumentById(documentId);
@@ -10,8 +10,7 @@ export function useProcessorModuleDocumentById(documentId) {
10
10
  /** Hook to get the selected ProcessorModule document */
11
11
  export function useSelectedProcessorModuleDocument() {
12
12
  const [document, dispatch] = useSelectedDocument();
13
- if (!isProcessorModuleDocument(document))
14
- return [undefined, undefined];
13
+ assertIsProcessorModuleDocument(document);
15
14
  return [document, dispatch];
16
15
  }
17
16
  /** Hook to get all ProcessorModule documents in the selected drive */
@@ -1,9 +1,12 @@
1
1
  import type { DocumentDispatch } from "@powerhousedao/reactor-browser";
2
- import type { SubgraphModuleDocument, SubgraphModuleAction } from "@powerhousedao/vetra/document-models/subgraph-module";
2
+ import type { SubgraphModuleAction, SubgraphModuleDocument } from "@powerhousedao/vetra/document-models/subgraph-module";
3
3
  /** Hook to get a SubgraphModule document by its id */
4
4
  export declare function useSubgraphModuleDocumentById(documentId: string | null | undefined): [SubgraphModuleDocument, DocumentDispatch<SubgraphModuleAction>] | [undefined, undefined];
5
5
  /** Hook to get the selected SubgraphModule document */
6
- export declare function useSelectedSubgraphModuleDocument(): [SubgraphModuleDocument, DocumentDispatch<SubgraphModuleAction>] | [undefined, undefined];
6
+ export declare function useSelectedSubgraphModuleDocument(): [
7
+ SubgraphModuleDocument,
8
+ DocumentDispatch<SubgraphModuleAction>
9
+ ];
7
10
  /** Hook to get all SubgraphModule documents in the selected drive */
8
11
  export declare function useSubgraphModuleDocumentsInSelectedDrive(): SubgraphModuleDocument[] | undefined;
9
12
  /** Hook to get all SubgraphModule documents in the selected folder */
@@ -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,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,sDAAsD,CAAC;AAG9D,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,IAC7C,CAAC,sBAAsB,EAAE,gBAAgB,CAAC,oBAAoB,CAAC,CAAC,GAChE,CAAC,SAAS,EAAE,SAAS,CAAC,CAIzB;AAED,qEAAqE;AACrE,wBAAgB,yCAAyC,yCAGxD;AAED,sEAAsE;AACtE,wBAAgB,0CAA0C,yCAGzD"}
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,CAIA;AAED,qEAAqE;AACrE,wBAAgB,yCAAyC,yCAGxD;AAED,sEAAsE;AACtE,wBAAgB,0CAA0C,yCAGzD"}
@@ -1,5 +1,5 @@
1
- import { useDocumentsInSelectedDrive, useDocumentsInSelectedFolder, useDocumentById, useSelectedDocument, } from "@powerhousedao/reactor-browser";
2
- import { isSubgraphModuleDocument } from "./gen/document-schema.js";
1
+ import { useDocumentById, useDocumentsInSelectedDrive, useDocumentsInSelectedFolder, useSelectedDocument, } from "@powerhousedao/reactor-browser";
2
+ import { assertIsSubgraphModuleDocument, isSubgraphModuleDocument, } from "./gen/document-schema.js";
3
3
  /** Hook to get a SubgraphModule document by its id */
4
4
  export function useSubgraphModuleDocumentById(documentId) {
5
5
  const [document, dispatch] = useDocumentById(documentId);
@@ -10,8 +10,7 @@ export function useSubgraphModuleDocumentById(documentId) {
10
10
  /** Hook to get the selected SubgraphModule document */
11
11
  export function useSelectedSubgraphModuleDocument() {
12
12
  const [document, dispatch] = useSelectedDocument();
13
- if (!isSubgraphModuleDocument(document))
14
- return [undefined, undefined];
13
+ assertIsSubgraphModuleDocument(document);
15
14
  return [document, dispatch];
16
15
  }
17
16
  /** Hook to get all SubgraphModule documents in the selected drive */
@@ -1,9 +1,12 @@
1
1
  import type { DocumentDispatch } from "@powerhousedao/reactor-browser";
2
- import type { VetraPackageDocument, VetraPackageAction } from "@powerhousedao/vetra/document-models/vetra-package";
2
+ import type { VetraPackageAction, VetraPackageDocument } from "@powerhousedao/vetra/document-models/vetra-package";
3
3
  /** Hook to get a VetraPackage document by its id */
4
4
  export declare function useVetraPackageDocumentById(documentId: string | null | undefined): [VetraPackageDocument, DocumentDispatch<VetraPackageAction>] | [undefined, undefined];
5
5
  /** Hook to get the selected VetraPackage document */
6
- export declare function useSelectedVetraPackageDocument(): [VetraPackageDocument, DocumentDispatch<VetraPackageAction>] | [undefined, undefined];
6
+ export declare function useSelectedVetraPackageDocument(): [
7
+ VetraPackageDocument,
8
+ DocumentDispatch<VetraPackageAction>
9
+ ];
7
10
  /** Hook to get all VetraPackage documents in the selected drive */
8
11
  export declare function useVetraPackageDocumentsInSelectedDrive(): VetraPackageDocument[] | undefined;
9
12
  /** Hook to get all VetraPackage documents in the selected folder */
@@ -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,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,oDAAoD,CAAC;AAG5D,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,IAC3C,CAAC,oBAAoB,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC,GAC5D,CAAC,SAAS,EAAE,SAAS,CAAC,CAIzB;AAED,mEAAmE;AACnE,wBAAgB,uCAAuC,uCAGtD;AAED,oEAAoE;AACpE,wBAAgB,wCAAwC,uCAGvD"}
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,CAIA;AAED,mEAAmE;AACnE,wBAAgB,uCAAuC,uCAGtD;AAED,oEAAoE;AACpE,wBAAgB,wCAAwC,uCAGvD"}
@@ -1,5 +1,5 @@
1
- import { useDocumentsInSelectedDrive, useDocumentsInSelectedFolder, useDocumentById, useSelectedDocument, } from "@powerhousedao/reactor-browser";
2
- import { isVetraPackageDocument } from "./gen/document-schema.js";
1
+ import { useDocumentById, useDocumentsInSelectedDrive, useDocumentsInSelectedFolder, useSelectedDocument, } from "@powerhousedao/reactor-browser";
2
+ import { assertIsVetraPackageDocument, isVetraPackageDocument, } from "./gen/document-schema.js";
3
3
  /** Hook to get a VetraPackage document by its id */
4
4
  export function useVetraPackageDocumentById(documentId) {
5
5
  const [document, dispatch] = useDocumentById(documentId);
@@ -10,8 +10,7 @@ export function useVetraPackageDocumentById(documentId) {
10
10
  /** Hook to get the selected VetraPackage document */
11
11
  export function useSelectedVetraPackageDocument() {
12
12
  const [document, dispatch] = useSelectedDocument();
13
- if (!isVetraPackageDocument(document))
14
- return [undefined, undefined];
13
+ assertIsVetraPackageDocument(document);
15
14
  return [document, dispatch];
16
15
  }
17
16
  /** Hook to get all VetraPackage documents in the selected drive */
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useDocumentTypesInSelectedDrive, useSupportedDocumentTypesInReactor, } from "@powerhousedao/reactor-browser";
3
3
  import { useCallback, useEffect, useState } from "react";
4
+ import { useSelectedAppModuleDocument } from "../../../document-models/app-module/hooks.js";
4
5
  import { actions } from "../../../document-models/app-module/index.js";
5
6
  import { StatusPill } from "../../components/index.js";
6
7
  import { useDebounce } from "../../hooks/index.js";
7
- import { useSelectedAppModuleDocument } from "../../hooks/useVetraDocument.js";
8
8
  const ALL_IN_DRIVE = "all-in-drive";
9
9
  const ALL_IN_REACTOR = "all-in-reactor";
10
10
  const ALLOW_ANY = "allow-any";
@@ -2,9 +2,9 @@ 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 { useSelectedAppModuleDocument } from "../hooks/useVetraDocument.js";
5
+ import { useSelectedAppModuleDocument } from "../../document-models/app-module/hooks.js";
6
6
  import Editor from "./editor.js";
7
- vi.mock("../hooks/useVetraDocument.js", () => ({
7
+ vi.mock("../../document-models/app-module/hooks.js", () => ({
8
8
  useSelectedAppModuleDocument: vi.fn(),
9
9
  }));
10
10
  vi.mock("@powerhousedao/reactor-browser", async (importOriginal) => {
@@ -20,6 +20,7 @@ vi.mock("@powerhousedao/reactor-browser", async (importOriginal) => {
20
20
  useSetPHDocumentEditorConfig: vi.fn(),
21
21
  // These are needed by DocumentToolbar but mocked in setupTests
22
22
  useSelectedDocument: vi.fn(() => [null, vi.fn()]),
23
+ useSelectedDocumentSafe: vi.fn(() => [null, vi.fn()]),
23
24
  useDocumentById: vi.fn(() => [null, vi.fn()]),
24
25
  useDocumentTimeline: vi.fn(() => []),
25
26
  useNodeParentFolderById: vi.fn(() => null),
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentEditorForm.d.ts","sourceRoot":"","sources":["../../../../editors/document-editor/components/DocumentEditorForm.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,mDAAmD,CAAC;AAI3D,MAAM,WAAW,uBAAuB;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC1D,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,IAAI,CAAC;IAChE,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAmKhE,CAAC"}
1
+ {"version":3,"file":"DocumentEditorForm.d.ts","sourceRoot":"","sources":["../../../../editors/document-editor/components/DocumentEditorForm.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,mDAAmD,CAAC;AAI3D,MAAM,WAAW,uBAAuB;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC1D,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,IAAI,CAAC;IAChE,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAqED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAmIhE,CAAC"}
@@ -1,14 +1,41 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useState } from "react";
2
+ import { Suspense, useEffect, useState } from "react";
3
3
  import { StatusPill } from "../../components/index.js";
4
4
  import { useAvailableDocumentTypes, useDebounce } from "../../hooks/index.js";
5
+ function DocumentTypeSelectUI(props) {
6
+ return (_jsxs("select", { id: "supported-document-types", 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", ...props, children: [_jsx("option", { value: "", children: "Select a document type" }), props.children] }));
7
+ }
8
+ function DocumentTypeSelect({ documentTypes, setDocumentTypes, onAddDocumentType, onRemoveDocumentType, }) {
9
+ // Get available document types from the hook (vetra drive only for document editor)
10
+ const availableDocumentTypes = useAvailableDocumentTypes(true);
11
+ const [selectedDocumentType, setSelectedDocumentType] = useState("");
12
+ return (_jsx(DocumentTypeSelectUI, { value: selectedDocumentType, onChange: (e) => {
13
+ const selectedValue = e.target.value;
14
+ if (selectedValue) {
15
+ // Remove existing document type if any
16
+ const existingType = documentTypes?.at(0);
17
+ if (existingType) {
18
+ onRemoveDocumentType?.({ id: existingType.id });
19
+ }
20
+ // Add the new document type
21
+ const newTypeInput = {
22
+ id: Date.now().toString(), // Generate a unique ID
23
+ documentType: selectedValue,
24
+ };
25
+ const newType = {
26
+ id: newTypeInput.id,
27
+ documentType: newTypeInput.documentType,
28
+ };
29
+ setDocumentTypes([newType]); // Replace with single item array
30
+ onAddDocumentType?.(newTypeInput);
31
+ }
32
+ setSelectedDocumentType("");
33
+ }, children: availableDocumentTypes.map((docType) => (_jsx("option", { value: docType, children: docType }, docType))) }));
34
+ }
5
35
  export const DocumentEditorForm = ({ editorName: initialEditorName = "", documentTypes: initialDocumentTypes = [], status = "DRAFT", onEditorNameChange, onAddDocumentType, onRemoveDocumentType, onConfirm, }) => {
6
36
  const [editorName, setEditorName] = useState(initialEditorName);
7
37
  const [documentTypes, setDocumentTypes] = useState(initialDocumentTypes);
8
- const [selectedDocumentType, setSelectedDocumentType] = useState("");
9
38
  const [isConfirmed, setIsConfirmed] = useState(false);
10
- // Get available document types from the hook (vetra drive only for document editor)
11
- const availableDocumentTypes = useAvailableDocumentTypes(true);
12
39
  // Use the debounce hook for name changes
13
40
  useDebounce(editorName, onEditorNameChange, 300);
14
41
  // Update local state when initial values change
@@ -32,28 +59,7 @@ export const DocumentEditorForm = ({ editorName: initialEditorName = "", documen
32
59
  onConfirm?.();
33
60
  }
34
61
  };
35
- return (_jsxs("div", { className: "space-y-6 bg-white 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 && availableDocumentTypes.length > 0 && (_jsxs("select", { id: "supported-document-types", value: selectedDocumentType, onChange: (e) => {
36
- const selectedValue = e.target.value;
37
- if (selectedValue) {
38
- // Remove existing document type if any
39
- const existingType = documentTypes.at(0);
40
- if (existingType) {
41
- onRemoveDocumentType?.({ id: existingType.id });
42
- }
43
- // Add the new document type
44
- const newTypeInput = {
45
- id: Date.now().toString(), // Generate a unique ID
46
- documentType: selectedValue,
47
- };
48
- const newType = {
49
- id: newTypeInput.id,
50
- documentType: newTypeInput.documentType,
51
- };
52
- setDocumentTypes([newType]); // Replace with single item array
53
- onAddDocumentType?.(newTypeInput);
54
- }
55
- setSelectedDocumentType("");
56
- }, 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" }), availableDocumentTypes.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: () => {
62
+ return (_jsxs("div", { className: "space-y-6 bg-white 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: () => {
57
63
  setDocumentTypes([]);
58
64
  onRemoveDocumentType?.({ id: type.id });
59
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" }) }))] }));
@@ -2,8 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { DocumentToolbar } from "@powerhousedao/design-system/connect";
3
3
  import { useSetPHDocumentEditorConfig } from "@powerhousedao/reactor-browser";
4
4
  import { useCallback } from "react";
5
+ import { useSelectedDocumentEditorDocument } from "../../document-models/document-editor/hooks.js";
5
6
  import { actions } from "../../document-models/document-editor/index.js";
6
- import { useSelectedDocumentEditorDocument } from "../hooks/useVetraDocument.js";
7
7
  import { DocumentEditorForm } from "./components/DocumentEditorForm.js";
8
8
  import { editorConfig } from "./config.js";
9
9
  export default function Editor() {
@@ -2,9 +2,9 @@ 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 { useSelectedDocumentEditorDocument } from "../hooks/useVetraDocument.js";
5
+ import { useSelectedDocumentEditorDocument } from "../../document-models/document-editor/hooks.js";
6
6
  import Editor from "./editor.js";
7
- vi.mock("../hooks/useVetraDocument.js", () => ({
7
+ vi.mock("../../document-models/document-editor/hooks.js", () => ({
8
8
  useSelectedDocumentEditorDocument: vi.fn(),
9
9
  }));
10
10
  vi.mock("../hooks/useAvailableDocumentTypes.js", () => ({
@@ -193,8 +193,8 @@ describe("CodegenProcessor E2E Tests", () => {
193
193
  });
194
194
  });
195
195
  describe("Document Model E2E", () => {
196
- it("should process valid document-model strand and call all three codegen functions", async () => {
197
- const { generateFromDocument, generateSubgraphFromDocumentModel, generateManifest, } = await import("@powerhousedao/codegen");
196
+ it("should process valid document-model strand and call model and manifest codegen functions", async () => {
197
+ const { generateFromDocument, generateManifest } = await import("@powerhousedao/codegen");
198
198
  const validState = {
199
199
  id: "test-model-id",
200
200
  name: "Test Model",
@@ -215,7 +215,6 @@ describe("CodegenProcessor E2E Tests", () => {
215
215
  },
216
216
  ];
217
217
  expect(generateFromDocument).toHaveBeenCalledWith(...generateFromDocumentArgs);
218
- expect(generateSubgraphFromDocumentModel).toHaveBeenCalledWith("Test Model", validState, mockConfig.PH_CONFIG, { verbose: false });
219
218
  expect(generateManifest).toHaveBeenCalledWith({
220
219
  documentModels: [
221
220
  {
@@ -1 +1 @@
1
- {"version":3,"file":"document-model-generator.d.ts","sourceRoot":"","sources":["../../../../../processors/codegen/document-handlers/generators/document-model-generator.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAGhE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAI1D;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,eAAe;IACzD,QAAQ,CAAC,sBAAsB,+BAA+B;IAE9D;;OAEG;IACH,aAAa,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO;IAiCnD,QAAQ,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;CAkEjE"}
1
+ {"version":3,"file":"document-model-generator.d.ts","sourceRoot":"","sources":["../../../../../processors/codegen/document-handlers/generators/document-model-generator.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAGhE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAI1D;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,eAAe;IACzD,QAAQ,CAAC,sBAAsB,+BAA+B;IAE9D;;OAEG;IACH,aAAa,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO;IAiCnD,QAAQ,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;CA4DjE"}
@@ -1,4 +1,4 @@
1
- import { generateFromDocument, generateManifest, generateSubgraphFromDocumentModel, validateDocumentModelState, } from "@powerhousedao/codegen";
1
+ import { generateFromDocument, generateManifest, validateDocumentModelState, } from "@powerhousedao/codegen";
2
2
  import { logger } from "../../logger.js";
3
3
  import { BaseDocumentGen } from "../base-document-gen.js";
4
4
  import { USE_TS_MORPH, USE_VERSIONING } from "./constants.js";
@@ -44,7 +44,6 @@ export class DocumentModelGenerator extends BaseDocumentGen {
44
44
  useTsMorph: USE_TS_MORPH,
45
45
  useVersioning: USE_VERSIONING,
46
46
  });
47
- await generateSubgraphFromDocumentModel(state.name, state, this.config.PH_CONFIG, { verbose: false });
48
47
  logger.info(`✅ Code generation completed successfully for: ${state.name}`);
49
48
  // Update the manifest with the new document model
50
49
  try {
@@ -3,6 +3,7 @@ import { vi } from "vitest";
3
3
  vi.mock("@powerhousedao/reactor-browser", () => ({
4
4
  // Mock hooks
5
5
  useSelectedDocument: vi.fn(() => [null, vi.fn()]),
6
+ useSelectedDocumentSafe: vi.fn(() => [null, vi.fn()]),
6
7
  useSetPHDocumentEditorConfig: vi.fn(),
7
8
  useSetPHDriveEditorConfig: vi.fn(),
8
9
  useDocumentById: vi.fn(() => [null, vi.fn()]),