@powerhousedao/vetra-builder-package 0.0.15 → 0.0.17

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 (34) hide show
  1. package/dist/document-models/index.d.ts +0 -1
  2. package/dist/document-models/index.js +0 -1
  3. package/dist/editors/index.d.ts +0 -1
  4. package/dist/editors/index.js +0 -1
  5. package/dist/index.d.ts +1 -1
  6. package/dist/processors/factory.js +6 -4
  7. package/dist/processors/index.d.ts +2 -4
  8. package/dist/processors/index.js +2 -4
  9. package/dist/processors/vetra-builder-read-model/builder-account-handlers.d.ts +27 -0
  10. package/dist/processors/vetra-builder-read-model/builder-account-handlers.js +249 -0
  11. package/dist/processors/vetra-builder-read-model/database-helpers.d.ts +39 -0
  12. package/dist/processors/vetra-builder-read-model/database-helpers.js +144 -0
  13. package/dist/processors/vetra-builder-read-model/factory.d.ts +3 -0
  14. package/dist/processors/vetra-builder-read-model/factory.js +25 -0
  15. package/dist/processors/vetra-builder-read-model/index.d.ts +29 -0
  16. package/dist/processors/vetra-builder-read-model/index.js +370 -0
  17. package/dist/processors/vetra-builder-read-model/migrations.d.ts +3 -0
  18. package/dist/processors/vetra-builder-read-model/migrations.js +152 -0
  19. package/dist/processors/vetra-builder-read-model/package-handlers.d.ts +20 -0
  20. package/dist/processors/vetra-builder-read-model/package-handlers.js +116 -0
  21. package/dist/processors/vetra-builder-read-model/schema.d.ts +66 -0
  22. package/dist/processors/vetra-builder-read-model/schema.js +1 -0
  23. package/dist/processors/vetra-builder-read-model/types.d.ts +32 -0
  24. package/dist/processors/vetra-builder-read-model/types.js +1 -0
  25. package/dist/style.css +3 -180
  26. package/dist/subgraphs/index.d.ts +1 -2
  27. package/dist/subgraphs/index.js +1 -3
  28. package/dist/subgraphs/vetra-builder-read-model/index.d.ts +10 -0
  29. package/dist/subgraphs/vetra-builder-read-model/index.js +11 -0
  30. package/dist/subgraphs/vetra-builder-read-model/resolvers.d.ts +2 -0
  31. package/dist/subgraphs/vetra-builder-read-model/resolvers.js +174 -0
  32. package/dist/subgraphs/vetra-builder-read-model/schema.d.ts +2 -0
  33. package/dist/subgraphs/vetra-builder-read-model/schema.js +79 -0
  34. package/package.json +1 -1
