@powerhousedao/vetra-builder-package 0.0.20 → 0.0.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 (61) hide show
  1. package/dist/document-models/builder-team/gen/document-model.js +40 -18
  2. package/dist/document-models/builder-team/gen/packages/actions.d.ts +6 -2
  3. package/dist/document-models/builder-team/gen/packages/creators.d.ts +3 -2
  4. package/dist/document-models/builder-team/gen/packages/creators.js +1 -0
  5. package/dist/document-models/builder-team/gen/packages/object.d.ts +2 -1
  6. package/dist/document-models/builder-team/gen/packages/object.js +4 -1
  7. package/dist/document-models/builder-team/gen/packages/operations.d.ts +2 -1
  8. package/dist/document-models/builder-team/gen/reducer.js +8 -0
  9. package/dist/document-models/builder-team/gen/schema/types.d.ts +9 -14
  10. package/dist/document-models/builder-team/gen/schema/zod.d.ts +3 -1
  11. package/dist/document-models/builder-team/gen/schema/zod.js +13 -0
  12. package/dist/document-models/builder-team/gen/spaces/actions.d.ts +6 -2
  13. package/dist/document-models/builder-team/gen/spaces/creators.d.ts +3 -2
  14. package/dist/document-models/builder-team/gen/spaces/creators.js +1 -0
  15. package/dist/document-models/builder-team/gen/spaces/object.d.ts +2 -1
  16. package/dist/document-models/builder-team/gen/spaces/object.js +4 -1
  17. package/dist/document-models/builder-team/gen/spaces/operations.d.ts +2 -1
  18. package/dist/document-models/builder-team/index.d.ts +2 -0
  19. package/dist/document-models/builder-team/src/reducers/packages.js +21 -0
  20. package/dist/document-models/builder-team/src/reducers/spaces.js +16 -0
  21. package/dist/editors/builder-team-editor/components/MembersSection.d.ts +1 -6
  22. package/dist/editors/builder-team-editor/components/MembersSection.js +24 -88
  23. package/dist/editors/builder-team-editor/components/PackageForm.js +7 -75
  24. package/dist/editors/builder-team-editor/components/PackageItem.js +22 -83
  25. package/dist/editors/builder-team-editor/components/PackagesTable.d.ts +9 -0
  26. package/dist/editors/builder-team-editor/components/PackagesTable.js +80 -0
  27. package/dist/editors/builder-team-editor/components/ProfileSection.js +2 -2
  28. package/dist/editors/builder-team-editor/components/QuickStats.js +2 -1
  29. package/dist/editors/builder-team-editor/components/SpaceItem.d.ts +2 -1
  30. package/dist/editors/builder-team-editor/components/SpaceItem.js +4 -3
  31. package/dist/editors/builder-team-editor/components/SpacesSection.d.ts +3 -1
  32. package/dist/editors/builder-team-editor/components/SpacesSection.js +19 -3
  33. package/dist/editors/builder-team-editor/components/SpacesTable.d.ts +11 -0
  34. package/dist/editors/builder-team-editor/components/SpacesTable.js +71 -0
  35. package/dist/editors/builder-team-editor/config.d.ts +1 -0
  36. package/dist/editors/builder-team-editor/config.js +1 -0
  37. package/dist/editors/builder-team-editor/editor.js +7 -1
  38. package/dist/editors/builder-team-editor/hooks/usePackageHandlers.js +0 -1
  39. package/dist/editors/builder-team-editor/services/renown-api.d.ts +21 -0
  40. package/dist/editors/builder-team-editor/services/renown-api.js +63 -0
  41. package/dist/editors/builder-team-editor/services/vetra-api.d.ts +31 -0
  42. package/dist/editors/builder-team-editor/services/vetra-api.js +70 -0
  43. package/dist/editors/builder-team-editor/types/index.d.ts +33 -0
  44. package/dist/editors/builder-team-editor/types/index.js +1 -0
  45. package/dist/editors/builder-team-editor/utils/format.d.ts +7 -0
  46. package/dist/editors/builder-team-editor/utils/format.js +13 -0
  47. package/dist/editors/builder-team-editor/utils/graphql.d.ts +7 -0
  48. package/dist/editors/builder-team-editor/utils/graphql.js +55 -0
  49. package/dist/powerhouse.manifest.json +3 -3
  50. package/dist/processors/vetra-builder-relational-db-processor/builder-team-handlers.d.ts +2 -0
  51. package/dist/processors/vetra-builder-relational-db-processor/builder-team-handlers.js +73 -48
  52. package/dist/processors/vetra-builder-relational-db-processor/database-helpers.d.ts +5 -4
  53. package/dist/processors/vetra-builder-relational-db-processor/factory.js +0 -1
  54. package/dist/processors/vetra-builder-relational-db-processor/index.js +0 -1
  55. package/dist/processors/vetra-builder-relational-db-processor/migrations.d.ts +3 -2
  56. package/dist/style.css +74 -6
  57. package/dist/subgraphs/builder-team/resolvers.js +48 -4
  58. package/dist/subgraphs/builder-team/schema.js +21 -14
  59. package/dist/subgraphs/vetra-builders/resolvers.js +36 -12
  60. package/dist/subgraphs/vetra-builders/schema.js +2 -14
  61. package/package.json +1 -1
