@powerhousedao/service-offering 1.0.0-dev.17 → 1.0.0-dev.18

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.
package/dist/style.css CHANGED
@@ -394,6 +394,9 @@
394
394
  .left-\[calc\(100\%-1\.125rem\)\] {
395
395
  left: calc(100% - 1.125rem);
396
396
  }
397
+ .isolate {
398
+ isolation: isolate;
399
+ }
397
400
  .z-10 {
398
401
  z-index: 10;
399
402
  }
@@ -1 +1 @@
1
- {"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/resources-services/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAyD/D,eAAO,MAAM,YAAY,GACvB,UAAU,YAAY,KACrB,MAAM,CAAC,MAAM,EAAE,OAAO,CA4gBxB,CAAC"}
1
+ {"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/resources-services/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAyD/D,eAAO,MAAM,YAAY,GACvB,UAAU,YAAY,KACrB,MAAM,CAAC,MAAM,EAAE,OAAO,CA+hBxB,CAAC"}
@@ -10,12 +10,15 @@ export const getResolvers = (subgraph) => {
10
10
  Query: {
11
11
  resourceTemplates: async (_, args) => {
12
12
  const { id, status, operatorId } = args.filter || {};
13
+ const deletedDriveDocIds = await getDeletedDriveDocIds(reactorClient);
13
14
  // If filtering by specific id, try to fetch directly
14
15
  if (id) {
15
16
  try {
16
17
  const doc = await reactorClient.get(id);
17
18
  if (doc &&
18
- doc.header.documentType === "powerhouse/resource-template") {
19
+ doc.header.documentType === "powerhouse/resource-template" &&
20
+ !doc.state.document.isDeleted &&
21
+ !deletedDriveDocIds.has(doc.header.id)) {
19
22
  const state = doc.state.global;
20
23
  if (status &&
21
24
  status.length > 0 &&
@@ -39,6 +42,11 @@ export const getResolvers = (subgraph) => {
39
42
  });
40
43
  const resourceTemplates = [];
41
44
  for (const doc of docs) {
45
+ // Skip docs from soft-deleted drives or soft-deleted documents
46
+ if (deletedDriveDocIds.has(doc.header.id))
47
+ continue;
48
+ if (doc.state.document.isDeleted)
49
+ continue;
42
50
  const resourceDoc = doc;
43
51
  const state = resourceDoc.state.global;
44
52
  // Skip documents missing required fields
@@ -58,12 +66,15 @@ export const getResolvers = (subgraph) => {
58
66
  },
59
67
  serviceOfferings: async (_, args) => {
60
68
  const { id, status, operatorId, resourceTemplateId } = args.filter || {};
69
+ const deletedDriveDocIds = await getDeletedDriveDocIds(reactorClient);
61
70
  // If filtering by specific id, try to fetch directly
62
71
  if (id) {
63
72
  try {
64
73
  const doc = await reactorClient.get(id);
65
74
  if (doc &&
66
- doc.header.documentType === "powerhouse/service-offering") {
75
+ doc.header.documentType === "powerhouse/service-offering" &&
76
+ !doc.state.document.isDeleted &&
77
+ !deletedDriveDocIds.has(doc.header.id)) {
67
78
  const state = doc.state.global;
68
79
  if (status &&
69
80
  status.length > 0 &&
@@ -91,6 +102,11 @@ export const getResolvers = (subgraph) => {
91
102
  });
92
103
  const serviceOfferings = [];
93
104
  for (const doc of docs) {
105
+ // Skip docs from soft-deleted drives or soft-deleted documents
106
+ if (deletedDriveDocIds.has(doc.header.id))
107
+ continue;
108
+ if (doc.state.document.isDeleted)
109
+ continue;
94
110
  const offeringDoc = doc;
95
111
  const state = offeringDoc.state.global;
96
112
  // Skip documents missing required fields
@@ -195,8 +211,11 @@ export const getResolvers = (subgraph) => {
195
211
  };
196
212
  }
197
213
  // Fetch the service offering
214
+ const deletedDriveDocIds = await getDeletedDriveDocIds(reactorClient);
198
215
  const serviceOfferingDoc = await reactorClient.get(serviceOfferingId);
199
- if (!serviceOfferingDoc) {
216
+ if (!serviceOfferingDoc ||
217
+ serviceOfferingDoc.state.document.isDeleted ||
218
+ deletedDriveDocIds.has(serviceOfferingDoc.header.id)) {
200
219
  return {
201
220
  success: false,
202
221
  data: null,
@@ -667,12 +686,36 @@ function mapServiceOfferingState(state, doc) {
667
686
  })),
668
687
  };
669
688
  }
689
+ /**
690
+ * Returns a Set of document IDs that belong to soft-deleted drives.
691
+ * Documents inside a deleted drive should not be returned by queries.
692
+ */
693
+ async function getDeletedDriveDocIds(reactorClient) {
694
+ const { results: drives } = await reactorClient.find({
695
+ type: "powerhouse/document-drive",
696
+ });
697
+ const ids = new Set();
698
+ for (const drive of drives) {
699
+ if (!drive.state.document.isDeleted)
700
+ continue;
701
+ const driveDoc = drive;
702
+ for (const node of driveDoc.state.global.nodes) {
703
+ if (node.kind === "file") {
704
+ ids.add(node.id);
705
+ }
706
+ }
707
+ }
708
+ return ids;
709
+ }
670
710
  async function getOperatorDrive(reactorClient, resourceTemplateId) {
671
711
  // Find all drives
672
712
  const { results: drives } = await reactorClient.find({
673
713
  type: "powerhouse/document-drive",
674
714
  });
675
715
  for (const drive of drives) {
716
+ // Skip soft-deleted drives
717
+ if (drive.state.document.isDeleted)
718
+ continue;
676
719
  const driveDoc = drive;
677
720
  // Check if this drive contains the resource template as a child
678
721
  const { results: children } = await reactorClient.getChildren(driveDoc.header.id);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@powerhousedao/service-offering",
3
3
  "description": "service offering document models",
4
- "version": "1.0.0-dev.17",
4
+ "version": "1.0.0-dev.18",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
7
7
  "type": "git",