@@ -0,0 +1,66 @@
1
+ import type { ColumnType } from "kysely";
2
+ export type Generated<T> = T extends ColumnType<infer S, infer I, infer U> ? ColumnType<S, I | undefined, U> : ColumnType<T, T | undefined, T>;
3
+ export type Timestamp = ColumnType<Date, Date | string, Date | string>;
4
+ export interface BuilderAccountMembers {
5
+ builder_account_id: string;
6
+ created_at: Generated<Timestamp>;
7
+ eth_address: string;
8
+ id: string;
9
+ }
10
+ export interface BuilderAccounts {
11
+ created_at: Generated<Timestamp>;
12
+ id: string;
13
+ profile_description: string | null;
14
+ profile_logo: string | null;
15
+ profile_name: string;
16
+ profile_slug: string;
17
+ profile_socials_github: string | null;
18
+ profile_socials_website: string | null;
19
+ profile_socials_x: string | null;
20
+ updated_at: Generated<Timestamp>;
21
+ }
22
+ export interface BuilderPackageKeywords {
23
+ created_at: Generated<Timestamp>;
24
+ id: string;
25
+ label: string;
26
+ package_id: string;
27
+ }
28
+ export interface BuilderPackages {
29
+ author_name: string;
30
+ author_website: string | null;
31
+ category: string | null;
32
+ created_at: Generated<Timestamp>;
33
+ description: string | null;
34
+ drive_id: string | null;
35
+ github_url: string | null;
36
+ id: string;
37
+ name: string;
38
+ npm_url: string | null;
39
+ sort_order: Generated<number>;
40
+ space_id: string;
41
+ updated_at: Generated<Timestamp>;
42
+ vetra_drive_url: string | null;
43
+ }
44
+ export interface BuilderSpaces {
45
+ builder_account_id: string;
46
+ created_at: Generated<Timestamp>;
47
+ description: string | null;
48
+ id: string;
49
+ sort_order: Generated<number>;
50
+ title: string;
51
+ updated_at: Generated<Timestamp>;
52
+ }
53
+ export interface DeletedFiles {
54
+ deleted_at: Generated<Timestamp>;
55
+ document_id: string;
56
+ drive_id: string;
57
+ id: string;
58
+ }
59
+ export interface DB {
60
+ builder_account_members: BuilderAccountMembers;
61
+ builder_accounts: BuilderAccounts;
62
+ builder_package_keywords: BuilderPackageKeywords;
63
+ builder_packages: BuilderPackages;
64
+ builder_spaces: BuilderSpaces;
65
+ deleted_files: DeletedFiles;
66
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,32 @@
1
+ export interface SetPackageNameInput {
2
+ name: string;
3
+ }
4
+ export interface SetPackageDescriptionInput {
5
+ description: string;
6
+ }
7
+ export interface SetPackageCategoryInput {
8
+ category: string;
9
+ }
10
+ export interface SetPackageAuthorInput {
11
+ name?: string | null;
12
+ website?: string | null;
13
+ }
14
+ export interface SetPackageAuthorNameInput {
15
+ name: string;
16
+ }
17
+ export interface SetPackageAuthorWebsiteInput {
18
+ website: string;
19
+ }
20
+ export interface AddPackageKeywordInput {
21
+ id: string;
22
+ label: string;
23
+ }
24
+ export interface RemovePackageKeywordInput {
25
+ id: string;
26
+ }
27
+ export interface SetPackageGithubUrlInput {
28
+ url: string;
29
+ }
30
+ export interface SetPackageNpmUrlInput {
31
+ url: string;
32
+ }
@@ -0,0 +1 @@
1
+ export {};
package/dist/style.css CHANGED
@@ -26,7 +26,6 @@
26
26
  --color-green-700: oklch(52.7% 0.154 150.069);
27
27
  --color-green-800: oklch(44.8% 0.119 151.328);
28
28
  --color-green-900: oklch(39.3% 0.095 152.535);
29
- --color-blue-50: oklch(97% 0.014 254.604);
30
29
  --color-blue-100: oklch(93.2% 0.032 255.585);
31
30
  --color-blue-200: oklch(88.2% 0.059 254.128);
32
31
  --color-blue-300: oklch(80.9% 0.105 251.813);
@@ -36,9 +35,6 @@
36
35
  --color-blue-700: oklch(48.8% 0.243 264.376);
37
36
  --color-blue-800: oklch(42.4% 0.199 265.638);
38
37
  --color-blue-900: oklch(37.9% 0.146 265.522);
39
- --color-purple-50: oklch(97.7% 0.014 308.299);
40
- --color-purple-500: oklch(62.7% 0.265 303.9);
41
- --color-purple-600: oklch(55.8% 0.288 302.321);
42
38
  --color-purple-900: oklch(38.1% 0.176 304.987);
43
39
  --color-slate-50: oklch(98.4% 0.003 247.858);
44
40
  --color-slate-100: oklch(96.8% 0.007 247.896);
@@ -70,7 +66,6 @@
70
66
  --spacing: 0.25rem;
71
67
  --container-xs: 20rem;
72
68
  --container-4xl: 56rem;
73
- --container-5xl: 64rem;
74
69
  --container-7xl: 80rem;
75
70
  --text-xs: 0.75rem;
76
71
  --text-xs--line-height: calc(1 / 0.75);
@@ -84,8 +79,6 @@
84
79
  --text-xl--line-height: calc(1.75 / 1.25);
85
80
  --text-2xl: 1.5rem;
86
81
  --text-2xl--line-height: calc(2 / 1.5);
87
- --text-3xl: 1.875rem;
88
- --text-3xl--line-height: calc(2.25 / 1.875);
89
82
  --font-weight-extralight: 200;
90
83
  --font-weight-normal: 400;
91
84
  --font-weight-medium: 500;
@@ -281,9 +274,6 @@
281
274
  .mt-4 {
282
275
  margin-top: calc(var(--spacing) * 4);
283
276
  }
284
- .mb-2 {
285
- margin-bottom: calc(var(--spacing) * 2);
286
- }
287
277
  .block {
288
278
  display: block;
289
279
  }
@@ -299,54 +289,21 @@
299
289
  .table {
300
290
  display: table;
301
291
  }
302
- .h-5 {
303
- height: calc(var(--spacing) * 5);
304
- }
305
292
  .h-6 {
306
293
  height: calc(var(--spacing) * 6);
307
294
  }
308
- .h-8 {
309
- height: calc(var(--spacing) * 8);
310
- }
311
295
  .h-12 {
312
296
  height: calc(var(--spacing) * 12);
313
297
  }
314
- .h-16 {
315
- height: calc(var(--spacing) * 16);
316
- }
317
- .h-20 {
318
- height: calc(var(--spacing) * 20);
319
- }
320
- .h-24 {
321
- height: calc(var(--spacing) * 24);
322
- }
323
298
  .min-h-screen {
324
299
  min-height: 100vh;
325
300
  }
326
- .w-5 {
327
- width: calc(var(--spacing) * 5);
328
- }
329
301
  .w-6 {
330
302
  width: calc(var(--spacing) * 6);
331
303
  }
332
- .w-8 {
333
- width: calc(var(--spacing) * 8);
334
- }
335
304
  .w-12 {
336
305
  width: calc(var(--spacing) * 12);
337
306
  }
338
- .w-16 {
339
- width: calc(var(--spacing) * 16);
340
- }
341
- .w-20 {
342
- width: calc(var(--spacing) * 20);
343
- }
344
- .w-24 {
345
- width: calc(var(--spacing) * 24);
346
- }
347
- .max-w-5xl {
348
- max-width: var(--container-5xl);
349
- }
350
307
  .max-w-7xl {
351
308
  max-width: var(--container-7xl);
352
309
  }
@@ -374,9 +331,6 @@
374
331
  .gap-4 {
375
332
  gap: calc(var(--spacing) * 4);
376
333
  }
377
- .gap-6 {
378
- gap: calc(var(--spacing) * 6);
379
- }
380
334
  .gap-8 {
381
335
  gap: calc(var(--spacing) * 8);
382
336
  }
@@ -436,13 +390,6 @@
436
390
  margin-inline-end: calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-x-reverse)));
