@powerhousedao/vetra 5.1.0-dev.20 → 5.1.0-dev.22

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 (50) hide show
  1. package/dist/document-models/app-module/src/tests/base-operations.test.js +52 -1
  2. package/dist/document-models/document-editor/src/tests/base-operations.test.js +42 -1
  3. package/dist/document-models/processor-module/src/tests/base-operations.test.js +52 -1
  4. package/dist/document-models/subgraph-module/src/tests/base-operations.test.js +22 -1
  5. package/dist/document-models/vetra-package/src/tests/base-operations.test.js +127 -28
  6. package/dist/processors/codegen/__tests__/codegen-processor-e2e.test.js +53 -41
  7. package/dist/processors/codegen/document-handlers/generators/app-generator.js +2 -2
  8. package/dist/processors/codegen/document-handlers/generators/constants.d.ts +1 -1
  9. package/dist/processors/codegen/document-handlers/generators/constants.d.ts.map +1 -1
  10. package/dist/processors/codegen/document-handlers/generators/constants.js +1 -1
  11. package/dist/processors/codegen/document-handlers/generators/document-editor-generator.js +2 -2
  12. package/dist/processors/codegen/document-handlers/generators/document-model-generator.js +2 -2
  13. package/dist/subgraphs/app-module/resolvers.d.ts.map +1 -1
  14. package/dist/subgraphs/app-module/resolvers.js +4 -4
  15. package/dist/subgraphs/app-module/schema.d.ts.map +1 -1
  16. package/dist/subgraphs/app-module/schema.js +2 -17
  17. package/dist/subgraphs/document-editor/index.d.ts +3 -2
  18. package/dist/subgraphs/document-editor/index.d.ts.map +1 -1
  19. package/dist/subgraphs/document-editor/index.js +1 -1
  20. package/dist/subgraphs/document-editor/resolvers.d.ts +1 -1
  21. package/dist/subgraphs/document-editor/resolvers.d.ts.map +1 -1
  22. package/dist/subgraphs/document-editor/resolvers.js +12 -16
  23. package/dist/subgraphs/document-editor/schema.d.ts.map +1 -1
  24. package/dist/subgraphs/document-editor/schema.js +2 -21
  25. package/dist/subgraphs/index.d.ts +4 -4
  26. package/dist/subgraphs/index.d.ts.map +1 -1
  27. package/dist/subgraphs/index.js +4 -4
  28. package/dist/subgraphs/processor-module/index.d.ts +1 -1
  29. package/dist/subgraphs/processor-module/index.d.ts.map +1 -1
  30. package/dist/subgraphs/processor-module/resolvers.d.ts +1 -1
  31. package/dist/subgraphs/processor-module/resolvers.d.ts.map +1 -1
  32. package/dist/subgraphs/processor-module/resolvers.js +12 -16
  33. package/dist/subgraphs/processor-module/schema.d.ts.map +1 -1
  34. package/dist/subgraphs/processor-module/schema.js +2 -22
  35. package/dist/subgraphs/subgraph-module/index.d.ts +1 -1
  36. package/dist/subgraphs/subgraph-module/index.d.ts.map +1 -1
  37. package/dist/subgraphs/subgraph-module/resolvers.d.ts +1 -1
  38. package/dist/subgraphs/subgraph-module/resolvers.d.ts.map +1 -1
  39. package/dist/subgraphs/subgraph-module/resolvers.js +12 -16
  40. package/dist/subgraphs/subgraph-module/schema.d.ts.map +1 -1
  41. package/dist/subgraphs/subgraph-module/schema.js +2 -15
  42. package/dist/subgraphs/vetra-package/index.d.ts +1 -1
  43. package/dist/subgraphs/vetra-package/index.d.ts.map +1 -1
  44. package/dist/subgraphs/vetra-package/resolvers.d.ts +1 -1
  45. package/dist/subgraphs/vetra-package/resolvers.d.ts.map +1 -1
  46. package/dist/subgraphs/vetra-package/resolvers.js +137 -94
  47. package/dist/subgraphs/vetra-package/schema.d.ts.map +1 -1
  48. package/dist/subgraphs/vetra-package/schema.js +3 -26
  49. package/dist/tsconfig.tsbuildinfo +1 -1
  50. package/package.json +14 -14
