@powerhousedao/vetra-builder-package 0.0.17 → 0.0.19

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 (190) hide show
  1. package/dist/document-models/builder-account/gen/document-model.js +1 -1
  2. package/dist/document-models/builder-account/gen/profile/actions.d.ts +5 -5
  3. package/dist/document-models/builder-account/gen/profile/creators.d.ts +3 -3
  4. package/dist/document-models/builder-account/gen/profile/creators.js +1 -1
  5. package/dist/document-models/builder-account/gen/profile/object.d.ts +2 -2
  6. package/dist/document-models/builder-account/gen/profile/object.js +3 -3
  7. package/dist/document-models/builder-account/gen/profile/operations.d.ts +2 -2
  8. package/dist/document-models/builder-account/gen/reducer.js +3 -3
  9. package/dist/document-models/builder-account/gen/schema/types.d.ts +1 -1
  10. package/dist/document-models/builder-account/gen/schema/zod.js +1 -1
  11. package/dist/document-models/builder-account/index.d.ts +1 -1
  12. package/dist/document-models/builder-account/src/reducers/profile.js +4 -0
  13. package/dist/document-models/builder-team/gen/actions.d.ts +9 -0
  14. package/dist/document-models/builder-team/gen/actions.js +4 -0
  15. package/dist/document-models/builder-team/gen/creators.d.ts +4 -0
  16. package/dist/document-models/builder-team/gen/creators.js +4 -0
  17. package/dist/document-models/builder-team/gen/document-model.d.ts +2 -0
  18. package/dist/document-models/builder-team/gen/document-model.js +212 -0
  19. package/dist/document-models/builder-team/gen/index.d.ts +7 -0
  20. package/dist/document-models/builder-team/gen/index.js +6 -0
  21. package/dist/document-models/builder-team/gen/member/actions.d.ts +15 -0
  22. package/dist/document-models/builder-team/gen/member/actions.js +1 -0
  23. package/dist/document-models/builder-team/gen/member/creators.d.ts +5 -0
  24. package/dist/document-models/builder-team/gen/member/creators.js +5 -0
  25. package/dist/document-models/builder-team/gen/member/error.d.ts +1 -0
  26. package/dist/document-models/builder-team/gen/member/error.js +1 -0
  27. package/dist/document-models/builder-team/gen/member/object.d.ts +8 -0
  28. package/dist/document-models/builder-team/gen/member/object.js +13 -0
  29. package/dist/document-models/builder-team/gen/member/operations.d.ts +8 -0
  30. package/dist/document-models/builder-team/gen/member/operations.js +1 -0
  31. package/dist/document-models/builder-team/gen/object.d.ts +20 -0
  32. package/dist/document-models/builder-team/gen/object.js +36 -0
  33. package/dist/document-models/builder-team/gen/packages/actions.d.ts +15 -0
  34. package/dist/document-models/builder-team/gen/packages/actions.js +1 -0
  35. package/dist/document-models/builder-team/gen/packages/creators.d.ts +5 -0
  36. package/dist/document-models/builder-team/gen/packages/creators.js +5 -0
  37. package/dist/document-models/builder-team/gen/packages/error.d.ts +1 -0
  38. package/dist/document-models/builder-team/gen/packages/error.js +1 -0
  39. package/dist/document-models/builder-team/gen/packages/object.d.ts +8 -0
  40. package/dist/document-models/builder-team/gen/packages/object.js +13 -0
  41. package/dist/document-models/builder-team/gen/packages/operations.d.ts +8 -0
  42. package/dist/document-models/builder-team/gen/packages/operations.js +1 -0
  43. package/dist/document-models/builder-team/gen/ph-factories.d.ts +26 -0
  44. package/dist/document-models/builder-team/gen/ph-factories.js +62 -0
  45. package/dist/document-models/builder-team/gen/profile/actions.d.ts +23 -0
  46. package/dist/document-models/builder-team/gen/profile/actions.js +1 -0
  47. package/dist/document-models/builder-team/gen/profile/creators.d.ts +7 -0
  48. package/dist/document-models/builder-team/gen/profile/creators.js +7 -0
  49. package/dist/document-models/builder-team/gen/profile/error.d.ts +1 -0
  50. package/dist/document-models/builder-team/gen/profile/error.js +1 -0
  51. package/dist/document-models/builder-team/gen/profile/object.d.ts +10 -0
  52. package/dist/document-models/builder-team/gen/profile/object.js +19 -0
  53. package/dist/document-models/builder-team/gen/profile/operations.d.ts +10 -0
  54. package/dist/document-models/builder-team/gen/profile/operations.js +1 -0
  55. package/dist/document-models/builder-team/gen/reducer.d.ts +4 -0
  56. package/dist/document-models/builder-team/gen/reducer.js +75 -0
  57. package/dist/document-models/builder-team/gen/schema/index.d.ts +2 -0
  58. package/dist/document-models/builder-team/gen/schema/index.js +2 -0
  59. package/dist/document-models/builder-team/gen/schema/types.d.ts +247 -0
  60. package/dist/document-models/builder-team/gen/schema/types.js +1 -0
  61. package/dist/document-models/builder-team/gen/schema/zod.d.ts +29 -0
  62. package/dist/document-models/builder-team/gen/schema/zod.js +148 -0
  63. package/dist/document-models/builder-team/gen/spaces/actions.d.ts +15 -0
  64. package/dist/document-models/builder-team/gen/spaces/actions.js +1 -0
  65. package/dist/document-models/builder-team/gen/spaces/creators.d.ts +5 -0
  66. package/dist/document-models/builder-team/gen/spaces/creators.js +5 -0
  67. package/dist/document-models/builder-team/gen/spaces/error.d.ts +1 -0
  68. package/dist/document-models/builder-team/gen/spaces/error.js +1 -0
  69. package/dist/document-models/builder-team/gen/spaces/object.d.ts +8 -0
  70. package/dist/document-models/builder-team/gen/spaces/object.js +13 -0
  71. package/dist/document-models/builder-team/gen/spaces/operations.d.ts +8 -0
  72. package/dist/document-models/builder-team/gen/spaces/operations.js +1 -0
  73. package/dist/document-models/builder-team/gen/types.d.ts +9 -0
  74. package/dist/document-models/builder-team/gen/types.js +1 -0
  75. package/dist/document-models/builder-team/gen/utils.d.ts +21 -0
  76. package/dist/document-models/builder-team/gen/utils.js +54 -0
  77. package/dist/document-models/builder-team/index.d.ts +37 -0
  78. package/dist/document-models/builder-team/index.js +21 -0
  79. package/dist/document-models/builder-team/src/reducers/member.d.ts +2 -0
  80. package/dist/document-models/builder-team/src/reducers/member.js +30 -0
  81. package/dist/document-models/builder-team/src/reducers/packages.d.ts +2 -0
  82. package/dist/document-models/builder-team/src/reducers/packages.js +40 -0
  83. package/dist/document-models/builder-team/src/reducers/profile.d.ts +2 -0
  84. package/dist/document-models/builder-team/src/reducers/profile.js +26 -0
  85. package/dist/document-models/builder-team/src/reducers/spaces.d.ts +2 -0
  86. package/dist/document-models/builder-team/src/reducers/spaces.js +34 -0
  87. package/dist/document-models/builder-team/src/tests/document-model.test.d.ts +5 -0
  88. package/dist/document-models/builder-team/src/tests/document-model.test.js +18 -0
  89. package/dist/document-models/builder-team/src/tests/member.test.d.ts +5 -0
  90. package/dist/document-models/builder-team/src/tests/member.test.js +40 -0
  91. package/dist/document-models/builder-team/src/tests/packages.test.d.ts +5 -0
  92. package/dist/document-models/builder-team/src/tests/packages.test.js +40 -0
  93. package/dist/document-models/builder-team/src/tests/profile.test.d.ts +5 -0
  94. package/dist/document-models/builder-team/src/tests/profile.test.js +56 -0
  95. package/dist/document-models/builder-team/src/tests/spaces.test.d.ts +5 -0
  96. package/dist/document-models/builder-team/src/tests/spaces.test.js +40 -0
  97. package/dist/document-models/builder-team/src/utils.d.ts +1 -0
  98. package/dist/document-models/builder-team/src/utils.js +1 -0
  99. package/dist/document-models/index.d.ts +1 -1
  100. package/dist/document-models/index.js +1 -1
  101. package/dist/editors/builder-team-editor/components/Header.d.ts +8 -0
  102. package/dist/editors/builder-team-editor/components/Header.js +5 -0
  103. package/dist/editors/builder-team-editor/components/MembersSection.d.ts +14 -0
  104. package/dist/editors/builder-team-editor/components/MembersSection.js +152 -0
  105. package/dist/editors/builder-team-editor/components/PackageForm.d.ts +8 -0
  106. package/dist/editors/builder-team-editor/components/PackageForm.js +92 -0
  107. package/dist/editors/builder-team-editor/components/PackageItem.d.ts +11 -0
  108. package/dist/editors/builder-team-editor/components/PackageItem.js +99 -0
  109. package/dist/editors/builder-team-editor/components/ProfileSection.d.ts +17 -0
  110. package/dist/editors/builder-team-editor/components/ProfileSection.js +5 -0
  111. package/dist/editors/builder-team-editor/components/QuickStats.d.ts +7 -0
  112. package/dist/editors/builder-team-editor/components/QuickStats.js +5 -0
  113. package/dist/editors/builder-team-editor/components/SpaceForm.d.ts +9 -0
  114. package/dist/editors/builder-team-editor/components/SpaceForm.js +11 -0
  115. package/dist/editors/builder-team-editor/components/SpaceItem.d.ts +21 -0
  116. package/dist/editors/builder-team-editor/components/SpaceItem.js +12 -0
  117. package/dist/editors/builder-team-editor/components/SpacesSection.d.ts +22 -0
  118. package/dist/editors/builder-team-editor/components/SpacesSection.js +14 -0
  119. package/dist/editors/builder-team-editor/config.d.ts +6 -0
  120. package/dist/editors/builder-team-editor/config.js +11 -0
  121. package/dist/editors/builder-team-editor/editor.d.ts +3 -0
  122. package/dist/editors/builder-team-editor/editor.js +73 -0
  123. package/dist/editors/builder-team-editor/hooks/useMemberHandlers.d.ts +12 -0
  124. package/dist/editors/builder-team-editor/hooks/useMemberHandlers.js +27 -0
  125. package/dist/editors/builder-team-editor/hooks/usePackageHandlers.d.ts +11 -0
  126. package/dist/editors/builder-team-editor/hooks/usePackageHandlers.js +49 -0
  127. package/dist/editors/builder-team-editor/hooks/useProfileHandlers.d.ts +14 -0
  128. package/dist/editors/builder-team-editor/hooks/useProfileHandlers.js +38 -0
  129. package/dist/editors/builder-team-editor/hooks/useSpaceHandlers.d.ts +15 -0
  130. package/dist/editors/builder-team-editor/hooks/useSpaceHandlers.js +82 -0
  131. package/dist/editors/builder-team-editor/index.d.ts +2 -0
  132. package/dist/editors/builder-team-editor/index.js +11 -0
  133. package/dist/editors/hooks/useBuilderTeamDocument.d.ts +3 -0
  134. package/dist/editors/hooks/useBuilderTeamDocument.js +8 -0
  135. package/dist/editors/index.d.ts +1 -1
  136. package/dist/editors/index.js +1 -1
  137. package/dist/index.d.ts +1 -1
  138. package/dist/powerhouse.manifest.json +21 -6
  139. package/dist/processors/factory.d.ts +0 -4
  140. package/dist/processors/factory.js +3 -3
  141. package/dist/processors/index.d.ts +2 -2
  142. package/dist/processors/index.js +2 -2
  143. package/dist/processors/old_vetra-builder-relational-db-processor/factory.d.ts +3 -0
  144. package/dist/processors/old_vetra-builder-relational-db-processor/factory.js +22 -0
  145. package/dist/processors/old_vetra-builder-relational-db-processor/index.d.ts +9 -0
  146. package/dist/processors/old_vetra-builder-relational-db-processor/index.js +32 -0
  147. package/dist/processors/old_vetra-builder-relational-db-processor/migrations.d.ts +3 -0
  148. package/dist/processors/old_vetra-builder-relational-db-processor/migrations.js +14 -0
  149. package/dist/processors/old_vetra-builder-relational-db-processor/schema.d.ts +7 -0
  150. package/dist/processors/old_vetra-builder-relational-db-processor/schema.js +1 -0
  151. package/dist/processors/vetra-builder-relational-db-processor/builder-team-handlers.d.ts +22 -0
  152. package/dist/processors/vetra-builder-relational-db-processor/builder-team-handlers.js +261 -0
  153. package/dist/processors/vetra-builder-relational-db-processor/database-helpers.d.ts +39 -0
  154. package/dist/processors/vetra-builder-relational-db-processor/database-helpers.js +144 -0
  155. package/dist/processors/vetra-builder-relational-db-processor/factory.d.ts +3 -0
  156. package/dist/processors/vetra-builder-relational-db-processor/factory.js +23 -0
  157. package/dist/processors/vetra-builder-relational-db-processor/index.d.ts +13 -0
  158. package/dist/processors/vetra-builder-relational-db-processor/index.js +53 -0
  159. package/dist/processors/vetra-builder-relational-db-processor/migrations.d.ts +3 -0
  160. package/dist/processors/vetra-builder-relational-db-processor/migrations.js +155 -0
  161. package/dist/processors/vetra-builder-relational-db-processor/schema.d.ts +66 -0
  162. package/dist/processors/vetra-builder-relational-db-processor/schema.js +1 -0
  163. package/dist/processors/vetra-builder-relational-db-processor/types.d.ts +32 -0
  164. package/dist/processors/vetra-builder-relational-db-processor/types.js +1 -0
  165. package/dist/style.css +36 -28
  166. package/dist/subgraphs/builder-account/resolvers.js +3 -3
  167. package/dist/subgraphs/builder-account/schema.js +4 -4
  168. package/dist/subgraphs/builder-team/index.d.ts +10 -0
  169. package/dist/subgraphs/builder-team/index.js +11 -0
  170. package/dist/subgraphs/builder-team/resolvers.d.ts +2 -0
  171. package/dist/subgraphs/builder-team/resolvers.js +240 -0
  172. package/dist/subgraphs/builder-team/schema.d.ts +2 -0
  173. package/dist/subgraphs/builder-team/schema.js +228 -0
  174. package/dist/subgraphs/index.d.ts +2 -2
  175. package/dist/subgraphs/index.js +3 -2
  176. package/dist/subgraphs/vetra-builders/index.d.ts +10 -0
  177. package/dist/subgraphs/vetra-builders/index.js +11 -0
  178. package/dist/subgraphs/vetra-builders/resolvers.d.ts +2 -0
  179. package/dist/subgraphs/vetra-builders/resolvers.js +144 -0
  180. package/dist/subgraphs/vetra-builders/schema.d.ts +2 -0
  181. package/dist/subgraphs/vetra-builders/schema.js +79 -0
  182. package/dist/subgraphs/vetra-builders-bkp/index.d.ts +10 -0
  183. package/dist/subgraphs/vetra-builders-bkp/index.js +11 -0
  184. package/dist/subgraphs/vetra-builders-bkp/resolvers.d.ts +2 -0
  185. package/dist/subgraphs/vetra-builders-bkp/resolvers.js +10 -0
  186. package/dist/subgraphs/vetra-builders-bkp/schema.d.ts +2 -0
  187. package/dist/subgraphs/vetra-builders-bkp/schema.js +9 -0
  188. package/dist/utils/nano-id.d.ts +1 -0
  189. package/dist/utils/nano-id.js +4 -0
  190. package/package.json +4 -2