437
391
  }
438
392
  }
439
- .space-x-6 {
440
- :where(& > :not(:last-child)) {
441
- --tw-space-x-reverse: 0;
442
- margin-inline-start: calc(calc(var(--spacing) * 6) * var(--tw-space-x-reverse));
443
- margin-inline-end: calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-x-reverse)));
444
- }
445
- }
446
393
  .truncate {
447
394
  overflow: hidden;
448
395
  text-overflow: ellipsis;
@@ -451,9 +398,6 @@
451
398
  .rounded {
452
399
  border-radius: 0.25rem;
453
400
  }
454
- .rounded-full {
455
- border-radius: calc(infinity * 1px);
456
- }
457
401
  .rounded-lg {
458
402
  border-radius: var(--radius-lg);
459
403
  }
@@ -464,37 +408,16 @@
464
408
  border-style: var(--tw-border-style);
465
409
  border-width: 1px;
466
410
  }
467
- .border-2 {
468
- border-style: var(--tw-border-style);
469
- border-width: 2px;
470
- }
471
- .border-4 {
472
- border-style: var(--tw-border-style);
473
- border-width: 4px;
474
- }
475
- .border-t {
476
- border-top-style: var(--tw-border-style);
477
- border-top-width: 1px;
478
- }
479
411
  .border-b {
480
412
  border-bottom-style: var(--tw-border-style);
481
413
  border-bottom-width: 1px;
482
414
  }
