@powerhousedao/network-admin 0.0.64 → 0.0.65

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.
@@ -1 +1 @@
1
- {"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/builders-addon/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAc5D,eAAO,MAAM,YAAY,GAAI,UAAU,SAAS,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAybxE,CAAC"}
1
+ {"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/builders-addon/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAe5D,eAAO,MAAM,YAAY,GAAI,UAAU,SAAS,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CA6fxE,CAAC"}
@@ -55,6 +55,10 @@ export const getResolvers = (subgraph) => {
55
55
  if (!hasAllScopes)
56
56
  return false;
57
57
  }
58
+ if (filter.isOperator !== undefined && filter.isOperator !== null) {
59
+ if (builder.isOperator !== filter.isOperator)
60
+ return false;
61
+ }
58
62
  return true;
59
63
  };
60
64
  return {
@@ -64,6 +68,7 @@ export const getResolvers = (subgraph) => {
64
68
  const filter = args.filter;
65
69
  let builderDocs = [];
66
70
  const sowDocs = [];
71
+ const resourceTemplateDocs = [];
67
72
  const allowedDriveIds = new Set(drives);
68
73
  // Step 1: If networkSlug is provided, identify the network drive and valid builder PHIDs
69
74
  if (filter?.networkSlug) {
@@ -125,6 +130,9 @@ export const getResolvers = (subgraph) => {
125
130
  if (doc.header.documentType === "powerhouse/scopeofwork") {
126
131
  sowDocs.push(doc);
127
132
  }
133
+ else if (doc.header.documentType === "powerhouse/resource-template") {
134
+ resourceTemplateDocs.push(doc);
135
+ }
128
136
  }
129
137
  catch { }
130
138
  }
@@ -169,6 +177,9 @@ export const getResolvers = (subgraph) => {
169
177
  else if (doc.header.documentType === "powerhouse/scopeofwork") {
170
178
  sowDocs.push(doc);
171
179
  }
180
+ else if (doc.header.documentType === "powerhouse/resource-template") {
181
+ resourceTemplateDocs.push(doc);
182
+ }
172
183
  }
173
184
  }
174
185
  catch (error) {
@@ -303,6 +314,60 @@ export const getResolvers = (subgraph) => {
303
314
  }
304
315
  }
305
316
  }
317
+ // Step 3b: Extract products from resource-template documents and group by operatorId
318
+ const productsByOperator = new Map();
319
+ for (const rtDoc of resourceTemplateDocs) {
320
+ const rtState = rtDoc.state.global;
321
+ if (!rtState || typeof rtState !== "object")
322
+ continue;
323
+ const operatorId = rtState.operatorId;
324
+ if (!operatorId || typeof operatorId !== "string")
325
+ continue;
326
+ try {
327
+ const product = {
328
+ id: rtState.id || rtDoc.header.id,
329
+ operatorId,
330
+ title: String(rtState.title || ""),
331
+ summary: String(rtState.summary || ""),
332
+ description: rtState.description ?? null,
333
+ thumbnailUrl: rtState.thumbnailUrl ?? null,
334
+ infoLink: rtState.infoLink ?? null,
335
+ status: rtState.status || "DRAFT",
336
+ lastModified: rtState.lastModified ?? null,
337
+ targetAudiences: Array.isArray(rtState.targetAudiences)
338
+ ? rtState.targetAudiences
339
+ : [],
340
+ setupServices: Array.isArray(rtState.setupServices)
341
+ ? rtState.setupServices
342
+ : [],
343
+ recurringServices: Array.isArray(rtState.recurringServices)
344
+ ? rtState.recurringServices
345
+ : [],
346
+ facetTargets: Array.isArray(rtState.facetTargets)
347
+ ? rtState.facetTargets
348
+ : [],
349
+ services: Array.isArray(rtState.services)
350
+ ? rtState.services
351
+ : [],
352
+ optionGroups: Array.isArray(rtState.optionGroups)
353
+ ? rtState.optionGroups
354
+ : [],
355
+ faqFields: Array.isArray(rtState.faqFields)
356
+ ? rtState.faqFields
357
+ : [],
358
+ contentSections: Array.isArray(rtState.contentSections)
359
+ ? rtState.contentSections
360
+ : [],
361
+ };
362
+ if (!productsByOperator.has(operatorId)) {
363
+ productsByOperator.set(operatorId, []);
364
+ }
365
+ productsByOperator.get(operatorId).push(product);
366
+ }
367
+ catch (error) {
368
+ console.warn(`Failed to transform resource-template ${rtDoc.header.id}:`, error);
369
+ }
370
+ }
306
371
  // Step 4: Transform builder documents to BuilderProfileState format