@@ -0,0 +1,240 @@
1
+ import { addFile } from "document-drive";
2
+ import { actions, } from "../../document-models/builder-team/index.js";
3
+ import { setName } from "document-model";
4
+ export const getResolvers = (subgraph) => {
5
+ const reactor = subgraph.reactor;
6
+ return {
7
+ Query: {
8
+ BuilderTeam: async () => {
9
+ return {
10
+ getDocument: async (args) => {
11
+ const { docId, driveId } = args;
12
+ if (!docId) {
13
+ throw new Error("Document id is required");
14
+ }
15
+ if (driveId) {
16
+ const docIds = await reactor.getDocuments(driveId);
17
+ if (!docIds.includes(docId)) {
18
+ throw new Error(`Document with id ${docId} is not part of ${driveId}`);
19
+ }
20
+ }
21
+ const doc = await reactor.getDocument(docId);
22
+ return {
23
+ driveId: driveId,
24
+ ...doc,
25
+ ...doc.header,
26
+ created: doc.header.createdAtUtcIso,
27
+ lastModified: doc.header.lastModifiedAtUtcIso,
28
+ state: doc.state.global,
29
+ stateJSON: doc.state.global,
30
+ revision: doc.header?.revision?.global ?? 0,
31
+ };
32
+ },
33
+ getDocuments: async (args) => {
34
+ const { driveId } = args;
35
+ const docsIds = await reactor.getDocuments(driveId);
36
+ const docs = await Promise.all(docsIds.map(async (docId) => {
37
+ const doc = await reactor.getDocument(docId);
38
+ return {
39
+ driveId: driveId,
40
+ ...doc,
41
+ ...doc.header,
42
+ created: doc.header.createdAtUtcIso,
43
+ lastModified: doc.header.lastModifiedAtUtcIso,
44
+ state: doc.state.global,
45
+ stateJSON: doc.state.global,
46
+ revision: doc.header?.revision?.global ?? 0,
47
+ };
48
+ }));
49
+ return docs.filter((doc) => doc.header.documentType === "powerhouse/builder-team");
50
+ },
51
+ };
52
+ },
53
+ },
54
+ Mutation: {
55
+ BuilderTeam_createDocument: async (_, args) => {
56
+ const { driveId, name } = args;
57
+ const document = await reactor.addDocument("powerhouse/builder-team");
58
+ if (driveId) {
59
+ await reactor.addAction(driveId, addFile({
60
+ name,
61
+ id: document.header.id,
62
+ documentType: "powerhouse/builder-team",
63
+ }));
64
+ }
65
+ if (name) {
66
+ await reactor.addAction(document.header.id, setName(name));
67
+ }
68
+ return document.header.id;
69
+ },
70
+ BuilderTeam_setLogo: async (_, args) => {
71
+ const { docId, input } = args;
72
+ const doc = await reactor.getDocument(docId);
73
+ if (!doc) {
74
+ throw new Error("Document not found");
75
+ }
76
+ const result = await reactor.addAction(docId, actions.setLogo(input));
77
+ if (result.status !== "SUCCESS") {
78
+ throw new Error(result.error?.message ?? "Failed to setLogo");
79
+ }
80
+ return true;
81
+ },
82
+ BuilderTeam_setTeamName: async (_, args) => {
83
+ const { docId, input } = args;
84
+ const doc = await reactor.getDocument(docId);
85
+ if (!doc) {
86
+ throw new Error("Document not found");
87
+ }
88
+ const result = await reactor.addAction(docId, actions.setTeamName(input));
89
+ if (result.status !== "SUCCESS") {
90
+ throw new Error(result.error?.message ?? "Failed to setTeamName");
91
+ }
92
+ return true;
93
+ },
94
+ BuilderTeam_setSlug: async (_, args) => {
95
+ const { docId, input } = args;
96
+ const doc = await reactor.getDocument(docId);
97
+ if (!doc) {
98
+ throw new Error("Document not found");
99
+ }
100
+ const result = await reactor.addAction(docId, actions.setSlug(input));
101
+ if (result.status !== "SUCCESS") {
102
+ throw new Error(result.error?.message ?? "Failed to setSlug");
103
+ }
104
+ return true;
105
+ },
106
+ BuilderTeam_setDescription: async (_, args) => {
107
+ const { docId, input } = args;
108
+ const doc = await reactor.getDocument(docId);
109
+ if (!doc) {
110
+ throw new Error("Document not found");
111
+ }
112
+ const result = await reactor.addAction(docId, actions.setDescription(input));
113
+ if (result.status !== "SUCCESS") {
114
+ throw new Error(result.error?.message ?? "Failed to setDescription");
115
+ }
116
+ return true;
117
+ },
118
+ BuilderTeam_setSocials: async (_, args) => {
119
+ const { docId, input } = args;
120
+ const doc = await reactor.getDocument(docId);
121
+ if (!doc) {
122
+ throw new Error("Document not found");
123
+ }
124
+ const result = await reactor.addAction(docId, actions.setSocials(input));
125
+ if (result.status !== "SUCCESS") {
126
+ throw new Error(result.error?.message ?? "Failed to setSocials");
127
+ }
128
+ return true;
129
+ },
130
+ BuilderTeam_addMember: async (_, args) => {
131
+ const { docId, input } = args;
132
+ const doc = await reactor.getDocument(docId);
133
+ if (!doc) {
134
+ throw new Error("Document not found");
135
+ }
136
+ const result = await reactor.addAction(docId, actions.addMember(input));
137
+ if (result.status !== "SUCCESS") {
138
+ throw new Error(result.error?.message ?? "Failed to addMember");
139
+ }
140
+ return true;
141
+ },
142
+ BuilderTeam_updateMemberInfo: async (_, args) => {
143
+ const { docId, input } = args;
144
+ const doc = await reactor.getDocument(docId);
145
+ if (!doc) {
146
+ throw new Error("Document not found");
147
+ }
148
+ const result = await reactor.addAction(docId, actions.updateMemberInfo(input));
149
+ if (result.status !== "SUCCESS") {
150
+ throw new Error(result.error?.message ?? "Failed to updateMemberInfo");
151
+ }
152
+ return true;
153
+ },
154
+ BuilderTeam_removeMember: async (_, args) => {
155
+ const { docId, input } = args;
156
+ const doc = await reactor.getDocument(docId);
157
+ if (!doc) {
158
+ throw new Error("Document not found");
159
+ }
160
+ const result = await reactor.addAction(docId, actions.removeMember(input));
161
+ if (result.status !== "SUCCESS") {
162
+ throw new Error(result.error?.message ?? "Failed to removeMember");
163
+ }
164
+ return true;
165
+ },
166
+ BuilderTeam_addSpace: async (_, args) => {
167
+ const { docId, input } = args;
168
+ const doc = await reactor.getDocument(docId);
169
+ if (!doc) {
170
+ throw new Error("Document not found");
171
+ }
172
+ const result = await reactor.addAction(docId, actions.addSpace(input));
173
+ if (result.status !== "SUCCESS") {
174
+ throw new Error(result.error?.message ?? "Failed to addSpace");
175
+ }
176
+ return true;
177
+ },
178
+ BuilderTeam_updateSpaceInfo: async (_, args) => {
179
+ const { docId, input } = args;
180
+ const doc = await reactor.getDocument(docId);
181
+ if (!doc) {
182
+ throw new Error("Document not found");
183
+ }
184
+ const result = await reactor.addAction(docId, actions.updateSpaceInfo(input));
185
+ if (result.status !== "SUCCESS") {
186
+ throw new Error(result.error?.message ?? "Failed to updateSpaceInfo");
187
+ }
188
+ return true;
189
+ },
190
+ BuilderTeam_removeSpace: async (_, args) => {
191
+ const { docId, input } = args;
192
+ const doc = await reactor.getDocument(docId);
193
+ if (!doc) {
194
+ throw new Error("Document not found");
195
+ }
196
+ const result = await reactor.addAction(docId, actions.removeSpace(input));
197
+ if (result.status !== "SUCCESS") {
198
+ throw new Error(result.error?.message ?? "Failed to removeSpace");
199
+ }
200
+ return true;
201
+ },
202
+ BuilderTeam_addPackage: async (_, args) => {
203
+ const { docId, input } = args;
204
+ const doc = await reactor.getDocument(docId);
205
+ if (!doc) {
206
+ throw new Error("Document not found");
207
+ }
208
+ const result = await reactor.addAction(docId, actions.addPackage(input));
209
+ if (result.status !== "SUCCESS") {
210
+ throw new Error(result.error?.message ?? "Failed to addPackage");
211
+ }
212
+ return true;
213
+ },
214
+ BuilderTeam_updatePackageInfo: async (_, args) => {
215
+ const { docId, input } = args;
216
+ const doc = await reactor.getDocument(docId);
217
+ if (!doc) {
218
+ throw new Error("Document not found");
219
+ }
220
+ const result = await reactor.addAction(docId, actions.updatePackageInfo(input));
221
+ if (result.status !== "SUCCESS") {
222
+ throw new Error(result.error?.message ?? "Failed to updatePackageInfo");
223
+ }
224
+ return true;
225
+ },
226
+ BuilderTeam_removePackage: async (_, args) => {
227
+ const { docId, input } = args;
228
+ const doc = await reactor.getDocument(docId);
229
+ if (!doc) {
230
+ throw new Error("Document not found");
231
+ }
232
+ const result = await reactor.addAction(docId, actions.removePackage(input));
233
+ if (result.status !== "SUCCESS") {
234
+ throw new Error(result.error?.message ?? "Failed to removePackage");
235
+ }
236
+ return true;
237
+ },
238
+ },
239
+ };
240
+ };
@@ -0,0 +1,2 @@
1
+ import type { DocumentNode } from "graphql";
2
+ export declare const schema: DocumentNode;
@@ -0,0 +1,228 @@
1
+ import { gql } from "graphql-tag";
2
+ export const schema = gql `
3
+ """
4
+ Subgraph definition for BuilderTeam (powerhouse/builder-team)
5
+ """
6
+ type BuilderTeamState {
7
+ profile: VetraBuilderProfile!
8
+ members: [RenownProfileInfo!]!
9
+ spaces: [VetraBuilderSpace!]!
10
+ }
11
+
12
+ type RenownProfileInfo {
13
+ id: OID!
14
+ phid: PHID
15
+ ethAddress: String
16
+ name: String
17
+ profileImage: String
18
+ }
19
+
20
+ type VetraBuilderProfile {
21
+ logo: URL
22
+ name: String!
23
+ slug: String!
24
+ description: String
25
+ socials: VetraBuilderSocials!
26
+ }
27
+
28
+ type VetraBuilderSocials {
29
+ xProfile: URL
30
+ github: URL
31
+ website: URL
32
+ }
33
+
34
+ type VetraBuilderSpace {
35
+ id: OID!
36
+ title: String!
37
+ description: String
38
+ packages: [VetraPackageInfo!]!
39
+ }
40
+
41
+ type VetraPackageInfo {
42
+ id: OID!
43
+ phid: PHID
44
+ title: String
45
+ description: String
46
+ github: String
47
+ npm: String
48
+ vetraDriveUrl: URL
49
+ }
50
+
51
+ """
52
+ Queries: BuilderTeam
53
+ """
54
+ type BuilderTeamQueries {
55
+ getDocument(docId: PHID!, driveId: PHID): BuilderTeam
56
+ getDocuments(driveId: String!): [BuilderTeam!]
57
+ }
58
+
59
+ type Query {
60
+ BuilderTeam: BuilderTeamQueries
61
+ }
62
+
63
+ """
64
+ Mutations: BuilderTeam
65
+ """
66
+ type Mutation {
67
+ BuilderTeam_createDocument(name: String!, driveId: String): String
68
+
69
+ BuilderTeam_setLogo(
70
+ driveId: String
71
+ docId: PHID
72
+ input: BuilderTeam_SetLogoInput
73
+ ): Int
74
+ BuilderTeam_setTeamName(
75
+ driveId: String
76
+ docId: PHID
77
+ input: BuilderTeam_SetTeamNameInput
78
+ ): Int
79
+ BuilderTeam_setSlug(
80
+ driveId: String
81
+ docId: PHID
82
+ input: BuilderTeam_SetSlugInput
83
+ ): Int
84
+ BuilderTeam_setDescription(
85
+ driveId: String
86
+ docId: PHID
87
+ input: BuilderTeam_SetDescriptionInput
88
+ ): Int
89
+ BuilderTeam_setSocials(
90
+ driveId: String
91
+ docId: PHID
92
+ input: BuilderTeam_SetSocialsInput
93
+ ): Int
94
+ BuilderTeam_addMember(
95
+ driveId: String
96
+ docId: PHID
97
+ input: BuilderTeam_AddMemberInput
98
+ ): Int
99
+ BuilderTeam_updateMemberInfo(
100
+ driveId: String
101
+ docId: PHID
102
+ input: BuilderTeam_UpdateMemberInfoInput
103
+ ): Int
104
+ BuilderTeam_removeMember(
105
+ driveId: String
106
+ docId: PHID
107
+ input: BuilderTeam_RemoveMemberInput
108
+ ): Int
109
+ BuilderTeam_addSpace(
110
+ driveId: String
111
+ docId: PHID
112
+ input: BuilderTeam_AddSpaceInput
113
+ ): Int
114
+ BuilderTeam_updateSpaceInfo(
115
+ driveId: String
116
+ docId: PHID
117
+ input: BuilderTeam_UpdateSpaceInfoInput
118
+ ): Int
119
+ BuilderTeam_removeSpace(
120
+ driveId: String
121
+ docId: PHID
122
+ input: BuilderTeam_RemoveSpaceInput
123
+ ): Int
124
+ BuilderTeam_addPackage(
125
+ driveId: String
126
+ docId: PHID
127
+ input: BuilderTeam_AddPackageInput
128
+ ): Int
129
+ BuilderTeam_updatePackageInfo(
130
+ driveId: String
131
+ docId: PHID
132
+ input: BuilderTeam_UpdatePackageInfoInput
133
+ ): Int
134
+ BuilderTeam_removePackage(
135
+ driveId: String
136
+ docId: PHID
137
+ input: BuilderTeam_RemovePackageInput
138
+ ): Int
139
+ }
140
+
141
+ """
142
+ Module: Profile
143
+ """
144
+ input BuilderTeam_SetLogoInput {
145
+ "Add your inputs here"
146
+ logo: String
147
+ }
148
+ input BuilderTeam_SetTeamNameInput {
149
+ "Add your inputs here"
150
+ name: String!
151
+ }
152
+ input BuilderTeam_SetSlugInput {
153
+ "Add your inputs here"
154
+ slug: String!
155
+ }
156
+ input BuilderTeam_SetDescriptionInput {
157
+ "Add your inputs here"
158
+ description: String
159
+ }
160
+ input BuilderTeam_SetSocialsInput {
161
+ "Add your inputs here"
162
+ xProfile: String
163
+ github: String
164
+ website: String
165
+ }
166
+
167
+ """
168
+ Module: Member
169
+ """
170
+ input BuilderTeam_AddMemberInput {
171
+ "Add your inputs here"
172
+ id: OID!
173
+ }
174
+ input BuilderTeam_UpdateMemberInfoInput {
175
+ "Add your inputs here"
176
+ id: OID!
177
+ phid: PHID
178
+ ethAddress: String
179
+ name: String
180
+ profileImage: String
181
+ }
182
+ input BuilderTeam_RemoveMemberInput {
183
+ "Add your inputs here"
184
+ id: OID!
185
+ }
186
+
187
+ """
188
+ Module: Spaces
189
+ """
190
+ input BuilderTeam_AddSpaceInput {
191
+ "Add your inputs here"
192
+ id: OID!
193
+ }
194
+ input BuilderTeam_UpdateSpaceInfoInput {
195
+ "Add your inputs here"
196
+ id: OID!
197
+ title: String
198
+ description: String
199
+ }
200
+ input BuilderTeam_RemoveSpaceInput {
201
+ "Add your inputs here"
202
+ id: OID!
203
+ }
204
+
205
+ """
206
+ Module: Packages
207
+ """
208
+ input BuilderTeam_AddPackageInput {
209
+ "Add your inputs here"
210
+ id: OID!
211
+ spaceId: OID!
212
+ }
213
+ input BuilderTeam_UpdatePackageInfoInput {
214
+ "Add your inputs here"
215
+ id: OID!
216
+ spaceId: OID
217
+ phid: PHID
218
+ title: String
219
+ description: String
220
+ github: String
221
+ npm: String
222
+ vetraDriveUrl: URL
223
+ }
224
+ input BuilderTeam_RemovePackageInput {
225
+ "Add your inputs here"
226
+ id: OID!
227
+ }
228
+ `;
@@ -1,3 +1,3 @@
1
1
  export {};
