@powerhousedao/vetra-builder-package 0.0.3 → 0.0.5

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.
@@ -2,17 +2,17 @@
2
2
  * This file aggregates all processor factories
3
3
  * Auto-generated by codegen - DO NOT EDIT MANUALLY
4
4
  */
5
- // Import processor factories here as they are generated
5
+ // Import other processor factories here as they are generated
6
6
  import { vetraReadModelProcessorFactory } from "./vetra-read-model/factory.js";
7
7
  export const processorFactory = (module) => {
8
8
  // Initialize all processor factories once with the module
9
9
  const factories = [];
10
- // Add processors here as they are generated
10
+ // Add other processors here as they are generated
11
11
  factories.push(vetraReadModelProcessorFactory(module));
12
12
  // Return the inner function that will be called for each drive
13
13
  return async (driveHeader) => {
14
14
  const processors = [];
15
- // Call each cached factory with the driveHeader
15
+ // Call each cached factory with the driveId
16
16
  for (const factory of factories) {
17
17
  const factoryProcessors = await factory(driveHeader);
18
18
  processors.push(...factoryProcessors);
@@ -1,3 +1,3 @@
1
- export {};
2
1
  export { VetraReadModelProcessor } from "./vetra-read-model/index.js";
2
+ export { vetraReadModelProcessorFactory } from "./vetra-read-model/factory.js";
3
3
  export { processorFactory } from "./factory.js";
@@ -1,2 +1,3 @@
1
1
  export { VetraReadModelProcessor } from "./vetra-read-model/index.js";
2
+ export { vetraReadModelProcessorFactory } from "./vetra-read-model/factory.js";
2
3
  export { processorFactory } from "./factory.js";
@@ -1,6 +1,6 @@
1
1
  import { RelationalDbProcessor } from "document-drive/processors/relational";
2
- import { up } from "./migrations.js";
3
2
  import { generateId } from "document-model";
3
+ import { up } from "./migrations.js";
4
4
  export class VetraReadModelProcessor extends RelationalDbProcessor {
5
5
  static getNamespace(driveId) {
6
6
  // Default namespace: `${this.name}_${driveId.replaceAll("-", "_")}`
@@ -4,8 +4,8 @@ export const getResolvers = (subgraph) => {
4
4
  const db = subgraph.relationalDb;
5
5
  return {
6
6
  Query: {
7
- fetchAllBuilderAccounts: async (parent, args, context) => {
8
- const driveId = context.driveId || "default";
7
+ fetchAllBuilderAccounts: async (parent, args) => {
8
+ const driveId = args.driveId || "powerhouse";
9
9
  const accounts = await VetraReadModelProcessor.query(driveId, db)
10
10
  .selectFrom("builder_accounts")
11
11
  .selectAll()
@@ -25,8 +25,8 @@ export const getResolvers = (subgraph) => {
25
25
  members: [], // Will be resolved by field resolver
26
26
  }));
27
27
  },
28
- fetchBuilderAccount: async (parent, args, context) => {
29
- const driveId = context.driveId || "default";
28
+ fetchBuilderAccount: async (parent, args) => {
29
+ const driveId = args.driveId || "powerhouse";
30
30
  const account = await VetraReadModelProcessor.query(driveId, db)
31
31
  .selectFrom("builder_accounts")
32
32
  .selectAll()
@@ -63,7 +63,7 @@ export const schema = gql `
63
63
 
64
64
  type Query {
65
65
  example(driveId: String!): String
66
- fetchAllBuilderAccounts: [BuilderAccountType!]!
67
- fetchBuilderAccount(id: String!): BuilderAccountType
66
+ fetchAllBuilderAccounts(driveId: String): [BuilderAccountType!]!
67
+ fetchBuilderAccount(driveId: String, id: String!): BuilderAccountType
68
68
  }
69
69
  `;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@powerhousedao/vetra-builder-package",
3
3
  "description": "",
4
- "version": "0.0.3",
4
+ "version": "0.0.5",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",
7
7
  "files": [