483
- .border-blue-100 {
484
- border-color: var(--color-blue-100);
485
- }
486
- .border-blue-500 {
487
- border-color: var(--color-blue-500);
488
- }
489
415
  .border-gray-200 {
490
416
  border-color: var(--color-gray-200);
491
417
  }
492
418
  .border-gray-300 {
493
419
  border-color: var(--color-gray-300);
494
420
  }
495
- .border-white {
496
- border-color: var(--color-white);
497
- }
498
421
  .bg-blue-600 {
499
422
  background-color: var(--color-blue-600);
500
423
  }
@@ -504,34 +427,6 @@
504
427
  .bg-white {
505
428
  background-color: var(--color-white);
506
429
  }
507
- .bg-gradient-to-br {
508
- --tw-gradient-position: to bottom right in oklab;
509
- background-image: linear-gradient(var(--tw-gradient-stops));
510
- }
511
- .from-blue-50 {
512
- --tw-gradient-from: var(--color-blue-50);
513
- --tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));
514
- }
515
- .from-blue-400 {
516
- --tw-gradient-from: var(--color-blue-400);
517
- --tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));
518
- }
519
- .from-blue-500 {
520
- --tw-gradient-from: var(--color-blue-500);
521
- --tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));
522
- }
523
- .to-purple-50 {
524
- --tw-gradient-to: var(--color-purple-50);
525
- --tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));
526
- }
527
- .to-purple-500 {
528
- --tw-gradient-to: var(--color-purple-500);
529
- --tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));
530
- }
531
- .to-purple-600 {
532
- --tw-gradient-to: var(--color-purple-600);
533
- --tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));
534
- }
535
430
  .object-cover {
536
431
  object-fit: cover;
537
432
  }
@@ -568,9 +463,6 @@
568
463
  .py-8 {
569
464
  padding-block: calc(var(--spacing) * 8);
570
465
  }
571
- .pt-4 {
572
- padding-top: calc(var(--spacing) * 4);
573
- }
574
466
  .text-center {
575
467
  text-align: center;
576
468
  }
@@ -581,14 +473,6 @@
581
473
  font-size: var(--text-2xl);
582
474
  line-height: var(--tw-leading, var(--text-2xl--line-height));
583
475
  }
584
- .text-3xl {
585
- font-size: var(--text-3xl);
586
- line-height: var(--tw-leading, var(--text-3xl--line-height));
587
- }
588
- .text-base {
589
- font-size: var(--text-base);
590
- line-height: var(--tw-leading, var(--text-base--line-height));
591
- }
592
476
  .text-lg {
593
477
  font-size: var(--text-lg);
594
478
  line-height: var(--tw-leading, var(--text-lg--line-height));
@@ -613,9 +497,6 @@
613
497
  --tw-font-weight: var(--font-weight-semibold);
614
498
  font-weight: var(--font-weight-semibold);
615
499
  }
616
- .break-all {
617
- word-break: break-all;
618
- }
619
500
  .text-blue-600 {
620
501
  color: var(--color-blue-600);
621
502
  }
@@ -625,9 +506,6 @@
625
506
  .text-gray-500 {
626
507
  color: var(--color-gray-500);
627
508
  }
