@powerhousedao/vetra 5.1.0-staging.0 → 5.2.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 (86) hide show
  1. package/dist/document-models/app-module/gen/document-schema.d.ts +24 -170
  2. package/dist/document-models/app-module/gen/document-schema.d.ts.map +1 -1
  3. package/dist/document-models/app-module/gen/schema/types.d.ts +15 -3
  4. package/dist/document-models/app-module/gen/schema/types.d.ts.map +1 -1
  5. package/dist/document-models/app-module/gen/schema/zod.d.ts +7 -4
  6. package/dist/document-models/app-module/gen/schema/zod.d.ts.map +1 -1
  7. package/dist/document-models/app-module/gen/schema/zod.js +2 -2
  8. package/dist/document-models/app-module/src/tests/base-operations.test.js +52 -1
  9. package/dist/document-models/document-editor/gen/document-schema.d.ts +21 -151
  10. package/dist/document-models/document-editor/gen/document-schema.d.ts.map +1 -1
  11. package/dist/document-models/document-editor/gen/schema/types.d.ts +15 -3
  12. package/dist/document-models/document-editor/gen/schema/types.d.ts.map +1 -1
  13. package/dist/document-models/document-editor/gen/schema/zod.d.ts +7 -4
  14. package/dist/document-models/document-editor/gen/schema/zod.d.ts.map +1 -1
  15. package/dist/document-models/document-editor/gen/schema/zod.js +2 -2
  16. package/dist/document-models/document-editor/src/tests/base-operations.test.js +42 -1
  17. package/dist/document-models/processor-module/gen/document-schema.d.ts +24 -170
  18. package/dist/document-models/processor-module/gen/document-schema.d.ts.map +1 -1
  19. package/dist/document-models/processor-module/gen/schema/types.d.ts +15 -3
  20. package/dist/document-models/processor-module/gen/schema/types.d.ts.map +1 -1
  21. package/dist/document-models/processor-module/gen/schema/zod.d.ts +7 -4
  22. package/dist/document-models/processor-module/gen/schema/zod.d.ts.map +1 -1
  23. package/dist/document-models/processor-module/gen/schema/zod.js +2 -2
  24. package/dist/document-models/processor-module/src/tests/base-operations.test.js +52 -1
  25. package/dist/document-models/subgraph-module/gen/document-schema.d.ts +18 -132
  26. package/dist/document-models/subgraph-module/gen/document-schema.d.ts.map +1 -1
  27. package/dist/document-models/subgraph-module/gen/schema/types.d.ts +15 -3
  28. package/dist/document-models/subgraph-module/gen/schema/types.d.ts.map +1 -1
  29. package/dist/document-models/subgraph-module/gen/schema/zod.d.ts +7 -4
  30. package/dist/document-models/subgraph-module/gen/schema/zod.d.ts.map +1 -1
  31. package/dist/document-models/subgraph-module/gen/schema/zod.js +1 -1
  32. package/dist/document-models/subgraph-module/src/tests/base-operations.test.js +22 -1
  33. package/dist/document-models/vetra-package/gen/document-schema.d.ts +33 -227
  34. package/dist/document-models/vetra-package/gen/document-schema.d.ts.map +1 -1
  35. package/dist/document-models/vetra-package/gen/schema/types.d.ts +17 -1
  36. package/dist/document-models/vetra-package/gen/schema/types.d.ts.map +1 -1
  37. package/dist/document-models/vetra-package/gen/schema/zod.d.ts +3 -3
  38. package/dist/document-models/vetra-package/gen/schema/zod.d.ts.map +1 -1
  39. package/dist/document-models/vetra-package/gen/schema/zod.js +10 -10
  40. package/dist/document-models/vetra-package/src/tests/base-operations.test.js +127 -28
  41. package/dist/processors/codegen/__tests__/codegen-processor-e2e.test.js +96 -44
  42. package/dist/processors/codegen/document-handlers/generators/app-generator.js +2 -2
  43. package/dist/processors/codegen/document-handlers/generators/constants.d.ts +2 -1
  44. package/dist/processors/codegen/document-handlers/generators/constants.d.ts.map +1 -1
  45. package/dist/processors/codegen/document-handlers/generators/constants.js +2 -1
  46. package/dist/processors/codegen/document-handlers/generators/document-editor-generator.js +2 -2
  47. package/dist/processors/codegen/document-handlers/generators/document-model-generator.d.ts.map +1 -1
  48. package/dist/processors/codegen/document-handlers/generators/document-model-generator.js +7 -3
  49. package/dist/subgraphs/app-module/resolvers.d.ts.map +1 -1
  50. package/dist/subgraphs/app-module/resolvers.js +4 -4
  51. package/dist/subgraphs/app-module/schema.d.ts.map +1 -1
  52. package/dist/subgraphs/app-module/schema.js +2 -17
  53. package/dist/subgraphs/document-editor/index.d.ts +3 -2
  54. package/dist/subgraphs/document-editor/index.d.ts.map +1 -1
  55. package/dist/subgraphs/document-editor/index.js +1 -1
  56. package/dist/subgraphs/document-editor/resolvers.d.ts +1 -1
  57. package/dist/subgraphs/document-editor/resolvers.d.ts.map +1 -1
  58. package/dist/subgraphs/document-editor/resolvers.js +12 -16
  59. package/dist/subgraphs/document-editor/schema.d.ts.map +1 -1
  60. package/dist/subgraphs/document-editor/schema.js +2 -21
  61. package/dist/subgraphs/index.d.ts +4 -4
  62. package/dist/subgraphs/index.d.ts.map +1 -1
  63. package/dist/subgraphs/index.js +4 -4
  64. package/dist/subgraphs/processor-module/index.d.ts +1 -1
  65. package/dist/subgraphs/processor-module/index.d.ts.map +1 -1
  66. package/dist/subgraphs/processor-module/resolvers.d.ts +1 -1
  67. package/dist/subgraphs/processor-module/resolvers.d.ts.map +1 -1
  68. package/dist/subgraphs/processor-module/resolvers.js +12 -16
  69. package/dist/subgraphs/processor-module/schema.d.ts.map +1 -1
  70. package/dist/subgraphs/processor-module/schema.js +2 -22
  71. package/dist/subgraphs/subgraph-module/index.d.ts +1 -1
  72. package/dist/subgraphs/subgraph-module/index.d.ts.map +1 -1
  73. package/dist/subgraphs/subgraph-module/resolvers.d.ts +1 -1
  74. package/dist/subgraphs/subgraph-module/resolvers.d.ts.map +1 -1
  75. package/dist/subgraphs/subgraph-module/resolvers.js +12 -16
  76. package/dist/subgraphs/subgraph-module/schema.d.ts.map +1 -1
  77. package/dist/subgraphs/subgraph-module/schema.js +2 -15
  78. package/dist/subgraphs/vetra-package/index.d.ts +1 -1
  79. package/dist/subgraphs/vetra-package/index.d.ts.map +1 -1
  80. package/dist/subgraphs/vetra-package/resolvers.d.ts +1 -1
  81. package/dist/subgraphs/vetra-package/resolvers.d.ts.map +1 -1
  82. package/dist/subgraphs/vetra-package/resolvers.js +137 -94
  83. package/dist/subgraphs/vetra-package/schema.d.ts.map +1 -1
  84. package/dist/subgraphs/vetra-package/schema.js +3 -26
  85. package/dist/tsconfig.tsbuildinfo +1 -1
  86. package/package.json +15 -15