307
372
  const builders = builderDocs
308
373
  .map((doc) => {
@@ -342,6 +407,7 @@ export const getResolvers = (subgraph) => {
342
407
  scopes,
343
408
  links,
344
409
  projects: projectsByOwner.get(doc.header.id) || [],
410
+ products: productsByOperator.get(doc.header.id) || [],
345
411
  };
346
412
  return builder;
347
413
  })
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../subgraphs/builders-addon/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,MAAM,EAAE,YA+MpB,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../subgraphs/builders-addon/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,MAAM,EAAE,YAoSpB,CAAC"}
@@ -18,6 +18,7 @@ export const schema = gql `
18
18
  skills: [BuilderSkill!]
19
19
  scopes: [BuilderScope!]
20
20
  networkSlug: String
21
+ isOperator: Boolean
21
22
  }
22
23
 
23
24
  ## Builder Profile Schema
@@ -38,6 +39,7 @@ export const schema = gql `
38
39
  scopes: [BuilderScope!]!
39
40
  links: [BuilderLink!]!
40
41
  projects: [BuilderProject!]!
42
+ products: [BuilderProduct!]!
41
43
  }
42
44
 
43
45
  type OpHubMember {
@@ -206,4 +208,87 @@ export const schema = gql `
206
208
  total: Int!
207
209
  completed: Int!
208
210
  }
211
+
212
+ # PRODUCTS #
213
+
214
+ type BuilderProduct {
215
+ id: PHID!
216
+ operatorId: PHID!
217
+ title: String!
218
+ summary: String!
219
+ description: String
220
+ thumbnailUrl: URL
221
+ infoLink: URL
222
+ status: BTemplateStatus!
223
+ lastModified: DateTime!
224
+ targetAudiences: [BTargetAudience!]!
225
+ setupServices: [String!]!
226
+ recurringServices: [String!]!
227
+ facetTargets: [BFacetTarget!]!
228
+ services: [BService!]!
229
+ optionGroups: [BOptionGroup!]!
230
+ faqFields: [BFaqField!]
231
+ contentSections: [BContentSection!]!
232
+ }
233
+
234
+ enum BTemplateStatus {
235
+ DRAFT
236
+ COMING_SOON
237
+ ACTIVE
238
+ DEPRECATED
239
+ }
240
+
241
+ type BTargetAudience {
242
+ id: OID!
243
+ label: String!
244
+ color: String
245
+ }
246
+
247
+ type BFacetTarget {
248
+ id: OID!
249
+ categoryKey: String!
250
+ categoryLabel: String!
251
+ selectedOptions: [String!]!
252
+ }
253
+
254
+ type BService {
255
+ id: OID!
256
+ title: String!
257
+ description: String
258
+ displayOrder: Int
259
+ parentServiceId: OID
260
+ isSetupFormation: Boolean!
261
+ optionGroupId: OID
262
+ facetBindings: [BResourceFacetBinding!]!
263
+ }
264
+
265
+ type BResourceFacetBinding {
266
+ id: OID!
267
+ facetName: String!
268
+ facetType: PHID!
269
+ supportedOptions: [OID!]!
270
+ }
271
+
272
+ type BOptionGroup {
273
+ id: OID!
274
+ name: String!
275
+ description: String
276
+ isAddOn: Boolean!
277
+ defaultSelected: Boolean!
278
+ }
279
+
280
+ type BFaqField {
281
+ id: OID!
282
+ question: String
283
+ answer: String
284
+ displayOrder: Int!
285
+ }
286
+
287
+ type BContentSection {
288
+ id: OID!
289
+ title: String!
290
+ content: String!
291
+ displayOrder: Int!
292
+ }
293
+
209
294
  `;
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.64",
4
+ "version": "0.0.65",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",
7
7
  "files": [