628
- .text-gray-600 {
629
- color: var(--color-gray-600);
630
- }
631
509
  .text-gray-700 {
632
510
  color: var(--color-gray-700);
633
511
  }
@@ -637,13 +515,6 @@
637
515
  .text-white {
638
516
  color: var(--color-white);
639
517
  }
640
- .italic {
641
- font-style: italic;
642
- }
643
- .shadow-lg {
644
- --tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 4px 6px -4px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
645
- box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
646
- }
647
518
  .shadow-sm {
648
519
  --tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
649
520
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
@@ -5789,6 +5660,9 @@ input[type="number"] {
5789
5660
  .inline-flex {
5790
5661
  display: inline-flex;
5791
5662
  }
5663
+ .table {
5664
+ display: table;
5665
+ }
5792
5666
  .h-4 {
5793
5667
  height: calc(var(--spacing) * 4);
5794
5668
  }
@@ -11002,48 +10876,6 @@ input[type="number"] {
11002
10876
  inherits: false;
11003
10877
  initial-value: solid;
11004
10878
  }
11005
- @property --tw-gradient-position {
11006
- syntax: "*";
11007
- inherits: false;
11008
- }
11009
- @property --tw-gradient-from {
11010
- syntax: "<color>";
11011
- inherits: false;
11012
- initial-value: #0000;
11013
- }
11014
- @property --tw-gradient-via {
11015
- syntax: "<color>";
11016
- inherits: false;
11017
- initial-value: #0000;
11018
- }
11019
- @property --tw-gradient-to {
11020
- syntax: "<color>";
11021
- inherits: false;
11022
- initial-value: #0000;
11023
- }
11024
- @property --tw-gradient-stops {
11025
- syntax: "*";
11026
- inherits: false;
11027
- }
11028
- @property --tw-gradient-via-stops {
11029
- syntax: "*";
11030
- inherits: false;
11031
- }
11032
- @property --tw-gradient-from-position {
11033
- syntax: "<length-percentage>";
11034
- inherits: false;
11035
- initial-value: 0%;
11036
- }
11037
- @property --tw-gradient-via-position {
11038
- syntax: "<length-percentage>";
11039
- inherits: false;
11040
- initial-value: 50%;
11041
- }
11042
- @property --tw-gradient-to-position {
11043
- syntax: "<length-percentage>";
11044
- inherits: false;
11045
- initial-value: 100%;
11046
- }
11047
10879
  @property --tw-font-weight {
11048
10880
  syntax: "*";
11049
10881
  inherits: false;
@@ -11182,15 +11014,6 @@ input[type="number"] {
11182
11014
  --tw-space-y-reverse: 0;
11183
11015
  --tw-space-x-reverse: 0;
11184
11016
  --tw-border-style: solid;
11185
- --tw-gradient-position: initial;
11186
- --tw-gradient-from: #0000;
11187
- --tw-gradient-via: #0000;
11188
- --tw-gradient-to: #0000;
11189
- --tw-gradient-stops: initial;
11190
- --tw-gradient-via-stops: initial;
11191
- --tw-gradient-from-position: 0%;
11192
- --tw-gradient-via-position: 50%;
11193
- --tw-gradient-to-position: 100%;
11194
11017
  --tw-font-weight: initial;
11195
11018
  --tw-shadow: 0 0 #0000;
11196
11019
  --tw-shadow-color: initial;
@@ -1,4 +1,3 @@
1
1
  export {};
2
2
  export * as BuilderAccountSubgraph from "./builder-account/index.js";
3
- export * as VetraReadModelSubgraph from "./vetra-read-model/index.js";
4
- export * as RenownProfileSubgraph from "./renown-profile/index.js";
3
+ export * as VetraBuilderReadModelSubgraph from "./vetra-builder-read-model/index.js";
@@ -1,4 +1,2 @@
1
1
  export * as BuilderAccountSubgraph from "./builder-account/index.js";
2
- export * as VetraReadModelSubgraph from "./vetra-read-model/index.js";
3
- export * as RenownProfileSubgraph from "./renown-profile/index.js";
4
- // export * as RenownReadModelSubgraph from "./renown-read-model/index.js";
2
+ export * as VetraBuilderReadModelSubgraph from "./vetra-builder-read-model/index.js";
@@ -0,0 +1,10 @@
1
+ import { Subgraph } from "@powerhousedao/reactor-api";
2
+ import type { DocumentNode } from "graphql";
3
+ export declare class VetraBuilderReadModelSubgraph 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 VetraBuilderReadModelSubgraph extends Subgraph {
5
+ name = "vetra-builder-read-model";
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,174 @@
1
+ import { VetraBuilderReadModelProcessor } from "../../processors/vetra-builder-read-model/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
+ BuilderAccountType: {
8
+ spaces: async (parent, args, context) => {
9
+ const driveId = context.driveId || DEFAULT_DRIVE_ID;
10
+ const spaces = await VetraBuilderReadModelProcessor.query(driveId, db)
11
+ .selectFrom("builder_spaces")
12
+ .selectAll()
13
+ .leftJoin("deleted_files", (join) => join
14
+ .onRef("deleted_files.document_id", "=", "builder_spaces.builder_account_id")
15
+ .on("deleted_files.drive_id", "=", driveId))
16
+ .where("builder_account_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_account_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 VetraBuilderReadModelProcessor.query(driveId, db)
35
+ .selectFrom("builder_account_members")
36
+ .selectAll()
37
+ .leftJoin("deleted_files", (join) => join
38
+ .onRef("deleted_files.document_id", "=", "builder_account_members.builder_account_id")
39
+ .on("deleted_files.drive_id", "=", driveId))
40
+ .where("builder_account_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_account_id,
46
+ ethAddress: member.eth_address,
47
+ createdAt: member.created_at.toISOString(),
48
+ }));
49
+ },
50
+ },
51
+ BuilderSpace: {
52
+ packages: async (parent, args, context) => {
53
+ const driveId = parent.driveId || context.driveId || DEFAULT_DRIVE_ID;
54
+ const packages = await VetraBuilderReadModelProcessor.query(driveId, db)
55
+ .selectFrom("builder_packages")
56
+ .selectAll()
57
+ .leftJoin("builder_spaces", (join) => join.onRef("builder_spaces.id", "=", "builder_packages.space_id"))
58
+ .leftJoin("deleted_files", (join) => join
59
+ .onRef("deleted_files.document_id", "=", "builder_spaces.builder_account_id")
60
+ .on("deleted_files.drive_id", "=", driveId))
61
+ .where("builder_packages.space_id", "=", parent.id)
62
+ .where("deleted_files.id", "is", null) // Exclude packages from deleted accounts
63
+ .orderBy("sort_order", "asc")
64
+ .execute();
65
+ return packages.map((pkg) => ({
66
+ id: pkg.id,
67
+ spaceId: pkg.space_id,
68
+ name: pkg.name,
69
+ description: pkg.description,
70
+ category: pkg.category,
71
+ authorName: pkg.author_name,
72
+ authorWebsite: pkg.author_website,
73
+ githubUrl: pkg.github_url,
74
+ npmUrl: pkg.npm_url,
75
+ vetraDriveUrl: pkg.vetra_drive_url,
76
+ driveId: pkg.drive_id,
77
+ sortOrder: pkg.sort_order,
78
+ createdAt: pkg.created_at.toISOString(),
79
+ updatedAt: pkg.updated_at.toISOString(),
80
+ keywords: [], // Will be resolved by field resolver
81
+ }));
82
+ },
83
+ },
84
+ BuilderPackage: {
85
+ keywords: async (parent, args, context) => {
86
+ const driveId = context.driveId || DEFAULT_DRIVE_ID;
87
+ const keywords = await VetraBuilderReadModelProcessor.query(driveId, db)
88
+ .selectFrom("builder_package_keywords")
89
+ .selectAll()
90
+ .leftJoin("builder_packages", (join) => join.onRef("builder_packages.id", "=", "builder_package_keywords.package_id"))
91
+ .leftJoin("builder_spaces", (join) => join.onRef("builder_spaces.id", "=", "builder_packages.space_id"))
92
+ .leftJoin("deleted_files", (join) => join
93
+ .onRef("deleted_files.document_id", "=", "builder_spaces.builder_account_id")
94
+ .on("deleted_files.drive_id", "=", driveId))
95
+ .where("builder_package_keywords.package_id", "=", parent.id)
96
+ .where("deleted_files.id", "is", null) // Exclude keywords from deleted accounts
97
+ .execute();
98
+ return keywords.map((keyword) => ({
99
+ id: keyword.id,
100
+ packageId: keyword.package_id,
101
+ label: keyword.label,
102
+ createdAt: keyword.created_at.toISOString(),
103
+ }));
104
+ },
105
+ },
106
+ Query: {
107
+ fetchAllBuilderAccounts: async (parent, args) => {
108
+ const driveId = args.driveId || DEFAULT_DRIVE_ID;
109
+ const search = args.search;
110
+ const sortOrder = args.sortOrder || "asc";
111
+ let accounts = VetraBuilderReadModelProcessor.query(driveId, db)
112
+ .selectFrom("builder_accounts")
113
+ .selectAll()
114
+ .leftJoin("deleted_files", (join) => join
115
+ .onRef("deleted_files.document_id", "=", "builder_accounts.id")
116
+ .on("deleted_files.drive_id", "=", driveId))
117
+ .where("deleted_files.id", "is", null); // Exclude deleted documents
118
+ if (search) {
119
+ accounts = accounts.where((eb) => {
120
+ return eb("profile_name", "ilike", `%${search}%`)
121
+ .or("profile_slug", "ilike", `%${search}%`)
122
+ .or("profile_description", "ilike", `%${search}%`);
123
+ });
124
+ }
125
+ // Add sorting by profile_name
126
+ accounts = accounts.orderBy("profile_name", sortOrder);
127
+ const results = await accounts.execute();
128
+ return results.map((account) => ({
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
+ spaces: [], // Will be resolved by field resolver
141
+ members: [], // Will be resolved by field resolver
142
+ }));
143
+ },
144
+ fetchBuilderAccount: async (parent, args) => {
145
+ const driveId = args.driveId || DEFAULT_DRIVE_ID;
146
+ const account = await VetraBuilderReadModelProcessor.query(driveId, db)
147
+ .selectFrom("builder_accounts")
148
+ .selectAll()
149
+ .leftJoin("deleted_files", (join) => join
150
+ .onRef("deleted_files.document_id", "=", "builder_accounts.id")
151
+ .on("deleted_files.drive_id", "=", driveId))
152
+ .where("builder_accounts.id", "=", args.id)
153
+ .where("deleted_files.id", "is", null) // Exclude deleted documents
154
+ .executeTakeFirst();
155
+ if (!account) {
156
+ return null;
157
+ }
158
+ return {
159
+ id: account.id,
160
+ profileName: account.profile_name,
161
+ profileSlug: account.profile_slug,
162
+ profileLogo: account.profile_logo,
163
+ profileDescription: account.profile_description,
164
+ profileSocialsX: account.profile_socials_x,
165
+ profileSocialsGithub: account.profile_socials_github,
166
+ profileSocialsWebsite: account.profile_socials_website,
167
+ createdAt: account.created_at.toISOString(),
168
+ updatedAt: account.updated_at.toISOString(),
169
+ driveId: driveId, // Pass driveId to field resolvers
170
+ };
171
+ },
172
+ },
173
+ };
174
+ };
@@ -0,0 +1,2 @@
1
+ import type { DocumentNode } from "graphql";
2
+ export declare const schema: DocumentNode;