@@ -41,9 +41,9 @@ export class BuilderTeamHandlers {
41
41
  case "UPDATE_SPACE_INFO":
42
42
  await this.handleUpdateSpaceInfo(documentId, action, state);
43
43
  break;
44
- // case "REORDER_SPACES":
45
- // await this.handleReorderSpaces(documentId, action, state);
46
- // break;
44
+ case "REORDER_SPACES":
45
+ await this.handleReorderSpaces(documentId, action, state);
46
+ break;
47
47
  // Packages operations
48
48
  case "ADD_PACKAGE":
49
49
  await this.handleAddPackage(documentId, action, state);
@@ -54,6 +54,9 @@ export class BuilderTeamHandlers {
54
54
  case "UPDATE_PACKAGE_INFO":
55
55
  await this.handleUpdatePackageInfo(documentId, action, state);
56
56
  break;
57
+ case "REORDER_PACKAGES":
58
+ await this.handleReorderPackages(documentId, action, state);
59
+ break;
57
60
  }
58
61
  }
59
62
  // Profile operations
@@ -119,6 +122,9 @@ export class BuilderTeamHandlers {
119
122
  // Spaces operations
120
123
  async handleAddSpace(documentId, action, state) {
121
124
  await this.dbHelpers.ensureBuilderAccountExistsAndIsNotdeleted(documentId);
125
+ // Find the space in state to get its sortOrder
126
+ const space = state.spaces.find((s) => s.id === action.input.id);
127
+ const sortOrder = space?.sortOrder ?? 0;
122
128
  await this.db
123
129
  .insertInto("builder_team_spaces")
124
130
  .values({
@@ -126,7 +132,7 @@ export class BuilderTeamHandlers {
126
132
  builder_team_id: documentId,
127
133
  title: "",
128
134
  description: "",
129
- sort_order: 0,
135
+ sort_order: sortOrder,
130
136
  created_at: new Date(),
131
137
  updated_at: new Date(),
132
138
  })
@@ -143,10 +149,10 @@ export class BuilderTeamHandlers {
143
149
  async handleUpdateSpaceInfo(documentId, action, state) {
144
150
  const updates = {};
145
151
  // Only include fields that are provided
146
- if (action.input.title !== undefined) {
152
+ if (action.input.title !== undefined && action.input.title !== null) {
147
153
  updates.title = action.input.title;
148
154
  }
149
- if (action.input.description !== undefined) {
155
+ if (action.input.description !== undefined && action.input.description !== null) {
150
156
  updates.description = action.input.description;
151
157
  }
152
158
  // Only update if there are actual changes
@@ -154,22 +160,25 @@ export class BuilderTeamHandlers {
154
160
  await this.dbHelpers.updateBuilderSpace(action.input.id, documentId, updates);
155
161
  }
156
162
  }
157
- // private async handleReorderSpaces(
158
- // documentId: string,
159
- // action: ReorderSpacesAction,
160
- // state: BuilderAccountState
161
- // ): Promise<void> {
162
- // const { ids, insertAfter } = action.input;
163
- // for (let i = 0; i < ids.length; i++) {
164
- // const spaceId = ids[i];
165
- // const sortOrder = insertAfter !== null ? Number(insertAfter) + i + 1 : i;
166
- // await this.dbHelpers.updateBuilderSpace(spaceId, documentId, {
167
- // sort_order: sortOrder,
168
- // });
169
- // }
170
- // }
163
+ async handleReorderSpaces(documentId, action, state) {
164
+ // Update sortOrder for all spaces based on the state
165
+ for (const space of state.spaces) {
166
+ await this.dbHelpers.updateBuilderSpace(space.id, documentId, {
167
+ sort_order: space.sortOrder,
168
+ });
169
+ }
170
+ }
171
171
  // Packages operations
172
172
  async handleAddPackage(documentId, action, state) {
173
+ // Find the package in state to get its sortOrder
174
+ let sortOrder = 0;
175
+ for (const space of state.spaces) {
176
+ const pkg = space.packages.find((p) => p.id === action.input.id);
177
+ if (pkg) {
178
+ sortOrder = pkg.sortOrder ?? 0;
179
+ break;
180
+ }
181
+ }
173
182
  await this.db
174
183
  .insertInto("builder_team_packages")
175
184
  .values({
@@ -184,7 +193,7 @@ export class BuilderTeamHandlers {
184
193
  npm_url: "",
185
194
  vetra_drive_url: "",
186
195
  drive_id: "",
187
- sort_order: 0,
196
+ sort_order: sortOrder,
188
197
  created_at: new Date(),
189
198
  updated_at: new Date(),
190
199
  })
@@ -207,51 +216,67 @@ export class BuilderTeamHandlers {
207
216
  }
208
217
  async handleUpdatePackageInfo(documentId, action, state) {
209
218
  const updates = {};
219
+ // Find the package in the state to get additional information
220
+ let packageFromState = null;
221
+ for (const space of state.spaces) {
222
+ const pkg = space.packages.find((p) => p.id === action.input.id);
223
+ if (pkg) {
224
+ packageFromState = pkg;
225
+ break;
226
+ }
227
+ }
210
228
  // Map input fields to database columns, only include provided fields
211
- if (action.input.title !== undefined) {
229
+ if (action.input.title !== undefined && action.input.title !== null) {
212
230
  updates.title = action.input.title;
213
231
  }
214
- if (action.input.description !== undefined) {
232
+ if (action.input.description !== undefined && action.input.description !== null) {
215
233
  updates.description = action.input.description;
216
234
  }
217
- if (action.input.github !== undefined) {
235
+ if (action.input.github !== undefined && action.input.github !== null) {
218
236
  updates.github_url = action.input.github;
219
237
  }
220
- if (action.input.npm !== undefined) {
238
+ if (action.input.npm !== undefined && action.input.npm !== null) {
221
239
  updates.npm_url = action.input.npm;
222
240
  }
223
- if (action.input.vetraDriveUrl !== undefined) {
241
+ if (action.input.vetraDriveUrl !== undefined && action.input.vetraDriveUrl !== null) {
224
242
  updates.vetra_drive_url = action.input.vetraDriveUrl;
225
243
  }
226
- if (action.input.spaceId !== undefined) {
244
+ if (action.input.spaceId !== undefined && action.input.spaceId !== null) {
227
245
  updates.space_id = action.input.spaceId;
228
246
  }
229
- // Note: phid is not stored in the packages table, and id is the WHERE condition
247
+ // If we found the package in state and phid is available, store it
248
+ if (packageFromState?.phid) {
249
+ updates.drive_id = packageFromState.phid;
250
+ }
251
+ else if (action.input.phid) {
252
+ updates.drive_id = action.input.phid;
253
+ }
254
+ // Always update the updated_at timestamp
255
+ updates.updated_at = new Date();
230
256
  // Only update if there are actual changes
231
257
  if (Object.keys(updates).length > 0) {
232
258
  await this.dbHelpers.updateBuilderPackage(action.input.id, updates);
233
259
  }
234
260
  }
235
- // private async handleReorderPackages(
236
- // documentId: string,
237
- // action: ReorderPackagesAction,
238
- // state: BuilderAccountState
239
- // ): Promise<void> {
240
- // const { ids, insertAfter, spaceId } = action.input;
241
- // for (let i = 0; i < ids.length; i++) {
242
- // const packageId = ids[i];
243
- // const sortOrder = insertAfter !== null ? Number(insertAfter) + i + 1 : i;
244
- // await this.db
245
- // .updateTable("builder_packages")
246
- // .set({
247
- // sort_order: sortOrder,
248
- // updated_at: new Date(),
249
- // })
250
- // .where("id", "=", packageId)
251
- // .where("space_id", "=", spaceId)
252
- // .execute();
253
- // }
254
- // }
261
+ async handleReorderPackages(documentId, action, state) {
262
+ const { spaceId } = action.input;
263
+ // Find the space in state
264
+ const space = state.spaces.find((s) => s.id === spaceId);
265
+ if (!space)
266
+ return;
267
+ // Update sortOrder for all packages in the space based on the state
268
+ for (const pkg of space.packages) {
269
+ await this.db
270
+ .updateTable("builder_team_packages")
271
+ .set({
272
+ sort_order: pkg.sortOrder,
273
+ updated_at: new Date(),
274
+ })
275
+ .where("id", "=", pkg.id)
276
+ .where("space_id", "=", spaceId)
277
+ .execute();
278
+ }
279
+ }
255
280
  async handleDeletePackage(documentId, action, state) {
256
281
  await this.db
257
282
  .deleteFrom("builder_team_packages")
@@ -1,5 +1,6 @@
1
1
  import type { IRelationalDb } from "document-drive";
2
2
  import type { DB } from "./schema.js";
3
+ import type { Updateable } from "kysely";
3
4
  export declare class DatabaseHelpers {
4
5
  private db;
5
6
  constructor(db: IRelationalDb<DB>);
@@ -19,19 +20,19 @@ export declare class DatabaseHelpers {
19
20
  /**
20
21
  * Updates a package with the provided data
21
22
  */
22
- updatePackage(documentId: string, updates: Record<string, any>): Promise<void>;
23
+ updatePackage(documentId: string, updates: Partial<Updateable<DB["builder_team_packages"]>>): Promise<void>;
23
24
  /**
24
25
  * Updates a builder account with the provided data
25
26
  */
26
- updateBuilderAccount(documentId: string, updates: Record<string, any>): Promise<void>;
27
+ updateBuilderAccount(documentId: string, updates: Partial<Updateable<DB["builder_teams"]>>): Promise<void>;
27
28
  /**
28
29
  * Updates a builder space with the provided data
29
30
  */
30
- updateBuilderSpace(spaceId: string, documentId: string, updates: Record<string, any>): Promise<void>;
31
+ updateBuilderSpace(spaceId: string, documentId: string, updates: Partial<Updateable<DB["builder_team_spaces"]>>): Promise<void>;
31
32
  /**
32
33
  * Updates a builder package with the provided data
33
34
  */
34
- updateBuilderPackage(packageId: string, updates: Record<string, any>): Promise<void>;
35
+ updateBuilderPackage(packageId: string, updates: Partial<Updateable<DB["builder_team_packages"]>>): Promise<void>;
35
36
  /**
36
37
  * Checks if a member already exists for a builder account
37
38
  */
@@ -13,7 +13,6 @@ export const vetraBuilderTeamRelationalDbProcessorFactory = (module) => async (d
13
13
  };
14
14
  // Create the processor
15
15
  const processor = new VetraBuilderRelationalDbProcessor(namespace, filter, store);
16
- console.log("vetraBuilderRelationalDbProcessorFactory", processor);
17
16
  return [
18
17
  {
19
18
  processor,
@@ -22,7 +22,6 @@ export class VetraBuilderRelationalDbProcessor extends RelationalDbProcessor {
22
22
  if (strand.operations.length === 0) {
23
23
  continue;
24
24
  }
25
- console.log("onStrands", strand);
26
25
  for (const operation of strand.operations) {
27
26
  if (strand.documentType.includes("powerhouse/document-drive")) {
28
27
  await this.handleDocumentDriveOperation(strand.documentId, strand.driveId, operation.action, operation.state);
@@ -1,3 +1,4 @@
1
1
  import { type IRelationalDb } from "document-drive/processors/types";
2
- export declare function up(db: IRelationalDb<any>): Promise<void>;
3
- export declare function down(db: IRelationalDb<any>): Promise<void>;
2
+ import type { DB } from "./schema.js";
3
+ export declare function up(db: IRelationalDb<DB>): Promise<void>;
4
+ export declare function down(db: IRelationalDb<DB>): Promise<void>;
package/dist/style.css CHANGED
@@ -284,6 +284,9 @@
284
284
  .mt-4 {
285
285
  margin-top: calc(var(--spacing) * 4);
286
286
  }
287
+ .mt-6 {
288
+ margin-top: calc(var(--spacing) * 6);
289
+ }
287
290
  .mb-0\.5 {
288
291
  margin-bottom: calc(var(--spacing) * 0.5);
289
292
  }
@@ -302,12 +305,21 @@
302
305
  .mb-5 {
303
306
  margin-bottom: calc(var(--spacing) * 5);
304
307
  }
308
+ .mb-6 {
309
+ margin-bottom: calc(var(--spacing) * 6);
310
+ }
305
311
  .ml-4 {
306
312
  margin-left: calc(var(--spacing) * 4);
307
313
  }
308
314
  .ml-6 {
309
315
  margin-left: calc(var(--spacing) * 6);
310
316
  }
317
+ .line-clamp-2 {
318
+ overflow: hidden;
319
+ display: -webkit-box;
320
+ -webkit-box-orient: vertical;
321
+ -webkit-line-clamp: 2;
322
+ }
311
323
  .block {
312
324
  display: block;
313
325
  }
@@ -338,9 +350,6 @@
338
350
  .h-5 {
339
351
  height: calc(var(--spacing) * 5);
340
352
  }
341
- .h-6 {
342
- height: calc(var(--spacing) * 6);
343
- }
344
353
  .h-8 {
345
354
  height: calc(var(--spacing) * 8);
346
355
  }
@@ -371,9 +380,6 @@
371
380
  .w-5 {
372
381
  width: calc(var(--spacing) * 5);
373
382
  }
374
- .w-6 {
375
- width: calc(var(--spacing) * 6);
376
- }
377
383
  .w-8 {
378
384
  width: calc(var(--spacing) * 8);
379
385
  }
@@ -389,6 +395,9 @@
389
395
  .w-20 {
390
396
  width: calc(var(--spacing) * 20);
391
397
  }
398
+ .w-full {
399
+ width: 100%;
400
+ }
392
401
  .max-w-7xl {
393
402
  max-width: var(--container-7xl);
394
403
  }
@@ -514,12 +523,18 @@
514
523
  .overflow-hidden {
515
524
  overflow: hidden;
516
525
  }
526
+ .rounded {
527
+ border-radius: 0.25rem;
528
+ }
517
529
  .rounded-full {
518
530
  border-radius: calc(infinity * 1px);
519
531
  }
520
532
  .rounded-lg {
521
533
  border-radius: var(--radius-lg);
522
534
  }
535
+ .rounded-md {
536
+ border-radius: var(--radius-md);
537
+ }
523
538
  .rounded-xl {
524
539
  border-radius: var(--radius-xl);
525
540
  }
@@ -541,6 +556,9 @@
541
556
  .border-gray-300 {
542
557
  border-color: var(--color-gray-300);
543
558
  }
559
+ .bg-blue-100 {
560
+ background-color: var(--color-blue-100);
561
+ }
544
562
  .bg-gray-50 {
545
563
  background-color: var(--color-gray-50);
546
564
  }
@@ -568,6 +586,12 @@
568
586
  .p-6 {
569
587
  padding: calc(var(--spacing) * 6);
570
588
  }
589
+ .px-2 {
590
+ padding-inline: calc(var(--spacing) * 2);
591
+ }
592
+ .px-2\.5 {
593
+ padding-inline: calc(var(--spacing) * 2.5);
594
+ }
571
595
  .px-3 {
572
596
  padding-inline: calc(var(--spacing) * 3);
573
597
  }
@@ -577,15 +601,27 @@
577
601
  .px-6 {
578
602
  padding-inline: calc(var(--spacing) * 6);
579
603
  }
604
+ .py-0\.5 {
605
+ padding-block: calc(var(--spacing) * 0.5);
606
+ }
607
+ .py-1 {
608
+ padding-block: calc(var(--spacing) * 1);
609
+ }
580
610
  .py-2 {
581
611
  padding-block: calc(var(--spacing) * 2);
582
612
  }
613
+ .py-3 {
614
+ padding-block: calc(var(--spacing) * 3);
615
+ }
583
616
  .py-4 {
584
617
  padding-block: calc(var(--spacing) * 4);
585
618
  }
586
619
  .py-5 {
587
620
  padding-block: calc(var(--spacing) * 5);
588
621
  }
622
+ .py-6 {
623
+ padding-block: calc(var(--spacing) * 6);
624
+ }
589
625
  .py-8 {
590
626
  padding-block: calc(var(--spacing) * 8);
591
627
  }
@@ -652,6 +688,9 @@
652
688
  --tw-tracking: var(--tracking-wider);
653
689
  letter-spacing: var(--tracking-wider);
654
690
  }
691
+ .text-blue-800 {
692
+ color: var(--color-blue-800);
693
+ }
655
694
  .text-gray-400 {
656
695
  color: var(--color-gray-400);
657
696
  }
@@ -736,6 +775,13 @@
736
775
  }
737
776
  }
738
777
  }
778
+ .hover\:text-blue-600 {
779
+ &:hover {
780
+ @media (hover: hover) {
781
+ color: var(--color-blue-600);
782
+ }
783
+ }
784
+ }
739
785
  .hover\:text-gray-900 {
740
786
  &:hover {
741
787
  @media (hover: hover) {
@@ -766,6 +812,28 @@
766
812
  }
767
813
  }
768
814
  }
815
+ .focus\:border-blue-500 {
816
+ &:focus {
817
+ border-color: var(--color-blue-500);
818
+ }
819
+ }
820
+ .focus\:ring-2 {
821
+ &:focus {
822
+ --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
823
+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
824
+ }
825
+ }
826
+ .focus\:ring-blue-500 {
827
+ &:focus {
828
+ --tw-ring-color: var(--color-blue-500);
829
+ }
830
+ }
831
+ .focus\:outline-none {
832
+ &:focus {
833
+ --tw-outline-style: none;
834
+ outline-style: none;
835
+ }
836
+ }
769
837
  .sm\:px-6 {
770
838
  @media (width >= 40rem) {
771
839
  padding-inline: calc(var(--spacing) * 6);
@@ -19,14 +19,24 @@ export const getResolvers = (subgraph) => {
19
19
  }
20
20
  }
21
21
  const doc = await reactor.getDocument(docId);
22
+ // Sort spaces and packages by sortOrder
23
+ const sortedState = {
24
+ ...doc.state.global,
25
+ spaces: [...doc.state.global.spaces]
26
+ .sort((a, b) => a.sortOrder - b.sortOrder)
27
+ .map(space => ({
28
+ ...space,
29
+ packages: [...space.packages].sort((a, b) => a.sortOrder - b.sortOrder)
30
+ }))
31
+ };
22
32
  return {
23
33
  driveId: driveId,
24
34
  ...doc,
25
35
  ...doc.header,
26
36
  created: doc.header.createdAtUtcIso,
27
37
  lastModified: doc.header.lastModifiedAtUtcIso,
28
- state: doc.state.global,
29
- stateJSON: doc.state.global,
38
+ state: sortedState,
39
+ stateJSON: sortedState,
30
40
  revision: doc.header?.revision?.global ?? 0,
31
41
  };
32
42
  },
@@ -35,14 +45,24 @@ export const getResolvers = (subgraph) => {
35
45
  const docsIds = await reactor.getDocuments(driveId);
36
46
  const docs = await Promise.all(docsIds.map(async (docId) => {
37
47
  const doc = await reactor.getDocument(docId);
48
+ // Sort spaces and packages by sortOrder
49
+ const sortedState = {
50
+ ...doc.state.global,
51
+ spaces: [...doc.state.global.spaces]
52
+ .sort((a, b) => a.sortOrder - b.sortOrder)
53
+ .map(space => ({
54
+ ...space,
55
+ packages: [...space.packages].sort((a, b) => a.sortOrder - b.sortOrder)
56
+ }))
57
+ };
38
58
  return {
39
59
  driveId: driveId,
40
60
  ...doc,
41
61
  ...doc.header,
42
62
  created: doc.header.createdAtUtcIso,
43
63
  lastModified: doc.header.lastModifiedAtUtcIso,
44
- state: doc.state.global,
45
- stateJSON: doc.state.global,
64
+ state: sortedState,
65
+ stateJSON: sortedState,
46
66
  revision: doc.header?.revision?.global ?? 0,
47
67
  };
48
68
  }));
@@ -199,6 +219,18 @@ export const getResolvers = (subgraph) => {
199
219
  }
200
220
  return true;
201
221
  },
222
+ BuilderTeam_reorderSpaces: async (_, args) => {
223
+ const { docId, input } = args;
224
+ const doc = await reactor.getDocument(docId);
225
+ if (!doc) {
226
+ throw new Error("Document not found");
227
+ }
228
+ const result = await reactor.addAction(docId, actions.reorderSpaces(input));
229
+ if (result.status !== "SUCCESS") {
230
+ throw new Error(result.error?.message ?? "Failed to reorderSpaces");
231
+ }
232
+ return true;
233
+ },
202
234
  BuilderTeam_addPackage: async (_, args) => {
203
235
  const { docId, input } = args;
204
236
  const doc = await reactor.getDocument(docId);
@@ -235,6 +267,18 @@ export const getResolvers = (subgraph) => {
235
267
  }
236
268
  return true;
237
269
  },
270
+ BuilderTeam_reorderPackages: async (_, args) => {
271
+ const { docId, input } = args;
272
+ const doc = await reactor.getDocument(docId);
273
+ if (!doc) {
274
+ throw new Error("Document not found");
275
+ }
276
+ const result = await reactor.addAction(docId, actions.reorderPackages(input));
277
+ if (result.status !== "SUCCESS") {
278
+ throw new Error(result.error?.message ?? "Failed to reorderPackages");
279
+ }
280
+ return true;
281
+ },
238
282
  },
239
283
  };
240
284
  };
@@ -36,6 +36,7 @@ export const schema = gql `
36
36
  title: String!
37
37
  description: String
38
38
  packages: [VetraPackageInfo!]!
39
+ sortOrder: Int!
39
40
  }
40
41
 
41
42
  type VetraPackageInfo {
@@ -46,6 +47,7 @@ export const schema = gql `
46
47
  github: String
47
48
  npm: String
48
49
  vetraDriveUrl: URL
50
+ sortOrder: Int!
49
51
  }
50
52
 
51
53
  """
@@ -121,6 +123,11 @@ export const schema = gql `
121
123
  docId: PHID
122
124
  input: BuilderTeam_RemoveSpaceInput
123
125
  ): Int
126
+ BuilderTeam_reorderSpaces(
127
+ driveId: String
128
+ docId: PHID
129
+ input: BuilderTeam_ReorderSpacesInput
130
+ ): Int
124
131
  BuilderTeam_addPackage(
125
132
  driveId: String
126
133
  docId: PHID
@@ -136,29 +143,29 @@ export const schema = gql `
136
143
  docId: PHID
137
144
  input: BuilderTeam_RemovePackageInput
138
145
  ): Int
146
+ BuilderTeam_reorderPackages(
147
+ driveId: String
148
+ docId: PHID
149
+ input: BuilderTeam_ReorderPackagesInput
150
+ ): Int
139
151
  }
140
152
 
141
153
  """
142
154
  Module: Profile
143
155
  """
144
156
  input BuilderTeam_SetLogoInput {
145
- "Add your inputs here"
146
157
  logo: String
147
158
  }
148
159
  input BuilderTeam_SetTeamNameInput {
149
- "Add your inputs here"
150
160
  name: String!
151
161
  }
152
162
  input BuilderTeam_SetSlugInput {
153
- "Add your inputs here"
154
163
  slug: String!
155
164
  }
156
165
  input BuilderTeam_SetDescriptionInput {
157
- "Add your inputs here"
158
166
  description: String
159
167
  }
160
168
  input BuilderTeam_SetSocialsInput {
161
- "Add your inputs here"
162
169
  xProfile: String
163
170
  github: String
164
171
  website: String
@@ -168,11 +175,9 @@ export const schema = gql `
168
175
  Module: Member
169
176
  """
170
177
  input BuilderTeam_AddMemberInput {
171
- "Add your inputs here"
172
178
  id: OID!
173
179
  }
174
180
  input BuilderTeam_UpdateMemberInfoInput {
175
- "Add your inputs here"
176
181
  id: OID!
177
182
  phid: PHID
178
183
  ethAddress: String
@@ -180,7 +185,6 @@ export const schema = gql `
180
185
  profileImage: String
181
186
  }
182
187
  input BuilderTeam_RemoveMemberInput {
183
- "Add your inputs here"
184
188
  id: OID!
185
189
  }
186
190
 
@@ -188,30 +192,29 @@ export const schema = gql `
188
192
  Module: Spaces
189
193
  """
190
194
  input BuilderTeam_AddSpaceInput {
191
- "Add your inputs here"
192
195
  id: OID!
193
196
  }
194
197
  input BuilderTeam_UpdateSpaceInfoInput {
195
- "Add your inputs here"
196
198
  id: OID!
197
199
  title: String
198
200
  description: String
199
201
  }
200
202
  input BuilderTeam_RemoveSpaceInput {
201
- "Add your inputs here"
202
203
  id: OID!
203
204
  }
205
+ input BuilderTeam_ReorderSpacesInput {
206
+ spaceIds: [OID!]!
207
+ targetIndex: Int!
208
+ }
204
209
 
205
210
  """
206
211
  Module: Packages
207
212
  """
208
213
  input BuilderTeam_AddPackageInput {
209
- "Add your inputs here"
210
214
  id: OID!
211
215
  spaceId: OID!
212
216
  }
213
217
  input BuilderTeam_UpdatePackageInfoInput {
214
- "Add your inputs here"
215
218
  id: OID!
216
219
  spaceId: OID
217
220
  phid: PHID
@@ -222,7 +225,11 @@ export const schema = gql `
222
225
  vetraDriveUrl: URL
223
226
  }
224
227
  input BuilderTeam_RemovePackageInput {
225
- "Add your inputs here"
226
228
  id: OID!
227
229
  }
230
+ input BuilderTeam_ReorderPackagesInput {
231
+ spaceId: OID!
232
+ packageIds: [OID!]!
233
+ targetIndex: Int!
234
+ }
228
235
  `;