@powerhousedao/network-admin 0.0.7 → 0.0.9
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/subgraphs/index.d.ts +3 -3
- package/dist/subgraphs/index.d.ts.map +1 -1
- package/dist/subgraphs/index.js +3 -3
- package/dist/subgraphs/network-profile/index.d.ts +3 -2
- package/dist/subgraphs/network-profile/index.d.ts.map +1 -1
- package/dist/subgraphs/network-profile/resolvers.d.ts +1 -1
- package/dist/subgraphs/network-profile/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/network-profile/resolvers.js +144 -85
- package/dist/subgraphs/network-profile/schema.js +3 -3
- package/dist/subgraphs/payment-terms/index.d.ts +3 -2
- package/dist/subgraphs/payment-terms/index.d.ts.map +1 -1
- package/dist/subgraphs/payment-terms/resolvers.d.ts +1 -1
- package/dist/subgraphs/payment-terms/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/payment-terms/resolvers.js +18 -2
- package/dist/subgraphs/payment-terms/schema.d.ts.map +1 -1
- package/dist/subgraphs/payment-terms/schema.js +30 -8
- package/dist/subgraphs/request-for-proposals/index.d.ts +3 -2
- package/dist/subgraphs/request-for-proposals/index.d.ts.map +1 -1
- package/dist/subgraphs/request-for-proposals/resolvers.d.ts +1 -1
- package/dist/subgraphs/request-for-proposals/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/request-for-proposals/resolvers.js +95 -61
- package/dist/subgraphs/request-for-proposals/schema.js +3 -3
- package/dist/subgraphs/workstream/index.d.ts +3 -2
- package/dist/subgraphs/workstream/index.d.ts.map +1 -1
- package/dist/subgraphs/workstream/resolvers.d.ts +1 -1
- package/dist/subgraphs/workstream/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/workstream/resolvers.js +125 -76
- package/dist/subgraphs/workstream/schema.js +3 -3
- package/package.json +13 -13
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
export * as WorkstreamSubgraph from "./workstream/index.js";
|
|
3
|
-
export * as RequestForProposalsSubgraph from "./request-for-proposals/index.js";
|
|
4
|
-
export * as PaymentTermsSubgraph from "./payment-terms/index.js";
|
|
5
2
|
export * as NetworkProfileSubgraph from "./network-profile/index.js";
|
|
3
|
+
export * as PaymentTermsSubgraph from "./payment-terms/index.js";
|
|
4
|
+
export * as RequestForProposalsSubgraph from "./request-for-proposals/index.js";
|
|
5
|
+
export * as WorkstreamSubgraph from "./workstream/index.js";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../subgraphs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AACV,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../subgraphs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AACV,OAAO,KAAK,sBAAsB,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,oBAAoB,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,2BAA2B,MAAM,kCAAkC,CAAC;AAChF,OAAO,KAAK,kBAAkB,MAAM,uBAAuB,CAAC"}
|
package/dist/subgraphs/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * as WorkstreamSubgraph from "./workstream/index.js";
|
|
2
|
-
export * as RequestForProposalsSubgraph from "./request-for-proposals/index.js";
|
|
3
|
-
export * as PaymentTermsSubgraph from "./payment-terms/index.js";
|
|
4
1
|
export * as NetworkProfileSubgraph from "./network-profile/index.js";
|
|
2
|
+
export * as PaymentTermsSubgraph from "./payment-terms/index.js";
|
|
3
|
+
export * as RequestForProposalsSubgraph from "./request-for-proposals/index.js";
|
|
4
|
+
export * as WorkstreamSubgraph from "./workstream/index.js";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Subgraph } from "@powerhousedao/reactor-api";
|
|
2
|
+
import type { DocumentNode } from "graphql";
|
|
2
3
|
export declare class NetworkProfileSubgraph extends Subgraph {
|
|
3
4
|
name: string;
|
|
4
|
-
typeDefs:
|
|
5
|
-
resolvers: Record<string,
|
|
5
|
+
typeDefs: DocumentNode;
|
|
6
|
+
resolvers: Record<string, unknown>;
|
|
6
7
|
additionalContextFields: {};
|
|
7
8
|
onSetup(): Promise<void>;
|
|
8
9
|
onDisconnect(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../subgraphs/network-profile/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../subgraphs/network-profile/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAI5C,qBAAa,sBAAuB,SAAQ,QAAQ;IAClD,IAAI,SAAqB;IACzB,QAAQ,EAAE,YAAY,CAAU;IAChC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAsB;IACxD,uBAAuB,KAAM;IACvB,OAAO;IACP,YAAY;CACnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/network-profile/resolvers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/network-profile/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAmB3D,eAAO,MAAM,YAAY,GAAI,UAAU,QAAQ,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAkUvE,CAAC"}
|
|
@@ -1,38 +1,49 @@
|
|
|
1
1
|
import { addFile } from "document-drive";
|
|
2
|
-
import { actions } from "../../document-models/network-profile/index.js";
|
|
3
|
-
import {
|
|
4
|
-
const DEFAULT_DRIVE_ID = "powerhouse";
|
|
2
|
+
import { actions, } from "../../document-models/network-profile/index.js";
|
|
3
|
+
import { setName } from "document-model";
|
|
5
4
|
export const getResolvers = (subgraph) => {
|
|
6
5
|
const reactor = subgraph.reactor;
|
|
7
6
|
return {
|
|
8
7
|
Query: {
|
|
9
|
-
NetworkProfile: async (
|
|
8
|
+
NetworkProfile: async () => {
|
|
10
9
|
return {
|
|
11
10
|
getDocument: async (args) => {
|
|
12
|
-
const driveId = args
|
|
13
|
-
|
|
11
|
+
const { docId, driveId } = args;
|
|
12
|
+
if (!docId) {
|
|
13
|
+
throw new Error("Document id is required");
|
|
14
|
+
}
|
|
15
|
+
if (driveId) {
|
|
16
|
+
const docIds = await reactor.getDocuments(driveId);
|
|
17
|
+
if (!docIds.includes(docId)) {
|
|
18
|
+
throw new Error(`Document with id ${docId} is not part of ${driveId}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
14
21
|
const doc = await reactor.getDocument(docId);
|
|
15
22
|
return {
|
|
16
23
|
driveId: driveId,
|
|
17
24
|
...doc,
|
|
18
25
|
...doc.header,
|
|
26
|
+
created: doc.header.createdAtUtcIso,
|
|
27
|
+
lastModified: doc.header.lastModifiedAtUtcIso,
|
|
19
28
|
state: doc.state.global,
|
|
20
29
|
stateJSON: doc.state.global,
|
|
21
|
-
revision: doc.header
|
|
30
|
+
revision: doc.header?.revision?.global ?? 0,
|
|
22
31
|
};
|
|
23
32
|
},
|
|
24
33
|
getDocuments: async (args) => {
|
|
25
|
-
const driveId = args
|
|
34
|
+
const { driveId } = args;
|
|
26
35
|
const docsIds = await reactor.getDocuments(driveId);
|
|
27
36
|
const docs = await Promise.all(docsIds.map(async (docId) => {
|
|
28
|
-
const doc = await reactor.getDocument(
|
|
37
|
+
const doc = await reactor.getDocument(docId);
|
|
29
38
|
return {
|
|
30
39
|
driveId: driveId,
|
|
31
40
|
...doc,
|
|
32
41
|
...doc.header,
|
|
42
|
+
created: doc.header.createdAtUtcIso,
|
|
43
|
+
lastModified: doc.header.lastModifiedAtUtcIso,
|
|
33
44
|
state: doc.state.global,
|
|
34
45
|
stateJSON: doc.state.global,
|
|
35
|
-
revision: doc.header
|
|
46
|
+
revision: doc.header?.revision?.global ?? 0,
|
|
36
47
|
};
|
|
37
48
|
}));
|
|
38
49
|
return docs.filter((doc) => doc.header.documentType === "powerhouse/network-profile");
|
|
@@ -42,103 +53,151 @@ export const getResolvers = (subgraph) => {
|
|
|
42
53
|
},
|
|
43
54
|
Mutation: {
|
|
44
55
|
NetworkProfile_createDocument: async (_, args) => {
|
|
45
|
-
const driveId = args
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
branch: "main",
|
|
59
|
-
scope: "local",
|
|
60
|
-
syncId: generateId(),
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
}));
|
|
64
|
-
return docId;
|
|
56
|
+
const { driveId, name } = args;
|
|
57
|
+
const document = await reactor.addDocument("powerhouse/network-profile");
|
|
58
|
+
if (driveId) {
|
|
59
|
+
await reactor.addAction(driveId, addFile({
|
|
60
|
+
name,
|
|
61
|
+
id: document.header.id,
|
|
62
|
+
documentType: "powerhouse/network-profile",
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
if (name) {
|
|
66
|
+
await reactor.addAction(document.header.id, setName(name));
|
|
67
|
+
}
|
|
68
|
+
return document.header.id;
|
|
65
69
|
},
|
|
66
70
|
NetworkProfile_setIcon: async (_, args) => {
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
const { docId, input } = args;
|
|
72
|
+
const doc = await reactor.getDocument(docId);
|
|
73
|
+
if (!doc) {
|
|
74
|
+
throw new Error("Document not found");
|
|
75
|
+
}
|
|
76
|
+
const result = await reactor.addAction(docId, actions.setIcon(input));
|
|
77
|
+
if (result.status !== "SUCCESS") {
|
|
78
|
+
throw new Error(result.error?.message ?? "Failed to setIcon");
|
|
79
|
+
}
|
|
80
|
+
return true;
|
|
72
81
|
},
|
|
73
82
|
NetworkProfile_setLogo: async (_, args) => {
|
|
74
|
-
const
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
83
|
+
const { docId, input } = args;
|
|
84
|
+
const doc = await reactor.getDocument(docId);
|
|
85
|
+
if (!doc) {
|
|
86
|
+
throw new Error("Document not found");
|
|
87
|
+
}
|
|
88
|
+
const result = await reactor.addAction(docId, actions.setLogo(input));
|
|
89
|
+
if (result.status !== "SUCCESS") {
|
|
90
|
+
throw new Error(result.error?.message ?? "Failed to setLogo");
|
|
91
|
+
}
|
|
92
|
+
return true;
|
|
79
93
|
},
|
|
80
94
|
NetworkProfile_setLogoBig: async (_, args) => {
|
|
81
|
-
const
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
95
|
+
const { docId, input } = args;
|
|
96
|
+
const doc = await reactor.getDocument(docId);
|
|
97
|
+
if (!doc) {
|
|
98
|
+
throw new Error("Document not found");
|
|
99
|
+
}
|
|
100
|
+
const result = await reactor.addAction(docId, actions.setLogoBig(input));
|
|
101
|
+
if (result.status !== "SUCCESS") {
|
|
102
|
+
throw new Error(result.error?.message ?? "Failed to setLogoBig");
|
|
103
|
+
}
|
|
104
|
+
return true;
|
|
86
105
|
},
|
|
87
106
|
NetworkProfile_setWebsite: async (_, args) => {
|
|
88
|
-
const
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
107
|
+
const { docId, input } = args;
|
|
108
|
+
const doc = await reactor.getDocument(docId);
|
|
109
|
+
if (!doc) {
|
|
110
|
+
throw new Error("Document not found");
|
|
111
|
+
}
|
|
112
|
+
const result = await reactor.addAction(docId, actions.setWebsite(input));
|
|
113
|
+
if (result.status !== "SUCCESS") {
|
|
114
|
+
throw new Error(result.error?.message ?? "Failed to setWebsite");
|
|
115
|
+
}
|
|
116
|
+
return true;
|
|
93
117
|
},
|
|
94
118
|
NetworkProfile_setDescription: async (_, args) => {
|
|
95
|
-
const
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
119
|
+
const { docId, input } = args;
|
|
120
|
+
const doc = await reactor.getDocument(docId);
|
|
121
|
+
if (!doc) {
|
|
122
|
+
throw new Error("Document not found");
|
|
123
|
+
}
|
|
124
|
+
const result = await reactor.addAction(docId, actions.setDescription(input));
|
|
125
|
+
if (result.status !== "SUCCESS") {
|
|
126
|
+
throw new Error(result.error?.message ?? "Failed to setDescription");
|
|
127
|
+
}
|
|
128
|
+
return true;
|
|
100
129
|
},
|
|
101
130
|
NetworkProfile_setCategory: async (_, args) => {
|
|
102
|
-
const
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
131
|
+
const { docId, input } = args;
|
|
132
|
+
const doc = await reactor.getDocument(docId);
|
|
133
|
+
if (!doc) {
|
|
134
|
+
throw new Error("Document not found");
|
|
135
|
+
}
|
|
136
|
+
const result = await reactor.addAction(docId, actions.setCategory(input));
|
|
137
|
+
if (result.status !== "SUCCESS") {
|
|
138
|
+
throw new Error(result.error?.message ?? "Failed to setCategory");
|
|
139
|
+
}
|
|
140
|
+
return true;
|
|
107
141
|
},
|
|
108
142
|
NetworkProfile_setX: async (_, args) => {
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
143
|
+
const { docId, input } = args;
|
|
144
|
+
const doc = await reactor.getDocument(docId);
|
|
145
|
+
if (!doc) {
|
|
146
|
+
throw new Error("Document not found");
|
|
147
|
+
}
|
|
148
|
+
const result = await reactor.addAction(docId, actions.setX(input));
|
|
149
|
+
if (result.status !== "SUCCESS") {
|
|
150
|
+
throw new Error(result.error?.message ?? "Failed to setX");
|
|
151
|
+
}
|
|
152
|
+
return true;
|
|
114
153
|
},
|
|
115
154
|
NetworkProfile_setGithub: async (_, args) => {
|
|
116
|
-
const
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
155
|
+
const { docId, input } = args;
|
|
156
|
+
const doc = await reactor.getDocument(docId);
|
|
157
|
+
if (!doc) {
|
|
158
|
+
throw new Error("Document not found");
|
|
159
|
+
}
|
|
160
|
+
const result = await reactor.addAction(docId, actions.setGithub(input));
|
|
161
|
+
if (result.status !== "SUCCESS") {
|
|
162
|
+
throw new Error(result.error?.message ?? "Failed to setGithub");
|
|
163
|
+
}
|
|
164
|
+
return true;
|
|
121
165
|
},
|
|
122
166
|
NetworkProfile_setDiscord: async (_, args) => {
|
|
123
|
-
const
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
167
|
+
const { docId, input } = args;
|
|
168
|
+
const doc = await reactor.getDocument(docId);
|
|
169
|
+
if (!doc) {
|
|
170
|
+
throw new Error("Document not found");
|
|
171
|
+
}
|
|
172
|
+
const result = await reactor.addAction(docId, actions.setDiscord(input));
|
|
173
|
+
if (result.status !== "SUCCESS") {
|
|
174
|
+
throw new Error(result.error?.message ?? "Failed to setDiscord");
|
|
175
|
+
}
|
|
176
|
+
return true;
|
|
128
177
|
},
|
|
129
178
|
NetworkProfile_setYoutube: async (_, args) => {
|
|
130
|
-
const
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
179
|
+
const { docId, input } = args;
|
|
180
|
+
const doc = await reactor.getDocument(docId);
|
|
181
|
+
if (!doc) {
|
|
182
|
+
throw new Error("Document not found");
|
|
183
|
+
}
|
|
184
|
+
const result = await reactor.addAction(docId, actions.setYoutube(input));
|
|
185
|
+
if (result.status !== "SUCCESS") {
|
|
186
|
+
throw new Error(result.error?.message ?? "Failed to setYoutube");
|
|
187
|
+
}
|
|
188
|
+
return true;
|
|
135
189
|
},
|
|
136
190
|
NetworkProfile_setProfileName: async (_, args) => {
|
|
137
|
-
const
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
191
|
+
const { docId, input } = args;
|
|
192
|
+
const doc = await reactor.getDocument(docId);
|
|
193
|
+
if (!doc) {
|
|
194
|
+
throw new Error("Document not found");
|
|
195
|
+
}
|
|
196
|
+
const result = await reactor.addAction(docId, actions.setProfileName(input));
|
|
197
|
+
if (result.status !== "SUCCESS") {
|
|
198
|
+
throw new Error(result.error?.message ?? "Failed to setProfileName");
|
|
199
|
+
}
|
|
200
|
+
return true;
|
|
142
201
|
},
|
|
143
202
|
},
|
|
144
203
|
};
|
|
@@ -29,8 +29,8 @@ export const schema = gql `
|
|
|
29
29
|
Queries: NetworkProfile
|
|
30
30
|
"""
|
|
31
31
|
type NetworkProfileQueries {
|
|
32
|
-
getDocument(
|
|
33
|
-
getDocuments: [NetworkProfile!]
|
|
32
|
+
getDocument(docId: PHID!, driveId: PHID): NetworkProfile
|
|
33
|
+
getDocuments(driveId: String!): [NetworkProfile!]
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
type Query {
|
|
@@ -41,7 +41,7 @@ export const schema = gql `
|
|
|
41
41
|
Mutations: NetworkProfile
|
|
42
42
|
"""
|
|
43
43
|
type Mutation {
|
|
44
|
-
NetworkProfile_createDocument(
|
|
44
|
+
NetworkProfile_createDocument(name: String!, driveId: String): String
|
|
45
45
|
|
|
46
46
|
NetworkProfile_setIcon(
|
|
47
47
|
driveId: String
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Subgraph } from "@powerhousedao/reactor-api";
|
|
2
|
+
import type { DocumentNode } from "graphql";
|
|
2
3
|
export declare class PaymentTermsSubgraph extends Subgraph {
|
|
3
4
|
name: string;
|
|
4
|
-
typeDefs:
|
|
5
|
-
resolvers: Record<string,
|
|
5
|
+
typeDefs: DocumentNode;
|
|
6
|
+
resolvers: Record<string, unknown>;
|
|
6
7
|
additionalContextFields: {};
|
|
7
8
|
onSetup(): Promise<void>;
|
|
8
9
|
onDisconnect(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../subgraphs/payment-terms/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../subgraphs/payment-terms/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAI5C,qBAAa,oBAAqB,SAAQ,QAAQ;IAChD,IAAI,SAAmB;IACvB,QAAQ,EAAE,YAAY,CAAU;IAChC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAsB;IACxD,uBAAuB,KAAM;IACvB,OAAO;IACP,YAAY;CACnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/payment-terms/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/payment-terms/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAyB3D,eAAO,MAAM,YAAY,GAAI,UAAU,QAAQ,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAqevE,CAAC"}
|
|
@@ -23,6 +23,8 @@ export const getResolvers = (subgraph) => {
|
|
|
23
23
|
driveId: driveId,
|
|
24
24
|
...doc,
|
|
25
25
|
...doc.header,
|
|
26
|
+
created: doc.header.createdAtUtcIso,
|
|
27
|
+
lastModified: doc.header.lastModifiedAtUtcIso,
|
|
26
28
|
state: doc.state.global,
|
|
27
29
|
stateJSON: doc.state.global,
|
|
28
30
|
revision: doc.header?.revision?.global ?? 0,
|
|
@@ -37,6 +39,8 @@ export const getResolvers = (subgraph) => {
|
|
|
37
39
|
driveId: driveId,
|
|
38
40
|
...doc,
|
|
39
41
|
...doc.header,
|
|
42
|
+
created: doc.header.createdAtUtcIso,
|
|
43
|
+
lastModified: doc.header.lastModifiedAtUtcIso,
|
|
40
44
|
state: doc.state.global,
|
|
41
45
|
stateJSON: doc.state.global,
|
|
42
46
|
revision: doc.header?.revision?.global ?? 0,
|
|
@@ -87,7 +91,7 @@ export const getResolvers = (subgraph) => {
|
|
|
87
91
|
}
|
|
88
92
|
return true;
|
|
89
93
|
},
|
|
90
|
-
|
|
94
|
+
PaymentTerms_setCostAndMaterials: async (_, args) => {
|
|
91
95
|
const { docId, input } = args;
|
|
92
96
|
const doc = await reactor.getDocument(docId);
|
|
93
97
|
if (!doc) {
|
|
@@ -95,7 +99,7 @@ export const getResolvers = (subgraph) => {
|
|
|
95
99
|
}
|
|
96
100
|
const result = await reactor.addAction(docId, actions.setCostAndMaterials(input));
|
|
97
101
|
if (result.status !== "SUCCESS") {
|
|
98
|
-
throw new Error(result.error?.message ?? "Failed to
|
|
102
|
+
throw new Error(result.error?.message ?? "Failed to setCostAndMaterials");
|
|
99
103
|
}
|
|
100
104
|
return true;
|
|
101
105
|
},
|
|
@@ -123,6 +127,18 @@ export const getResolvers = (subgraph) => {
|
|
|
123
127
|
}
|
|
124
128
|
return true;
|
|
125
129
|
},
|
|
130
|
+
PaymentTerms_setRetainerDetails: async (_, args) => {
|
|
131
|
+
const { docId, input } = args;
|
|
132
|
+
const doc = await reactor.getDocument(docId);
|
|
133
|
+
if (!doc) {
|
|
134
|
+
throw new Error("Document not found");
|
|
135
|
+
}
|
|
136
|
+
const result = await reactor.addAction(docId, actions.setRetainerDetails(input));
|
|
137
|
+
if (result.status !== "SUCCESS") {
|
|
138
|
+
throw new Error(result.error?.message ?? "Failed to setRetainerDetails");
|
|
139
|
+
}
|
|
140
|
+
return true;
|
|
141
|
+
},
|
|
126
142
|
PaymentTerms_addMilestone: async (_, args) => {
|
|
127
143
|
const { docId, input } = args;
|
|
128
144
|
const doc = await reactor.getDocument(docId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../subgraphs/payment-terms/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../subgraphs/payment-terms/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,MAAM,EAAE,YAkUpB,CAAC"}
|
|
@@ -18,7 +18,8 @@ export const schema = gql `
|
|
|
18
18
|
|
|
19
19
|
enum PaymentModel {
|
|
20
20
|
MILESTONE
|
|
21
|
-
|
|
21
|
+
COST_AND_MATERIALS
|
|
22
|
+
RETAINER
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
enum MilestonePayoutStatus {
|
|
@@ -50,14 +51,22 @@ export const schema = gql `
|
|
|
50
51
|
payoutStatus: MilestonePayoutStatus!
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
type
|
|
54
|
-
retainerAmount: Amount
|
|
54
|
+
type CostAndMaterials {
|
|
55
55
|
hourlyRate: Amount
|
|
56
56
|
variableCap: Amount
|
|
57
57
|
billingFrequency: BillingFrequency!
|
|
58
58
|
timesheetRequired: Boolean!
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
type Retainer {
|
|
62
|
+
retainerAmount: Amount!
|
|
63
|
+
billingFrequency: BillingFrequency!
|
|
64
|
+
startDate: Date!
|
|
65
|
+
endDate: Date
|
|
66
|
+
autoRenew: Boolean!
|
|
67
|
+
servicesIncluded: String!
|
|
68
|
+
}
|
|
69
|
+
|
|
61
70
|
type Escrow {
|
|
62
71
|
amountHeld: Amount!
|
|
63
72
|
proofOfFundsDocumentId: String
|
|
@@ -96,7 +105,8 @@ export const schema = gql `
|
|
|
96
105
|
paymentModel: PaymentModel!
|
|
97
106
|
totalAmount: Amount
|
|
98
107
|
milestoneSchedule: [Milestone!]!
|
|
99
|
-
|
|
108
|
+
costAndMaterials: CostAndMaterials
|
|
109
|
+
retainerDetails: Retainer
|
|
100
110
|
escrowDetails: Escrow
|
|
101
111
|
evaluation: EvaluationTerms
|
|
102
112
|
bonusClauses: [BonusClause!]!
|
|
@@ -131,10 +141,10 @@ export const schema = gql `
|
|
|
131
141
|
docId: PHID
|
|
132
142
|
input: PaymentTerms_UpdateStatusInput
|
|
133
143
|
): Int
|
|
134
|
-
|
|
144
|
+
PaymentTerms_setCostAndMaterials(
|
|
135
145
|
driveId: String
|
|
136
146
|
docId: PHID
|
|
137
|
-
input:
|
|
147
|
+
input: PaymentTerms_SetCostAndMaterialsInput
|
|
138
148
|
): Int
|
|
139
149
|
PaymentTerms_setEscrowDetails(
|
|
140
150
|
driveId: String
|
|
@@ -146,6 +156,11 @@ export const schema = gql `
|
|
|
146
156
|
docId: PHID
|
|
147
157
|
input: PaymentTerms_SetEvaluationTermsInput
|
|
148
158
|
): Int
|
|
159
|
+
PaymentTerms_setRetainerDetails(
|
|
160
|
+
driveId: String
|
|
161
|
+
docId: PHID
|
|
162
|
+
input: PaymentTerms_SetRetainerDetailsInput
|
|
163
|
+
): Int
|
|
149
164
|
PaymentTerms_addMilestone(
|
|
150
165
|
driveId: String
|
|
151
166
|
docId: PHID
|
|
@@ -216,8 +231,7 @@ export const schema = gql `
|
|
|
216
231
|
input PaymentTerms_UpdateStatusInput {
|
|
217
232
|
status: PaymentTermsStatus!
|
|
218
233
|
}
|
|
219
|
-
input
|
|
220
|
-
retainerAmount: Amount
|
|
234
|
+
input PaymentTerms_SetCostAndMaterialsInput {
|
|
221
235
|
hourlyRate: Amount
|
|
222
236
|
variableCap: Amount
|
|
223
237
|
billingFrequency: BillingFrequency!
|
|
@@ -237,6 +251,14 @@ export const schema = gql `
|
|
|
237
251
|
impactsReputation: Boolean!
|
|
238
252
|
commentsVisibleToClient: Boolean!
|
|
239
253
|
}
|
|
254
|
+
input PaymentTerms_SetRetainerDetailsInput {
|
|
255
|
+
retainerAmount: Amount!
|
|
256
|
+
billingFrequency: BillingFrequency!
|
|
257
|
+
startDate: Date!
|
|
258
|
+
endDate: Date
|
|
259
|
+
autoRenew: Boolean!
|
|
260
|
+
servicesIncluded: String!
|
|
261
|
+
}
|
|
240
262
|
|
|
241
263
|
"""
|
|
242
264
|
Module: Milestones
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Subgraph } from "@powerhousedao/reactor-api";
|
|
2
|
+
import type { DocumentNode } from "graphql";
|
|
2
3
|
export declare class RequestForProposalsSubgraph extends Subgraph {
|
|
3
4
|
name: string;
|
|
4
|
-
typeDefs:
|
|
5
|
-
resolvers: Record<string,
|
|
5
|
+
typeDefs: DocumentNode;
|
|
6
|
+
resolvers: Record<string, unknown>;
|
|
6
7
|
additionalContextFields: {};
|
|
7
8
|
onSetup(): Promise<void>;
|
|
8
9
|
onDisconnect(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../subgraphs/request-for-proposals/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../subgraphs/request-for-proposals/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAI5C,qBAAa,2BAA4B,SAAQ,QAAQ;IACvD,IAAI,SAA2B;IAC/B,QAAQ,EAAE,YAAY,CAAU;IAChC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAsB;IACxD,uBAAuB,KAAM;IACvB,OAAO;IACP,YAAY;CACnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/request-for-proposals/resolvers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/request-for-proposals/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAc3D,eAAO,MAAM,YAAY,GAAI,UAAU,QAAQ,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAuOvE,CAAC"}
|
|
@@ -1,38 +1,49 @@
|
|
|
1
1
|
import { addFile } from "document-drive";
|
|
2
|
-
import { actions } from "../../document-models/request-for-proposals/index.js";
|
|
3
|
-
import {
|
|
4
|
-
const DEFAULT_DRIVE_ID = "powerhouse";
|
|
2
|
+
import { actions, } from "../../document-models/request-for-proposals/index.js";
|
|
3
|
+
import { setName } from "document-model";
|
|
5
4
|
export const getResolvers = (subgraph) => {
|
|
6
5
|
const reactor = subgraph.reactor;
|
|
7
6
|
return {
|
|
8
7
|
Query: {
|
|
9
|
-
RequestForProposals: async (
|
|
8
|
+
RequestForProposals: async () => {
|
|
10
9
|
return {
|
|
11
10
|
getDocument: async (args) => {
|
|
12
|
-
const driveId = args
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const { docId, driveId } = args;
|
|
12
|
+
if (!docId) {
|
|
13
|
+
throw new Error("Document id is required");
|
|
14
|
+
}
|
|
15
|
+
if (driveId) {
|
|
16
|
+
const docIds = await reactor.getDocuments(driveId);
|
|
17
|
+
if (!docIds.includes(docId)) {
|
|
18
|
+
throw new Error(`Document with id ${docId} is not part of ${driveId}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const doc = await reactor.getDocument(docId);
|
|
15
22
|
return {
|
|
16
23
|
driveId: driveId,
|
|
17
24
|
...doc,
|
|
18
25
|
...doc.header,
|
|
26
|
+
created: doc.header.createdAtUtcIso,
|
|
27
|
+
lastModified: doc.header.lastModifiedAtUtcIso,
|
|
19
28
|
state: doc.state.global,
|
|
20
29
|
stateJSON: doc.state.global,
|
|
21
|
-
revision: doc.header
|
|
30
|
+
revision: doc.header?.revision?.global ?? 0,
|
|
22
31
|
};
|
|
23
32
|
},
|
|
24
33
|
getDocuments: async (args) => {
|
|
25
|
-
const driveId = args
|
|
34
|
+
const { driveId } = args;
|
|
26
35
|
const docsIds = await reactor.getDocuments(driveId);
|
|
27
36
|
const docs = await Promise.all(docsIds.map(async (docId) => {
|
|
28
|
-
const doc = await reactor.getDocument(
|
|
37
|
+
const doc = await reactor.getDocument(docId);
|
|
29
38
|
return {
|
|
30
39
|
driveId: driveId,
|
|
31
40
|
...doc,
|
|
32
41
|
...doc.header,
|
|
42
|
+
created: doc.header.createdAtUtcIso,
|
|
43
|
+
lastModified: doc.header.lastModifiedAtUtcIso,
|
|
33
44
|
state: doc.state.global,
|
|
34
45
|
stateJSON: doc.state.global,
|
|
35
|
-
revision: doc.header
|
|
46
|
+
revision: doc.header?.revision?.global ?? 0,
|
|
36
47
|
};
|
|
37
48
|
}));
|
|
38
49
|
return docs.filter((doc) => doc.header.documentType === "powerhouse/rfp");
|
|
@@ -42,68 +53,91 @@ export const getResolvers = (subgraph) => {
|
|
|
42
53
|
},
|
|
43
54
|
Mutation: {
|
|
44
55
|
RequestForProposals_createDocument: async (_, args) => {
|
|
45
|
-
const driveId = args
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
branch: "main",
|
|
59
|
-
scope: "local",
|
|
60
|
-
syncId: generateId(),
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
}));
|
|
64
|
-
return docId;
|
|
56
|
+
const { driveId, name } = args;
|
|
57
|
+
const document = await reactor.addDocument("powerhouse/rfp");
|
|
58
|
+
if (driveId) {
|
|
59
|
+
await reactor.addAction(driveId, addFile({
|
|
60
|
+
name,
|
|
61
|
+
id: document.header.id,
|
|
62
|
+
documentType: "powerhouse/rfp",
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
if (name) {
|
|
66
|
+
await reactor.addAction(document.header.id, setName(name));
|
|
67
|
+
}
|
|
68
|
+
return document.header.id;
|
|
65
69
|
},
|
|
66
70
|
RequestForProposals_editRfp: async (_, args) => {
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
const { docId, input } = args;
|
|
72
|
+
const doc = await reactor.getDocument(docId);
|
|
73
|
+
if (!doc) {
|
|
74
|
+
throw new Error("Document not found");
|
|
75
|
+
}
|
|
76
|
+
const result = await reactor.addAction(docId, actions.editRfp(input));
|
|
77
|
+
if (result.status !== "SUCCESS") {
|
|
78
|
+
throw new Error(result.error?.message ?? "Failed to editRfp");
|
|
79
|
+
}
|
|
80
|
+
return true;
|
|
72
81
|
},
|
|
73
82
|
RequestForProposals_addContextDocument: async (_, args) => {
|
|
74
|
-
const
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
83
|
+
const { docId, input } = args;
|
|
84
|
+
const doc = await reactor.getDocument(docId);
|
|
85
|
+
if (!doc) {
|
|
86
|
+
throw new Error("Document not found");
|
|
87
|
+
}
|
|
88
|
+
const result = await reactor.addAction(docId, actions.addContextDocument(input));
|
|
89
|
+
if (result.status !== "SUCCESS") {
|
|
90
|
+
throw new Error(result.error?.message ?? "Failed to addContextDocument");
|
|
91
|
+
}
|
|
92
|
+
return true;
|
|
79
93
|
},
|
|
80
94
|
RequestForProposals_removeContextDocument: async (_, args) => {
|
|
81
|
-
const
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
95
|
+
const { docId, input } = args;
|
|
96
|
+
const doc = await reactor.getDocument(docId);
|
|
97
|
+
if (!doc) {
|
|
98
|
+
throw new Error("Document not found");
|
|
99
|
+
}
|
|
100
|
+
const result = await reactor.addAction(docId, actions.removeContextDocument(input));
|
|
101
|
+
if (result.status !== "SUCCESS") {
|
|
102
|
+
throw new Error(result.error?.message ?? "Failed to removeContextDocument");
|
|
103
|
+
}
|
|
104
|
+
return true;
|
|
86
105
|
},
|
|
87
106
|
RequestForProposals_addProposal: async (_, args) => {
|
|
88
|
-
const
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
107
|
+
const { docId, input } = args;
|
|
108
|
+
const doc = await reactor.getDocument(docId);
|
|
109
|
+
if (!doc) {
|
|
110
|
+
throw new Error("Document not found");
|
|
111
|
+
}
|
|
112
|
+
const result = await reactor.addAction(docId, actions.addProposal(input));
|
|
113
|
+
if (result.status !== "SUCCESS") {
|
|
114
|
+
throw new Error(result.error?.message ?? "Failed to addProposal");
|
|
115
|
+
}
|
|
116
|
+
return true;
|
|
93
117
|
},
|
|
94
118
|
RequestForProposals_changeProposalStatus: async (_, args) => {
|
|
95
|
-
const
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
119
|
+
const { docId, input } = args;
|
|
120
|
+
const doc = await reactor.getDocument(docId);
|
|
121
|
+
if (!doc) {
|
|
122
|
+
throw new Error("Document not found");
|
|
123
|
+
}
|
|
124
|
+
const result = await reactor.addAction(docId, actions.changeProposalStatus(input));
|
|
125
|
+
if (result.status !== "SUCCESS") {
|
|
126
|
+
throw new Error(result.error?.message ?? "Failed to changeProposalStatus");
|
|
127
|
+
}
|
|
128
|
+
return true;
|
|
100
129
|
},
|
|
101
130
|
RequestForProposals_removeProposal: async (_, args) => {
|
|
102
|
-
const
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
131
|
+
const { docId, input } = args;
|
|
132
|
+
const doc = await reactor.getDocument(docId);
|
|
133
|
+
if (!doc) {
|
|
134
|
+
throw new Error("Document not found");
|
|
135
|
+
}
|
|
136
|
+
const result = await reactor.addAction(docId, actions.removeProposal(input));
|
|
137
|
+
if (result.status !== "SUCCESS") {
|
|
138
|
+
throw new Error(result.error?.message ?? "Failed to removeProposal");
|
|
139
|
+
}
|
|
140
|
+
return true;
|
|
107
141
|
},
|
|
108
142
|
},
|
|
109
143
|
};
|
|
@@ -95,8 +95,8 @@ export const schema = gql `
|
|
|
95
95
|
Queries: RequestForProposals
|
|
96
96
|
"""
|
|
97
97
|
type RequestForProposalsQueries {
|
|
98
|
-
getDocument(
|
|
99
|
-
getDocuments: [RequestForProposals!]
|
|
98
|
+
getDocument(docId: PHID!, driveId: PHID): RequestForProposals
|
|
99
|
+
getDocuments(driveId: String!): [RequestForProposals!]
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
type Query {
|
|
@@ -107,7 +107,7 @@ export const schema = gql `
|
|
|
107
107
|
Mutations: RequestForProposals
|
|
108
108
|
"""
|
|
109
109
|
type Mutation {
|
|
110
|
-
RequestForProposals_createDocument(
|
|
110
|
+
RequestForProposals_createDocument(name: String!, driveId: String): String
|
|
111
111
|
|
|
112
112
|
RequestForProposals_editRfp(
|
|
113
113
|
driveId: String
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Subgraph } from "@powerhousedao/reactor-api";
|
|
2
|
+
import type { DocumentNode } from "graphql";
|
|
2
3
|
export declare class WorkstreamSubgraph extends Subgraph {
|
|
3
4
|
name: string;
|
|
4
|
-
typeDefs:
|
|
5
|
-
resolvers: Record<string,
|
|
5
|
+
typeDefs: DocumentNode;
|
|
6
|
+
resolvers: Record<string, unknown>;
|
|
6
7
|
additionalContextFields: {};
|
|
7
8
|
onSetup(): Promise<void>;
|
|
8
9
|
onDisconnect(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../subgraphs/workstream/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../subgraphs/workstream/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAI5C,qBAAa,kBAAmB,SAAQ,QAAQ;IAC9C,IAAI,SAAgB;IACpB,QAAQ,EAAE,YAAY,CAAU;IAChC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAsB;IACxD,uBAAuB,KAAM;IACvB,OAAO;IACP,YAAY;CACnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/workstream/resolvers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/workstream/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAiB3D,eAAO,MAAM,YAAY,GAAI,UAAU,QAAQ,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CA6SvE,CAAC"}
|
|
@@ -1,38 +1,49 @@
|
|
|
1
1
|
import { addFile } from "document-drive";
|
|
2
|
-
import { actions } from "../../document-models/workstream/index.js";
|
|
3
|
-
import {
|
|
4
|
-
const DEFAULT_DRIVE_ID = "powerhouse";
|
|
2
|
+
import { actions, } from "../../document-models/workstream/index.js";
|
|
3
|
+
import { setName } from "document-model";
|
|
5
4
|
export const getResolvers = (subgraph) => {
|
|
6
5
|
const reactor = subgraph.reactor;
|
|
7
6
|
return {
|
|
8
7
|
Query: {
|
|
9
|
-
Workstream: async (
|
|
8
|
+
Workstream: async () => {
|
|
10
9
|
return {
|
|
11
10
|
getDocument: async (args) => {
|
|
12
|
-
const driveId = args
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const { docId, driveId } = args;
|
|
12
|
+
if (!docId) {
|
|
13
|
+
throw new Error("Document id is required");
|
|
14
|
+
}
|
|
15
|
+
if (driveId) {
|
|
16
|
+
const docIds = await reactor.getDocuments(driveId);
|
|
17
|
+
if (!docIds.includes(docId)) {
|
|
18
|
+
throw new Error(`Document with id ${docId} is not part of ${driveId}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const doc = await reactor.getDocument(docId);
|
|
15
22
|
return {
|
|
16
23
|
driveId: driveId,
|
|
17
24
|
...doc,
|
|
18
25
|
...doc.header,
|
|
26
|
+
created: doc.header.createdAtUtcIso,
|
|
27
|
+
lastModified: doc.header.lastModifiedAtUtcIso,
|
|
19
28
|
state: doc.state.global,
|
|
20
29
|
stateJSON: doc.state.global,
|
|
21
|
-
revision: doc.header
|
|
30
|
+
revision: doc.header?.revision?.global ?? 0,
|
|
22
31
|
};
|
|
23
32
|
},
|
|
24
33
|
getDocuments: async (args) => {
|
|
25
|
-
const driveId = args
|
|
34
|
+
const { driveId } = args;
|
|
26
35
|
const docsIds = await reactor.getDocuments(driveId);
|
|
27
36
|
const docs = await Promise.all(docsIds.map(async (docId) => {
|
|
28
|
-
const doc = await reactor.getDocument(
|
|
37
|
+
const doc = await reactor.getDocument(docId);
|
|
29
38
|
return {
|
|
30
39
|
driveId: driveId,
|
|
31
40
|
...doc,
|
|
32
41
|
...doc.header,
|
|
42
|
+
created: doc.header.createdAtUtcIso,
|
|
43
|
+
lastModified: doc.header.lastModifiedAtUtcIso,
|
|
33
44
|
state: doc.state.global,
|
|
34
45
|
stateJSON: doc.state.global,
|
|
35
|
-
revision: doc.header
|
|
46
|
+
revision: doc.header?.revision?.global ?? 0,
|
|
36
47
|
};
|
|
37
48
|
}));
|
|
38
49
|
return docs.filter((doc) => doc.header.documentType === "powerhouse/workstream");
|
|
@@ -42,89 +53,127 @@ export const getResolvers = (subgraph) => {
|
|
|
42
53
|
},
|
|
43
54
|
Mutation: {
|
|
44
55
|
Workstream_createDocument: async (_, args) => {
|
|
45
|
-
const driveId = args
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
branch: "main",
|
|
59
|
-
scope: "local",
|
|
60
|
-
syncId: generateId(),
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
}));
|
|
64
|
-
return docId;
|
|
56
|
+
const { driveId, name } = args;
|
|
57
|
+
const document = await reactor.addDocument("powerhouse/workstream");
|
|
58
|
+
if (driveId) {
|
|
59
|
+
await reactor.addAction(driveId, addFile({
|
|
60
|
+
name,
|
|
61
|
+
id: document.header.id,
|
|
62
|
+
documentType: "powerhouse/workstream",
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
if (name) {
|
|
66
|
+
await reactor.addAction(document.header.id, setName(name));
|
|
67
|
+
}
|
|
68
|
+
return document.header.id;
|
|
65
69
|
},
|
|
66
70
|
Workstream_editWorkstream: async (_, args) => {
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
const { docId, input } = args;
|
|
72
|
+
const doc = await reactor.getDocument(docId);
|
|
73
|
+
if (!doc) {
|
|
74
|
+
throw new Error("Document not found");
|
|
75
|
+
}
|
|
76
|
+
const result = await reactor.addAction(docId, actions.editWorkstream(input));
|
|
77
|
+
if (result.status !== "SUCCESS") {
|
|
78
|
+
throw new Error(result.error?.message ?? "Failed to editWorkstream");
|
|
79
|
+
}
|
|
80
|
+
return true;
|
|
72
81
|
},
|
|
73
82
|
Workstream_editClientInfo: async (_, args) => {
|
|
74
|
-
const
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
83
|
+
const { docId, input } = args;
|
|
84
|
+
const doc = await reactor.getDocument(docId);
|
|
85
|
+
if (!doc) {
|
|
86
|
+
throw new Error("Document not found");
|
|
87
|
+
}
|
|
88
|
+
const result = await reactor.addAction(docId, actions.editClientInfo(input));
|
|
89
|
+
if (result.status !== "SUCCESS") {
|
|
90
|
+
throw new Error(result.error?.message ?? "Failed to editClientInfo");
|
|
91
|
+
}
|
|
92
|
+
return true;
|
|
79
93
|
},
|
|
80
94
|
Workstream_setRequestForProposal: async (_, args) => {
|
|
81
|
-
const
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
95
|
+
const { docId, input } = args;
|
|
96
|
+
const doc = await reactor.getDocument(docId);
|
|
97
|
+
if (!doc) {
|
|
98
|
+
throw new Error("Document not found");
|
|
99
|
+
}
|
|
100
|
+
const result = await reactor.addAction(docId, actions.setRequestForProposal(input));
|
|
101
|
+
if (result.status !== "SUCCESS") {
|
|
102
|
+
throw new Error(result.error?.message ?? "Failed to setRequestForProposal");
|
|
103
|
+
}
|
|
104
|
+
return true;
|
|
86
105
|
},
|
|
87
106
|
Workstream_addPaymentRequest: async (_, args) => {
|
|
88
|
-
const
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
107
|
+
const { docId, input } = args;
|
|
108
|
+
const doc = await reactor.getDocument(docId);
|
|
109
|
+
if (!doc) {
|
|
110
|
+
throw new Error("Document not found");
|
|
111
|
+
}
|
|
112
|
+
const result = await reactor.addAction(docId, actions.addPaymentRequest(input));
|
|
113
|
+
if (result.status !== "SUCCESS") {
|
|
114
|
+
throw new Error(result.error?.message ?? "Failed to addPaymentRequest");
|
|
115
|
+
}
|
|
116
|
+
return true;
|
|
93
117
|
},
|
|
94
118
|
Workstream_removePaymentRequest: async (_, args) => {
|
|
95
|
-
const
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
119
|
+
const { docId, input } = args;
|
|
120
|
+
const doc = await reactor.getDocument(docId);
|
|
121
|
+
if (!doc) {
|
|
122
|
+
throw new Error("Document not found");
|
|
123
|
+
}
|
|
124
|
+
const result = await reactor.addAction(docId, actions.removePaymentRequest(input));
|
|
125
|
+
if (result.status !== "SUCCESS") {
|
|
126
|
+
throw new Error(result.error?.message ?? "Failed to removePaymentRequest");
|
|
127
|
+
}
|
|
128
|
+
return true;
|
|
100
129
|
},
|
|
101
130
|
Workstream_editInitialProposal: async (_, args) => {
|
|
102
|
-
const
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
131
|
+
const { docId, input } = args;
|
|
132
|
+
const doc = await reactor.getDocument(docId);
|
|
133
|
+
if (!doc) {
|
|
134
|
+
throw new Error("Document not found");
|
|
135
|
+
}
|
|
136
|
+
const result = await reactor.addAction(docId, actions.editInitialProposal(input));
|
|
137
|
+
if (result.status !== "SUCCESS") {
|
|
138
|
+
throw new Error(result.error?.message ?? "Failed to editInitialProposal");
|
|
139
|
+
}
|
|
140
|
+
return true;
|
|
107
141
|
},
|
|
108
142
|
Workstream_addAlternativeProposal: async (_, args) => {
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
143
|
+
const { docId, input } = args;
|
|
144
|
+
const doc = await reactor.getDocument(docId);
|
|
145
|
+
if (!doc) {
|
|
146
|
+
throw new Error("Document not found");
|
|
147
|
+
}
|
|
148
|
+
const result = await reactor.addAction(docId, actions.addAlternativeProposal(input));
|
|
149
|
+
if (result.status !== "SUCCESS") {
|
|
150
|
+
throw new Error(result.error?.message ?? "Failed to addAlternativeProposal");
|
|
151
|
+
}
|
|
152
|
+
return true;
|
|
114
153
|
},
|
|
115
154
|
Workstream_editAlternativeProposal: async (_, args) => {
|
|
116
|
-
const
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
155
|
+
const { docId, input } = args;
|
|
156
|
+
const doc = await reactor.getDocument(docId);
|
|
157
|
+
if (!doc) {
|
|
158
|
+
throw new Error("Document not found");
|
|
159
|
+
}
|
|
160
|
+
const result = await reactor.addAction(docId, actions.editAlternativeProposal(input));
|
|
161
|
+
if (result.status !== "SUCCESS") {
|
|
162
|
+
throw new Error(result.error?.message ?? "Failed to editAlternativeProposal");
|
|
163
|
+
}
|
|
164
|
+
return true;
|
|
121
165
|
},
|
|
122
166
|
Workstream_removeAlternativeProposal: async (_, args) => {
|
|
123
|
-
const
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
167
|
+
const { docId, input } = args;
|
|
168
|
+
const doc = await reactor.getDocument(docId);
|
|
169
|
+
if (!doc) {
|
|
170
|
+
throw new Error("Document not found");
|
|
171
|
+
}
|
|
172
|
+
const result = await reactor.addAction(docId, actions.removeAlternativeProposal(input));
|
|
173
|
+
if (result.status !== "SUCCESS") {
|
|
174
|
+
throw new Error(result.error?.message ?? "Failed to removeAlternativeProposal");
|
|
175
|
+
}
|
|
176
|
+
return true;
|
|
128
177
|
},
|
|
129
178
|
},
|
|
130
179
|
};
|
|
@@ -64,8 +64,8 @@ export const schema = gql `
|
|
|
64
64
|
Queries: Workstream
|
|
65
65
|
"""
|
|
66
66
|
type WorkstreamQueries {
|
|
67
|
-
getDocument(
|
|
68
|
-
getDocuments: [Workstream!]
|
|
67
|
+
getDocument(docId: PHID!, driveId: PHID): Workstream
|
|
68
|
+
getDocuments(driveId: String!): [Workstream!]
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
type Query {
|
|
@@ -76,7 +76,7 @@ export const schema = gql `
|
|
|
76
76
|
Mutations: Workstream
|
|
77
77
|
"""
|
|
78
78
|
type Mutation {
|
|
79
|
-
Workstream_createDocument(
|
|
79
|
+
Workstream_createDocument(name: String!, driveId: String): String
|
|
80
80
|
|
|
81
81
|
Workstream_editWorkstream(
|
|
82
82
|
driveId: String
|
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.
|
|
4
|
+
"version": "0.0.9",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
@@ -55,13 +55,13 @@
|
|
|
55
55
|
"service-unstartup": "bash ./node_modules/@powerhousedao/ph-cli/dist/scripts/service-unstartup.sh"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@powerhousedao/builder-tools": "^5.0.0-staging.
|
|
59
|
-
"@powerhousedao/common": "^5.0.0-staging.
|
|
60
|
-
"@powerhousedao/design-system": "^5.0.0-staging.
|
|
58
|
+
"@powerhousedao/builder-tools": "^5.0.0-staging.9",
|
|
59
|
+
"@powerhousedao/common": "^5.0.0-staging.9",
|
|
60
|
+
"@powerhousedao/design-system": "^5.0.0-staging.9",
|
|
61
61
|
"@powerhousedao/document-engineering": "^1.34.0",
|
|
62
|
-
"@powerhousedao/project-management": "0.0.
|
|
62
|
+
"@powerhousedao/project-management": "^0.0.28",
|
|
63
63
|
"@uiw/react-md-editor": "^4.0.8",
|
|
64
|
-
"document-model": "^5.0.0-staging.
|
|
64
|
+
"document-model": "^5.0.0-staging.9",
|
|
65
65
|
"error": "^10.4.0",
|
|
66
66
|
"graphql": "^16.10.0",
|
|
67
67
|
"graphql-tag": "^2.12.6",
|
|
@@ -73,19 +73,19 @@
|
|
|
73
73
|
"@electric-sql/pglite": "^0.2.12",
|
|
74
74
|
"@eslint/js": "^9.25.0",
|
|
75
75
|
"@powerhousedao/analytics-engine-core": "^0.5.0",
|
|
76
|
-
"@powerhousedao/codegen": "^5.0.0-staging.
|
|
77
|
-
"@powerhousedao/ph-cli": "^5.0.0-staging.
|
|
78
|
-
"@powerhousedao/reactor-api": "^5.0.0-staging.
|
|
79
|
-
"@powerhousedao/reactor-browser": "^5.0.0-staging.
|
|
80
|
-
"@powerhousedao/reactor-local": "^5.0.0-staging.
|
|
76
|
+
"@powerhousedao/codegen": "^5.0.0-staging.9",
|
|
77
|
+
"@powerhousedao/ph-cli": "^5.0.0-staging.9",
|
|
78
|
+
"@powerhousedao/reactor-api": "^5.0.0-staging.9",
|
|
79
|
+
"@powerhousedao/reactor-browser": "^5.0.0-staging.9",
|
|
80
|
+
"@powerhousedao/reactor-local": "^5.0.0-staging.9",
|
|
81
81
|
"@powerhousedao/scalars": "^1.33.1-staging.5",
|
|
82
|
-
"@powerhousedao/switchboard": "^5.0.0-staging.
|
|
82
|
+
"@powerhousedao/switchboard": "^5.0.0-staging.9",
|
|
83
83
|
"@tailwindcss/cli": "^4.1.4",
|
|
84
84
|
"@testing-library/react": "^16.3.0",
|
|
85
85
|
"@types/node": "^22.14.1",
|
|
86
86
|
"@types/react": "^18.3.20",
|
|
87
87
|
"@vitejs/plugin-react": "^4.4.1",
|
|
88
|
-
"document-drive": "^5.0.0-staging.
|
|
88
|
+
"document-drive": "^5.0.0-staging.9",
|
|
89
89
|
"eslint": "^9.25.0",
|
|
90
90
|
"eslint-plugin-react": "^7.37.5",
|
|
91
91
|
"eslint-plugin-react-hooks": "^5.2.0",
|