@@ -2,7 +2,7 @@ import { generateDriveEditor, generateManifest } from "@powerhousedao/codegen";
2
2
  import { kebabCase } from "change-case";
3
3
  import { logger } from "../../logger.js";
4
4
  import { BaseDocumentGen } from "../base-document-gen.js";
5
- import { LEGACY } from "./constants.js";
5
+ import { USE_TS_MORPH } from "./constants.js";
6
6
  import { backupDocument } from "./utils.js";
7
7
  /**
8
8
  * Generator for app documents
@@ -48,7 +48,7 @@ export class AppGenerator extends BaseDocumentGen {
48
48
  appId: appId,
49
49
  allowedDocumentTypes: state.allowedDocumentTypes?.join(","),
50
50
  isDragAndDropEnabled: state.isDragAndDropEnabled,
51
- legacy: LEGACY,
51
+ useTsMorph: USE_TS_MORPH,
52
52
  });
53
53
  logger.info(`✅ Drive editor generation completed successfully for app: ${state.name}`);
54
54
  // Update the manifest with the new app
@@ -1,2 +1,3 @@
1
- export declare const LEGACY = true;
1
+ export declare const USE_TS_MORPH = true;
2
+ export declare const USE_VERSIONING = false;
2
3
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../processors/codegen/document-handlers/generators/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,OAAO,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../processors/codegen/document-handlers/generators/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,OAAO,CAAC;AACjC,eAAO,MAAM,cAAc,QAAQ,CAAC"}
@@ -1 +1,2 @@
1
- export const LEGACY = true;
1
+ export const USE_TS_MORPH = true;
2
+ export const USE_VERSIONING = false;
@@ -2,7 +2,7 @@ import { generateEditor, generateManifest } from "@powerhousedao/codegen";
2
2
  import { kebabCase } from "change-case";
3
3
  import { logger } from "../../logger.js";
4
4
  import { BaseDocumentGen } from "../base-document-gen.js";
5
- import { LEGACY } from "./constants.js";
5
+ import { USE_TS_MORPH } from "./constants.js";
6
6
  import { backupDocument } from "./utils.js";
7
7
  /**
8
8
  * Generator for document editor documents
@@ -52,7 +52,7 @@ export class DocumentEditorGenerator extends BaseDocumentGen {
52
52
  documentTypes: documentTypes,
53
53
  config: this.config.PH_CONFIG,
54
54
  editorId: editorId,
55
- legacy: LEGACY,
55
+ useTsMorph: USE_TS_MORPH,
56
56
  });
57
57
  logger.info(`✅ Editor generation completed successfully for: ${state.name}`);
58
58
  // Update the manifest with the new editor
@@ -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;IA6BnD,QAAQ,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;CA+DjE"}
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;IA+BnD,QAAQ,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;CAkEjE"}
@@ -1,7 +1,7 @@
1
1
  import { generateFromDocument, generateManifest, generateSubgraphFromDocumentModel, validateDocumentModelState, } from "@powerhousedao/codegen";
2
2
  import { logger } from "../../logger.js";
3
3
  import { BaseDocumentGen } from "../base-document-gen.js";
4
- import { LEGACY } from "./constants.js";
4
+ import { USE_TS_MORPH, USE_VERSIONING } from "./constants.js";
5
5
  import { backupDocument } from "./utils.js";
6
6
  /**
7
7
  * Generator for document model documents
@@ -22,6 +22,7 @@ export class DocumentModelGenerator extends BaseDocumentGen {
22
22
  logger.debug(`>>> No state found for document model: ${strand.documentId}`);
23
23
  return false;
24
24
  }
25
+ console.log(">>>> state", JSON.stringify(state, null, 2));
25
26
  const validationResult = validateDocumentModelState(state);
26
27
  if (!validationResult.isValid) {
27
28
  const errorList = validationResult.errors
@@ -37,8 +38,11 @@ export class DocumentModelGenerator extends BaseDocumentGen {
37
38
  // Validation is already done in shouldProcess, so we can proceed directly
38
39
  logger.debug(`🔄 Starting code generation for document model: ${state.name}`);
39
40
  try {
40
- await generateFromDocument(state, this.config.PH_CONFIG, LEGACY, {
41
- verbose: false,
41
+ await generateFromDocument({
42
+ documentModelState: state,
43
+ config: this.config.PH_CONFIG,
44
+ useTsMorph: USE_TS_MORPH,
45
+ useVersioning: USE_VERSIONING,
42
46
  });
43
47
  await generateSubgraphFromDocumentModel(state.name, state, this.config.PH_CONFIG, { verbose: false });
44
48
  logger.info(`✅ Code generation completed successfully for: ${state.name}`);
@@ -1 +1 @@
1
- {"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/app-module/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAc/D,eAAO,MAAM,YAAY,GACvB,UAAU,YAAY,KACrB,MAAM,CAAC,MAAM,EAAE,OAAO,CAkOxB,CAAC"}
1
+ {"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/app-module/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAkB/D,eAAO,MAAM,YAAY,GACvB,UAAU,YAAY,KACrB,MAAM,CAAC,MAAM,EAAE,OAAO,CAkOxB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { addFile } from "document-drive";
2
- import { actions, } from "../../document-models/app-module/index.js";
3
2
  import { setName } from "document-model";
3
+ import { actions, appModuleDocumentType, } from "@powerhousedao/vetra/document-models/app-module";
4
4
  export const getResolvers = (subgraph) => {
5
5
  const reactor = subgraph.reactor;
6
6
  return {
@@ -46,7 +46,7 @@ export const getResolvers = (subgraph) => {
46
46
  revision: doc.header?.revision?.global ?? 0,
47
47
  };
48
48
  }));
49
- return docs.filter((doc) => doc.header.documentType === "powerhouse/app");
49
+ return docs.filter((doc) => doc.header.documentType === appModuleDocumentType);
50
50
  },
51
51
  };
52
52
  },
@@ -54,12 +54,12 @@ export const getResolvers = (subgraph) => {
54
54
  Mutation: {
55
55
  AppModule_createDocument: async (_, args) => {
56
56
  const { driveId, name } = args;
57
- const document = await reactor.addDocument("powerhouse/app");
57
+ const document = await reactor.addDocument(appModuleDocumentType);
58
58
  if (driveId) {
59
59
  await reactor.addAction(driveId, addFile({
60
60
  name,
61
61
  id: document.header.id,
62
- documentType: "powerhouse/app",
62
+ documentType: appModuleDocumentType,
63
63
  }));
64
64
  }
65
65
  if (name) {
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../subgraphs/app-module/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,MAAM,EAAE,YA2FpB,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../subgraphs/app-module/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,MAAM,EAAE,YA4EpB,CAAC"}
@@ -1,22 +1,7 @@
1
1
  import { gql } from "graphql-tag";
2
2
  export const schema = gql `
3
3
  """
4
- Subgraph definition for AppModule (powerhouse/app)
5
- """
6
- type AppModuleState {
7
- name: String!
8
- status: StatusType!
9
- allowedDocumentTypes: [String!]
10
- isDragAndDropEnabled: Boolean!
11
- }
12
-
13
- enum StatusType {
14
- DRAFT
15
- CONFIRMED
16
- }
17
-
18
- """
19
- Queries: AppModule
4
+ Queries: AppModule Document
20
5
  """
21
6
  type AppModuleQueries {
22
7
  getDocument(docId: PHID!, driveId: PHID): AppModule
@@ -72,7 +57,7 @@ export const schema = gql `
72
57
  name: String!
73
58
  }
74
59
  input AppModule_SetAppStatusInput {
75
- status: StatusType!
60
+ status: AppModule_StatusType!
76
61
  }
77
62
  input AppModule_AddDocumentTypeInput {
78
63
  documentType: String!
@@ -1,8 +1,9 @@
1
1
  import { BaseSubgraph } from "@powerhousedao/reactor-api";
2
+ import type { DocumentNode } from "graphql";
2
3
  export declare class DocumentEditorSubgraph extends BaseSubgraph {
3
4
  name: string;
4
- typeDefs: import("graphql").DocumentNode;
5
- resolvers: Record<string, any>;
5
+ typeDefs: DocumentNode;
6
+ resolvers: Record<string, unknown>;
6
7
  additionalContextFields: {};
7
8
  onSetup(): Promise<void>;
8
9
  onDisconnect(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../subgraphs/document-editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI1D,qBAAa,sBAAuB,SAAQ,YAAY;IACtD,IAAI,SAAqB;IACzB,QAAQ,iCAAU;IAClB,SAAS,sBAAsB;IAC/B,uBAAuB,KAAM;IACvB,OAAO;IACP,YAAY;CACnB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../subgraphs/document-editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAI5C,qBAAa,sBAAuB,SAAQ,YAAY;IACtD,IAAI,SAAqB;IACzB,QAAQ,EAAE,YAAY,CAAU;IAChC,SAAS,0BAAsB;IAC/B,uBAAuB,KAAM;IACvB,OAAO;IACP,YAAY;CACnB"}
@@ -1,6 +1,6 @@
1
1
  import { BaseSubgraph } from "@powerhousedao/reactor-api";
2
- import { getResolvers } from "./resolvers.js";
3
2
  import { schema } from "./schema.js";
3
+ import { getResolvers } from "./resolvers.js";
4
4
  export class DocumentEditorSubgraph extends BaseSubgraph {
5
5
  name = "document-editor";
6
6
  typeDefs = schema;
@@ -1,3 +1,3 @@
1
1
  import type { BaseSubgraph } from "@powerhousedao/reactor-api";
2
- export declare const getResolvers: (subgraph: BaseSubgraph) => Record<string, any>;
2
+ export declare const getResolvers: (subgraph: BaseSubgraph) => Record<string, unknown>;
3
3
  //# sourceMappingURL=resolvers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/document-editor/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAW/D,eAAO,MAAM,YAAY,GAAI,UAAU,YAAY,KAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAwLvE,CAAC"}
1
+ {"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/document-editor/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAgB/D,eAAO,MAAM,YAAY,GACvB,UAAU,YAAY,KACrB,MAAM,CAAC,MAAM,EAAE,OAAO,CAoLxB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { addFile } from "document-drive";
2
2
  import { setName } from "document-model";
3
- import { actions } from "../../document-models/document-editor/index.js";
3
+ import { actions, documentEditorDocumentType, } from "@powerhousedao/vetra/document-models/document-editor";
4
4
  export const getResolvers = (subgraph) => {
5
5
  const reactor = subgraph.reactor;
6
6
  return {
@@ -23,12 +23,10 @@ export const getResolvers = (subgraph) => {
23
23
  driveId: driveId,
24
24
  ...doc,
25
25
  ...doc.header,
26
- // these will be ripped out in the future, but for now all doc models have global state
27
- // TODO (thegoldenmule): once the gql interface is updated for arbitrary state, we can remove this
28
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
29
- state: doc.state.global ?? {},
30
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
31
- stateJSON: doc.state.global ?? "{}",
26
+ created: doc.header.createdAtUtcIso,
27
+ lastModified: doc.header.lastModifiedAtUtcIso,
28
+ state: doc.state.global,
29
+ stateJSON: doc.state.global,
32
30
  revision: doc.header?.revision?.global ?? 0,
33
31
  };
34
32
  },
@@ -41,16 +39,14 @@ export const getResolvers = (subgraph) => {
41
39
  driveId: driveId,
42
40
  ...doc,
43
41
  ...doc.header,
44
- // these will be ripped out in the future, but for now all doc models have global state
45
- // TODO (thegoldenmule): once the gql interface is updated for arbitrary state, we can remove this
46
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
47
- state: doc.state.global ?? {},
48
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
49
- stateJSON: doc.state.global ?? "{}",
42
+ created: doc.header.createdAtUtcIso,
43
+ lastModified: doc.header.lastModifiedAtUtcIso,
44
+ state: doc.state.global,
45
+ stateJSON: doc.state.global,
50
46
  revision: doc.header?.revision?.global ?? 0,
51
47
  };
52
48
  }));
53
- return docs.filter((doc) => doc.header.documentType === "powerhouse/document-editor");
49
+ return docs.filter((doc) => doc.header.documentType === documentEditorDocumentType);
54
50
  },
55
51
  };
56
52
  },
@@ -58,12 +54,12 @@ export const getResolvers = (subgraph) => {
58
54
  Mutation: {
59
55
  DocumentEditor_createDocument: async (_, args) => {
60
56
  const { driveId, name } = args;
61
- const document = await reactor.addDocument("powerhouse/document-editor");
57
+ const document = await reactor.addDocument(documentEditorDocumentType);
62
58
  if (driveId) {
63
59
  await reactor.addAction(driveId, addFile({
64
60
  name,
65
61
  id: document.header.id,
66
- documentType: "powerhouse/document-editor",
62
+ documentType: documentEditorDocumentType,
67
63
  }));
68
64
  }
69
65
  if (name) {
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../subgraphs/document-editor/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,MAAM,EAAE,YA4EpB,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../subgraphs/document-editor/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,MAAM,EAAE,YAyDpB,CAAC"}
@@ -1,26 +1,7 @@
1
1
  import { gql } from "graphql-tag";
2
2
  export const schema = gql `
3
3
  """
4
- Subgraph definition for DocumentEditor (powerhouse/document-editor)
5
- """
6
- type DocumentEditorState {
7
- name: String!
8
- documentTypes: [DocumentTypeItem!]!
9
- status: StatusType!
10
- }
11
-
12
- type DocumentTypeItem {
13
- id: OID!
14
- documentType: String!
15
- }
16
-
17
- enum StatusType {
18
- DRAFT
19
- CONFIRMED
20
- }
21
-
22
- """
23
- Queries: DocumentEditor
4
+ Queries: DocumentEditor Document
24
5
  """
25
6
  type DocumentEditorQueries {
26
7
  getDocument(docId: PHID!, driveId: PHID): DocumentEditor
@@ -73,6 +54,6 @@ export const schema = gql `
73
54
  id: OID!
74
55
  }
75
56
  input DocumentEditor_SetEditorStatusInput {
76
- status: StatusType!
57
+ status: DocumentEditor_StatusType!
77
58
  }
78
59
  `;
@@ -1,7 +1,7 @@
1
- export * as DocumentEditorSubgraph from "./document-editor/index.js";
2
- export * as VetraPackageSubgraph from "./vetra-package/index.js";
3
- export * as SubgraphModuleSubgraph from "./subgraph-module/index.js";
4
- export * as ProcessorModuleSubgraph from "./processor-module/index.js";
5
1
  export * as AppModuleSubgraph from "./app-module/index.js";
2
+ export * as ProcessorModuleSubgraph from "./processor-module/index.js";
3
+ export * as SubgraphModuleSubgraph from "./subgraph-module/index.js";
4
+ export * as VetraPackageSubgraph from "./vetra-package/index.js";
6
5
  export * as VetraReadModelSubgraph from "./vetra-read-model/index.js";
6
+ export * as DocumentEditorSubgraph from "./document-editor/index.js";
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../subgraphs/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,sBAAsB,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,oBAAoB,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,sBAAsB,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,uBAAuB,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,iBAAiB,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,sBAAsB,MAAM,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../subgraphs/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,iBAAiB,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,uBAAuB,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,sBAAsB,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,oBAAoB,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,sBAAsB,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,sBAAsB,MAAM,4BAA4B,CAAC"}
@@ -1,6 +1,6 @@
1
- export * as DocumentEditorSubgraph from "./document-editor/index.js";
2
- export * as VetraPackageSubgraph from "./vetra-package/index.js";
3
- export * as SubgraphModuleSubgraph from "./subgraph-module/index.js";
4
- export * as ProcessorModuleSubgraph from "./processor-module/index.js";
5
1
  export * as AppModuleSubgraph from "./app-module/index.js";
2
+ export * as ProcessorModuleSubgraph from "./processor-module/index.js";
3
+ export * as SubgraphModuleSubgraph from "./subgraph-module/index.js";
4
+ export * as VetraPackageSubgraph from "./vetra-package/index.js";
6
5
  export * as VetraReadModelSubgraph from "./vetra-read-model/index.js";
6
+ export * as DocumentEditorSubgraph from "./document-editor/index.js";
@@ -2,7 +2,7 @@ import { BaseSubgraph } from "@powerhousedao/reactor-api";
2
2
  export declare class ProcessorModuleSubgraph extends BaseSubgraph {
3
3
  name: string;
4
4
  typeDefs: import("graphql").DocumentNode;
5
- resolvers: Record<string, any>;
5
+ resolvers: Record<string, unknown>;
6
6
  additionalContextFields: {};
7
7
  onSetup(): Promise<void>;
8
8
  onDisconnect(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../subgraphs/processor-module/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI1D,qBAAa,uBAAwB,SAAQ,YAAY;IACvD,IAAI,SAAsB;IAC1B,QAAQ,iCAAU;IAClB,SAAS,sBAAsB;IAC/B,uBAAuB,KAAM;IACvB,OAAO;IACP,YAAY;CACnB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../subgraphs/processor-module/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI1D,qBAAa,uBAAwB,SAAQ,YAAY;IACvD,IAAI,SAAsB;IAC1B,QAAQ,iCAAU;IAClB,SAAS,0BAAsB;IAC/B,uBAAuB,KAAM;IACvB,OAAO;IACP,YAAY;CACnB"}
@@ -1,3 +1,3 @@
1
1
  import type { BaseSubgraph } from "@powerhousedao/reactor-api";
2
- export declare const getResolvers: (subgraph: BaseSubgraph) => Record<string, any>;
2
+ export declare const getResolvers: (subgraph: BaseSubgraph) => Record<string, unknown>;
3
3
  //# sourceMappingURL=resolvers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/processor-module/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAY/D,eAAO,MAAM,YAAY,GAAI,UAAU,YAAY,KAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAkNvE,CAAC"}
1
+ {"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/processor-module/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAiB/D,eAAO,MAAM,YAAY,GACvB,UAAU,YAAY,KACrB,MAAM,CAAC,MAAM,EAAE,OAAO,CAgNxB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { addFile } from "document-drive";
2
2
  import { setName } from "document-model";
3
- import { actions } from "../../document-models/processor-module/index.js";
3
+ import { actions, processorModuleDocumentType, } from "@powerhousedao/vetra/document-models/processor-module";
4
4
  export const getResolvers = (subgraph) => {
5
5
  const reactor = subgraph.reactor;
6
6
  return {
@@ -23,12 +23,10 @@ export const getResolvers = (subgraph) => {
23
23
  driveId: driveId,
24
24
  ...doc,
25
25
  ...doc.header,
26
- // these will be ripped out in the future, but for now all doc models have global state
27
- // TODO (thegoldenmule): once the gql interface is updated for arbitrary state, we can remove this
28
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
29
- state: doc.state.global ?? {},
30
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
31
- stateJSON: doc.state.global ?? "{}",
26
+ created: doc.header.createdAtUtcIso,
27
+ lastModified: doc.header.lastModifiedAtUtcIso,
28
+ state: doc.state.global,
29
+ stateJSON: doc.state.global,
32
30
  revision: doc.header?.revision?.global ?? 0,
33
31
  };
34
32
  },
@@ -41,16 +39,14 @@ export const getResolvers = (subgraph) => {
41
39
  driveId: driveId,
42
40
  ...doc,
43
41
  ...doc.header,
44
- // these will be ripped out in the future, but for now all doc models have global state
45
- // TODO (thegoldenmule): once the gql interface is updated for arbitrary state, we can remove this
46
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
47
- state: doc.state.global ?? {},
48
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
49
- stateJSON: doc.state.global ?? "{}",
42
+ created: doc.header.createdAtUtcIso,
43
+ lastModified: doc.header.lastModifiedAtUtcIso,
44
+ state: doc.state.global,
45
+ stateJSON: doc.state.global,
50
46
  revision: doc.header?.revision?.global ?? 0,
51
47
  };
52
48
  }));
53
- return docs.filter((doc) => doc.header.documentType === "powerhouse/processor");
49
+ return docs.filter((doc) => doc.header.documentType === processorModuleDocumentType);
54
50
  },
55
51
  };
56
52
  },
@@ -58,12 +54,12 @@ export const getResolvers = (subgraph) => {
58
54
  Mutation: {
59
55
  ProcessorModule_createDocument: async (_, args) => {
60
56
  const { driveId, name } = args;
61
- const document = await reactor.addDocument("powerhouse/processor");
57
+ const document = await reactor.addDocument(processorModuleDocumentType);
62
58
  if (driveId) {
63
59
  await reactor.addAction(driveId, addFile({
64
60
  name,
65
61
  id: document.header.id,
66
- documentType: "powerhouse/processor",
62
+ documentType: processorModuleDocumentType,
67
63
  }));
68
64
  }
69
65
  if (name) {
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../subgraphs/processor-module/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,MAAM,EAAE,YAqFpB,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../subgraphs/processor-module/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,MAAM,EAAE,YAiEpB,CAAC"}
@@ -1,27 +1,7 @@
1
1
  import { gql } from "graphql-tag";
2
2
  export const schema = gql `
3
3
  """
4
- Subgraph definition for ProcessorModule (powerhouse/processor)
5
- """
6
- type ProcessorModuleState {
7
- name: String!
8
- type: String!
9
- documentTypes: [DocumentTypeItem!]!
10
- status: StatusType!
11
- }
12
-
13
- type DocumentTypeItem {
14
- id: OID!
15
- documentType: String!
16
- }
17
-
18
- enum StatusType {
19
- DRAFT
20
- CONFIRMED
21
- }
22
-
23
- """
24
- Queries: ProcessorModule
4
+ Queries: ProcessorModule Document
25
5
  """
26
6
  type ProcessorModuleQueries {
27
7
  getDocument(docId: PHID!, driveId: PHID): ProcessorModule
@@ -82,6 +62,6 @@ export const schema = gql `
82
62
  id: OID!
83
63
  }
84
64
  input ProcessorModule_SetProcessorStatusInput {
85
- status: StatusType!
65
+ status: ProcessorModule_StatusType!
86
66
  }
87
67
  `;
@@ -2,7 +2,7 @@ import { BaseSubgraph } from "@powerhousedao/reactor-api";
2
2
  export declare class SubgraphModuleSubgraph extends BaseSubgraph {
3
3
  name: string;
4
4
  typeDefs: import("graphql").DocumentNode;
5
- resolvers: Record<string, any>;
5
+ resolvers: Record<string, unknown>;
6
6
  additionalContextFields: {};
7
7
  onSetup(): Promise<void>;
8
8
  onDisconnect(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../subgraphs/subgraph-module/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI1D,qBAAa,sBAAuB,SAAQ,YAAY;IACtD,IAAI,SAAqB;IACzB,QAAQ,iCAAU;IAClB,SAAS,sBAAsB;IAC/B,uBAAuB,KAAM;IACvB,OAAO;IACP,YAAY;CACnB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../subgraphs/subgraph-module/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI1D,qBAAa,sBAAuB,SAAQ,YAAY;IACtD,IAAI,SAAqB;IACzB,QAAQ,iCAAU;IAClB,SAAS,0BAAsB;IAC/B,uBAAuB,KAAM;IACvB,OAAO;IACP,YAAY;CACnB"}
@@ -1,3 +1,3 @@
1
1
  import type { BaseSubgraph } from "@powerhousedao/reactor-api";
2
- export declare const getResolvers: (subgraph: BaseSubgraph) => Record<string, any>;
2
+ export declare const getResolvers: (subgraph: BaseSubgraph) => Record<string, unknown>;
3
3
  //# sourceMappingURL=resolvers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/subgraph-module/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAS/D,eAAO,MAAM,YAAY,GAAI,UAAU,YAAY,KAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CA0IvE,CAAC"}
1
+ {"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/subgraph-module/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAc/D,eAAO,MAAM,YAAY,GACvB,UAAU,YAAY,KACrB,MAAM,CAAC,MAAM,EAAE,OAAO,CAwIxB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { addFile } from "document-drive";
2
2
  import { setName } from "document-model";
3
- import { actions } from "../../document-models/subgraph-module/index.js";
3
+ import { actions, subgraphModuleDocumentType, } from "@powerhousedao/vetra/document-models/subgraph-module";
4
4
  export const getResolvers = (subgraph) => {
5
5
  const reactor = subgraph.reactor;
6
6
  return {
@@ -23,12 +23,10 @@ export const getResolvers = (subgraph) => {
23
23
  driveId: driveId,
24
24
  ...doc,
25
25
  ...doc.header,
26
- // these will be ripped out in the future, but for now all doc models have global state
27
- // TODO (thegoldenmule): once the gql interface is updated for arbitrary state, we can remove this
28
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
29
- state: doc.state.global ?? {},
30
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
31
- stateJSON: doc.state.global ?? "{}",
26
+ created: doc.header.createdAtUtcIso,
27
+ lastModified: doc.header.lastModifiedAtUtcIso,
28
+ state: doc.state.global,
29
+ stateJSON: doc.state.global,
32
30
  revision: doc.header?.revision?.global ?? 0,
33
31
  };
34
32
  },
@@ -41,16 +39,14 @@ export const getResolvers = (subgraph) => {
41
39
  driveId: driveId,
42
40
  ...doc,
43
41
  ...doc.header,
44
- // these will be ripped out in the future, but for now all doc models have global state
45
- // TODO (thegoldenmule): once the gql interface is updated for arbitrary state, we can remove this
46
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
47
- state: doc.state.global ?? {},
48
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
49
- stateJSON: doc.state.global ?? "{}",
42
+ created: doc.header.createdAtUtcIso,
43
+ lastModified: doc.header.lastModifiedAtUtcIso,
44
+ state: doc.state.global,
45
+ stateJSON: doc.state.global,
50
46
  revision: doc.header?.revision?.global ?? 0,
51
47
  };
52
48
  }));
53
- return docs.filter((doc) => doc.header.documentType === "powerhouse/subgraph");
49
+ return docs.filter((doc) => doc.header.documentType === subgraphModuleDocumentType);
54
50
  },
55
51
  };
56
52
  },
@@ -58,12 +54,12 @@ export const getResolvers = (subgraph) => {
58
54
  Mutation: {
59
55
  SubgraphModule_createDocument: async (_, args) => {
60
56
  const { driveId, name } = args;
61
- const document = await reactor.addDocument("powerhouse/subgraph");
57
+ const document = await reactor.addDocument(subgraphModuleDocumentType);
62
58
  if (driveId) {
63
59
  await reactor.addAction(driveId, addFile({
64
60
  name,
65
61
  id: document.header.id,
66
- documentType: "powerhouse/subgraph",
62
+ documentType: subgraphModuleDocumentType,
67
63
  }));
68
64
  }
69
65
  if (name) {
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../subgraphs/subgraph-module/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,MAAM,EAAE,YAqDpB,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../subgraphs/subgraph-module/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,MAAM,EAAE,YAwCpB,CAAC"}
@@ -1,20 +1,7 @@
1
1
  import { gql } from "graphql-tag";
2
2
  export const schema = gql `
3
3
  """
4
- Subgraph definition for SubgraphModule (powerhouse/subgraph)
5
- """
6
- type SubgraphModuleState {
7
- name: String!
8
- status: StatusType!
9
- }
10
-
11
- enum StatusType {
12
- DRAFT
13
- CONFIRMED
14
- }
15
-
16
- """
17
- Queries: SubgraphModule
4
+ Queries: SubgraphModule Document
18
5
  """
19
6
  type SubgraphModuleQueries {
20
7
  getDocument(docId: PHID!, driveId: PHID): SubgraphModule
@@ -50,6 +37,6 @@ export const schema = gql `
50
37
  name: String!
51
38
  }
52
39
  input SubgraphModule_SetSubgraphStatusInput {
53
- status: StatusType!
40
+ status: SubgraphModule_StatusType!
54
41
  }
55
42
  `;
@@ -2,7 +2,7 @@ import { BaseSubgraph } from "@powerhousedao/reactor-api";
2
2
  export declare class VetraPackageSubgraph extends BaseSubgraph {
3
3
  name: string;
4
4
  typeDefs: import("graphql").DocumentNode;
5
- resolvers: Record<string, any>;
5
+ resolvers: Record<string, unknown>;
6
6
  additionalContextFields: {};
7
7
  onSetup(): Promise<void>;
8
8
  onDisconnect(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../subgraphs/vetra-package/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAK1D,qBAAa,oBAAqB,SAAQ,YAAY;IACpD,IAAI,SAAmB;IAEvB,QAAQ,iCAAU;IAClB,SAAS,sBAAsB;IAC/B,uBAAuB,KAAM;IACvB,OAAO;IACP,YAAY;CACnB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../subgraphs/vetra-package/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAK1D,qBAAa,oBAAqB,SAAQ,YAAY;IACpD,IAAI,SAAmB;IAEvB,QAAQ,iCAAU;IAClB,SAAS,0BAAsB;IAC/B,uBAAuB,KAAM;IACvB,OAAO;IACP,YAAY;CACnB"}
@@ -1,3 +1,3 @@
1
1
  import type { BaseSubgraph } from "@powerhousedao/reactor-api";
2
- export declare const getResolvers: (subgraph: BaseSubgraph) => Record<string, any>;
2
+ export declare const getResolvers: (subgraph: BaseSubgraph) => Record<string, unknown>;
3
3
  //# sourceMappingURL=resolvers.d.ts.map