@powerhousedao/contributor-billing 0.1.41 → 0.1.42
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/document-models/document-models.d.ts.map +1 -1
- package/dist/document-models/document-models.js +2 -0
- package/dist/document-models/resource-template/gen/document-model.js +25 -25
- package/dist/document-models/resource-template/gen/reducer.d.ts +1 -1
- package/dist/document-models/resource-template/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/resource-template/hooks.d.ts +1 -1
- package/dist/document-models/resource-template/hooks.d.ts.map +1 -1
- package/dist/document-models/resource-template/module.d.ts +1 -1
- package/dist/document-models/resource-template/module.d.ts.map +1 -1
- package/dist/document-models/resource-template/reducers/audience-management.d.ts +3 -0
- package/dist/document-models/resource-template/reducers/audience-management.d.ts.map +1 -0
- package/dist/document-models/resource-template/reducers/audience-management.js +17 -0
- package/dist/document-models/resource-template/reducers/facet-preset-management.d.ts +59 -0
- package/dist/document-models/resource-template/reducers/facet-preset-management.d.ts.map +1 -0
- package/dist/document-models/resource-template/reducers/facet-preset-management.js +52 -0
- package/dist/document-models/resource-template/reducers/facet-targeting.d.ts +3 -0
- package/dist/document-models/resource-template/reducers/facet-targeting.d.ts.map +1 -0
- package/dist/document-models/resource-template/reducers/facet-targeting.js +47 -0
- package/dist/document-models/resource-template/reducers/option-group-management.d.ts +3 -0
- package/dist/document-models/resource-template/reducers/option-group-management.d.ts.map +1 -0
- package/dist/document-models/resource-template/reducers/option-group-management.js +44 -0
- package/dist/document-models/resource-template/reducers/service-category-management.d.ts +3 -0
- package/dist/document-models/resource-template/reducers/service-category-management.d.ts.map +1 -0
- package/dist/document-models/resource-template/reducers/service-category-management.js +10 -0
- package/dist/document-models/resource-template/reducers/service-management.d.ts +3 -0
- package/dist/document-models/resource-template/reducers/service-management.d.ts.map +1 -0
- package/dist/document-models/resource-template/reducers/service-management.js +71 -0
- package/dist/document-models/resource-template/reducers/template-management.d.ts +3 -0
- package/dist/document-models/resource-template/reducers/template-management.d.ts.map +1 -0
- package/dist/document-models/resource-template/reducers/template-management.js +32 -0
- package/dist/document-models/resource-template/src/reducers/audience-management.d.ts.map +1 -1
- package/dist/document-models/resource-template/src/reducers/audience-management.js +1 -1
- package/dist/document-models/resource-template/src/reducers/facet-targeting.d.ts.map +1 -1
- package/dist/document-models/resource-template/src/reducers/facet-targeting.js +1 -1
- package/dist/document-models/resource-template/src/reducers/option-group-management.d.ts.map +1 -1
- package/dist/document-models/resource-template/src/reducers/option-group-management.js +1 -1
- package/dist/document-models/resource-template/src/reducers/service-category-management.d.ts.map +1 -1
- package/dist/document-models/resource-template/src/reducers/service-category-management.js +1 -1
- package/dist/document-models/resource-template/src/reducers/service-management.d.ts.map +1 -1
- package/dist/document-models/resource-template/src/reducers/service-management.js +1 -1
- package/dist/document-models/resource-template/src/reducers/template-management.d.ts.map +1 -1
- package/dist/document-models/resource-template/src/reducers/template-management.js +1 -1
- package/dist/document-models/service-offering/gen/document-model.js +5 -5
- package/dist/document-models/service-offering/gen/document-schema.d.ts.map +1 -1
- package/dist/document-models/service-offering/gen/reducer.d.ts +1 -1
- package/dist/document-models/service-offering/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/service-offering/gen/schema/types.d.ts +3 -0
- package/dist/document-models/service-offering/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/service-offering/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/service-offering/gen/schema/zod.js +3 -0
- package/dist/document-models/service-offering/src/reducers/option-group-management.d.ts.map +1 -1
- package/dist/document-models/service-offering/src/reducers/option-group-management.js +11 -8
- package/dist/document-models/service-offering/src/reducers/service-management.d.ts.map +1 -1
- package/dist/document-models/service-offering/src/reducers/service-management.js +20 -12
- package/dist/document-models/service-offering/src/reducers/tier-management.d.ts.map +1 -1
- package/dist/document-models/service-offering/src/reducers/tier-management.js +21 -19
- package/dist/editors/resource-template-editor/components/FacetTargeting.d.ts +1 -1
- package/dist/editors/resource-template-editor/components/FacetTargeting.d.ts.map +1 -1
- package/dist/editors/resource-template-editor/components/FacetTargeting.js +526 -19
- package/dist/editors/resource-template-editor/components/TemplateInfo.d.ts +1 -1
- package/dist/editors/resource-template-editor/components/TemplateInfo.d.ts.map +1 -1
- package/dist/editors/resource-template-editor/components/TemplateInfo.js +302 -2
- package/dist/editors/resource-template-editor/editor.d.ts.map +1 -1
- package/dist/editors/service-offering-editor/components/EditName.js +1 -1
- package/dist/editors/service-offering-editor/components/OfferingInfo.d.ts +1 -1
- package/dist/editors/service-offering-editor/components/OfferingInfo.d.ts.map +1 -1
- package/dist/editors/service-offering-editor/components/OfferingProgress.d.ts +10 -0
- package/dist/editors/service-offering-editor/components/OfferingProgress.d.ts.map +1 -0
- package/dist/editors/service-offering-editor/components/OfferingProgress.js +240 -0
- package/dist/editors/service-offering-editor/components/ResourceTemplateSelector.d.ts +1 -1
- package/dist/editors/service-offering-editor/components/ResourceTemplateSelector.d.ts.map +1 -1
- package/dist/editors/service-offering-editor/components/ResourceTemplateSelector.js +111 -4
- package/dist/editors/service-offering-editor/components/ScopeAndFacets.d.ts +1 -1
- package/dist/editors/service-offering-editor/components/ScopeAndFacets.d.ts.map +1 -1
- package/dist/editors/service-offering-editor/components/ServiceCatalog.d.ts +1 -1
- package/dist/editors/service-offering-editor/components/ServiceCatalog.d.ts.map +1 -1
- package/dist/editors/service-offering-editor/components/ServiceCatalog.js +318 -1
- package/dist/editors/service-offering-editor/components/ServicesList.d.ts +1 -1
- package/dist/editors/service-offering-editor/components/ServicesList.d.ts.map +1 -1
- package/dist/editors/service-offering-editor/components/ServicesList.js +1 -1
- package/dist/editors/service-offering-editor/components/TheMatrix.d.ts +1 -1
- package/dist/editors/service-offering-editor/components/TheMatrix.d.ts.map +1 -1
- package/dist/editors/service-offering-editor/components/TheMatrix.js +548 -13
- package/dist/editors/service-offering-editor/components/TierDefinition.d.ts +1 -1
- package/dist/editors/service-offering-editor/components/TierDefinition.d.ts.map +1 -1
- package/dist/editors/service-offering-editor/components/TierDefinition.js +406 -4
- package/dist/editors/service-offering-editor/components/TiersList.d.ts +1 -1
- package/dist/editors/service-offering-editor/components/TiersList.d.ts.map +1 -1
- package/dist/editors/service-offering-editor/editor.d.ts.map +1 -1
- package/dist/editors/service-offering-editor/editor.js +2 -2
- package/dist/powerhouse.manifest.json +18 -0
- package/dist/subgraphs/index.d.ts +1 -0
- package/dist/subgraphs/index.d.ts.map +1 -1
- package/dist/subgraphs/index.js +1 -0
- package/dist/subgraphs/resource-template/index.d.ts +11 -0
- package/dist/subgraphs/resource-template/index.d.ts.map +1 -0
- package/dist/subgraphs/resource-template/index.js +11 -0
- package/dist/subgraphs/resource-template/resolvers.d.ts +3 -0
- package/dist/subgraphs/resource-template/resolvers.d.ts.map +1 -0
- package/dist/subgraphs/resource-template/resolvers.js +312 -0
- package/dist/subgraphs/resource-template/schema.d.ts +3 -0
- package/dist/subgraphs/resource-template/schema.d.ts.map +1 -0
- package/dist/subgraphs/resource-template/schema.js +262 -0
- package/dist/subgraphs/service-offering/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/service-offering/resolvers.js +24 -0
- package/dist/subgraphs/service-offering/schema.d.ts.map +1 -1
- package/dist/subgraphs/service-offering/schema.js +21 -0
- package/package.json +1 -1
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import { addFile } from "document-drive";
|
|
2
|
+
import { setName } from "document-model";
|
|
3
|
+
import { actions, resourceTemplateDocumentType, } from "@powerhousedao/contributor-billing/document-models/resource-template";
|
|
4
|
+
export const getResolvers = (subgraph) => {
|
|
5
|
+
const reactor = subgraph.reactor;
|
|
6
|
+
return {
|
|
7
|
+
Query: {
|
|
8
|
+
ResourceTemplate: async () => {
|
|
9
|
+
return {
|
|
10
|
+
getDocument: async (args) => {
|
|
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);
|
|
22
|
+
return {
|
|
23
|
+
driveId: driveId,
|
|
24
|
+
...doc,
|
|
25
|
+
...doc.header,
|
|
26
|
+
created: doc.header.createdAtUtcIso,
|
|
27
|
+
lastModified: doc.header.lastModifiedAtUtcIso,
|
|
28
|
+
state: doc.state.global,
|
|
29
|
+
stateJSON: doc.state.global,
|
|
30
|
+
revision: doc.header?.revision?.global ?? 0,
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
getDocuments: async (args) => {
|
|
34
|
+
const { driveId } = args;
|
|
35
|
+
const docsIds = await reactor.getDocuments(driveId);
|
|
36
|
+
const docs = await Promise.all(docsIds.map(async (docId) => {
|
|
37
|
+
const doc = await reactor.getDocument(docId);
|
|
38
|
+
return {
|
|
39
|
+
driveId: driveId,
|
|
40
|
+
...doc,
|
|
41
|
+
...doc.header,
|
|
42
|
+
created: doc.header.createdAtUtcIso,
|
|
43
|
+
lastModified: doc.header.lastModifiedAtUtcIso,
|
|
44
|
+
state: doc.state.global,
|
|
45
|
+
stateJSON: doc.state.global,
|
|
46
|
+
revision: doc.header?.revision?.global ?? 0,
|
|
47
|
+
};
|
|
48
|
+
}));
|
|
49
|
+
return docs.filter((doc) => doc.header.documentType === resourceTemplateDocumentType);
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
Mutation: {
|
|
55
|
+
ResourceTemplate_createDocument: async (_, args) => {
|
|
56
|
+
const { driveId, name } = args;
|
|
57
|
+
const document = await reactor.addDocument(resourceTemplateDocumentType);
|
|
58
|
+
if (driveId) {
|
|
59
|
+
await reactor.addAction(driveId, addFile({
|
|
60
|
+
name,
|
|
61
|
+
id: document.header.id,
|
|
62
|
+
documentType: resourceTemplateDocumentType,
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
if (name) {
|
|
66
|
+
await reactor.addAction(document.header.id, setName(name));
|
|
67
|
+
}
|
|
68
|
+
return document.header.id;
|
|
69
|
+
},
|
|
70
|
+
ResourceTemplate_updateTemplateInfo: async (_, args) => {
|
|
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.updateTemplateInfo(input));
|
|
77
|
+
if (result.status !== "SUCCESS") {
|
|
78
|
+
throw new Error(result.error?.message ?? "Failed to updateTemplateInfo");
|
|
79
|
+
}
|
|
80
|
+
return true;
|
|
81
|
+
},
|
|
82
|
+
ResourceTemplate_updateTemplateStatus: async (_, args) => {
|
|
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.updateTemplateStatus(input));
|
|
89
|
+
if (result.status !== "SUCCESS") {
|
|
90
|
+
throw new Error(result.error?.message ?? "Failed to updateTemplateStatus");
|
|
91
|
+
}
|
|
92
|
+
return true;
|
|
93
|
+
},
|
|
94
|
+
ResourceTemplate_setOperator: async (_, args) => {
|
|
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.setOperator(input));
|
|
101
|
+
if (result.status !== "SUCCESS") {
|
|
102
|
+
throw new Error(result.error?.message ?? "Failed to setOperator");
|
|
103
|
+
}
|
|
104
|
+
return true;
|
|
105
|
+
},
|
|
106
|
+
ResourceTemplate_setTemplateId: async (_, args) => {
|
|
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.setTemplateId(input));
|
|
113
|
+
if (result.status !== "SUCCESS") {
|
|
114
|
+
throw new Error(result.error?.message ?? "Failed to setTemplateId");
|
|
115
|
+
}
|
|
116
|
+
return true;
|
|
117
|
+
},
|
|
118
|
+
ResourceTemplate_addTargetAudience: async (_, args) => {
|
|
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.addTargetAudience(input));
|
|
125
|
+
if (result.status !== "SUCCESS") {
|
|
126
|
+
throw new Error(result.error?.message ?? "Failed to addTargetAudience");
|
|
127
|
+
}
|
|
128
|
+
return true;
|
|
129
|
+
},
|
|
130
|
+
ResourceTemplate_removeTargetAudience: 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.removeTargetAudience(input));
|
|
137
|
+
if (result.status !== "SUCCESS") {
|
|
138
|
+
throw new Error(result.error?.message ?? "Failed to removeTargetAudience");
|
|
139
|
+
}
|
|
140
|
+
return true;
|
|
141
|
+
},
|
|
142
|
+
ResourceTemplate_setFacetTarget: async (_, args) => {
|
|
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.setFacetTarget(input));
|
|
149
|
+
if (result.status !== "SUCCESS") {
|
|
150
|
+
throw new Error(result.error?.message ?? "Failed to setFacetTarget");
|
|
151
|
+
}
|
|
152
|
+
return true;
|
|
153
|
+
},
|
|
154
|
+
ResourceTemplate_removeFacetTarget: async (_, args) => {
|
|
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.removeFacetTarget(input));
|
|
161
|
+
if (result.status !== "SUCCESS") {
|
|
162
|
+
throw new Error(result.error?.message ?? "Failed to removeFacetTarget");
|
|
163
|
+
}
|
|
164
|
+
return true;
|
|
165
|
+
},
|
|
166
|
+
ResourceTemplate_addFacetOption: async (_, args) => {
|
|
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.addFacetOption(input));
|
|
173
|
+
if (result.status !== "SUCCESS") {
|
|
174
|
+
throw new Error(result.error?.message ?? "Failed to addFacetOption");
|
|
175
|
+
}
|
|
176
|
+
return true;
|
|
177
|
+
},
|
|
178
|
+
ResourceTemplate_removeFacetOption: async (_, args) => {
|
|
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.removeFacetOption(input));
|
|
185
|
+
if (result.status !== "SUCCESS") {
|
|
186
|
+
throw new Error(result.error?.message ?? "Failed to removeFacetOption");
|
|
187
|
+
}
|
|
188
|
+
return true;
|
|
189
|
+
},
|
|
190
|
+
ResourceTemplate_setSetupServices: async (_, args) => {
|
|
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.setSetupServices(input));
|
|
197
|
+
if (result.status !== "SUCCESS") {
|
|
198
|
+
throw new Error(result.error?.message ?? "Failed to setSetupServices");
|
|
199
|
+
}
|
|
200
|
+
return true;
|
|
201
|
+
},
|
|
202
|
+
ResourceTemplate_setRecurringServices: async (_, args) => {
|
|
203
|
+
const { docId, input } = args;
|
|
204
|
+
const doc = await reactor.getDocument(docId);
|
|
205
|
+
if (!doc) {
|
|
206
|
+
throw new Error("Document not found");
|
|
207
|
+
}
|
|
208
|
+
const result = await reactor.addAction(docId, actions.setRecurringServices(input));
|
|
209
|
+
if (result.status !== "SUCCESS") {
|
|
210
|
+
throw new Error(result.error?.message ?? "Failed to setRecurringServices");
|
|
211
|
+
}
|
|
212
|
+
return true;
|
|
213
|
+
},
|
|
214
|
+
ResourceTemplate_addService: async (_, args) => {
|
|
215
|
+
const { docId, input } = args;
|
|
216
|
+
const doc = await reactor.getDocument(docId);
|
|
217
|
+
if (!doc) {
|
|
218
|
+
throw new Error("Document not found");
|
|
219
|
+
}
|
|
220
|
+
const result = await reactor.addAction(docId, actions.addService(input));
|
|
221
|
+
if (result.status !== "SUCCESS") {
|
|
222
|
+
throw new Error(result.error?.message ?? "Failed to addService");
|
|
223
|
+
}
|
|
224
|
+
return true;
|
|
225
|
+
},
|
|
226
|
+
ResourceTemplate_updateService: async (_, args) => {
|
|
227
|
+
const { docId, input } = args;
|
|
228
|
+
const doc = await reactor.getDocument(docId);
|
|
229
|
+
if (!doc) {
|
|
230
|
+
throw new Error("Document not found");
|
|
231
|
+
}
|
|
232
|
+
const result = await reactor.addAction(docId, actions.updateService(input));
|
|
233
|
+
if (result.status !== "SUCCESS") {
|
|
234
|
+
throw new Error(result.error?.message ?? "Failed to updateService");
|
|
235
|
+
}
|
|
236
|
+
return true;
|
|
237
|
+
},
|
|
238
|
+
ResourceTemplate_deleteService: async (_, args) => {
|
|
239
|
+
const { docId, input } = args;
|
|
240
|
+
const doc = await reactor.getDocument(docId);
|
|
241
|
+
if (!doc) {
|
|
242
|
+
throw new Error("Document not found");
|
|
243
|
+
}
|
|
244
|
+
const result = await reactor.addAction(docId, actions.deleteService(input));
|
|
245
|
+
if (result.status !== "SUCCESS") {
|
|
246
|
+
throw new Error(result.error?.message ?? "Failed to deleteService");
|
|
247
|
+
}
|
|
248
|
+
return true;
|
|
249
|
+
},
|
|
250
|
+
ResourceTemplate_addFacetBinding: async (_, args) => {
|
|
251
|
+
const { docId, input } = args;
|
|
252
|
+
const doc = await reactor.getDocument(docId);
|
|
253
|
+
if (!doc) {
|
|
254
|
+
throw new Error("Document not found");
|
|
255
|
+
}
|
|
256
|
+
const result = await reactor.addAction(docId, actions.addFacetBinding(input));
|
|
257
|
+
if (result.status !== "SUCCESS") {
|
|
258
|
+
throw new Error(result.error?.message ?? "Failed to addFacetBinding");
|
|
259
|
+
}
|
|
260
|
+
return true;
|
|
261
|
+
},
|
|
262
|
+
ResourceTemplate_removeFacetBinding: async (_, args) => {
|
|
263
|
+
const { docId, input } = args;
|
|
264
|
+
const doc = await reactor.getDocument(docId);
|
|
265
|
+
if (!doc) {
|
|
266
|
+
throw new Error("Document not found");
|
|
267
|
+
}
|
|
268
|
+
const result = await reactor.addAction(docId, actions.removeFacetBinding(input));
|
|
269
|
+
if (result.status !== "SUCCESS") {
|
|
270
|
+
throw new Error(result.error?.message ?? "Failed to removeFacetBinding");
|
|
271
|
+
}
|
|
272
|
+
return true;
|
|
273
|
+
},
|
|
274
|
+
ResourceTemplate_addOptionGroup: async (_, args) => {
|
|
275
|
+
const { docId, input } = args;
|
|
276
|
+
const doc = await reactor.getDocument(docId);
|
|
277
|
+
if (!doc) {
|
|
278
|
+
throw new Error("Document not found");
|
|
279
|
+
}
|
|
280
|
+
const result = await reactor.addAction(docId, actions.addOptionGroup(input));
|
|
281
|
+
if (result.status !== "SUCCESS") {
|
|
282
|
+
throw new Error(result.error?.message ?? "Failed to addOptionGroup");
|
|
283
|
+
}
|
|
284
|
+
return true;
|
|
285
|
+
},
|
|
286
|
+
ResourceTemplate_updateOptionGroup: async (_, args) => {
|
|
287
|
+
const { docId, input } = args;
|
|
288
|
+
const doc = await reactor.getDocument(docId);
|
|
289
|
+
if (!doc) {
|
|
290
|
+
throw new Error("Document not found");
|
|
291
|
+
}
|
|
292
|
+
const result = await reactor.addAction(docId, actions.updateOptionGroup(input));
|
|
293
|
+
if (result.status !== "SUCCESS") {
|
|
294
|
+
throw new Error(result.error?.message ?? "Failed to updateOptionGroup");
|
|
295
|
+
}
|
|
296
|
+
return true;
|
|
297
|
+
},
|
|
298
|
+
ResourceTemplate_deleteOptionGroup: async (_, args) => {
|
|
299
|
+
const { docId, input } = args;
|
|
300
|
+
const doc = await reactor.getDocument(docId);
|
|
301
|
+
if (!doc) {
|
|
302
|
+
throw new Error("Document not found");
|
|
303
|
+
}
|
|
304
|
+
const result = await reactor.addAction(docId, actions.deleteOptionGroup(input));
|
|
305
|
+
if (result.status !== "SUCCESS") {
|
|
306
|
+
throw new Error(result.error?.message ?? "Failed to deleteOptionGroup");
|
|
307
|
+
}
|
|
308
|
+
return true;
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
};
|
|
312
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../subgraphs/resource-template/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,MAAM,EAAE,YAoQpB,CAAC"}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { gql } from "graphql-tag";
|
|
2
|
+
export const schema = gql `
|
|
3
|
+
"""
|
|
4
|
+
Queries: ResourceTemplate Document
|
|
5
|
+
"""
|
|
6
|
+
type ResourceTemplateQueries {
|
|
7
|
+
getDocument(docId: PHID!, driveId: PHID): ResourceTemplate
|
|
8
|
+
getDocuments(driveId: String!): [ResourceTemplate!]
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
type Query {
|
|
12
|
+
ResourceTemplate: ResourceTemplateQueries
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
"""
|
|
16
|
+
Mutations: ResourceTemplate
|
|
17
|
+
"""
|
|
18
|
+
type Mutation {
|
|
19
|
+
ResourceTemplate_createDocument(name: String!, driveId: String): String
|
|
20
|
+
|
|
21
|
+
ResourceTemplate_updateTemplateInfo(
|
|
22
|
+
driveId: String
|
|
23
|
+
docId: PHID
|
|
24
|
+
input: ResourceTemplate_UpdateTemplateInfoInput
|
|
25
|
+
): Int
|
|
26
|
+
ResourceTemplate_updateTemplateStatus(
|
|
27
|
+
driveId: String
|
|
28
|
+
docId: PHID
|
|
29
|
+
input: ResourceTemplate_UpdateTemplateStatusInput
|
|
30
|
+
): Int
|
|
31
|
+
ResourceTemplate_setOperator(
|
|
32
|
+
driveId: String
|
|
33
|
+
docId: PHID
|
|
34
|
+
input: ResourceTemplate_SetOperatorInput
|
|
35
|
+
): Int
|
|
36
|
+
ResourceTemplate_setTemplateId(
|
|
37
|
+
driveId: String
|
|
38
|
+
docId: PHID
|
|
39
|
+
input: ResourceTemplate_SetTemplateIdInput
|
|
40
|
+
): Int
|
|
41
|
+
ResourceTemplate_addTargetAudience(
|
|
42
|
+
driveId: String
|
|
43
|
+
docId: PHID
|
|
44
|
+
input: ResourceTemplate_AddTargetAudienceInput
|
|
45
|
+
): Int
|
|
46
|
+
ResourceTemplate_removeTargetAudience(
|
|
47
|
+
driveId: String
|
|
48
|
+
docId: PHID
|
|
49
|
+
input: ResourceTemplate_RemoveTargetAudienceInput
|
|
50
|
+
): Int
|
|
51
|
+
ResourceTemplate_setFacetTarget(
|
|
52
|
+
driveId: String
|
|
53
|
+
docId: PHID
|
|
54
|
+
input: ResourceTemplate_SetFacetTargetInput
|
|
55
|
+
): Int
|
|
56
|
+
ResourceTemplate_removeFacetTarget(
|
|
57
|
+
driveId: String
|
|
58
|
+
docId: PHID
|
|
59
|
+
input: ResourceTemplate_RemoveFacetTargetInput
|
|
60
|
+
): Int
|
|
61
|
+
ResourceTemplate_addFacetOption(
|
|
62
|
+
driveId: String
|
|
63
|
+
docId: PHID
|
|
64
|
+
input: ResourceTemplate_AddFacetOptionInput
|
|
65
|
+
): Int
|
|
66
|
+
ResourceTemplate_removeFacetOption(
|
|
67
|
+
driveId: String
|
|
68
|
+
docId: PHID
|
|
69
|
+
input: ResourceTemplate_RemoveFacetOptionInput
|
|
70
|
+
): Int
|
|
71
|
+
ResourceTemplate_setSetupServices(
|
|
72
|
+
driveId: String
|
|
73
|
+
docId: PHID
|
|
74
|
+
input: ResourceTemplate_SetSetupServicesInput
|
|
75
|
+
): Int
|
|
76
|
+
ResourceTemplate_setRecurringServices(
|
|
77
|
+
driveId: String
|
|
78
|
+
docId: PHID
|
|
79
|
+
input: ResourceTemplate_SetRecurringServicesInput
|
|
80
|
+
): Int
|
|
81
|
+
ResourceTemplate_addService(
|
|
82
|
+
driveId: String
|
|
83
|
+
docId: PHID
|
|
84
|
+
input: ResourceTemplate_AddServiceInput
|
|
85
|
+
): Int
|
|
86
|
+
ResourceTemplate_updateService(
|
|
87
|
+
driveId: String
|
|
88
|
+
docId: PHID
|
|
89
|
+
input: ResourceTemplate_UpdateServiceInput
|
|
90
|
+
): Int
|
|
91
|
+
ResourceTemplate_deleteService(
|
|
92
|
+
driveId: String
|
|
93
|
+
docId: PHID
|
|
94
|
+
input: ResourceTemplate_DeleteServiceInput
|
|
95
|
+
): Int
|
|
96
|
+
ResourceTemplate_addFacetBinding(
|
|
97
|
+
driveId: String
|
|
98
|
+
docId: PHID
|
|
99
|
+
input: ResourceTemplate_AddFacetBindingInput
|
|
100
|
+
): Int
|
|
101
|
+
ResourceTemplate_removeFacetBinding(
|
|
102
|
+
driveId: String
|
|
103
|
+
docId: PHID
|
|
104
|
+
input: ResourceTemplate_RemoveFacetBindingInput
|
|
105
|
+
): Int
|
|
106
|
+
ResourceTemplate_addOptionGroup(
|
|
107
|
+
driveId: String
|
|
108
|
+
docId: PHID
|
|
109
|
+
input: ResourceTemplate_AddOptionGroupInput
|
|
110
|
+
): Int
|
|
111
|
+
ResourceTemplate_updateOptionGroup(
|
|
112
|
+
driveId: String
|
|
113
|
+
docId: PHID
|
|
114
|
+
input: ResourceTemplate_UpdateOptionGroupInput
|
|
115
|
+
): Int
|
|
116
|
+
ResourceTemplate_deleteOptionGroup(
|
|
117
|
+
driveId: String
|
|
118
|
+
docId: PHID
|
|
119
|
+
input: ResourceTemplate_DeleteOptionGroupInput
|
|
120
|
+
): Int
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
"""
|
|
124
|
+
Module: TemplateManagement
|
|
125
|
+
"""
|
|
126
|
+
input ResourceTemplate_UpdateTemplateInfoInput {
|
|
127
|
+
title: String
|
|
128
|
+
summary: String
|
|
129
|
+
description: String
|
|
130
|
+
thumbnailUrl: URL
|
|
131
|
+
infoLink: URL
|
|
132
|
+
lastModified: DateTime!
|
|
133
|
+
}
|
|
134
|
+
input ResourceTemplate_UpdateTemplateStatusInput {
|
|
135
|
+
status: ResourceTemplate_TemplateStatus!
|
|
136
|
+
lastModified: DateTime!
|
|
137
|
+
}
|
|
138
|
+
input ResourceTemplate_SetOperatorInput {
|
|
139
|
+
operatorId: PHID!
|
|
140
|
+
lastModified: DateTime!
|
|
141
|
+
}
|
|
142
|
+
input ResourceTemplate_SetTemplateIdInput {
|
|
143
|
+
id: PHID!
|
|
144
|
+
lastModified: DateTime!
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
"""
|
|
148
|
+
Module: AudienceManagement
|
|
149
|
+
"""
|
|
150
|
+
input ResourceTemplate_AddTargetAudienceInput {
|
|
151
|
+
id: OID!
|
|
152
|
+
label: String!
|
|
153
|
+
color: String
|
|
154
|
+
lastModified: DateTime!
|
|
155
|
+
}
|
|
156
|
+
input ResourceTemplate_RemoveTargetAudienceInput {
|
|
157
|
+
id: OID!
|
|
158
|
+
lastModified: DateTime!
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
"""
|
|
162
|
+
Module: FacetTargeting
|
|
163
|
+
"""
|
|
164
|
+
input ResourceTemplate_SetFacetTargetInput {
|
|
165
|
+
id: OID!
|
|
166
|
+
categoryKey: String!
|
|
167
|
+
categoryLabel: String!
|
|
168
|
+
selectedOptions: [String!]!
|
|
169
|
+
lastModified: DateTime!
|
|
170
|
+
}
|
|
171
|
+
input ResourceTemplate_RemoveFacetTargetInput {
|
|
172
|
+
categoryKey: String!
|
|
173
|
+
lastModified: DateTime!
|
|
174
|
+
}
|
|
175
|
+
input ResourceTemplate_AddFacetOptionInput {
|
|
176
|
+
categoryKey: String!
|
|
177
|
+
optionId: String!
|
|
178
|
+
lastModified: DateTime!
|
|
179
|
+
}
|
|
180
|
+
input ResourceTemplate_RemoveFacetOptionInput {
|
|
181
|
+
categoryKey: String!
|
|
182
|
+
optionId: String!
|
|
183
|
+
lastModified: DateTime!
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
"""
|
|
187
|
+
Module: ServiceCategoryManagement
|
|
188
|
+
"""
|
|
189
|
+
input ResourceTemplate_SetSetupServicesInput {
|
|
190
|
+
services: [String!]!
|
|
191
|
+
lastModified: DateTime!
|
|
192
|
+
}
|
|
193
|
+
input ResourceTemplate_SetRecurringServicesInput {
|
|
194
|
+
services: [String!]!
|
|
195
|
+
lastModified: DateTime!
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
"""
|
|
199
|
+
Module: ServiceManagement
|
|
200
|
+
"""
|
|
201
|
+
input ResourceTemplate_AddServiceInput {
|
|
202
|
+
id: OID!
|
|
203
|
+
title: String!
|
|
204
|
+
description: String
|
|
205
|
+
parentServiceId: OID
|
|
206
|
+
displayOrder: Int
|
|
207
|
+
isSetupFormation: Boolean
|
|
208
|
+
optionGroupId: OID
|
|
209
|
+
lastModified: DateTime!
|
|
210
|
+
}
|
|
211
|
+
input ResourceTemplate_UpdateServiceInput {
|
|
212
|
+
id: OID!
|
|
213
|
+
title: String
|
|
214
|
+
description: String
|
|
215
|
+
parentServiceId: OID
|
|
216
|
+
displayOrder: Int
|
|
217
|
+
isSetupFormation: Boolean
|
|
218
|
+
optionGroupId: OID
|
|
219
|
+
lastModified: DateTime!
|
|
220
|
+
}
|
|
221
|
+
input ResourceTemplate_DeleteServiceInput {
|
|
222
|
+
id: OID!
|
|
223
|
+
lastModified: DateTime!
|
|
224
|
+
}
|
|
225
|
+
input ResourceTemplate_AddFacetBindingInput {
|
|
226
|
+
serviceId: OID!
|
|
227
|
+
bindingId: OID!
|
|
228
|
+
facetName: String!
|
|
229
|
+
facetType: PHID!
|
|
230
|
+
supportedOptions: [OID!]!
|
|
231
|
+
lastModified: DateTime!
|
|
232
|
+
}
|
|
233
|
+
input ResourceTemplate_RemoveFacetBindingInput {
|
|
234
|
+
serviceId: OID!
|
|
235
|
+
bindingId: OID!
|
|
236
|
+
lastModified: DateTime!
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
"""
|
|
240
|
+
Module: OptionGroupManagement
|
|
241
|
+
"""
|
|
242
|
+
input ResourceTemplate_AddOptionGroupInput {
|
|
243
|
+
id: OID!
|
|
244
|
+
name: String!
|
|
245
|
+
description: String
|
|
246
|
+
isAddOn: Boolean!
|
|
247
|
+
defaultSelected: Boolean!
|
|
248
|
+
lastModified: DateTime!
|
|
249
|
+
}
|
|
250
|
+
input ResourceTemplate_UpdateOptionGroupInput {
|
|
251
|
+
id: OID!
|
|
252
|
+
name: String
|
|
253
|
+
description: String
|
|
254
|
+
isAddOn: Boolean
|
|
255
|
+
defaultSelected: Boolean
|
|
256
|
+
lastModified: DateTime!
|
|
257
|
+
}
|
|
258
|
+
input ResourceTemplate_DeleteOptionGroupInput {
|
|
259
|
+
id: OID!
|
|
260
|
+
lastModified: DateTime!
|
|
261
|
+
}
|
|
262
|
+
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/service-offering/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/service-offering/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AA4C/D,eAAO,MAAM,YAAY,GACvB,UAAU,YAAY,KACrB,MAAM,CAAC,MAAM,EAAE,OAAO,CA2zBxB,CAAC"}
|
|
@@ -391,6 +391,30 @@ export const getResolvers = (subgraph) => {
|
|
|
391
391
|
}
|
|
392
392
|
return true;
|
|
393
393
|
},
|
|
394
|
+
ServiceOffering_selectResourceTemplate: async (_, args) => {
|
|
395
|
+
const { docId, input } = args;
|
|
396
|
+
const doc = await reactor.getDocument(docId);
|
|
397
|
+
if (!doc) {
|
|
398
|
+
throw new Error("Document not found");
|
|
399
|
+
}
|
|
400
|
+
const result = await reactor.addAction(docId, actions.selectResourceTemplate(input));
|
|
401
|
+
if (result.status !== "SUCCESS") {
|
|
402
|
+
throw new Error(result.error?.message ?? "Failed to selectResourceTemplate");
|
|
403
|
+
}
|
|
404
|
+
return true;
|
|
405
|
+
},
|
|
406
|
+
ServiceOffering_changeResourceTemplate: async (_, args) => {
|
|
407
|
+
const { docId, input } = args;
|
|
408
|
+
const doc = await reactor.getDocument(docId);
|
|
409
|
+
if (!doc) {
|
|
410
|
+
throw new Error("Document not found");
|
|
411
|
+
}
|
|
412
|
+
const result = await reactor.addAction(docId, actions.changeResourceTemplate(input));
|
|
413
|
+
if (result.status !== "SUCCESS") {
|
|
414
|
+
throw new Error(result.error?.message ?? "Failed to changeResourceTemplate");
|
|
415
|
+
}
|
|
416
|
+
return true;
|
|
417
|
+
},
|
|
394
418
|
ServiceOffering_addOptionGroup: async (_, args) => {
|
|
395
419
|
const { docId, input } = args;
|
|
396
420
|
const doc = await reactor.getDocument(docId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../subgraphs/service-offering/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/service-offering/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,MAAM,EAAE,YAqZpB,CAAC"}
|
|
@@ -153,6 +153,16 @@ export const schema = gql `
|
|
|
153
153
|
docId: PHID
|
|
154
154
|
input: ServiceOffering_SetRecurringServicesInput
|
|
155
155
|
): Int
|
|
156
|
+
ServiceOffering_selectResourceTemplate(
|
|
157
|
+
driveId: String
|
|
158
|
+
docId: PHID
|
|
159
|
+
input: ServiceOffering_SelectResourceTemplateInput
|
|
160
|
+
): Int
|
|
161
|
+
ServiceOffering_changeResourceTemplate(
|
|
162
|
+
driveId: String
|
|
163
|
+
docId: PHID
|
|
164
|
+
input: ServiceOffering_ChangeResourceTemplateInput
|
|
165
|
+
): Int
|
|
156
166
|
ServiceOffering_addOptionGroup(
|
|
157
167
|
driveId: String
|
|
158
168
|
docId: PHID
|
|
@@ -180,6 +190,7 @@ export const schema = gql `
|
|
|
180
190
|
parentServiceId: OID
|
|
181
191
|
displayOrder: Int
|
|
182
192
|
isSetupFormation: Boolean
|
|
193
|
+
isPremiumExclusive: Boolean
|
|
183
194
|
optionGroupId: OID
|
|
184
195
|
lastModified: DateTime!
|
|
185
196
|
}
|
|
@@ -190,6 +201,7 @@ export const schema = gql `
|
|
|
190
201
|
parentServiceId: OID
|
|
191
202
|
displayOrder: Int
|
|
192
203
|
isSetupFormation: Boolean
|
|
204
|
+
isPremiumExclusive: Boolean
|
|
193
205
|
optionGroupId: OID
|
|
194
206
|
lastModified: DateTime!
|
|
195
207
|
}
|
|
@@ -359,6 +371,15 @@ export const schema = gql `
|
|
|
359
371
|
services: [String!]!
|
|
360
372
|
lastModified: DateTime!
|
|
361
373
|
}
|
|
374
|
+
input ServiceOffering_SelectResourceTemplateInput {
|
|
375
|
+
resourceTemplateId: PHID!
|
|
376
|
+
lastModified: DateTime!
|
|
377
|
+
}
|
|
378
|
+
input ServiceOffering_ChangeResourceTemplateInput {
|
|
379
|
+
previousTemplateId: PHID!
|
|
380
|
+
newTemplateId: PHID!
|
|
381
|
+
lastModified: DateTime!
|
|
382
|
+
}
|
|
362
383
|
|
|
363
384
|
"""
|
|
364
385
|
Module: OptionGroupManagement
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/contributor-billing",
|
|
3
3
|
"description": "Document models that help contributors of open organisations get paid anonymously for their work on a monthly basis.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.42",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|