2
- export * as BuilderAccountSubgraph from "./builder-account/index.js";
3
- export * as VetraBuilderReadModelSubgraph from "./vetra-builder-read-model/index.js";
2
+ export * as VetraBuildersSubgraph from "./vetra-builders/index.js";
3
+ export * as BuilderTeamSubgraph from "./builder-team/index.js";
@@ -1,2 +1,3 @@
1
- export * as BuilderAccountSubgraph from "./builder-account/index.js";
2
- export * as VetraBuilderReadModelSubgraph from "./vetra-builder-read-model/index.js";
1
+ export * as VetraBuildersSubgraph from "./vetra-builders/index.js";
2
+ // export * as VetraBuildersSubgraph from "./vetra-builders-bkp/index.js";
3
+ export * as BuilderTeamSubgraph from "./builder-team/index.js";
@@ -0,0 +1,10 @@
1
+ import { Subgraph } from "@powerhousedao/reactor-api";
2
+ import type { DocumentNode } from "graphql";
3
+ export declare class VetraBuildersSubgraph extends Subgraph {
4
+ name: string;
5
+ typeDefs: DocumentNode;
6
+ resolvers: Record<string, unknown>;
7
+ additionalContextFields: {};
8
+ onSetup(): Promise<void>;
9
+ onDisconnect(): Promise<void>;
10
+ }
@@ -0,0 +1,11 @@
1
+ import { Subgraph } from "@powerhousedao/reactor-api";
2
+ import { schema } from "./schema.js";
3
+ import { getResolvers } from "./resolvers.js";
4
+ export class VetraBuildersSubgraph extends Subgraph {
5
+ name = "vetra-builders";
6
+ typeDefs = schema;
7
+ resolvers = getResolvers(this);
8
+ additionalContextFields = {};
9
+ async onSetup() { }
10
+ async onDisconnect() { }
11
+ }
@@ -0,0 +1,2 @@
1
+ import { type Subgraph } from "@powerhousedao/reactor-api";
2
+ export declare const getResolvers: (subgraph: Subgraph) => Record<string, unknown>;
@@ -0,0 +1,144 @@
1
+ import { VetraBuilderRelationalDbProcessor } from "../../processors/vetra-builder-relational-db-processor/index.js";
2
+ export const getResolvers = (subgraph) => {
3
+ const reactor = subgraph.reactor;
4
+ const db = subgraph.relationalDb;
5
+ const DEFAULT_DRIVE_ID = process.env.VETRA_BUILDER_DRIVE_ID || "powerhouse";
6
+ return {
7
+ BuilderTeamType: {
8
+ spaces: async (parent, args, context) => {
9
+ const driveId = context.driveId || DEFAULT_DRIVE_ID;
10
+ const spaces = await VetraBuilderRelationalDbProcessor.query(driveId, db)
11
+ .selectFrom("builder_team_spaces")
12
+ .selectAll()
13
+ .leftJoin("deleted_files", (join) => join
14
+ .onRef("deleted_files.document_id", "=", "builder_team_spaces.builder_team_id")
15
+ .on("deleted_files.drive_id", "=", driveId))
16
+ .where("builder_team_id", "=", parent.id)
17
+ .where("deleted_files.id", "is", null) // Exclude spaces from deleted accounts
18
+ .orderBy("sort_order", "asc")
19
+ .execute();
20
+ return spaces.map((space) => ({
21
+ id: space.id,
22
+ builderAccountId: space.builder_team_id,
23
+ title: space.title,
24
+ description: space.description,
25
+ sortOrder: space.sort_order,
26
+ createdAt: space.created_at.toISOString(),
27
+ updatedAt: space.updated_at.toISOString(),
28
+ driveId: driveId, // Pass driveId to field resolvers
29
+ packages: [], // Will be resolved by field resolver
30
+ }));
31
+ },
32
+ members: async (parent, args, context) => {
33
+ const driveId = context.driveId || DEFAULT_DRIVE_ID;
34
+ const members = await VetraBuilderRelationalDbProcessor.query(driveId, db)
35
+ .selectFrom("builder_team_members")
36
+ .selectAll()
37
+ .leftJoin("deleted_files", (join) => join
38
+ .onRef("deleted_files.document_id", "=", "builder_team_members.builder_team_id")
39
+ .on("deleted_files.drive_id", "=", driveId))
40
+ .where("builder_team_id", "=", parent.id)
41
+ .where("deleted_files.id", "is", null) // Exclude members from deleted accounts
42
+ .execute();
43
+ return members.map((member) => ({
44
+ id: member.id,
45
+ builderAccountId: member.builder_team_id,
46
+ ethAddress: member.eth_address,
47
+ createdAt: member.created_at.toISOString(),
48
+ }));
49
+ },
50
+ },
51
+ BuilderTeamSpace: {
52
+ packages: async (parent, args, context) => {
53
+ const driveId = parent.driveId || context.driveId || DEFAULT_DRIVE_ID;
54
+ const packages = await VetraBuilderRelationalDbProcessor.query(driveId, db)
55
+ .selectFrom("builder_team_packages")
56
+ .selectAll()
57
+ .leftJoin("builder_team_spaces", (join) => join.onRef("builder_team_spaces.id", "=", "builder_team_packages.space_id"))
58
+ .where("builder_team_packages.space_id", "=", parent.id)
59
+ .orderBy("sort_order", "asc")
60
+ .execute();
61
+ return packages.map((pkg) => ({
62
+ id: pkg.id,
63
+ spaceId: pkg.space_id,
64
+ title: pkg.title,
65
+ description: pkg.description,
66
+ category: pkg.category,
67
+ authorName: pkg.author_name,
68
+ authorWebsite: pkg.author_website,
69
+ githubUrl: pkg.github_url,
70
+ npmUrl: pkg.npm_url,
71
+ vetraDriveUrl: pkg.vetra_drive_url,
72
+ driveId: pkg.drive_id,
73
+ sortOrder: pkg.sort_order,
74
+ createdAt: pkg.created_at.toISOString(),
75
+ updatedAt: pkg.updated_at.toISOString(),
76
+ keywords: [], // Will be resolved by field resolver
77
+ }));
78
+ },
79
+ },
80
+ Query: {
81
+ fetchAllBuilderTeams: async (parent, args) => {
82
+ const driveId = args.driveId || DEFAULT_DRIVE_ID;
83
+ const search = args.search;
84
+ const sortOrder = args.sortOrder || "asc";
85
+ let accounts = VetraBuilderRelationalDbProcessor.query(driveId, db)
86
+ .selectFrom("builder_teams")
87
+ .selectAll();
88
+ if (search) {
89
+ accounts = accounts.where((eb) => {
90
+ return eb("profile_name", "ilike", `%${search}%`)
91
+ .or("profile_slug", "ilike", `%${search}%`)
92
+ .or("profile_description", "ilike", `%${search}%`);
93
+ });
94
+ }
95
+ // Add sorting by profile_name
96
+ accounts = accounts.orderBy("profile_name", sortOrder);
97
+ const results = await accounts.execute();
98
+ return results.map((account) => ({
99
+ id: account.id,
100
+ profileName: account.profile_name,
101
+ profileSlug: account.profile_slug,
102
+ profileLogo: account.profile_logo,
103
+ profileDescription: account.profile_description,
104
+ profileSocialsX: account.profile_socials_x,
105
+ profileSocialsGithub: account.profile_socials_github,
106
+ profileSocialsWebsite: account.profile_socials_website,
107
+ createdAt: account.created_at.toISOString(),
108
+ updatedAt: account.updated_at.toISOString(),
109
+ driveId: driveId, // Pass driveId to field resolvers
110
+ spaces: [], // Will be resolved by field resolver
111
+ members: [], // Will be resolved by field resolver
112
+ }));
113
+ },
114
+ fetchBuilderTeam: async (parent, args) => {
115
+ const driveId = args.driveId || DEFAULT_DRIVE_ID;
116
+ const account = await VetraBuilderRelationalDbProcessor.query(driveId, db)
117
+ .selectFrom("builder_teams")
118
+ .selectAll()
119
+ .leftJoin("deleted_files", (join) => join
120
+ .onRef("deleted_files.document_id", "=", "builder_teams.id")
121
+ .on("deleted_files.drive_id", "=", driveId))
122
+ .where("builder_teams.id", "=", args.id)
123
+ .where("deleted_files.id", "is", null) // Exclude deleted documents
124
+ .executeTakeFirst();
125
+ if (!account) {
126
+ return null;
127
+ }
128
+ return {
129
+ id: account.id,
130
+ profileName: account.profile_name,
131
+ profileSlug: account.profile_slug,
132
+ profileLogo: account.profile_logo,
133
+ profileDescription: account.profile_description,
134
+ profileSocialsX: account.profile_socials_x,
135
+ profileSocialsGithub: account.profile_socials_github,
136
+ profileSocialsWebsite: account.profile_socials_website,
137
+ createdAt: account.created_at.toISOString(),
138
+ updatedAt: account.updated_at.toISOString(),
139
+ driveId: driveId, // Pass driveId to field resolvers
140
+ };
141
+ },
142
+ },
143
+ };
144
+ };
@@ -0,0 +1,2 @@
1
+ import type { DocumentNode } from "graphql";
2
+ export declare const schema: DocumentNode;