@powerhousedao/contributor-billing 0.1.3 → 0.1.5
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/expense-report/gen/actions.d.ts +4 -0
- package/dist/document-models/expense-report/gen/actions.d.ts.map +1 -0
- package/dist/document-models/expense-report/gen/actions.js +1 -0
- package/dist/document-models/expense-report/gen/creators.d.ts +2 -0
- package/dist/document-models/expense-report/gen/creators.d.ts.map +1 -0
- package/dist/document-models/expense-report/gen/creators.js +1 -0
- package/dist/document-models/expense-report/gen/document-model.d.ts +3 -0
- package/dist/document-models/expense-report/gen/document-model.d.ts.map +1 -0
- package/dist/document-models/expense-report/gen/document-model.js +202 -0
- package/dist/document-models/expense-report/gen/expense-report/actions.d.ts +8 -0
- package/dist/document-models/expense-report/gen/expense-report/actions.d.ts.map +1 -0
- package/dist/document-models/expense-report/gen/expense-report/actions.js +1 -0
- package/dist/document-models/expense-report/gen/expense-report/creators.d.ts +4 -0
- package/dist/document-models/expense-report/gen/expense-report/creators.d.ts.map +1 -0
- package/dist/document-models/expense-report/gen/expense-report/creators.js +3 -0
- package/dist/document-models/expense-report/gen/expense-report/error.d.ts +2 -0
- package/dist/document-models/expense-report/gen/expense-report/error.d.ts.map +1 -0
- package/dist/document-models/expense-report/gen/expense-report/error.js +1 -0
- package/dist/document-models/expense-report/gen/expense-report/object.d.ts +7 -0
- package/dist/document-models/expense-report/gen/expense-report/object.d.ts.map +1 -0
- package/dist/document-models/expense-report/gen/expense-report/object.js +7 -0
- package/dist/document-models/expense-report/gen/expense-report/operations.d.ts +7 -0
- package/dist/document-models/expense-report/gen/expense-report/operations.d.ts.map +1 -0
- package/dist/document-models/expense-report/gen/expense-report/operations.js +1 -0
- package/dist/document-models/expense-report/gen/index.d.ts +8 -0
- package/dist/document-models/expense-report/gen/index.d.ts.map +1 -0
- package/dist/document-models/expense-report/gen/index.js +6 -0
- package/dist/document-models/expense-report/gen/object.d.ts +15 -0
- package/dist/document-models/expense-report/gen/object.d.ts.map +1 -0
- package/dist/document-models/expense-report/gen/object.js +25 -0
- package/dist/document-models/expense-report/gen/ph-factories.d.ts +27 -0
- package/dist/document-models/expense-report/gen/ph-factories.d.ts.map +1 -0
- package/dist/document-models/expense-report/gen/ph-factories.js +189 -0
- package/dist/document-models/expense-report/gen/reducer.d.ts +5 -0
- package/dist/document-models/expense-report/gen/reducer.d.ts.map +1 -0
- package/dist/document-models/expense-report/gen/reducer.js +76 -0
- package/dist/document-models/expense-report/gen/schema/index.d.ts +3 -0
- package/dist/document-models/expense-report/gen/schema/index.d.ts.map +1 -0
- package/dist/document-models/expense-report/gen/schema/index.js +2 -0
- package/dist/document-models/expense-report/gen/schema/types.d.ts +254 -0
- package/dist/document-models/expense-report/gen/schema/types.d.ts.map +1 -0
- package/dist/document-models/expense-report/gen/schema/types.js +1 -0
- package/dist/document-models/expense-report/gen/schema/zod.d.ts +32 -0
- package/dist/document-models/expense-report/gen/schema/zod.d.ts.map +1 -0
- package/dist/document-models/expense-report/gen/schema/zod.js +216 -0
- package/dist/document-models/expense-report/gen/types.d.ts +10 -0
- package/dist/document-models/expense-report/gen/types.d.ts.map +1 -0
- package/dist/document-models/expense-report/gen/types.js +1 -0
- package/dist/document-models/expense-report/gen/utils.d.ts +22 -0
- package/dist/document-models/expense-report/gen/utils.d.ts.map +1 -0
- package/dist/document-models/expense-report/gen/utils.js +181 -0
- package/dist/document-models/expense-report/gen/wallet/actions.d.ts +64 -0
- package/dist/document-models/expense-report/gen/wallet/actions.d.ts.map +1 -0
- package/dist/document-models/expense-report/gen/wallet/actions.js +1 -0
- package/dist/document-models/expense-report/gen/wallet/creators.d.ts +18 -0
- package/dist/document-models/expense-report/gen/wallet/creators.d.ts.map +1 -0
- package/dist/document-models/expense-report/gen/wallet/creators.js +17 -0
- package/dist/document-models/expense-report/gen/wallet/error.d.ts +2 -0
- package/dist/document-models/expense-report/gen/wallet/error.d.ts.map +1 -0
- package/dist/document-models/expense-report/gen/wallet/error.js +1 -0
- package/dist/document-models/expense-report/gen/wallet/object.d.ts +21 -0
- package/dist/document-models/expense-report/gen/wallet/object.d.ts.map +1 -0
- package/dist/document-models/expense-report/gen/wallet/object.js +49 -0
- package/dist/document-models/expense-report/gen/wallet/operations.d.ts +21 -0
- package/dist/document-models/expense-report/gen/wallet/operations.d.ts.map +1 -0
- package/dist/document-models/expense-report/gen/wallet/operations.js +1 -0
- package/dist/document-models/expense-report/index.d.ts +39 -0
- package/dist/document-models/expense-report/index.d.ts.map +1 -0
- package/dist/document-models/expense-report/index.js +21 -0
- package/dist/document-models/expense-report/src/reducers/wallet.d.ts +3 -0
- package/dist/document-models/expense-report/src/reducers/wallet.d.ts.map +1 -0
- package/dist/document-models/expense-report/src/reducers/wallet.js +180 -0
- package/dist/document-models/expense-report/src/tests/document-model.test.d.ts +6 -0
- package/dist/document-models/expense-report/src/tests/document-model.test.d.ts.map +1 -0
- package/dist/document-models/expense-report/src/tests/document-model.test.js +18 -0
- package/dist/document-models/expense-report/src/tests/expense-report.test.d.ts +6 -0
- package/dist/document-models/expense-report/src/tests/expense-report.test.d.ts.map +1 -0
- package/dist/document-models/expense-report/src/tests/expense-report.test.js +24 -0
- package/dist/document-models/expense-report/src/tests/wallet.test.d.ts +6 -0
- package/dist/document-models/expense-report/src/tests/wallet.test.d.ts.map +1 -0
- package/dist/document-models/expense-report/src/tests/wallet.test.js +24 -0
- package/dist/document-models/expense-report/src/utils.d.ts +2 -0
- package/dist/document-models/expense-report/src/utils.d.ts.map +1 -0
- package/dist/document-models/expense-report/src/utils.js +1 -0
- package/dist/document-models/index.d.ts +1 -0
- package/dist/document-models/index.d.ts.map +1 -1
- package/dist/document-models/index.js +1 -0
- package/dist/document-models/integrations/gen/ph-factories.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/ph-factories.js +2 -14
- package/dist/document-models/integrations/gen/utils.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/utils.js +2 -14
- package/dist/document-models/invoice/gen/ph-factories.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/ph-factories.js +2 -5
- package/dist/document-models/invoice/gen/schema/types.d.ts +1 -1
- package/dist/document-models/invoice/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/utils.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/utils.js +1 -4
- package/dist/editors/billing-statement/components/lineItemsTable.d.ts.map +1 -1
- package/dist/editors/billing-statement/components/lineItemsTable.js +71 -13
- package/dist/editors/billing-statement/editor.js +1 -1
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/DriveExplorer.js +8 -4
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts +4 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.js +2 -2
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.js +24 -1
- package/dist/editors/expense-report/components/AddBillingStatementModal.d.ts +11 -0
- package/dist/editors/expense-report/components/AddBillingStatementModal.d.ts.map +1 -0
- package/dist/editors/expense-report/components/AddBillingStatementModal.js +195 -0
- package/dist/editors/expense-report/components/AggregatedExpensesTable.d.ts +11 -0
- package/dist/editors/expense-report/components/AggregatedExpensesTable.d.ts.map +1 -0
- package/dist/editors/expense-report/components/AggregatedExpensesTable.js +268 -0
- package/dist/editors/expense-report/components/ExpenseReportPDF.d.ts +10 -0
- package/dist/editors/expense-report/components/ExpenseReportPDF.d.ts.map +1 -0
- package/dist/editors/expense-report/components/ExpenseReportPDF.js +287 -0
- package/dist/editors/expense-report/components/WalletsTable.d.ts +10 -0
- package/dist/editors/expense-report/components/WalletsTable.d.ts.map +1 -0
- package/dist/editors/expense-report/components/WalletsTable.js +164 -0
- package/dist/editors/expense-report/editor.d.ts +2 -0
- package/dist/editors/expense-report/editor.d.ts.map +1 -0
- package/dist/editors/expense-report/editor.js +74 -0
- package/dist/editors/expense-report/hooks/useSyncWallet.d.ts +5 -0
- package/dist/editors/expense-report/hooks/useSyncWallet.d.ts.map +1 -0
- package/dist/editors/expense-report/hooks/useSyncWallet.js +75 -0
- package/dist/editors/expense-report/hooks/useWalletSync.d.ts +9 -0
- package/dist/editors/expense-report/hooks/useWalletSync.d.ts.map +1 -0
- package/dist/editors/expense-report/hooks/useWalletSync.js +77 -0
- package/dist/editors/expense-report/index.d.ts +3 -0
- package/dist/editors/expense-report/index.d.ts.map +1 -0
- package/dist/editors/expense-report/index.js +11 -0
- package/dist/editors/hooks/useExpenseReportDocument.d.ts +4 -0
- package/dist/editors/hooks/useExpenseReportDocument.d.ts.map +1 -0
- package/dist/editors/hooks/useExpenseReportDocument.js +8 -0
- package/dist/editors/index.d.ts +1 -0
- package/dist/editors/index.d.ts.map +1 -1
- package/dist/editors/index.js +1 -0
- package/dist/editors/invoice/components/statusModalComponents.d.ts.map +1 -1
- package/dist/editors/invoice/components/statusModalComponents.js +4 -4
- package/dist/editors/invoice/editor.js +1 -1
- package/dist/editors/invoice/ingestPDF.d.ts.map +1 -1
- package/dist/editors/invoice/ingestPDF.js +3 -3
- package/dist/editors/invoice/invoiceToGnosis.js +1 -1
- package/dist/editors/invoice/requestFinance.js +1 -1
- package/dist/editors/invoice/uploadPdfChunked.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/powerhouse.manifest.json +13 -2
- package/dist/style.css +539 -37
- package/dist/subgraphs/expense-report/index.d.ts +11 -0
- package/dist/subgraphs/expense-report/index.d.ts.map +1 -0
- package/dist/subgraphs/expense-report/index.js +11 -0
- package/dist/subgraphs/expense-report/resolvers.d.ts +3 -0
- package/dist/subgraphs/expense-report/resolvers.d.ts.map +1 -0
- package/dist/subgraphs/expense-report/resolvers.js +252 -0
- package/dist/subgraphs/expense-report/schema.d.ts +3 -0
- package/dist/subgraphs/expense-report/schema.d.ts.map +1 -0
- package/dist/subgraphs/expense-report/schema.js +228 -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/package.json +13 -13
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Subgraph } from "@powerhousedao/reactor-api";
|
|
2
|
+
import type { DocumentNode } from "graphql";
|
|
3
|
+
export declare class ExpenseReportSubgraph extends Subgraph {
|
|
4
|
+
name: string;
|
|
5
|
+
typeDefs: DocumentNode;
|
|
6
|
+
resolvers: Record<string, unknown>;
|
|
7
|
+
additionalContextFields: {};
|
|
8
|
+
onSetup(): Promise<void>;
|
|
9
|
+
onDisconnect(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../subgraphs/expense-report/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAI5C,qBAAa,qBAAsB,SAAQ,QAAQ;IACjD,IAAI,SAAoB;IACxB,QAAQ,EAAE,YAAY,CAAU;IAChC,SAAS,0BAAsB;IAC/B,uBAAuB,KAAM;IACvB,OAAO;IACP,YAAY;CACnB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Subgraph } from "@powerhousedao/reactor-api";
|
|
2
|
+
import { schema } from "./schema.js";
|
|
3
|
+
import { getResolvers } from "./resolvers.js";
|
|
4
|
+
export class ExpenseReportSubgraph extends Subgraph {
|
|
5
|
+
name = "expense-report";
|
|
6
|
+
typeDefs = schema;
|
|
7
|
+
resolvers = getResolvers(this);
|
|
8
|
+
additionalContextFields = {};
|
|
9
|
+
async onSetup() { }
|
|
10
|
+
async onDisconnect() { }
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/expense-report/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAuB3D,eAAO,MAAM,YAAY,GAAI,UAAU,QAAQ,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CA4avE,CAAC"}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { addFile } from "document-drive";
|
|
2
|
+
import { actions, } from "../../document-models/expense-report/index.js";
|
|
3
|
+
import { setName } from "document-model";
|
|
4
|
+
export const getResolvers = (subgraph) => {
|
|
5
|
+
const reactor = subgraph.reactor;
|
|
6
|
+
return {
|
|
7
|
+
Query: {
|
|
8
|
+
ExpenseReport: 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 === "powerhouse/expense-report");
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
Mutation: {
|
|
55
|
+
ExpenseReport_createDocument: async (_, args) => {
|
|
56
|
+
const { driveId, name } = args;
|
|
57
|
+
const document = await reactor.addDocument("powerhouse/expense-report");
|
|
58
|
+
if (driveId) {
|
|
59
|
+
await reactor.addAction(driveId, addFile({
|
|
60
|
+
name,
|
|
61
|
+
id: document.header.id,
|
|
62
|
+
documentType: "powerhouse/expense-report",
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
if (name) {
|
|
66
|
+
await reactor.addAction(document.header.id, setName(name));
|
|
67
|
+
}
|
|
68
|
+
return document.header.id;
|
|
69
|
+
},
|
|
70
|
+
ExpenseReport_addWallet: 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.addWallet(input));
|
|
77
|
+
if (result.status !== "SUCCESS") {
|
|
78
|
+
throw new Error(result.error?.message ?? "Failed to addWallet");
|
|
79
|
+
}
|
|
80
|
+
return true;
|
|
81
|
+
},
|
|
82
|
+
ExpenseReport_removeWallet: 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.removeWallet(input));
|
|
89
|
+
if (result.status !== "SUCCESS") {
|
|
90
|
+
throw new Error(result.error?.message ?? "Failed to removeWallet");
|
|
91
|
+
}
|
|
92
|
+
return true;
|
|
93
|
+
},
|
|
94
|
+
ExpenseReport_addBillingStatement: 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.addBillingStatement(input));
|
|
101
|
+
if (result.status !== "SUCCESS") {
|
|
102
|
+
throw new Error(result.error?.message ?? "Failed to addBillingStatement");
|
|
103
|
+
}
|
|
104
|
+
return true;
|
|
105
|
+
},
|
|
106
|
+
ExpenseReport_removeBillingStatement: 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.removeBillingStatement(input));
|
|
113
|
+
if (result.status !== "SUCCESS") {
|
|
114
|
+
throw new Error(result.error?.message ?? "Failed to removeBillingStatement");
|
|
115
|
+
}
|
|
116
|
+
return true;
|
|
117
|
+
},
|
|
118
|
+
ExpenseReport_addLineItem: 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.addLineItem(input));
|
|
125
|
+
if (result.status !== "SUCCESS") {
|
|
126
|
+
throw new Error(result.error?.message ?? "Failed to addLineItem");
|
|
127
|
+
}
|
|
128
|
+
return true;
|
|
129
|
+
},
|
|
130
|
+
ExpenseReport_updateLineItem: 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.updateLineItem(input));
|
|
137
|
+
if (result.status !== "SUCCESS") {
|
|
138
|
+
throw new Error(result.error?.message ?? "Failed to updateLineItem");
|
|
139
|
+
}
|
|
140
|
+
return true;
|
|
141
|
+
},
|
|
142
|
+
ExpenseReport_removeLineItem: 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.removeLineItem(input));
|
|
149
|
+
if (result.status !== "SUCCESS") {
|
|
150
|
+
throw new Error(result.error?.message ?? "Failed to removeLineItem");
|
|
151
|
+
}
|
|
152
|
+
return true;
|
|
153
|
+
},
|
|
154
|
+
ExpenseReport_addLineItemGroup: 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.addLineItemGroup(input));
|
|
161
|
+
if (result.status !== "SUCCESS") {
|
|
162
|
+
throw new Error(result.error?.message ?? "Failed to addLineItemGroup");
|
|
163
|
+
}
|
|
164
|
+
return true;
|
|
165
|
+
},
|
|
166
|
+
ExpenseReport_updateLineItemGroup: 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.updateLineItemGroup(input));
|
|
173
|
+
if (result.status !== "SUCCESS") {
|
|
174
|
+
throw new Error(result.error?.message ?? "Failed to updateLineItemGroup");
|
|
175
|
+
}
|
|
176
|
+
return true;
|
|
177
|
+
},
|
|
178
|
+
ExpenseReport_removeLineItemGroup: 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.removeLineItemGroup(input));
|
|
185
|
+
if (result.status !== "SUCCESS") {
|
|
186
|
+
throw new Error(result.error?.message ?? "Failed to removeLineItemGroup");
|
|
187
|
+
}
|
|
188
|
+
return true;
|
|
189
|
+
},
|
|
190
|
+
ExpenseReport_setGroupTotals: 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.setGroupTotals(input));
|
|
197
|
+
if (result.status !== "SUCCESS") {
|
|
198
|
+
throw new Error(result.error?.message ?? "Failed to setGroupTotals");
|
|
199
|
+
}
|
|
200
|
+
return true;
|
|
201
|
+
},
|
|
202
|
+
ExpenseReport_removeGroupTotals: 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.removeGroupTotals(input));
|
|
209
|
+
if (result.status !== "SUCCESS") {
|
|
210
|
+
throw new Error(result.error?.message ?? "Failed to removeGroupTotals");
|
|
211
|
+
}
|
|
212
|
+
return true;
|
|
213
|
+
},
|
|
214
|
+
ExpenseReport_setPeriodStart: 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.setPeriodStart(input));
|
|
221
|
+
if (result.status !== "SUCCESS") {
|
|
222
|
+
throw new Error(result.error?.message ?? "Failed to setPeriodStart");
|
|
223
|
+
}
|
|
224
|
+
return true;
|
|
225
|
+
},
|
|
226
|
+
ExpenseReport_setPeriodEnd: 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.setPeriodEnd(input));
|
|
233
|
+
if (result.status !== "SUCCESS") {
|
|
234
|
+
throw new Error(result.error?.message ?? "Failed to setPeriodEnd");
|
|
235
|
+
}
|
|
236
|
+
return true;
|
|
237
|
+
},
|
|
238
|
+
ExpenseReport_updateWallet: 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.updateWallet(input));
|
|
245
|
+
if (result.status !== "SUCCESS") {
|
|
246
|
+
throw new Error(result.error?.message ?? "Failed to updateWallet");
|
|
247
|
+
}
|
|
248
|
+
return true;
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
};
|
|
252
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../subgraphs/expense-report/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,MAAM,EAAE,YAkOpB,CAAC"}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { gql } from "graphql-tag";
|
|
2
|
+
export const schema = gql `
|
|
3
|
+
"""
|
|
4
|
+
Subgraph definition for ExpenseReport (powerhouse/expense-report)
|
|
5
|
+
"""
|
|
6
|
+
type ExpenseReportState {
|
|
7
|
+
wallets: [Wallet!]!
|
|
8
|
+
groups: [LineItemGroup!]!
|
|
9
|
+
periodStart: DateTime
|
|
10
|
+
periodEnd: DateTime
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type Wallet {
|
|
14
|
+
name: String
|
|
15
|
+
wallet: EthereumAddress
|
|
16
|
+
totals: [GroupTotals]
|
|
17
|
+
billingStatements: [OID]
|
|
18
|
+
lineItems: [LineItem]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type LineItemGroup {
|
|
22
|
+
id: ID!
|
|
23
|
+
label: String
|
|
24
|
+
parentId: ID
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
type GroupTotals {
|
|
28
|
+
group: ID ## LineItemGroupId
|
|
29
|
+
totalBudget: Float
|
|
30
|
+
totalForecast: Float
|
|
31
|
+
totalActuals: Float
|
|
32
|
+
totalPayments: Float
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
type LineItem {
|
|
36
|
+
id: ID
|
|
37
|
+
label: String
|
|
38
|
+
group: ID ## LineItemGroupId
|
|
39
|
+
budget: Float
|
|
40
|
+
actuals: Float
|
|
41
|
+
forecast: Float
|
|
42
|
+
payments: Float
|
|
43
|
+
comments: String
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
"""
|
|
47
|
+
Queries: ExpenseReport
|
|
48
|
+
"""
|
|
49
|
+
type ExpenseReportQueries {
|
|
50
|
+
getDocument(docId: PHID!, driveId: PHID): ExpenseReport
|
|
51
|
+
getDocuments(driveId: String!): [ExpenseReport!]
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
type Query {
|
|
55
|
+
ExpenseReport: ExpenseReportQueries
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
"""
|
|
59
|
+
Mutations: ExpenseReport
|
|
60
|
+
"""
|
|
61
|
+
type Mutation {
|
|
62
|
+
ExpenseReport_createDocument(name: String!, driveId: String): String
|
|
63
|
+
|
|
64
|
+
ExpenseReport_addWallet(
|
|
65
|
+
driveId: String
|
|
66
|
+
docId: PHID
|
|
67
|
+
input: ExpenseReport_AddWalletInput
|
|
68
|
+
): Int
|
|
69
|
+
ExpenseReport_removeWallet(
|
|
70
|
+
driveId: String
|
|
71
|
+
docId: PHID
|
|
72
|
+
input: ExpenseReport_RemoveWalletInput
|
|
73
|
+
): Int
|
|
74
|
+
ExpenseReport_addBillingStatement(
|
|
75
|
+
driveId: String
|
|
76
|
+
docId: PHID
|
|
77
|
+
input: ExpenseReport_AddBillingStatementInput
|
|
78
|
+
): Int
|
|
79
|
+
ExpenseReport_removeBillingStatement(
|
|
80
|
+
driveId: String
|
|
81
|
+
docId: PHID
|
|
82
|
+
input: ExpenseReport_RemoveBillingStatementInput
|
|
83
|
+
): Int
|
|
84
|
+
ExpenseReport_addLineItem(
|
|
85
|
+
driveId: String
|
|
86
|
+
docId: PHID
|
|
87
|
+
input: ExpenseReport_AddLineItemInput
|
|
88
|
+
): Int
|
|
89
|
+
ExpenseReport_updateLineItem(
|
|
90
|
+
driveId: String
|
|
91
|
+
docId: PHID
|
|
92
|
+
input: ExpenseReport_UpdateLineItemInput
|
|
93
|
+
): Int
|
|
94
|
+
ExpenseReport_removeLineItem(
|
|
95
|
+
driveId: String
|
|
96
|
+
docId: PHID
|
|
97
|
+
input: ExpenseReport_RemoveLineItemInput
|
|
98
|
+
): Int
|
|
99
|
+
ExpenseReport_addLineItemGroup(
|
|
100
|
+
driveId: String
|
|
101
|
+
docId: PHID
|
|
102
|
+
input: ExpenseReport_AddLineItemGroupInput
|
|
103
|
+
): Int
|
|
104
|
+
ExpenseReport_updateLineItemGroup(
|
|
105
|
+
driveId: String
|
|
106
|
+
docId: PHID
|
|
107
|
+
input: ExpenseReport_UpdateLineItemGroupInput
|
|
108
|
+
): Int
|
|
109
|
+
ExpenseReport_removeLineItemGroup(
|
|
110
|
+
driveId: String
|
|
111
|
+
docId: PHID
|
|
112
|
+
input: ExpenseReport_RemoveLineItemGroupInput
|
|
113
|
+
): Int
|
|
114
|
+
ExpenseReport_setGroupTotals(
|
|
115
|
+
driveId: String
|
|
116
|
+
docId: PHID
|
|
117
|
+
input: ExpenseReport_SetGroupTotalsInput
|
|
118
|
+
): Int
|
|
119
|
+
ExpenseReport_removeGroupTotals(
|
|
120
|
+
driveId: String
|
|
121
|
+
docId: PHID
|
|
122
|
+
input: ExpenseReport_RemoveGroupTotalsInput
|
|
123
|
+
): Int
|
|
124
|
+
ExpenseReport_setPeriodStart(
|
|
125
|
+
driveId: String
|
|
126
|
+
docId: PHID
|
|
127
|
+
input: ExpenseReport_SetPeriodStartInput
|
|
128
|
+
): Int
|
|
129
|
+
ExpenseReport_setPeriodEnd(
|
|
130
|
+
driveId: String
|
|
131
|
+
docId: PHID
|
|
132
|
+
input: ExpenseReport_SetPeriodEndInput
|
|
133
|
+
): Int
|
|
134
|
+
ExpenseReport_updateWallet(
|
|
135
|
+
driveId: String
|
|
136
|
+
docId: PHID
|
|
137
|
+
input: ExpenseReport_UpdateWalletInput
|
|
138
|
+
): Int
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
"""
|
|
142
|
+
Module: Wallet
|
|
143
|
+
"""
|
|
144
|
+
input ExpenseReport_AddWalletInput {
|
|
145
|
+
wallet: EthereumAddress!
|
|
146
|
+
name: String
|
|
147
|
+
}
|
|
148
|
+
input ExpenseReport_RemoveWalletInput {
|
|
149
|
+
wallet: EthereumAddress!
|
|
150
|
+
}
|
|
151
|
+
input ExpenseReport_AddBillingStatementInput {
|
|
152
|
+
wallet: EthereumAddress!
|
|
153
|
+
billingStatementId: OID!
|
|
154
|
+
}
|
|
155
|
+
input ExpenseReport_RemoveBillingStatementInput {
|
|
156
|
+
wallet: EthereumAddress!
|
|
157
|
+
billingStatementId: OID!
|
|
158
|
+
}
|
|
159
|
+
input ExpenseReport_AddLineItemInput {
|
|
160
|
+
wallet: EthereumAddress!
|
|
161
|
+
lineItem: LineItemInput!
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
input LineItemInput {
|
|
165
|
+
id: ID!
|
|
166
|
+
label: String
|
|
167
|
+
group: ID
|
|
168
|
+
budget: Float
|
|
169
|
+
actuals: Float
|
|
170
|
+
forecast: Float
|
|
171
|
+
payments: Float
|
|
172
|
+
comments: String
|
|
173
|
+
}
|
|
174
|
+
input ExpenseReport_UpdateLineItemInput {
|
|
175
|
+
wallet: EthereumAddress!
|
|
176
|
+
lineItemId: ID!
|
|
177
|
+
label: String
|
|
178
|
+
group: ID
|
|
179
|
+
budget: Float
|
|
180
|
+
actuals: Float
|
|
181
|
+
forecast: Float
|
|
182
|
+
payments: Float
|
|
183
|
+
comments: String
|
|
184
|
+
}
|
|
185
|
+
input ExpenseReport_RemoveLineItemInput {
|
|
186
|
+
wallet: EthereumAddress!
|
|
187
|
+
lineItemId: ID!
|
|
188
|
+
}
|
|
189
|
+
input ExpenseReport_AddLineItemGroupInput {
|
|
190
|
+
id: ID!
|
|
191
|
+
label: String
|
|
192
|
+
parentId: ID
|
|
193
|
+
}
|
|
194
|
+
input ExpenseReport_UpdateLineItemGroupInput {
|
|
195
|
+
id: ID!
|
|
196
|
+
label: String
|
|
197
|
+
parentId: ID
|
|
198
|
+
}
|
|
199
|
+
input ExpenseReport_RemoveLineItemGroupInput {
|
|
200
|
+
id: ID!
|
|
201
|
+
}
|
|
202
|
+
input ExpenseReport_SetGroupTotalsInput {
|
|
203
|
+
wallet: EthereumAddress!
|
|
204
|
+
groupTotals: GroupTotalsInput!
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
input GroupTotalsInput {
|
|
208
|
+
group: ID!
|
|
209
|
+
totalBudget: Float
|
|
210
|
+
totalForecast: Float
|
|
211
|
+
totalActuals: Float
|
|
212
|
+
totalPayments: Float
|
|
213
|
+
}
|
|
214
|
+
input ExpenseReport_RemoveGroupTotalsInput {
|
|
215
|
+
wallet: EthereumAddress!
|
|
216
|
+
groupId: ID!
|
|
217
|
+
}
|
|
218
|
+
input ExpenseReport_SetPeriodStartInput {
|
|
219
|
+
periodStart: DateTime!
|
|
220
|
+
}
|
|
221
|
+
input ExpenseReport_SetPeriodEndInput {
|
|
222
|
+
periodEnd: DateTime!
|
|
223
|
+
}
|
|
224
|
+
input ExpenseReport_UpdateWalletInput {
|
|
225
|
+
address: EthereumAddress!
|
|
226
|
+
name: String
|
|
227
|
+
}
|
|
228
|
+
`;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * as InvoiceSubgraph from "./invoice/index.js";
|
|
2
2
|
export * as BillingStatementSubgraph from "./billing-statement/index.js";
|
|
3
3
|
export * as IntegrationsSubgraph from "./integrations/index.js";
|
|
4
|
+
export * as ExpenseReportSubgraph from "./expense-report/index.js";
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../subgraphs/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,eAAe,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,wBAAwB,MAAM,8BAA8B,CAAC;AACzE,OAAO,KAAK,oBAAoB,MAAM,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../subgraphs/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,eAAe,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,wBAAwB,MAAM,8BAA8B,CAAC;AACzE,OAAO,KAAK,oBAAoB,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,qBAAqB,MAAM,2BAA2B,CAAC"}
|
package/dist/subgraphs/index.js
CHANGED
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.5",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@google-cloud/documentai": "^8.12.0",
|
|
60
|
-
"@powerhousedao/builder-tools": "^5.0.0-staging.
|
|
61
|
-
"@powerhousedao/common": "^5.0.0-staging.
|
|
62
|
-
"@powerhousedao/design-system": "^5.0.0-staging.
|
|
63
|
-
"@powerhousedao/document-engineering": "
|
|
60
|
+
"@powerhousedao/builder-tools": "^5.0.0-staging.30",
|
|
61
|
+
"@powerhousedao/common": "^5.0.0-staging.30",
|
|
62
|
+
"@powerhousedao/design-system": "^5.0.0-staging.30",
|
|
63
|
+
"@powerhousedao/document-engineering": "1.39.0",
|
|
64
64
|
"@react-pdf/renderer": "^4.3.0",
|
|
65
65
|
"@safe-global/api-kit": "^3.0.1",
|
|
66
66
|
"@safe-global/protocol-kit": "^6.0.3",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@types/cors": "^2.8.17",
|
|
70
70
|
"axios": "^1.9.0",
|
|
71
71
|
"cors": "^2.8.5",
|
|
72
|
-
"document-model": "^5.0.0-staging.
|
|
72
|
+
"document-model": "^5.0.0-staging.30",
|
|
73
73
|
"dotenv": "^16.5.0",
|
|
74
74
|
"error": "^10.4.0",
|
|
75
75
|
"ethers": "^6.14.0",
|
|
@@ -86,19 +86,19 @@
|
|
|
86
86
|
"@eslint/js": "^9.25.0",
|
|
87
87
|
"@playwright/test": "^1.56.0",
|
|
88
88
|
"@powerhousedao/analytics-engine-core": "^0.5.0",
|
|
89
|
-
"@powerhousedao/codegen": "^5.0.0-staging.
|
|
90
|
-
"@powerhousedao/ph-cli": "^5.0.0-staging.
|
|
91
|
-
"@powerhousedao/reactor-api": "^5.0.0-staging.
|
|
92
|
-
"@powerhousedao/reactor-browser": "^5.0.0-staging.
|
|
93
|
-
"@powerhousedao/reactor-local": "^5.0.0-staging.
|
|
89
|
+
"@powerhousedao/codegen": "^5.0.0-staging.30",
|
|
90
|
+
"@powerhousedao/ph-cli": "^5.0.0-staging.30",
|
|
91
|
+
"@powerhousedao/reactor-api": "^5.0.0-staging.30",
|
|
92
|
+
"@powerhousedao/reactor-browser": "^5.0.0-staging.30",
|
|
93
|
+
"@powerhousedao/reactor-local": "^5.0.0-staging.30",
|
|
94
94
|
"@powerhousedao/scalars": "^1.33.1-staging.5",
|
|
95
|
-
"@powerhousedao/switchboard": "^5.0.0-staging.
|
|
95
|
+
"@powerhousedao/switchboard": "^5.0.0-staging.30",
|
|
96
96
|
"@tailwindcss/cli": "^4.1.4",
|
|
97
97
|
"@testing-library/react": "^16.3.0",
|
|
98
98
|
"@types/node": "^22.14.1",
|
|
99
99
|
"@types/react": "^18.3.20",
|
|
100
100
|
"@vitejs/plugin-react": "^4.4.1",
|
|
101
|
-
"document-drive": "^5.0.0-staging.
|
|
101
|
+
"document-drive": "^5.0.0-staging.30",
|
|
102
102
|
"eslint": "^9.25.0",
|
|
103
103
|
"eslint-plugin-react": "^7.37.5",
|
|
104
104
|
"eslint-plugin-react-hooks": "^5.2.0",
|