@@ -1,6 +1,6 @@
1
1
  import path from "path";
2
2
  import { beforeEach, describe, expect, it, vi } from "vitest";
3
- import { LEGACY, USE_VERSIONING, } from "../document-handlers/generators/constants.js";
3
+ import { USE_TS_MORPH, USE_VERSIONING, } from "../document-handlers/generators/constants.js";
4
4
  import { CodegenProcessor } from "../index.js";
5
5
  const defaultManifest = {
6
6
  name: "",
@@ -106,28 +106,35 @@ describe("CodegenProcessor E2E Tests", () => {
106
106
  await processor.onStrands([strand]);
107
107
  // Advance timers to trigger debounced generation
108
108
  await vi.runAllTimersAsync();
109
- expect(generateEditor).toHaveBeenCalledWith({
110
- name: "Test Editor",
111
- documentTypes: [
112
- "powerhouse/document-model",
113
- "powerhouse/budget-statement",
114
- ],
115
- config: mockConfig.PH_CONFIG,
116
- editorId: "test-editor",
117
- legacy: LEGACY,
118
- });
119
- expect(generateManifest).toHaveBeenCalledWith({
120
- editors: [
121
- {
122
- id: "test-editor",
123
- name: "Test Editor",
124
- documentTypes: [
125
- "powerhouse/document-model",
126
- "powerhouse/budget-statement",
127
- ],
128
- },
129
- ],
130
- }, mockConfig.CURRENT_WORKING_DIR);
109
+ const generateEditorArgs = [
110
+ {
111
+ name: "Test Editor",
112
+ documentTypes: [
113
+ "powerhouse/document-model",
114
+ "powerhouse/budget-statement",
115
+ ],
116
+ config: mockConfig.PH_CONFIG,
117
+ editorId: "test-editor",
118
+ useTsMorph: USE_TS_MORPH,
119
+ },
120
+ ];
121
+ expect(generateEditor).toHaveBeenCalledWith(...generateEditorArgs);
122
+ const generateManifestArgs = [
123
+ {
124
+ editors: [
125
+ {
126
+ id: "test-editor",
127
+ name: "Test Editor",
128
+ documentTypes: [
129
+ "powerhouse/document-model",
130
+ "powerhouse/budget-statement",
131
+ ],
132
+ },
133
+ ],
134
+ },
135
+ mockConfig.CURRENT_WORKING_DIR,
136
+ ];
137
+ expect(generateManifest).toHaveBeenCalledWith(...generateManifestArgs);
131
138
  });
132
139
  it("should not call codegen functions for invalid document-editor strand (missing name)", async () => {
133
140
  const { generateEditor, generateManifest } = await import("@powerhousedao/codegen");
@@ -199,13 +206,15 @@ describe("CodegenProcessor E2E Tests", () => {
199
206
  };
200
207
  await processor.onStrands([strand]);
201
208
  await vi.runAllTimersAsync();
202
- const generateFromDocumentArgs = {
203
- legacy: LEGACY,
204
- useVersioning: USE_VERSIONING,
205
- documentModelState: validState,
206
- config: mockConfig.PH_CONFIG,
207
- };
208
- expect(generateFromDocument).toHaveBeenCalledWith(generateFromDocumentArgs);
209
+ const generateFromDocumentArgs = [
210
+ {
211
+ useTsMorph: USE_TS_MORPH,
212
+ useVersioning: USE_VERSIONING,
213
+ documentModelState: validState,
214
+ config: mockConfig.PH_CONFIG,
215
+ },
216
+ ];
217
+ expect(generateFromDocument).toHaveBeenCalledWith(...generateFromDocumentArgs);
209
218
  expect(generateSubgraphFromDocumentModel).toHaveBeenCalledWith("Test Model", validState, mockConfig.PH_CONFIG, { verbose: false });
210
219
  expect(generateManifest).toHaveBeenCalledWith({
211
220
  documentModels: [
@@ -356,14 +365,17 @@ describe("CodegenProcessor E2E Tests", () => {
356
365
  };
357
366
  await processor.onStrands([strand]);
358
367
  await vi.runAllTimersAsync();
359
- expect(generateDriveEditor).toHaveBeenCalledWith({
360
- name: "Test App",
361
- config: mockConfig.PH_CONFIG,
362
- appId: "test-app",
363
- allowedDocumentTypes: "",
364
- isDragAndDropEnabled: false,
365
- legacy: LEGACY,
366
- });
368
+ const generateDriveEditorArgs = [
369
+ {
370
+ name: "Test App",
371
+ config: mockConfig.PH_CONFIG,
372
+ appId: "test-app",
373
+ allowedDocumentTypes: "",
374
+ isDragAndDropEnabled: false,
375
+ useTsMorph: USE_TS_MORPH,
376
+ },
377
+ ];
378
+ expect(generateDriveEditor).toHaveBeenCalledWith(...generateDriveEditorArgs);
367
379
  expect(generateManifest).toHaveBeenCalledWith({
368
380
  apps: [
369
381
  {
@@ -398,7 +410,7 @@ describe("CodegenProcessor E2E Tests", () => {
398
410
  appId: "test-app",
399
411
  allowedDocumentTypes: "powerhouse/document-model,powerhouse/budget-statement",
400
412
  isDragAndDropEnabled: true,
401
- legacy: LEGACY,
413
+ useTsMorph: USE_TS_MORPH,
402
414
  });
403
415
  expect(generateManifest).toHaveBeenCalled();
404
416
  });
@@ -550,7 +562,7 @@ describe("CodegenProcessor E2E Tests", () => {
550
562
  documentTypes: ["powerhouse/document-model"],
551
563
  config: mockConfig.PH_CONFIG,
552
564
  editorId: "test-editor",
553
- legacy: LEGACY,
565
+ useTsMorph: USE_TS_MORPH,
554
566
  });
555
567
  expect(generateSubgraph).toHaveBeenCalledWith("Test Subgraph", null, mockConfig.PH_CONFIG);
556
568
  // generateManifest should be called twice (once for each strand)
@@ -589,7 +601,7 @@ describe("CodegenProcessor E2E Tests", () => {
589
601
  documentTypes: ["powerhouse/document-model"],
590
602
  config: mockConfig.PH_CONFIG,
591
603
  editorId: "test-editor",
592
- legacy: LEGACY,
604
+ useTsMorph: USE_TS_MORPH,
593
605
  });
594
606
  // Invalid strand should NOT be processed
595
607
  expect(generateSubgraph).not.toHaveBeenCalled();
@@ -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,3 +1,3 @@
1
- export declare const LEGACY = true;
1
+ export declare const USE_TS_MORPH = true;
2
2
  export declare const USE_VERSIONING = false;
3
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;AAC3B,eAAO,MAAM,cAAc,QAAQ,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,2 +1,2 @@
1
- export const LEGACY = true;
1
+ export const USE_TS_MORPH = true;
2
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,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, USE_VERSIONING } 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
@@ -41,7 +41,7 @@ export class DocumentModelGenerator extends BaseDocumentGen {
41
41
  await generateFromDocument({
42
42
  documentModelState: state,
43
43
  config: this.config.PH_CONFIG,
44
- legacy: LEGACY,
44
+ useTsMorph: USE_TS_MORPH,
45
45
  useVersioning: USE_VERSIONING,
46
46
  });
47
47
  await generateSubgraphFromDocumentModel(state.name, state, this.config.PH_CONFIG, { verbose: false });
@@ -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"}