@powerhousedao/network-admin 0.0.51 → 0.0.52

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.
@@ -103,7 +103,7 @@ export const getResolvers = (subgraph) => {
103
103
  type: state?.type || "INDIVIDUAL",
104
104
  _contributorPhids: contributorPhids, // Internal field for resolver
105
105
  status: state?.status || null,
106
- skilss: state?.skilss || state?.skills || [],
106
+ skils: state?.skils || [],
107
107
  scopes: state?.scopes || [],
108
108
  links: state?.links || [],
109
109
  };
@@ -54,7 +54,7 @@ export const schema = gql `
54
54
  type: teamType!
55
55
  contributors: [Builder!]!
56
56
  status: BuilderStatus
57
- skilss: [BuilderSkill!]!
57
+ skils: [BuilderSkill!]!
58
58
  scopes: [BuilderScope!]!
59
59
  links: [BuilderLink!]!
60
60
  }
@@ -1 +1 @@
1
- {"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/workstreams/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAuC5D,eAAO,MAAM,YAAY,GAAI,UAAU,SAAS,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAoyBxE,CAAC"}
1
+ {"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/workstreams/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAuC5D,eAAO,MAAM,YAAY,GAAI,UAAU,SAAS,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CA+5BxE,CAAC"}
@@ -9,6 +9,17 @@ export const getResolvers = (subgraph) => {
9
9
  // Shared state for builder profile resolution (used by field resolvers)
10
10
  let getBuilderProfileByPhid = null;
11
11
  const deriveSlug = (name) => name.toLowerCase().trim().split(/\s+/).join("-");
12
+ const extractPhid = (value) => {
13
+ if (typeof value === "string")
14
+ return value;
15
+ if (value &&
16
+ typeof value === "object" &&
17
+ "id" in value &&
18
+ typeof value.id === "string") {
19
+ return value.id;
20
+ }
21
+ return null;
22
+ };
12
23
  const getCandidateDrives = async () => {
13
24
  try {
14
25
  const drives = await reactor.getDrives?.();
@@ -359,15 +370,33 @@ export const getResolvers = (subgraph) => {
359
370
  // Collect SOWs and their contributors
360
371
  const sowDocs = collectSowsFromWorkstreams(resolved);
361
372
  for (const sow of sowDocs) {
362
- if (sow && sow.contributors && Array.isArray(sow.contributors)) {
373
+ if (!sow || typeof sow !== "object")
374
+ continue;
375
+ if (Array.isArray(sow.contributors)) {
363
376
  sow.contributors.forEach((contributor) => {
364
- // Handle both string PHIDs and objects with id property
365
- const phid = typeof contributor === "string"
366
- ? contributor
367
- : contributor?.id;
368
- if (phid && typeof phid === "string") {
377
+ const phid = extractPhid(contributor);
378
+ if (phid)
379
+ contributorPhids.add(phid);
380
+ });
381
+ }
382
+ // Collect deliverable owners too so `SOW_Deliverable.owner` can resolve
383
+ if (Array.isArray(sow.deliverables)) {
384
+ sow.deliverables.forEach((deliverable) => {
385
+ if (!deliverable || typeof deliverable !== "object")
386
+ return;
387
+ const phid = extractPhid(deliverable.owner);
388
+ if (phid)
389
+ contributorPhids.add(phid);
390
+ });
391
+ }
392
+ // Collect project owners too so `SOW_Project.projectOwner` can resolve
393
+ if (Array.isArray(sow.projects)) {
394
+ sow.projects.forEach((project) => {
395
+ if (!project || typeof project !== "object")
396
+ return;
397
+ const phid = extractPhid(project.projectOwner);
398
+ if (phid)
369
399
  contributorPhids.add(phid);
370
- }
371
400
  });
372
401
  }
373
402
  }
@@ -380,21 +409,36 @@ export const getResolvers = (subgraph) => {
380
409
  return null;
381
410
  const state = doc.state.global;
382
411
  // Store contributor PHIDs separately - they'll be resolved by the field resolver
383
- const contributorPhids = state?.contributors || [];
412
+ const contributorPhids = state?.contributors ?? [];
413
+ // Ensure all non-nullable Builder fields are properly handled
414
+ // name: String! - non-nullable
415
+ const name = String(state?.name ?? doc.header?.name ?? "");
416
+ // icon: String! - non-nullable
417
+ const icon = String(state?.icon ?? "");
418
+ // description: String! - non-nullable
419
+ const description = String(state?.description ?? state?.slug ?? "");
420
+ // type: teamType! - non-nullable, default to "INDIVIDUAL"
421
+ const type = state?.type ?? "INDIVIDUAL";
422
+ // skils: [BuilderSkill!]! - non-nullable array
423
+ const skils = Array.isArray(state?.skils) ? state.skils : [];
424
+ // scopes: [BuilderScope!]! - non-nullable array
425
+ const scopes = Array.isArray(state?.scopes) ? state.scopes : [];
426
+ // links: [BuilderLink!]! - non-nullable array
427
+ const links = Array.isArray(state?.links) ? state.links : [];
384
428
  return {
385
429
  id: doc.header.id,
386
- code: state?.code || null,
387
- slug: state?.slug || null,
388
- name: state?.name || doc.header.name,
389
- icon: state?.icon || "",
390
- description: state?.description || state?.slug || "",
391
- lastModified: state?.lastModified || null,
392
- type: state?.type || "INDIVIDUAL",
430
+ code: state?.code ?? null,
431
+ slug: state?.slug ?? null,
432
+ name,
433
+ icon,
434
+ description,
435
+ lastModified: state?.lastModified ?? null,
436
+ type,
393
437
  _contributorPhids: contributorPhids, // Internal field for resolver
394
- status: state?.status || null,
395
- skilss: state?.skilss || state?.skills || [],
396
- scopes: state?.scopes || [],
397
- links: state?.links || [],
438
+ status: state?.status ?? null,
439
+ skils,
440
+ scopes,
441
+ links,
398
442
  };
399
443
  };
400
444
  return resolved;
@@ -434,15 +478,33 @@ export const getResolvers = (subgraph) => {
434
478
  // Collect SOWs and their contributors
435
479
  const sowDocs = collectSowsFromWorkstreams(results);
436
480
  for (const sow of sowDocs) {
437
- if (sow && sow.contributors && Array.isArray(sow.contributors)) {
481
+ if (!sow || typeof sow !== "object")
482
+ continue;
483
+ if (Array.isArray(sow.contributors)) {
438
484
  sow.contributors.forEach((contributor) => {
439
- // Handle both string PHIDs and objects with id property
440
- const phid = typeof contributor === "string"
441
- ? contributor
442
- : contributor?.id;
443
- if (phid && typeof phid === "string") {
485
+ const phid = extractPhid(contributor);
486
+ if (phid)
487
+ contributorPhids.add(phid);
488
+ });
489
+ }
490
+ // Collect deliverable owners too so `SOW_Deliverable.owner` can resolve
491
+ if (Array.isArray(sow.deliverables)) {
492
+ sow.deliverables.forEach((deliverable) => {
493
+ if (!deliverable || typeof deliverable !== "object")
494
+ return;
495
+ const phid = extractPhid(deliverable.owner);
496
+ if (phid)
497
+ contributorPhids.add(phid);
498
+ });
499
+ }
500
+ // Collect project owners too so `SOW_Project.projectOwner` can resolve
501
+ if (Array.isArray(sow.projects)) {
502
+ sow.projects.forEach((project) => {
503
+ if (!project || typeof project !== "object")
504
+ return;
505
+ const phid = extractPhid(project.projectOwner);
506
+ if (phid)
444
507
  contributorPhids.add(phid);
445
- }
446
508
  });
447
509
  }
448
510
  }
@@ -455,21 +517,36 @@ export const getResolvers = (subgraph) => {
455
517
  return null;
456
518
  const state = doc.state.global;
457
519
  // Store contributor PHIDs separately - they'll be resolved by the field resolver
458
- const contributorPhids = state?.contributors || [];
520
+ const contributorPhids = state?.contributors ?? [];
521
+ // Ensure all non-nullable Builder fields are properly handled
522
+ // name: String! - non-nullable
523
+ const name = String(state?.name ?? doc.header?.name ?? "");
524
+ // icon: String! - non-nullable
525
+ const icon = String(state?.icon ?? "");
526
+ // description: String! - non-nullable
527
+ const description = String(state?.description ?? state?.slug ?? "");
528
+ // type: teamType! - non-nullable, default to "INDIVIDUAL"
529
+ const type = state?.type ?? "INDIVIDUAL";
530
+ // skils: [BuilderSkill!]! - non-nullable array
531
+ const skils = Array.isArray(state?.skils) ? state.skils : [];
532
+ // scopes: [BuilderScope!]! - non-nullable array
533
+ const scopes = Array.isArray(state?.scopes) ? state.scopes : [];
534
+ // links: [BuilderLink!]! - non-nullable array
535
+ const links = Array.isArray(state?.links) ? state.links : [];
459
536
  return {
460
537
  id: doc.header.id,
461
- code: state?.code || null,
462
- slug: state?.slug || null,
463
- name: state?.name || doc.header.name,
464
- icon: state?.icon || "",
465
- description: state?.description || state?.slug || "",
466
- lastModified: state?.lastModified || null,
467
- type: state?.type || "INDIVIDUAL",
538
+ code: state?.code ?? null,
539
+ slug: state?.slug ?? null,
540
+ name,
541
+ icon,
542
+ description,
543
+ lastModified: state?.lastModified ?? null,
544
+ type,
468
545
  _contributorPhids: contributorPhids, // Internal field for resolver
469
- status: state?.status || null,
470
- skilss: state?.skilss || state?.skills || [],
471
- scopes: state?.scopes || [],
472
- links: state?.links || [],
546
+ status: state?.status ?? null,
547
+ skils,
548
+ scopes,
549
+ links,
473
550
  };
474
551
  };
475
552
  return results;
@@ -560,13 +637,33 @@ export const getResolvers = (subgraph) => {
560
637
  }
561
638
  // Collect contributor PHIDs from all SOWs
562
639
  for (const sow of sowDocs) {
563
- if (sow && sow.contributors && Array.isArray(sow.contributors)) {
640
+ if (!sow || typeof sow !== "object")
641
+ continue;
642
+ if (Array.isArray(sow.contributors)) {
564
643
  sow.contributors.forEach((contributor) => {
565
- // Handle both string PHIDs and objects with id property
566
- const phid = typeof contributor === "string" ? contributor : contributor?.id;
567
- if (phid && typeof phid === "string") {
644
+ const phid = extractPhid(contributor);
645
+ if (phid)
646
+ contributorPhids.add(phid);
647
+ });
648
+ }
649
+ // Collect deliverable owners too so `SOW_Deliverable.owner` can resolve
650
+ if (Array.isArray(sow.deliverables)) {
651
+ sow.deliverables.forEach((deliverable) => {
652
+ if (!deliverable || typeof deliverable !== "object")
653
+ return;
654
+ const phid = extractPhid(deliverable.owner);
655
+ if (phid)
656
+ contributorPhids.add(phid);
657
+ });
658
+ }
659
+ // Collect project owners too so `SOW_Project.projectOwner` can resolve
660
+ if (Array.isArray(sow.projects)) {
661
+ sow.projects.forEach((project) => {
662
+ if (!project || typeof project !== "object")
663
+ return;
664
+ const phid = extractPhid(project.projectOwner);
665
+ if (phid)
568
666
  contributorPhids.add(phid);
569
- }
570
667
  });
571
668
  }
572
669
  }
@@ -590,21 +687,36 @@ export const getResolvers = (subgraph) => {
590
687
  return null;
591
688
  const state = doc.state.global;
592
689
  // Store contributor PHIDs separately - they'll be resolved by the field resolver
593
- const contributorPhids = state?.contributors || [];
690
+ const contributorPhids = state?.contributors ?? [];
691
+ // Ensure all non-nullable Builder fields are properly handled
692
+ // name: String! - non-nullable
693
+ const name = String(state?.name ?? doc.header?.name ?? "");
694
+ // icon: String! - non-nullable
695
+ const icon = String(state?.icon ?? "");
696
+ // description: String! - non-nullable
697
+ const description = String(state?.description ?? state?.slug ?? "");
698
+ // type: teamType! - non-nullable, default to "INDIVIDUAL"
699
+ const type = state?.type ?? "INDIVIDUAL";
700
+ // skils: [BuilderSkill!]! - non-nullable array
701
+ const skils = Array.isArray(state?.skils) ? state.skils : [];
702
+ // scopes: [BuilderScope!]! - non-nullable array
703
+ const scopes = Array.isArray(state?.scopes) ? state.scopes : [];
704
+ // links: [BuilderLink!]! - non-nullable array
705
+ const links = Array.isArray(state?.links) ? state.links : [];
594
706
  return {
595
707
  id: doc.header.id,
596
- code: state?.code || null,
597
- slug: state?.slug || null,
598
- name: state?.name || doc.header.name,
599
- icon: state?.icon || "",
600
- description: state?.description || state?.slug || "",
601
- lastModified: state?.lastModified || null,
602
- type: state?.type || "INDIVIDUAL",
708
+ code: state?.code ?? null,
709
+ slug: state?.slug ?? null,
710
+ name,
711
+ icon,
712
+ description,
713
+ lastModified: state?.lastModified ?? null,
714
+ type,
603
715
  _contributorPhids: contributorPhids, // Internal field for resolver
604
- status: state?.status || null,
605
- skilss: state?.skilss || state?.skills || [],
606
- scopes: state?.scopes || [],
607
- links: state?.links || [],
716
+ status: state?.status ?? null,
717
+ skils,
718
+ scopes,
719
+ links,
608
720
  };
609
721
  };
610
722
  return results;
@@ -648,6 +760,30 @@ export const getResolvers = (subgraph) => {
648
760
  .filter((builder) => builder !== null);
649
761
  },
650
762
  },
763
+ SOW_Deliverable: {
764
+ owner: (parent) => {
765
+ if (!parent?.owner)
766
+ return null;
767
+ if (!getBuilderProfileByPhid)
768
+ return null;
769
+ const phid = extractPhid(parent.owner);
770
+ if (!phid)
771
+ return null;
772
+ return getBuilderProfileByPhid(phid);
773
+ },
774
+ },
775
+ SOW_Project: {
776
+ projectOwner: (parent) => {
777
+ if (!parent?.projectOwner)
778
+ return null;
779
+ if (!getBuilderProfileByPhid)
780
+ return null;
781
+ const phid = extractPhid(parent.projectOwner);
782
+ if (!phid)
783
+ return null;
784
+ return getBuilderProfileByPhid(phid);
785
+ },
786
+ },
651
787
  Builder: {
652
788
  contributors: (parent) => {
653
789
  // Resolve contributor PHIDs to Builder objects
@@ -220,7 +220,7 @@ export const schema = gql `
220
220
 
