@powerhousedao/contributor-billing 0.0.76 → 0.0.78
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/billing-statement/gen/general/actions.d.ts +13 -4
- package/dist/document-models/billing-statement/gen/general/actions.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/general/object.d.ts +3 -3
- package/dist/document-models/billing-statement/gen/general/object.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/index.d.ts +2 -0
- package/dist/document-models/billing-statement/gen/index.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/index.js +1 -0
- package/dist/document-models/billing-statement/gen/line-items/actions.d.ts +9 -3
- package/dist/document-models/billing-statement/gen/line-items/actions.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/line-items/object.d.ts +3 -3
- package/dist/document-models/billing-statement/gen/line-items/object.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/object.d.ts +4 -5
- package/dist/document-models/billing-statement/gen/object.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/object.js +2 -2
- package/dist/document-models/billing-statement/gen/ph-factories.d.ts +27 -0
- package/dist/document-models/billing-statement/gen/ph-factories.d.ts.map +1 -0
- package/dist/document-models/billing-statement/gen/ph-factories.js +58 -0
- package/dist/document-models/billing-statement/gen/reducer.d.ts +4 -2
- package/dist/document-models/billing-statement/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/reducer.js +4 -1
- package/dist/document-models/billing-statement/gen/schema/types.d.ts +4 -0
- package/dist/document-models/billing-statement/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/tags/actions.d.ts +5 -2
- package/dist/document-models/billing-statement/gen/tags/actions.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/tags/object.d.ts +3 -3
- package/dist/document-models/billing-statement/gen/tags/object.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/types.d.ts +4 -4
- package/dist/document-models/billing-statement/gen/types.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/utils.d.ts +18 -3
- package/dist/document-models/billing-statement/gen/utils.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/utils.js +33 -29
- package/dist/document-models/billing-statement/index.d.ts +8 -9
- package/dist/document-models/billing-statement/index.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/index.d.ts +2 -0
- package/dist/document-models/integrations/gen/index.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/index.js +1 -0
- package/dist/document-models/integrations/gen/integrations/actions.d.ts +13 -4
- package/dist/document-models/integrations/gen/integrations/actions.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/integrations/object.d.ts +3 -3
- package/dist/document-models/integrations/gen/integrations/object.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/object.d.ts +4 -5
- package/dist/document-models/integrations/gen/object.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/object.js +2 -2
- package/dist/document-models/integrations/gen/ph-factories.d.ts +27 -0
- package/dist/document-models/integrations/gen/ph-factories.d.ts.map +1 -0
- package/dist/document-models/integrations/gen/ph-factories.js +75 -0
- package/dist/document-models/integrations/gen/reducer.d.ts +4 -2
- package/dist/document-models/integrations/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/reducer.js +4 -1
- package/dist/document-models/integrations/gen/schema/types.d.ts +4 -0
- package/dist/document-models/integrations/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/types.d.ts +4 -4
- package/dist/document-models/integrations/gen/types.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/utils.d.ts +18 -3
- package/dist/document-models/integrations/gen/utils.d.ts.map +1 -1
- package/dist/document-models/integrations/gen/utils.js +36 -32
- package/dist/document-models/integrations/index.d.ts +8 -9
- package/dist/document-models/integrations/index.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/general/actions.d.ts +21 -6
- package/dist/document-models/invoice/gen/general/actions.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/general/object.d.ts +3 -3
- package/dist/document-models/invoice/gen/general/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/index.d.ts +2 -0
- package/dist/document-models/invoice/gen/index.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/index.js +1 -0
- package/dist/document-models/invoice/gen/items/actions.d.ts +21 -6
- package/dist/document-models/invoice/gen/items/actions.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/items/object.d.ts +3 -3
- package/dist/document-models/invoice/gen/items/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/object.d.ts +4 -5
- package/dist/document-models/invoice/gen/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/object.js +2 -2
- package/dist/document-models/invoice/gen/parties/actions.d.ts +25 -7
- package/dist/document-models/invoice/gen/parties/actions.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/parties/object.d.ts +3 -3
- package/dist/document-models/invoice/gen/parties/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/ph-factories.d.ts +27 -0
- package/dist/document-models/invoice/gen/ph-factories.d.ts.map +1 -0
- package/dist/document-models/invoice/gen/ph-factories.js +190 -0
- package/dist/document-models/invoice/gen/reducer.d.ts +4 -2
- package/dist/document-models/invoice/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/reducer.js +4 -1
- package/dist/document-models/invoice/gen/schema/types.d.ts +4 -0
- package/dist/document-models/invoice/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/transitions/actions.d.ts +49 -13
- package/dist/document-models/invoice/gen/transitions/actions.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/transitions/object.d.ts +3 -3
- package/dist/document-models/invoice/gen/transitions/object.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/types.d.ts +4 -4
- package/dist/document-models/invoice/gen/types.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/utils.d.ts +18 -3
- package/dist/document-models/invoice/gen/utils.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/utils.js +33 -29
- package/dist/document-models/invoice/index.d.ts +8 -9
- package/dist/document-models/invoice/index.d.ts.map +1 -1
- package/dist/editors/billing-statement/editor.d.ts +2 -3
- package/dist/editors/billing-statement/editor.d.ts.map +1 -1
- package/dist/editors/billing-statement/editor.js +11 -3
- package/dist/editors/billing-statement/index.d.ts +1 -2
- package/dist/editors/billing-statement/index.d.ts.map +1 -1
- package/dist/editors/billing-statement/lineItemTags/lineItemTags.js +1 -1
- package/dist/editors/contributor-billing/components/CreateDocument.d.ts +5 -7
- package/dist/editors/contributor-billing/components/CreateDocument.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/CreateDocument.js +18 -9
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts +6 -16
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/DriveExplorer.js +179 -88
- package/dist/editors/contributor-billing/components/EditorContainer.d.ts +9 -13
- package/dist/editors/contributor-billing/components/EditorContainer.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/EditorContainer.js +37 -26
- package/dist/editors/contributor-billing/components/FolderTree.d.ts +7 -3
- package/dist/editors/contributor-billing/components/FolderTree.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/FolderTree.js +11 -4
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts +1 -2
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts +4 -8
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.js +125 -119
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts +1 -2
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableRow.js +24 -4
- package/dist/editors/contributor-billing/editor.d.ts +9 -4
- package/dist/editors/contributor-billing/editor.d.ts.map +1 -1
- package/dist/editors/contributor-billing/editor.js +15 -41
- package/dist/editors/contributor-billing/hooks/useTransformedNodes.d.ts +1 -2
- package/dist/editors/contributor-billing/hooks/useTransformedNodes.d.ts.map +1 -1
- package/dist/editors/contributor-billing/index.d.ts +1 -2
- package/dist/editors/contributor-billing/index.d.ts.map +1 -1
- package/dist/editors/integrations/editor.d.ts +1 -4
- package/dist/editors/integrations/editor.d.ts.map +1 -1
- package/dist/editors/integrations/editor.js +10 -1
- package/dist/editors/integrations/index.d.ts +1 -2
- package/dist/editors/integrations/index.d.ts.map +1 -1
- package/dist/editors/invoice/InvoicePDF.d.ts.map +1 -1
- package/dist/editors/invoice/InvoicePDF.js +3 -3
- package/dist/editors/invoice/editor.d.ts +1 -4
- package/dist/editors/invoice/editor.d.ts.map +1 -1
- package/dist/editors/invoice/editor.js +10 -1
- package/dist/editors/invoice/index.d.ts +1 -2
- package/dist/editors/invoice/index.d.ts.map +1 -1
- package/dist/editors/invoice/ingestPDF.js +1 -1
- package/dist/editors/invoice/invoiceToGnosis.js +3 -3
- package/dist/editors/invoice/requestFinance.js +2 -2
- package/dist/editors/invoice/uploadPdfChunked.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/reducers/general.d.ts +8 -0
- package/dist/reducers/general.d.ts.map +1 -0
- package/dist/reducers/general.js +73 -0
- package/dist/reducers/items.d.ts +8 -0
- package/dist/reducers/items.d.ts.map +1 -0
- package/dist/reducers/items.js +195 -0
- package/dist/reducers/parties.d.ts +8 -0
- package/dist/reducers/parties.d.ts.map +1 -0
- package/dist/reducers/parties.js +266 -0
- package/dist/reducers/transitions.d.ts +8 -0
- package/dist/reducers/transitions.d.ts.map +1 -0
- package/dist/reducers/transitions.js +162 -0
- package/dist/scripts/contributor-billing/createXeroCsv.js +2 -2
- package/dist/scripts/invoice/gnosisTransactionBuilder.js +1 -1
- package/dist/style.css +730 -108
- package/dist/subgraphs/billing-statement/index.d.ts +2 -1
- package/dist/subgraphs/billing-statement/index.d.ts.map +1 -1
- package/dist/subgraphs/billing-statement/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/billing-statement/resolvers.js +101 -69
- package/dist/subgraphs/billing-statement/schema.js +3 -3
- package/dist/subgraphs/integrations/index.d.ts +2 -1
- package/dist/subgraphs/integrations/index.d.ts.map +1 -1
- package/dist/subgraphs/integrations/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/integrations/resolvers.js +61 -46
- package/dist/subgraphs/integrations/schema.js +3 -3
- package/dist/subgraphs/invoice/index.d.ts +2 -1
- package/dist/subgraphs/invoice/index.d.ts.map +1 -1
- package/dist/subgraphs/invoice/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/invoice/resolvers.js +323 -181
- package/dist/subgraphs/invoice/schema.js +3 -3
- package/package.json +14 -14
|
@@ -1,266 +1,408 @@
|
|
|
1
|
-
import { addFile } from "document-drive";
|
|
2
|
-
import { actions } from "../../document-models/invoice/index.js";
|
|
3
|
-
import { generateId } from "document-model";
|
|
4
1
|
import { Invoice_processGnosisPayment, Invoice_createRequestFinancePayment, Invoice_uploadInvoicePdfChunk } from "./customResolvers.js";
|
|
5
|
-
|
|
2
|
+
import { addFile } from "document-drive";
|
|
3
|
+
import { actions, } from "../../document-models/invoice/index.js";
|
|
4
|
+
import { setName } from "document-model";
|
|
6
5
|
export const getResolvers = (subgraph) => {
|
|
7
6
|
const reactor = subgraph.reactor;
|
|
8
7
|
return {
|
|
9
8
|
Query: {
|
|
10
|
-
Invoice: async (
|
|
9
|
+
Invoice: async () => {
|
|
11
10
|
return {
|
|
12
11
|
getDocument: async (args) => {
|
|
13
|
-
const driveId = args
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
const { docId, driveId } = args;
|
|
13
|
+
if (!docId) {
|
|
14
|
+
throw new Error("Document id is required");
|
|
15
|
+
}
|
|
16
|
+
if (driveId) {
|
|
17
|
+
const docIds = await reactor.getDocuments(driveId);
|
|
18
|
+
if (!docIds.includes(docId)) {
|
|
19
|
+
throw new Error(`Document with id ${docId} is not part of ${driveId}`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const doc = await reactor.getDocument(docId);
|
|
16
23
|
return {
|
|
17
24
|
driveId: driveId,
|
|
18
25
|
...doc,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
...doc.header,
|
|
27
|
+
state: doc.state.global,
|
|
28
|
+
stateJSON: doc.state.global,
|
|
29
|
+
revision: doc.header?.revision?.global ?? 0,
|
|
22
30
|
};
|
|
23
31
|
},
|
|
24
32
|
getDocuments: async (args) => {
|
|
25
|
-
const driveId = args
|
|
33
|
+
const { driveId } = args;
|
|
26
34
|
const docsIds = await reactor.getDocuments(driveId);
|
|
27
|
-
const docs = await Promise.all(
|
|
28
|
-
const doc = await reactor.getDocument(
|
|
35
|
+
const docs = await Promise.all(docsIds.map(async (docId) => {
|
|
36
|
+
const doc = await reactor.getDocument(docId);
|
|
29
37
|
return {
|
|
30
38
|
driveId: driveId,
|
|
31
39
|
...doc,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
...doc.header,
|
|
41
|
+
state: doc.state.global,
|
|
42
|
+
stateJSON: doc.state.global,
|
|
43
|
+
revision: doc.header?.revision?.global ?? 0,
|
|
35
44
|
};
|
|
36
45
|
}));
|
|
37
|
-
return docs.filter((doc) => doc.header
|
|
46
|
+
return docs.filter((doc) => doc.header.documentType === "powerhouse/invoice");
|
|
38
47
|
},
|
|
39
48
|
};
|
|
40
49
|
},
|
|
41
50
|
},
|
|
42
51
|
Mutation: {
|
|
43
52
|
Invoice_createDocument: async (_, args) => {
|
|
44
|
-
const driveId = args
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
branch: "main",
|
|
58
|
-
scope: "local",
|
|
59
|
-
syncId: generateId(),
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
}));
|
|
63
|
-
return docId;
|
|
53
|
+
const { driveId, name } = args;
|
|
54
|
+
const document = await reactor.addDocument("powerhouse/invoice");
|
|
55
|
+
if (driveId) {
|
|
56
|
+
await reactor.addAction(driveId, addFile({
|
|
57
|
+
name,
|
|
58
|
+
id: document.header.id,
|
|
59
|
+
documentType: "powerhouse/invoice",
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
if (name) {
|
|
63
|
+
await reactor.addAction(document.header.id, setName(name));
|
|
64
|
+
}
|
|
65
|
+
return document.header.id;
|
|
64
66
|
},
|
|
65
67
|
Invoice_editInvoice: async (_, args) => {
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
const { docId, input } = args;
|
|
69
|
+
const doc = await reactor.getDocument(docId);
|
|
70
|
+
if (!doc) {
|
|
71
|
+
throw new Error("Document not found");
|
|
72
|
+
}
|
|
73
|
+
const result = await reactor.addAction(docId, actions.editInvoice(input));
|
|
74
|
+
if (result.status !== "SUCCESS") {
|
|
75
|
+
throw new Error(result.error?.message ?? "Failed to editInvoice");
|
|
76
|
+
}
|
|
77
|
+
return true;
|
|
71
78
|
},
|
|
72
79
|
Invoice_editStatus: async (_, args) => {
|
|
73
|
-
const
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
80
|
+
const { docId, input } = args;
|
|
81
|
+
const doc = await reactor.getDocument(docId);
|
|
82
|
+
if (!doc) {
|
|
83
|
+
throw new Error("Document not found");
|
|
84
|
+
}
|
|
85
|
+
const result = await reactor.addAction(docId, actions.editStatus(input));
|
|
86
|
+
if (result.status !== "SUCCESS") {
|
|
87
|
+
throw new Error(result.error?.message ?? "Failed to editStatus");
|
|
88
|
+
}
|
|
89
|
+
return true;
|
|
78
90
|
},
|
|
79
91
|
Invoice_editPaymentData: async (_, args) => {
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
92
|
+
const { docId, input } = args;
|
|
93
|
+
const doc = await reactor.getDocument(docId);
|
|
94
|
+
if (!doc) {
|
|
95
|
+
throw new Error("Document not found");
|
|
96
|
+
}
|
|
97
|
+
const result = await reactor.addAction(docId, actions.editPaymentData(input));
|
|
98
|
+
if (result.status !== "SUCCESS") {
|
|
99
|
+
throw new Error(result.error?.message ?? "Failed to editPaymentData");
|
|
100
|
+
}
|
|
101
|
+
return true;
|
|
85
102
|
},
|
|
86
103
|
Invoice_setExportedData: async (_, args) => {
|
|
87
|
-
const
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
104
|
+
const { docId, input } = args;
|
|
105
|
+
const doc = await reactor.getDocument(docId);
|
|
106
|
+
if (!doc) {
|
|
107
|
+
throw new Error("Document not found");
|
|
108
|
+
}
|
|
109
|
+
const result = await reactor.addAction(docId, actions.setExportedData(input));
|
|
110
|
+
if (result.status !== "SUCCESS") {
|
|
111
|
+
throw new Error(result.error?.message ?? "Failed to setExportedData");
|
|
112
|
+
}
|
|
113
|
+
return true;
|
|
92
114
|
},
|
|
93
115
|
Invoice_addPayment: async (_, args) => {
|
|
94
|
-
const
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
116
|
+
const { docId, input } = args;
|
|
117
|
+
const doc = await reactor.getDocument(docId);
|
|
118
|
+
if (!doc) {
|
|
119
|
+
throw new Error("Document not found");
|
|
120
|
+
}
|
|
121
|
+
const result = await reactor.addAction(docId, actions.addPayment(input));
|
|
122
|
+
if (result.status !== "SUCCESS") {
|
|
123
|
+
throw new Error(result.error?.message ?? "Failed to addPayment");
|
|
124
|
+
}
|
|
125
|
+
return true;
|
|
99
126
|
},
|
|
100
127
|
Invoice_editIssuer: async (_, args) => {
|
|
101
|
-
const
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
128
|
+
const { docId, input } = args;
|
|
129
|
+
const doc = await reactor.getDocument(docId);
|
|
130
|
+
if (!doc) {
|
|
131
|
+
throw new Error("Document not found");
|
|
132
|
+
}
|
|
133
|
+
const result = await reactor.addAction(docId, actions.editIssuer(input));
|
|
134
|
+
if (result.status !== "SUCCESS") {
|
|
135
|
+
throw new Error(result.error?.message ?? "Failed to editIssuer");
|
|
136
|
+
}
|
|
137
|
+
return true;
|
|
106
138
|
},
|
|
107
139
|
Invoice_editIssuerBank: async (_, args) => {
|
|
108
|
-
const
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
140
|
+
const { docId, input } = args;
|
|
141
|
+
const doc = await reactor.getDocument(docId);
|
|
142
|
+
if (!doc) {
|
|
143
|
+
throw new Error("Document not found");
|
|
144
|
+
}
|
|
145
|
+
const result = await reactor.addAction(docId, actions.editIssuerBank(input));
|
|
146
|
+
if (result.status !== "SUCCESS") {
|
|
147
|
+
throw new Error(result.error?.message ?? "Failed to editIssuerBank");
|
|
148
|
+
}
|
|
149
|
+
return true;
|
|
113
150
|
},
|
|
114
151
|
Invoice_editIssuerWallet: async (_, args) => {
|
|
115
|
-
const
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
152
|
+
const { docId, input } = args;
|
|
153
|
+
const doc = await reactor.getDocument(docId);
|
|
154
|
+
if (!doc) {
|
|
155
|
+
throw new Error("Document not found");
|
|
156
|
+
}
|
|
157
|
+
const result = await reactor.addAction(docId, actions.editIssuerWallet(input));
|
|
158
|
+
if (result.status !== "SUCCESS") {
|
|
159
|
+
throw new Error(result.error?.message ?? "Failed to editIssuerWallet");
|
|
160
|
+
}
|
|
161
|
+
return true;
|
|
120
162
|
},
|
|
121
163
|
Invoice_editPayer: async (_, args) => {
|
|
122
|
-
const
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
164
|
+
const { docId, input } = args;
|
|
165
|
+
const doc = await reactor.getDocument(docId);
|
|
166
|
+
if (!doc) {
|
|
167
|
+
throw new Error("Document not found");
|
|
168
|
+
}
|
|
169
|
+
const result = await reactor.addAction(docId, actions.editPayer(input));
|
|
170
|
+
if (result.status !== "SUCCESS") {
|
|
171
|
+
throw new Error(result.error?.message ?? "Failed to editPayer");
|
|
172
|
+
}
|
|
173
|
+
return true;
|
|
127
174
|
},
|
|
128
175
|
Invoice_editPayerBank: async (_, args) => {
|
|
129
|
-
const
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
176
|
+
const { docId, input } = args;
|
|
177
|
+
const doc = await reactor.getDocument(docId);
|
|
178
|
+
if (!doc) {
|
|
179
|
+
throw new Error("Document not found");
|
|
180
|
+
}
|
|
181
|
+
const result = await reactor.addAction(docId, actions.editPayerBank(input));
|
|
182
|
+
if (result.status !== "SUCCESS") {
|
|
183
|
+
throw new Error(result.error?.message ?? "Failed to editPayerBank");
|
|
184
|
+
}
|
|
185
|
+
return true;
|
|
134
186
|
},
|
|
135
187
|
Invoice_editPayerWallet: async (_, args) => {
|
|
136
|
-
const
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
188
|
+
const { docId, input } = args;
|
|
189
|
+
const doc = await reactor.getDocument(docId);
|
|
190
|
+
if (!doc) {
|
|
191
|
+
throw new Error("Document not found");
|
|
192
|
+
}
|
|
193
|
+
const result = await reactor.addAction(docId, actions.editPayerWallet(input));
|
|
194
|
+
if (result.status !== "SUCCESS") {
|
|
195
|
+
throw new Error(result.error?.message ?? "Failed to editPayerWallet");
|
|
196
|
+
}
|
|
197
|
+
return true;
|
|
141
198
|
},
|
|
142
199
|
Invoice_addLineItem: async (_, args) => {
|
|
143
|
-
const
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
200
|
+
const { docId, input } = args;
|
|
201
|
+
const doc = await reactor.getDocument(docId);
|
|
202
|
+
if (!doc) {
|
|
203
|
+
throw new Error("Document not found");
|
|
204
|
+
}
|
|
205
|
+
const result = await reactor.addAction(docId, actions.addLineItem(input));
|
|
206
|
+
if (result.status !== "SUCCESS") {
|
|
207
|
+
throw new Error(result.error?.message ?? "Failed to addLineItem");
|
|
208
|
+
}
|
|
209
|
+
return true;
|
|
148
210
|
},
|
|
149
211
|
Invoice_editLineItem: async (_, args) => {
|
|
150
|
-
const
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
212
|
+
const { docId, input } = args;
|
|
213
|
+
const doc = await reactor.getDocument(docId);
|
|
214
|
+
if (!doc) {
|
|
215
|
+
throw new Error("Document not found");
|
|
216
|
+
}
|
|
217
|
+
const result = await reactor.addAction(docId, actions.editLineItem(input));
|
|
218
|
+
if (result.status !== "SUCCESS") {
|
|
219
|
+
throw new Error(result.error?.message ?? "Failed to editLineItem");
|
|
220
|
+
}
|
|
221
|
+
return true;
|
|
155
222
|
},
|
|
156
223
|
Invoice_deleteLineItem: async (_, args) => {
|
|
157
|
-
const
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
224
|
+
const { docId, input } = args;
|
|
225
|
+
const doc = await reactor.getDocument(docId);
|
|
226
|
+
if (!doc) {
|
|
227
|
+
throw new Error("Document not found");
|
|
228
|
+
}
|
|
229
|
+
const result = await reactor.addAction(docId, actions.deleteLineItem(input));
|
|
230
|
+
if (result.status !== "SUCCESS") {
|
|
231
|
+
throw new Error(result.error?.message ?? "Failed to deleteLineItem");
|
|
232
|
+
}
|
|
233
|
+
return true;
|
|
162
234
|
},
|
|
163
235
|
Invoice_setLineItemTag: async (_, args) => {
|
|
164
|
-
const
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
236
|
+
const { docId, input } = args;
|
|
237
|
+
const doc = await reactor.getDocument(docId);
|
|
238
|
+
if (!doc) {
|
|
239
|
+
throw new Error("Document not found");
|
|
240
|
+
}
|
|
241
|
+
const result = await reactor.addAction(docId, actions.setLineItemTag(input));
|
|
242
|
+
if (result.status !== "SUCCESS") {
|
|
243
|
+
throw new Error(result.error?.message ?? "Failed to setLineItemTag");
|
|
244
|
+
}
|
|
245
|
+
return true;
|
|
169
246
|
},
|
|
170
247
|
Invoice_setInvoiceTag: async (_, args) => {
|
|
171
|
-
const
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
248
|
+
const { docId, input } = args;
|
|
249
|
+
const doc = await reactor.getDocument(docId);
|
|
250
|
+
if (!doc) {
|
|
251
|
+
throw new Error("Document not found");
|
|
252
|
+
}
|
|
253
|
+
const result = await reactor.addAction(docId, actions.setInvoiceTag(input));
|
|
254
|
+
if (result.status !== "SUCCESS") {
|
|
255
|
+
throw new Error(result.error?.message ?? "Failed to setInvoiceTag");
|
|
256
|
+
}
|
|
257
|
+
return true;
|
|
176
258
|
},
|
|
177
259
|
Invoice_cancel: async (_, args) => {
|
|
178
|
-
const
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
260
|
+
const { docId, input } = args;
|
|
261
|
+
const doc = await reactor.getDocument(docId);
|
|
262
|
+
if (!doc) {
|
|
263
|
+
throw new Error("Document not found");
|
|
264
|
+
}
|
|
265
|
+
const result = await reactor.addAction(docId, actions.cancel(input));
|
|
266
|
+
if (result.status !== "SUCCESS") {
|
|
267
|
+
throw new Error(result.error?.message ?? "Failed to cancel");
|
|
268
|
+
}
|
|
269
|
+
return true;
|
|
183
270
|
},
|
|
184
271
|
Invoice_issue: async (_, args) => {
|
|
185
|
-
const
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
272
|
+
const { docId, input } = args;
|
|
273
|
+
const doc = await reactor.getDocument(docId);
|
|
274
|
+
if (!doc) {
|
|
275
|
+
throw new Error("Document not found");
|
|
276
|
+
}
|
|
277
|
+
const result = await reactor.addAction(docId, actions.issue(input));
|
|
278
|
+
if (result.status !== "SUCCESS") {
|
|
279
|
+
throw new Error(result.error?.message ?? "Failed to issue");
|
|
280
|
+
}
|
|
281
|
+
return true;
|
|
190
282
|
},
|
|
191
283
|
Invoice_reset: async (_, args) => {
|
|
192
|
-
const
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
284
|
+
const { docId, input } = args;
|
|
285
|
+
const doc = await reactor.getDocument(docId);
|
|
286
|
+
if (!doc) {
|
|
287
|
+
throw new Error("Document not found");
|
|
288
|
+
}
|
|
289
|
+
const result = await reactor.addAction(docId, actions.reset(input));
|
|
290
|
+
if (result.status !== "SUCCESS") {
|
|
291
|
+
throw new Error(result.error?.message ?? "Failed to reset");
|
|
292
|
+
}
|
|
293
|
+
return true;
|
|
197
294
|
},
|
|
198
295
|
Invoice_reject: async (_, args) => {
|
|
199
|
-
const
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
296
|
+
const { docId, input } = args;
|
|
297
|
+
const doc = await reactor.getDocument(docId);
|
|
298
|
+
if (!doc) {
|
|
299
|
+
throw new Error("Document not found");
|
|
300
|
+
}
|
|
301
|
+
const result = await reactor.addAction(docId, actions.reject(input));
|
|
302
|
+
if (result.status !== "SUCCESS") {
|
|
303
|
+
throw new Error(result.error?.message ?? "Failed to reject");
|
|
304
|
+
}
|
|
305
|
+
return true;
|
|
204
306
|
},
|
|
205
307
|
Invoice_accept: async (_, args) => {
|
|
206
|
-
const
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
308
|
+
const { docId, input } = args;
|
|
309
|
+
const doc = await reactor.getDocument(docId);
|
|
310
|
+
if (!doc) {
|
|
311
|
+
throw new Error("Document not found");
|
|
312
|
+
}
|
|
313
|
+
const result = await reactor.addAction(docId, actions.accept(input));
|
|
314
|
+
if (result.status !== "SUCCESS") {
|
|
315
|
+
throw new Error(result.error?.message ?? "Failed to accept");
|
|
316
|
+
}
|
|
317
|
+
return true;
|
|
211
318
|
},
|
|
212
319
|
Invoice_reinstate: async (_, args) => {
|
|
213
|
-
const
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
320
|
+
const { docId, input } = args;
|
|
321
|
+
const doc = await reactor.getDocument(docId);
|
|
322
|
+
if (!doc) {
|
|
323
|
+
throw new Error("Document not found");
|
|
324
|
+
}
|
|
325
|
+
const result = await reactor.addAction(docId, actions.reinstate(input));
|
|
326
|
+
if (result.status !== "SUCCESS") {
|
|
327
|
+
throw new Error(result.error?.message ?? "Failed to reinstate");
|
|
328
|
+
}
|
|
329
|
+
return true;
|
|
218
330
|
},
|
|
219
331
|
Invoice_schedulePayment: async (_, args) => {
|
|
220
|
-
const
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
332
|
+
const { docId, input } = args;
|
|
333
|
+
const doc = await reactor.getDocument(docId);
|
|
334
|
+
if (!doc) {
|
|
335
|
+
throw new Error("Document not found");
|
|
336
|
+
}
|
|
337
|
+
const result = await reactor.addAction(docId, actions.schedulePayment(input));
|
|
338
|
+
if (result.status !== "SUCCESS") {
|
|
339
|
+
throw new Error(result.error?.message ?? "Failed to schedulePayment");
|
|
340
|
+
}
|
|
341
|
+
return true;
|
|
225
342
|
},
|
|
226
343
|
Invoice_reapprovePayment: async (_, args) => {
|
|
227
|
-
const
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
344
|
+
const { docId, input } = args;
|
|
345
|
+
const doc = await reactor.getDocument(docId);
|
|
346
|
+
if (!doc) {
|
|
347
|
+
throw new Error("Document not found");
|
|
348
|
+
}
|
|
349
|
+
const result = await reactor.addAction(docId, actions.reapprovePayment(input));
|
|
350
|
+
if (result.status !== "SUCCESS") {
|
|
351
|
+
throw new Error(result.error?.message ?? "Failed to reapprovePayment");
|
|
352
|
+
}
|
|
353
|
+
return true;
|
|
232
354
|
},
|
|
233
355
|
Invoice_registerPaymentTx: async (_, args) => {
|
|
234
|
-
const
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
356
|
+
const { docId, input } = args;
|
|
357
|
+
const doc = await reactor.getDocument(docId);
|
|
358
|
+
if (!doc) {
|
|
359
|
+
throw new Error("Document not found");
|
|
360
|
+
}
|
|
361
|
+
const result = await reactor.addAction(docId, actions.registerPaymentTx(input));
|
|
362
|
+
if (result.status !== "SUCCESS") {
|
|
363
|
+
throw new Error(result.error?.message ?? "Failed to registerPaymentTx");
|
|
364
|
+
}
|
|
365
|
+
return true;
|
|
239
366
|
},
|
|
240
367
|
Invoice_reportPaymentIssue: async (_, args) => {
|
|
241
|
-
const
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
368
|
+
const { docId, input } = args;
|
|
369
|
+
const doc = await reactor.getDocument(docId);
|
|
370
|
+
if (!doc) {
|
|
371
|
+
throw new Error("Document not found");
|
|
372
|
+
}
|
|
373
|
+
const result = await reactor.addAction(docId, actions.reportPaymentIssue(input));
|
|
374
|
+
if (result.status !== "SUCCESS") {
|
|
375
|
+
throw new Error(result.error?.message ?? "Failed to reportPaymentIssue");
|
|
376
|
+
}
|
|
377
|
+
return true;
|
|
246
378
|
},
|
|
247
379
|
Invoice_confirmPayment: async (_, args) => {
|
|
248
|
-
const
|
|
249
|
-
const
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
380
|
+
const { docId, input } = args;
|
|
381
|
+
const doc = await reactor.getDocument(docId);
|
|
382
|
+
if (!doc) {
|
|
383
|
+
throw new Error("Document not found");
|
|
384
|
+
}
|
|
385
|
+
const result = await reactor.addAction(docId, actions.confirmPayment(input));
|
|
386
|
+
if (result.status !== "SUCCESS") {
|
|
387
|
+
throw new Error(result.error?.message ?? "Failed to confirmPayment");
|
|
388
|
+
}
|
|
389
|
+
return true;
|
|
253
390
|
},
|
|
254
391
|
Invoice_closePayment: async (_, args) => {
|
|
255
|
-
const
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
392
|
+
const { docId, input } = args;
|
|
393
|
+
const doc = await reactor.getDocument(docId);
|
|
394
|
+
if (!doc) {
|
|
395
|
+
throw new Error("Document not found");
|
|
396
|
+
}
|
|
397
|
+
const result = await reactor.addAction(docId, actions.closePayment(input));
|
|
398
|
+
if (result.status !== "SUCCESS") {
|
|
399
|
+
throw new Error(result.error?.message ?? "Failed to closePayment");
|
|
400
|
+
}
|
|
401
|
+
return true;
|
|
260
402
|
},
|
|
261
|
-
Invoice_processGnosisPayment,
|
|
262
|
-
Invoice_createRequestFinancePayment,
|
|
263
|
-
Invoice_uploadInvoicePdfChunk,
|
|
403
|
+
Invoice_processGnosisPayment: Invoice_processGnosisPayment,
|
|
404
|
+
Invoice_createRequestFinancePayment: Invoice_createRequestFinancePayment,
|
|
405
|
+
Invoice_uploadInvoicePdfChunk: Invoice_uploadInvoicePdfChunk,
|
|
264
406
|
},
|
|
265
407
|
};
|
|
266
408
|
};
|
|
@@ -179,8 +179,8 @@ export const schema = gql `
|
|
|
179
179
|
Queries: Invoice
|
|
180
180
|
"""
|
|
181
181
|
type InvoiceQueries {
|
|
182
|
-
getDocument(
|
|
183
|
-
getDocuments: [Invoice!]
|
|
182
|
+
getDocument(docId: PHID!, driveId: PHID): Invoice
|
|
183
|
+
getDocuments(driveId: String!): [Invoice!]
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
type Query {
|
|
@@ -191,7 +191,7 @@ export const schema = gql `
|
|
|
191
191
|
Mutations: Invoice
|
|
192
192
|
"""
|
|
193
193
|
type Mutation {
|
|
194
|
-
Invoice_createDocument(
|
|
194
|
+
Invoice_createDocument(name: String!, driveId: String): String
|
|
195
195
|
|
|
196
196
|
Invoice_editInvoice(
|
|
197
197
|
driveId: String
|