221
221
  type SOW_Deliverable {
222
222
  id: OID!
223
- owner: ID
223
+ owner: Builder
224
224
  title: String!
225
225
  code: String!
226
226
  description: String!
@@ -277,7 +277,7 @@ export const schema = gql `
277
277
  code: String!
278
278
  title: String!
279
279
  slug: String!
280
- projectOwner: ID
280
+ projectOwner: Builder
281
281
  abstract: String
282
282
  imageUrl: URL
283
283
  scope: SOW_DeliverablesSet
@@ -472,7 +472,7 @@ export const schema = gql `
472
472
  type: teamType!
473
473
  contributors: [Builder!]!
474
474
  status: BuilderStatus
475
- skilss: [BuilderSkill!]!
475
+ skils: [BuilderSkill!]!
476
476
  scopes: [BuilderScope!]!
477
477
  links: [BuilderLink!]!
478
478
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@powerhousedao/network-admin",
3
3
  "description": "Network Admin package for Powerhouse",
4
- "version": "0.0.51",
4
+ "version": "0.0.52",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",
7
7
  "files": [
@@ -62,6 +62,7 @@
62
62
  "service-unstartup": "bash ./node_modules/@powerhousedao/ph-cli/dist/scripts/service-unstartup.sh"
63
63
  },
64
64
  "dependencies": {
65
+ "@powerhousedao/builder-profile": "0.0.5",
65
66
  "@powerhousedao/builder-tools": "^5.0.12",
66
67
  "@powerhousedao/common": "^5.0.12",
67
68
  "@powerhousedao/design-system": "^5.0.12",