@powerhousedao/contributor-billing 0.1.53 → 1.0.0-dev.10

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.
Files changed (189) hide show
  1. package/dist/document-models/account-transactions/gen/schema/zod.d.ts.map +1 -1
  2. package/dist/document-models/account-transactions/gen/schema/zod.js +3 -3
  3. package/dist/document-models/account-transactions/module.d.ts +1 -1
  4. package/dist/document-models/account-transactions/module.d.ts.map +1 -1
  5. package/dist/document-models/account-transactions/module.js +1 -1
  6. package/dist/document-models/accounts/gen/schema/zod.d.ts.map +1 -1
  7. package/dist/document-models/accounts/module.d.ts +1 -1
  8. package/dist/document-models/accounts/module.d.ts.map +1 -1
  9. package/dist/document-models/accounts/module.js +1 -1
  10. package/dist/document-models/billing-statement/gen/schema/zod.d.ts.map +1 -1
  11. package/dist/document-models/billing-statement/gen/schema/zod.js +4 -4
  12. package/dist/document-models/billing-statement/module.d.ts +1 -1
  13. package/dist/document-models/billing-statement/module.d.ts.map +1 -1
  14. package/dist/document-models/billing-statement/module.js +1 -1
  15. package/dist/document-models/expense-report/gen/schema/zod.d.ts.map +1 -1
  16. package/dist/document-models/expense-report/gen/schema/zod.js +38 -18
  17. package/dist/document-models/expense-report/module.d.ts +1 -1
  18. package/dist/document-models/expense-report/module.d.ts.map +1 -1
  19. package/dist/document-models/expense-report/module.js +1 -1
  20. package/dist/document-models/invoice/gen/document-model.d.ts.map +1 -1
  21. package/dist/document-models/invoice/gen/document-model.js +150 -150
  22. package/dist/document-models/invoice/gen/schema/types.d.ts +3 -6
  23. package/dist/document-models/invoice/gen/schema/types.d.ts.map +1 -1
  24. package/dist/document-models/invoice/gen/schema/zod.d.ts +2 -8
  25. package/dist/document-models/invoice/gen/schema/zod.d.ts.map +1 -1
  26. package/dist/document-models/invoice/gen/schema/zod.js +14 -25
  27. package/dist/document-models/invoice/module.d.ts +1 -1
  28. package/dist/document-models/invoice/module.d.ts.map +1 -1
  29. package/dist/document-models/invoice/module.js +1 -1
  30. package/dist/document-models/invoice/src/reducers/general.d.ts.map +1 -1
  31. package/dist/document-models/invoice/src/reducers/general.js +8 -0
  32. package/dist/document-models/invoice/src/reducers/items.d.ts.map +1 -1
  33. package/dist/document-models/invoice/src/reducers/items.js +2 -1
  34. package/dist/document-models/invoice/src/reducers/parties.d.ts.map +1 -1
  35. package/dist/document-models/invoice/src/reducers/parties.js +6 -2
  36. package/dist/document-models/invoice/src/reducers/transitions.d.ts +0 -5
  37. package/dist/document-models/invoice/src/reducers/transitions.d.ts.map +1 -1
  38. package/dist/document-models/invoice/src/reducers/transitions.js +19 -6
  39. package/dist/document-models/invoice/tests/general.test.js +11 -2
  40. package/dist/document-models/invoice/tests/items.test.js +1 -1
  41. package/dist/document-models/invoice/tests/parties.test.js +1 -1
  42. package/dist/document-models/invoice/tests/transitions.test.js +7 -2
  43. package/dist/document-models/operational-hub-profile/module.d.ts +1 -1
  44. package/dist/document-models/operational-hub-profile/module.d.ts.map +1 -1
  45. package/dist/document-models/operational-hub-profile/module.js +1 -1
  46. package/dist/document-models/snapshot-report/gen/schema/zod.d.ts.map +1 -1
  47. package/dist/document-models/snapshot-report/gen/schema/zod.js +12 -12
  48. package/dist/document-models/snapshot-report/module.d.ts +1 -1
  49. package/dist/document-models/snapshot-report/module.d.ts.map +1 -1
  50. package/dist/document-models/snapshot-report/module.js +1 -1
  51. package/dist/editors/accounts-editor/editor.d.ts.map +1 -1
  52. package/dist/editors/accounts-editor/editor.js +2 -2
  53. package/dist/editors/builder-team-admin/components/DriveExplorer.d.ts.map +1 -1
  54. package/dist/editors/builder-team-admin/components/DriveExplorer.js +64 -4
  55. package/dist/editors/builder-team-admin/module.js +1 -1
  56. package/dist/editors/contributor-billing/components/DashboardHome.d.ts.map +1 -1
  57. package/dist/editors/contributor-billing/components/DashboardHome.js +2 -8
  58. package/dist/editors/contributor-billing/components/DocumentDropZone.d.ts.map +1 -1
  59. package/dist/editors/contributor-billing/components/DocumentDropZone.js +37 -8
  60. package/dist/editors/contributor-billing/components/DriveContents.d.ts.map +1 -1
  61. package/dist/editors/contributor-billing/components/DriveContents.js +4 -1
  62. package/dist/editors/contributor-billing/components/DriveExplorer.d.ts.map +1 -1
  63. package/dist/editors/contributor-billing/components/DriveExplorer.js +54 -3
  64. package/dist/editors/contributor-billing/components/FolderTree.d.ts.map +1 -1
  65. package/dist/editors/contributor-billing/components/FolderTree.js +6 -15
  66. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts +2 -1
  67. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +1 -1
  68. package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.js +41 -6
  69. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts +1 -1
  70. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -1
  71. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.js +16 -1
  72. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableContainer.d.ts +3 -1
  73. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableContainer.d.ts.map +1 -1
  74. package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableContainer.js +13 -11
  75. package/dist/editors/contributor-billing/components/MonthReportCard.d.ts +11 -4
  76. package/dist/editors/contributor-billing/components/MonthReportCard.d.ts.map +1 -1
  77. package/dist/editors/contributor-billing/components/MonthReportCard.js +55 -6
  78. package/dist/editors/contributor-billing/components/MonthlyReportsOverview.d.ts +1 -1
  79. package/dist/editors/contributor-billing/components/MonthlyReportsOverview.d.ts.map +1 -1
  80. package/dist/editors/contributor-billing/components/MonthlyReportsOverview.js +104 -7
  81. package/dist/editors/contributor-billing/components/ReportingView.d.ts +0 -3
  82. package/dist/editors/contributor-billing/components/ReportingView.d.ts.map +1 -1
  83. package/dist/editors/contributor-billing/components/ReportingView.js +65 -8
  84. package/dist/editors/contributor-billing/components/ToastRenderer.d.ts +2 -0
  85. package/dist/editors/contributor-billing/components/ToastRenderer.d.ts.map +1 -0
  86. package/dist/editors/contributor-billing/components/ToastRenderer.js +14 -0
  87. package/dist/editors/contributor-billing/components/cbToast.d.ts +16 -0
  88. package/dist/editors/contributor-billing/components/cbToast.d.ts.map +1 -0
  89. package/dist/editors/contributor-billing/components/cbToast.js +29 -0
  90. package/dist/editors/contributor-billing/hooks/useDocumentAutoPlacement.d.ts.map +1 -1
  91. package/dist/editors/contributor-billing/hooks/useDocumentAutoPlacement.js +42 -2
  92. package/dist/editors/contributor-billing/hooks/useMonthlyReports.d.ts +4 -0
  93. package/dist/editors/contributor-billing/hooks/useMonthlyReports.d.ts.map +1 -1
  94. package/dist/editors/contributor-billing/hooks/useMonthlyReports.js +4 -0
  95. package/dist/editors/contributor-billing/module.js +1 -1
  96. package/dist/editors/invoice/InvoicePDF.d.ts.map +1 -1
  97. package/dist/editors/invoice/InvoicePDF.js +12 -9
  98. package/dist/editors/invoice/editor.d.ts.map +1 -1
  99. package/dist/editors/invoice/editor.js +6 -10
  100. package/dist/editors/invoice/exportUBL.d.ts.map +1 -1
  101. package/dist/editors/invoice/exportUBL.js +1 -2
  102. package/dist/editors/invoice/ingestPDF.js +1 -1
  103. package/dist/editors/invoice/invoiceToGnosis.d.ts.map +1 -1
  104. package/dist/editors/invoice/invoiceToGnosis.js +25 -22
  105. package/dist/editors/invoice/invoiceToast.d.ts +4 -0
  106. package/dist/editors/invoice/invoiceToast.d.ts.map +1 -0
  107. package/dist/editors/invoice/invoiceToast.js +6 -0
  108. package/dist/editors/invoice/legalEntity/legalEntity.d.ts +2 -1
  109. package/dist/editors/invoice/legalEntity/legalEntity.d.ts.map +1 -1
  110. package/dist/editors/invoice/legalEntity/legalEntity.js +3 -14
  111. package/dist/editors/invoice/legalEntity/walletSection.d.ts +1 -0
  112. package/dist/editors/invoice/legalEntity/walletSection.d.ts.map +1 -1
  113. package/dist/editors/invoice/legalEntity/walletSection.js +2 -2
  114. package/dist/editors/invoice/lineItems.js +1 -1
  115. package/dist/editors/invoice/requestFinance.d.ts +3 -2
  116. package/dist/editors/invoice/requestFinance.d.ts.map +1 -1
  117. package/dist/editors/invoice/requestFinance.js +38 -42
  118. package/dist/editors/invoice/validation/validationHandler.d.ts +1 -1
  119. package/dist/editors/invoice/validation/validationHandler.d.ts.map +1 -1
  120. package/dist/editors/invoice/validation/validationHandler.js +15 -2
  121. package/dist/editors/invoice/validation/validationManager.d.ts +1 -1
  122. package/dist/editors/invoice/validation/validationManager.d.ts.map +1 -1
  123. package/dist/editors/invoice/validation/validationManager.js +2 -1
  124. package/dist/editors/invoice/validation/validationRules.d.ts +1 -0
  125. package/dist/editors/invoice/validation/validationRules.d.ts.map +1 -1
  126. package/dist/editors/invoice/validation/validationRules.js +26 -1
  127. package/dist/editors/snapshot-report-editor/components/DateRangePicker.d.ts +19 -0
  128. package/dist/editors/snapshot-report-editor/components/DateRangePicker.d.ts.map +1 -0
  129. package/dist/editors/snapshot-report-editor/components/DateRangePicker.js +66 -0
  130. package/dist/editors/snapshot-report-editor/editor.d.ts.map +1 -1
  131. package/dist/editors/snapshot-report-editor/editor.js +72 -48
  132. package/dist/scripts/download-all-drive-documents/download-drive-documents.d.ts +33 -0
  133. package/dist/scripts/download-all-drive-documents/download-drive-documents.d.ts.map +1 -0
  134. package/dist/scripts/download-all-drive-documents/download-drive-documents.js +583 -0
  135. package/dist/scripts/invoice/requestFinance.d.ts +18 -1
  136. package/dist/scripts/invoice/requestFinance.d.ts.map +1 -1
  137. package/dist/scripts/invoice/requestFinance.js +17 -5
  138. package/dist/scripts/upload-phd-documents/upload-phd-documents.d.ts +20 -0
  139. package/dist/scripts/upload-phd-documents/upload-phd-documents.d.ts.map +1 -0
  140. package/dist/scripts/upload-phd-documents/upload-phd-documents.js +313 -0
  141. package/dist/style.css +201 -106
  142. package/dist/subgraphs/budget-statements/resolvers.d.ts +38 -0
  143. package/dist/subgraphs/budget-statements/resolvers.d.ts.map +1 -1
  144. package/dist/subgraphs/budget-statements/resolvers.js +192 -62
  145. package/dist/subgraphs/budget-statements/resolvers.test.d.ts +2 -0
  146. package/dist/subgraphs/budget-statements/resolvers.test.d.ts.map +1 -0
  147. package/dist/subgraphs/budget-statements/resolvers.test.js +339 -0
  148. package/dist/subgraphs/budget-statements/schema.d.ts.map +1 -1
  149. package/dist/subgraphs/budget-statements/schema.js +8 -0
  150. package/dist/subgraphs/index.d.ts +0 -1
  151. package/dist/subgraphs/index.d.ts.map +1 -1
  152. package/dist/subgraphs/index.js +0 -1
  153. package/dist/subgraphs/invoice-addon/customResolvers.d.ts +70 -11
  154. package/dist/subgraphs/invoice-addon/customResolvers.d.ts.map +1 -1
  155. package/dist/subgraphs/invoice-addon/customResolvers.js +12 -27
  156. package/package.json +35 -28
  157. package/dist/document-models/invoice/src/tests/document-model.test.d.ts +0 -10
  158. package/dist/document-models/invoice/src/tests/document-model.test.d.ts.map +0 -1
  159. package/dist/document-models/invoice/src/tests/document-model.test.js +0 -104
  160. package/dist/document-models/invoice/src/tests/general.test.d.ts +0 -6
  161. package/dist/document-models/invoice/src/tests/general.test.d.ts.map +0 -1
  162. package/dist/document-models/invoice/src/tests/general.test.js +0 -49
  163. package/dist/document-models/invoice/src/tests/items.test.d.ts +0 -6
  164. package/dist/document-models/invoice/src/tests/items.test.d.ts.map +0 -1
  165. package/dist/document-models/invoice/src/tests/items.test.js +0 -59
  166. package/dist/document-models/invoice/src/tests/parties.test.d.ts +0 -6
  167. package/dist/document-models/invoice/src/tests/parties.test.d.ts.map +0 -1
  168. package/dist/document-models/invoice/src/tests/parties.test.js +0 -69
  169. package/dist/document-models/invoice/src/tests/transitions.test.d.ts +0 -6
  170. package/dist/document-models/invoice/src/tests/transitions.test.d.ts.map +0 -1
  171. package/dist/document-models/invoice/src/tests/transitions.test.js +0 -59
  172. package/dist/document-models/invoice/utils/statusTransitions.d.ts +0 -13
  173. package/dist/document-models/invoice/utils/statusTransitions.d.ts.map +0 -1
  174. package/dist/document-models/invoice/utils/statusTransitions.js +0 -13
  175. package/dist/editors/builder-team-admin/components/overview/SubscriptionsStats.d.ts +0 -15
  176. package/dist/editors/builder-team-admin/components/overview/SubscriptionsStats.d.ts.map +0 -1
  177. package/dist/editors/builder-team-admin/components/overview/SubscriptionsStats.js +0 -61
  178. package/dist/editors/contributor-billing/components/CreateHubProfileModal.d.ts +0 -12
  179. package/dist/editors/contributor-billing/components/CreateHubProfileModal.d.ts.map +0 -1
  180. package/dist/editors/contributor-billing/components/CreateHubProfileModal.js +0 -74
  181. package/dist/subgraphs/resources-services/index.d.ts +0 -11
  182. package/dist/subgraphs/resources-services/index.d.ts.map +0 -1
  183. package/dist/subgraphs/resources-services/index.js +0 -11
  184. package/dist/subgraphs/resources-services/resolvers.d.ts +0 -3
  185. package/dist/subgraphs/resources-services/resolvers.d.ts.map +0 -1
  186. package/dist/subgraphs/resources-services/resolvers.js +0 -462
  187. package/dist/subgraphs/resources-services/schema.d.ts +0 -3
  188. package/dist/subgraphs/resources-services/schema.d.ts.map +0 -1
  189. package/dist/subgraphs/resources-services/schema.js +0 -284
@@ -0,0 +1,339 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { computeReportedActuals, computeNetExpenseTxns, extractIsoDate, getPeriodKey, getMonthKey, } from "./resolvers.js";
3
+ const amt = (value) => ({
4
+ unit: "USDS",
5
+ value: String(value),
6
+ });
7
+ describe("computeReportedActuals", () => {
8
+ it("returns zero when there are no wallets", () => {
9
+ expect(computeReportedActuals({ wallets: [] })).toEqual(amt(0));
10
+ });
11
+ it("returns zero when wallets have no line items", () => {
12
+ expect(computeReportedActuals({
13
+ wallets: [{ lineItems: [] }, { lineItems: [] }],
14
+ })).toEqual(amt(0));
15
+ });
16
+ it("sums actuals from a single wallet", () => {
17
+ const result = computeReportedActuals({
18
+ wallets: [
19
+ {
20
+ lineItems: [
21
+ { actuals: amt(100) },
22
+ { actuals: amt(250.5) },
23
+ { actuals: amt(49.5) },
24
+ ],
25
+ },
26
+ ],
27
+ });
28
+ expect(result).toEqual(amt(400));
29
+ });
30
+ it("sums actuals across multiple wallets", () => {
31
+ const result = computeReportedActuals({
32
+ wallets: [
33
+ {
34
+ lineItems: [{ actuals: amt(100) }, { actuals: amt(200) }],
35
+ },
36
+ {
37
+ lineItems: [{ actuals: amt(300) }],
38
+ },
39
+ ],
40
+ });
41
+ expect(result).toEqual(amt(600));
42
+ });
43
+ it("treats non-numeric values as zero", () => {
44
+ const result = computeReportedActuals({
45
+ wallets: [
46
+ {
47
+ lineItems: [
48
+ { actuals: amt("abc") },
49
+ { actuals: amt(100) },
50
+ { actuals: amt("") },
51
+ ],
52
+ },
53
+ ],
54
+ });
55
+ expect(result).toEqual(amt(100));
56
+ });
57
+ it("handles negative actuals", () => {
58
+ const result = computeReportedActuals({
59
+ wallets: [
60
+ {
61
+ lineItems: [{ actuals: amt(-50) }, { actuals: amt(200) }],
62
+ },
63
+ ],
64
+ });
65
+ expect(result).toEqual(amt(150));
66
+ });
67
+ it("sums actuals regardless of unit on line items (all currently USDS)", () => {
68
+ // In practice the expense report builder hardcodes unit="USDS",
69
+ // but if line items had different units, values are still summed as-is.
70
+ const result = computeReportedActuals({
71
+ wallets: [
72
+ {
73
+ lineItems: [
74
+ { actuals: { unit: "USDS", value: "100" } },
75
+ { actuals: { unit: "DAI", value: "200" } },
76
+ { actuals: { unit: "ETH", value: "1.5" } },
77
+ ],
78
+ },
79
+ ],
80
+ });
81
+ // 100 + 200 + 1.5 = 301.5 (no conversion, sums raw values)
82
+ expect(result).toEqual(amt(301.5));
83
+ });
84
+ });
85
+ describe("extractIsoDate", () => {
86
+ it("extracts YYYY-MM-DD from full ISO string", () => {
87
+ expect(extractIsoDate("2025-09-01T00:00:00.000Z")).toBe("2025-09-01");
88
+ });
89
+ it("extracts YYYY-MM-DD from date-only string", () => {
90
+ expect(extractIsoDate("2025-09-01")).toBe("2025-09-01");
91
+ });
92
+ it("returns null for invalid input", () => {
93
+ expect(extractIsoDate("not-a-date")).toBeNull();
94
+ expect(extractIsoDate("")).toBeNull();
95
+ });
96
+ });
97
+ describe("getPeriodKey", () => {
98
+ it("creates key from ISO date strings", () => {
99
+ expect(getPeriodKey("2025-09-01T00:00:00.000Z", "2025-09-30T23:59:59.999Z")).toBe("2025-09-01_2025-09-30");
100
+ });
101
+ it("returns null when either date is missing", () => {
102
+ expect(getPeriodKey(null, "2025-09-30T00:00:00.000Z")).toBeNull();
103
+ expect(getPeriodKey("2025-09-01T00:00:00.000Z", null)).toBeNull();
104
+ expect(getPeriodKey(null, null)).toBeNull();
105
+ });
106
+ });
107
+ describe("getMonthKey", () => {
108
+ it("extracts month key from UTC midnight ISO string", () => {
109
+ expect(getMonthKey("2025-09-01T00:00:00.000Z")).toBe("SEP2025");
110
+ });
111
+ it("is not affected by timezone — UTC midnight stays in correct month", () => {
112
+ // This was the original bug: new Date("2025-09-01T00:00:00.000Z").getMonth()
113
+ // returns 7 (August) in UTC-3 because it becomes Aug 31 21:00 local time
114
+ expect(getMonthKey("2025-09-01T00:00:00.000Z")).toBe("SEP2025");
115
+ expect(getMonthKey("2025-01-01T00:00:00.000Z")).toBe("JAN2025");
116
+ expect(getMonthKey("2025-12-01T00:00:00.000Z")).toBe("DEC2025");
117
+ });
118
+ it("handles all months", () => {
119
+ const expected = [
120
+ "JAN",
121
+ "FEB",
122
+ "MAR",
123
+ "APR",
124
+ "MAY",
125
+ "JUN",
126
+ "JUL",
127
+ "AUG",
128
+ "SEP",
129
+ "OCT",
130
+ "NOV",
131
+ "DEC",
132
+ ];
133
+ for (let i = 0; i < 12; i++) {
134
+ const month = String(i + 1).padStart(2, "0");
135
+ expect(getMonthKey(`2026-${month}-15T12:00:00.000Z`)).toBe(`${expected[i]}2026`);
136
+ }
137
+ });
138
+ it("returns null for null or invalid input", () => {
139
+ expect(getMonthKey(null)).toBeNull();
140
+ expect(getMonthKey("not-a-date")).toBeNull();
141
+ expect(getMonthKey("")).toBeNull();
142
+ });
143
+ });
144
+ const makeTx = (direction, flowType, value, token = "USDS") => ({
145
+ direction,
146
+ flowType,
147
+ amount: { value: { unit: token, value: String(value) }, unit: token },
148
+ });
149
+ describe("computeNetExpenseTxns", () => {
150
+ it("returns zero when there are no accounts", () => {
151
+ expect(computeNetExpenseTxns({ accounts: [] })).toEqual(amt(0));
152
+ });
153
+ it("returns zero when there are no Internal accounts", () => {
154
+ const result = computeNetExpenseTxns({
155
+ accounts: [
156
+ {
157
+ type: "Source",
158
+ transactions: [makeTx("OUTFLOW", "External", 500)],
159
+ },
160
+ {
161
+ type: "Destination",
162
+ transactions: [makeTx("OUTFLOW", "External", 300)],
163
+ },
164
+ {
165
+ type: "External",
166
+ transactions: [makeTx("OUTFLOW", "External", 200)],
167
+ },
168
+ ],
169
+ });
170
+ expect(result).toEqual(amt(0));
171
+ });
172
+ it("sums only OUTFLOW transactions from Internal accounts that leave the group", () => {
173
+ const result = computeNetExpenseTxns({
174
+ accounts: [
175
+ {
176
+ type: "Internal",
177
+ transactions: [
178
+ makeTx("OUTFLOW", "External", 100), // counted: leaves group
179
+ makeTx("INFLOW", "TopUp", 500), // ignored: inflow
180
+ makeTx("OUTFLOW", "Internal", 200), // ignored: stays within group
181
+ ],
182
+ },
183
+ ],
184
+ });
185
+ expect(result).toEqual(amt(100));
186
+ });
187
+ it("excludes Swap transactions", () => {
188
+ const result = computeNetExpenseTxns({
189
+ accounts: [
190
+ {
191
+ type: "Internal",
192
+ transactions: [
193
+ makeTx("OUTFLOW", "External", 100),
194
+ makeTx("OUTFLOW", "Swap", 999), // excluded
195
+ makeTx("OUTFLOW", "TopUp", 50),
196
+ ],
197
+ },
198
+ ],
199
+ });
200
+ expect(result).toEqual(amt(150));
201
+ });
202
+ it("sums across multiple Internal accounts", () => {
203
+ const result = computeNetExpenseTxns({
204
+ accounts: [
205
+ {
206
+ type: "Internal",
207
+ transactions: [makeTx("OUTFLOW", "External", 100)],
208
+ },
209
+ {
210
+ type: "Internal",
211
+ transactions: [makeTx("OUTFLOW", "Return", 200)],
212
+ },
213
+ {
214
+ type: "Source",
215
+ transactions: [makeTx("OUTFLOW", "External", 9999)], // ignored: not Internal
216
+ },
217
+ ],
218
+ });
219
+ expect(result).toEqual(amt(300));
220
+ });
221
+ it("excludes Internal flowType (inter-wallet transfers stay in group)", () => {
222
+ const result = computeNetExpenseTxns({
223
+ accounts: [
224
+ {
225
+ type: "Internal",
226
+ transactions: [
227
+ makeTx("OUTFLOW", "Internal", 500), // excluded: stays in group
228
+ makeTx("OUTFLOW", "Internal", 300), // excluded: stays in group
229
+ makeTx("OUTFLOW", "External", 100), // counted: leaves group
230
+ ],
231
+ },
232
+ ],
233
+ });
234
+ expect(result).toEqual(amt(100));
235
+ });
236
+ it("returns zero when all Internal txns are swaps, internal transfers, or inflows", () => {
237
+ const result = computeNetExpenseTxns({
238
+ accounts: [
239
+ {
240
+ type: "Internal",
241
+ transactions: [
242
+ makeTx("OUTFLOW", "Swap", 100), // excluded: swap
243
+ makeTx("OUTFLOW", "Internal", 400), // excluded: stays in group
244
+ makeTx("INFLOW", "External", 200), // excluded: inflow
245
+ makeTx("INFLOW", "Swap", 300), // excluded: inflow
246
+ ],
247
+ },
248
+ ],
249
+ });
250
+ expect(result).toEqual(amt(0));
251
+ });
252
+ it("counts External, Return, and TopUp outflows as expenses leaving the group", () => {
253
+ const result = computeNetExpenseTxns({
254
+ accounts: [
255
+ {
256
+ type: "Internal",
257
+ transactions: [
258
+ makeTx("OUTFLOW", "External", 100), // counted: to external party
259
+ makeTx("OUTFLOW", "Return", 200), // counted: returning to source
260
+ makeTx("OUTFLOW", "TopUp", 50), // counted: funding destination
261
+ makeTx("OUTFLOW", "Swap", 999), // excluded: token conversion
262
+ makeTx("OUTFLOW", "Internal", 888), // excluded: inter-wallet
263
+ makeTx("INFLOW", "TopUp", 5000), // excluded: inflow
264
+ ],
265
+ },
266
+ ],
267
+ });
268
+ expect(result).toEqual(amt(350));
269
+ });
270
+ it("handles Internal accounts with no transactions", () => {
271
+ const result = computeNetExpenseTxns({
272
+ accounts: [{ type: "Internal", transactions: [] }],
273
+ });
274
+ expect(result).toEqual(amt(0));
275
+ });
276
+ it("treats non-numeric amounts as zero", () => {
277
+ const result = computeNetExpenseTxns({
278
+ accounts: [
279
+ {
280
+ type: "Internal",
281
+ transactions: [
282
+ makeTx("OUTFLOW", "External", "bad"),
283
+ makeTx("OUTFLOW", "External", 100),
284
+ ],
285
+ },
286
+ ],
287
+ });
288
+ expect(result).toEqual(amt(100));
289
+ });
290
+ it("only counts USD stablecoins (USDS, USDC, DAI)", () => {
291
+ const result = computeNetExpenseTxns({
292
+ accounts: [
293
+ {
294
+ type: "Internal",
295
+ transactions: [
296
+ makeTx("OUTFLOW", "External", 500, "USDS"), // counted
297
+ makeTx("OUTFLOW", "External", 200, "USDC"), // counted
298
+ makeTx("OUTFLOW", "External", 100, "DAI"), // counted
299
+ makeTx("OUTFLOW", "External", 1.5, "ETH"), // excluded: not stablecoin
300
+ makeTx("OUTFLOW", "External", 9999, "sUSDS"), // excluded: not stablecoin
301
+ makeTx("OUTFLOW", "External", 5000, "SKY"), // excluded: not stablecoin
302
+ makeTx("OUTFLOW", "External", 134, "MKR"), // excluded: not stablecoin
303
+ makeTx("OUTFLOW", "External", 46, "EURe"), // excluded: not stablecoin
304
+ ],
305
+ },
306
+ ],
307
+ });
308
+ expect(result).toEqual(amt(800));
309
+ });
310
+ it("excludes Swap even for stablecoin tokens", () => {
311
+ const result = computeNetExpenseTxns({
312
+ accounts: [
313
+ {
314
+ type: "Internal",
315
+ transactions: [
316
+ makeTx("OUTFLOW", "External", 100, "USDS"),
317
+ makeTx("OUTFLOW", "Swap", 2000, "USDC"), // excluded: swap
318
+ makeTx("OUTFLOW", "External", 50, "DAI"),
319
+ ],
320
+ },
321
+ ],
322
+ });
323
+ expect(result).toEqual(amt(150));
324
+ });
325
+ it("ignores INFLOW of any token on Internal accounts", () => {
326
+ const result = computeNetExpenseTxns({
327
+ accounts: [
328
+ {
329
+ type: "Internal",
330
+ transactions: [
331
+ makeTx("OUTFLOW", "External", 100, "USDS"),
332
+ makeTx("INFLOW", "TopUp", 5000, "ETH"), // ignored: inflow
333
+ ],
334
+ },
335
+ ],
336
+ });
337
+ expect(result).toEqual(amt(100));
338
+ });
339
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../subgraphs/budget-statements/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,MAAM,EAAE,YAqIpB,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../subgraphs/budget-statements/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,MAAM,EAAE,YA6IpB,CAAC"}
@@ -15,13 +15,21 @@ export const schema = gql `
15
15
  type BudgetStatement {
16
16
  id: OID!
17
17
  owner: BudgetStatementOwner!
18
+ operationalHubMember: OperationalHubMember
18
19
  month: String! ## JAN2026
19
20
  status: String!
20
21
  lastModifiedAtUtcIso: DateTime!
22
+ reportedActuals: Amount_Currency!
23
+ netExpenseTxns: Amount_Currency!
21
24
  snapshotReport: BudgetStatementSnapshotReport!
22
25
  expenseReport: BudgetStatementExpenseReport!
23
26
  }
24
27
 
28
+ type OperationalHubMember {
29
+ phid: PHID
30
+ name: String
31
+ }
32
+
25
33
  type BudgetStatementOwner {
26
34
  id: PHID!
27
35
  name: String!
@@ -1,5 +1,4 @@
1
1
  export * as InvoiceAddonSubgraph from "./invoice-addon/index.js";
2
2
  export * as AccTxsAddonSubgraph from "./acc-txs-addon/index.js";
3
3
  export * as BudgetStatementsSubgraph from "./budget-statements/index.js";
4
- export * as ResourcesServicesSubgraph from "./resources-services/index.js";
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../subgraphs/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,oBAAoB,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,mBAAmB,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,wBAAwB,MAAM,8BAA8B,CAAC;AACzE,OAAO,KAAK,yBAAyB,MAAM,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../subgraphs/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,oBAAoB,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,mBAAmB,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,wBAAwB,MAAM,8BAA8B,CAAC"}
@@ -1,4 +1,3 @@
1
1
  export * as InvoiceAddonSubgraph from "./invoice-addon/index.js";
2
2
  export * as AccTxsAddonSubgraph from "./acc-txs-addon/index.js";
3
3
  export * as BudgetStatementsSubgraph from "./budget-statements/index.js";
4
- export * as ResourcesServicesSubgraph from "./resources-services/index.js";
@@ -1,9 +1,68 @@
1
- declare const pendingTransactions: Record<string, {
1
+ import { type PaymentDetail, type TransferResult } from "../../scripts/invoice/gnosisTransactionBuilder.js";
2
+ interface GnosisPaymentArgs {
3
+ chainName: string;
4
+ paymentDetails: PaymentDetail;
5
+ invoiceNo: string;
6
+ }
7
+ interface RequestFinancePaymentArgs {
8
+ paymentData: Record<string, unknown>;
9
+ }
10
+ interface GnosisPaymentResult {
11
+ success: boolean;
12
+ data?: TransferResult;
13
+ error?: string;
14
+ }
15
+ interface PendingTransaction {
2
16
  invoiceNo: string;
3
17
  chainName: string;
4
- paymentDetails: any;
18
+ paymentDetails: PaymentDetail | PaymentDetail[];
5
19
  timestamp: number;
6
- }>;
20
+ }
21
+ interface DriveNode {
22
+ id: string;
23
+ documentType: string;
24
+ }
25
+ interface ReactorInstance {
26
+ getDrive(driveId: string): Promise<{
27
+ state: {
28
+ global: {
29
+ nodes: DriveNode[];
30
+ };
31
+ };
32
+ }>;
33
+ getDocument(driveId: string, documentId: string): Promise<{
34
+ state: {
35
+ global: {
36
+ invoiceNo: string;
37
+ };
38
+ };
39
+ }>;
40
+ addAction(driveId: string, documentId: string, action: unknown): Promise<void>;
41
+ }
42
+ interface AlchemyActivity {
43
+ category: string;
44
+ fromAddress: string;
45
+ toAddress: string;
46
+ rawContract: {
47
+ address: string;
48
+ };
49
+ hash?: string;
50
+ value?: number;
51
+ }
52
+ interface AlchemyWebhookPayload {
53
+ event?: {
54
+ activity?: AlchemyActivity | AlchemyActivity[];
55
+ };
56
+ }
57
+ interface WebhookRequest {
58
+ body: AlchemyWebhookPayload;
59
+ headers: Record<string, string | undefined>;
60
+ }
61
+ interface WebhookResponse {
62
+ status(code: number): WebhookResponse;
63
+ json(body: Record<string, unknown>): WebhookResponse;
64
+ }
65
+ declare const pendingTransactions: Record<string, PendingTransaction>;
7
66
  interface UploadInvoicePdfChunkArgs {
8
67
  chunk: string;
9
68
  chunkIndex: number;
@@ -11,23 +70,23 @@ interface UploadInvoicePdfChunkArgs {
11
70
  fileName: string;
12
71
  sessionId: string;
13
72
  }
14
- export declare const Invoice_processGnosisPayment: (_: any, args: any) => Promise<any>;
15
- export declare const Invoice_createRequestFinancePayment: (_: any, args: any) => Promise<{
73
+ export declare const Invoice_processGnosisPayment: (_: unknown, args: GnosisPaymentArgs) => Promise<GnosisPaymentResult>;
74
+ export declare const Invoice_createRequestFinancePayment: (_: unknown, args: RequestFinancePaymentArgs) => Promise<{
16
75
  success: boolean;
17
- error: any;
76
+ error: string;
18
77
  data?: undefined;
19
78
  } | {
20
79
  success: boolean;
21
80
  data: {
22
81
  message: string;
23
- response: any;
82
+ response: import("../../scripts/invoice/requestFinance.js").RequestFinanceResponse;
24
83
  };
25
84
  error?: undefined;
26
85
  }>;
27
- export declare const Invoice_uploadInvoicePdfChunk: (_: any, args: UploadInvoicePdfChunkArgs) => Promise<{
86
+ export declare const Invoice_uploadInvoicePdfChunk: (_: unknown, args: UploadInvoicePdfChunkArgs) => Promise<{
28
87
  success: boolean;
29
88
  data: {
30
- invoiceData: any;
89
+ invoiceData: Record<string, unknown>;
31
90
  processingMetadata: {
32
91
  provider: string;
33
92
  processingTimeMs: number;
@@ -47,8 +106,8 @@ export declare const Invoice_uploadInvoicePdfChunk: (_: any, args: UploadInvoice
47
106
  };
48
107
  error?: undefined;
49
108
  }>;
50
- export declare const setReactor: (reactorInstance: any) => void;
109
+ export declare const setReactor: (reactorInstance: ReactorInstance) => void;
51
110
  export { pendingTransactions };
52
111
  export declare const cleanupOldPendingTransactions: () => void;
53
- export declare const handleWebhook: (req: any, res: any) => Promise<any>;
112
+ export declare const handleWebhook: (req: WebhookRequest, res: WebhookResponse) => Promise<WebhookResponse>;
54
113
  //# sourceMappingURL=customResolvers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"customResolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/invoice-addon/customResolvers.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,mBAAmB,EAAE,MAAM,CAC/B,MAAM,EACN;IACE,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,GAAG,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,CACG,CAAC;AAQP,UAAU,yBAAyB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAaD,eAAO,MAAM,4BAA4B,GAAU,GAAG,GAAG,EAAE,MAAM,GAAG,iBA8EnE,CAAC;AAEF,eAAO,MAAM,mCAAmC,GAC9C,GAAG,GAAG,EACN,MAAM,GAAG;;;;;;;;;;;EAoCV,CAAC;AAEF,eAAO,MAAM,6BAA6B,GACxC,GAAG,GAAG,EACN,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;EAgFhC,CAAC;AAGF,eAAO,MAAM,UAAU,GAAI,iBAAiB,GAAG,SAE9C,CAAC;AAGF,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAG/B,eAAO,MAAM,6BAA6B,YA2BzC,CAAC;AAmDF,eAAO,MAAM,aAAa,GAAU,KAAK,GAAG,EAAE,KAAK,GAAG,iBAsLrD,CAAC"}
1
+ {"version":3,"file":"customResolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/invoice-addon/customResolvers.ts"],"names":[],"mappings":"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"}
@@ -1,4 +1,4 @@
1
- import { executeTransferProposal } from "../../scripts/invoice/gnosisTransactionBuilder.js";
1
+ import { executeTransferProposal, } from "../../scripts/invoice/gnosisTransactionBuilder.js";
2
2
  import { requestDirectPayment } from "../../scripts/invoice/requestFinance.js";
3
3
  import { actions } from "../../document-models/invoice/index.js";
4
4
  import { uploadPdfAndGetJsonClaude } from "../../scripts/invoice/pdfToClaudeAI.js";
@@ -238,24 +238,19 @@ const updateDocumentStatus = async (invoiceNo) => {
238
238
  }
239
239
  catch (error) {
240
240
  console.error(`Error finding document for invoice ${invoiceNo}:`, error);
241
- return Promise.reject(error);
241
+ return Promise.reject(new Error(error));
242
242
  }
243
243
  };
244
244
  // Webhook handler method
245
245
  export const handleWebhook = async (req, res) => {
246
246
  try {
247
247
  console.log("Webhook received");
248
- // Log all headers to debug
249
- // console.log('Webhook request headers:', req.headers);
250
- // console.log('Webhook request body:', req.body);
251
248
  // Get the request body and signature
252
249
  const payload = req.body;
253
250
  const rawBody = JSON.stringify(payload);
254
251
  const signature = req.headers["x-alchemy-signature"];
255
252
  if (!signature) {
256
253
  console.warn("Missing signature header");
257
- // For testing, continue anyway
258
- // return res.status(400).json({ error: 'Missing signature header' });
259
254
  }
260
255
  else {
261
256
  // Validate the signature
@@ -263,13 +258,8 @@ export const handleWebhook = async (req, res) => {
263
258
  const isValid = isValidSignatureForStringBody(rawBody, signature, signingKey);
264
259
  if (!isValid) {
265
260
  console.warn("Invalid signature");
266
- // For testing, continue anyway
267
- // return res.status(401).json({ error: 'Invalid signature' });
268
261
  }
269
262
  }
270
- // Process the webhook
271
- // console.log('Processing webhook test button:', payload.event);
272
- // console.log('Processing webhook payload:', payload.event.activity);
273
263
  // Check if this is a transaction confirmation webhook
274
264
  if (payload.event && payload.event.activity) {
275
265
  const activities = Array.isArray(payload.event.activity)
@@ -297,24 +287,19 @@ export const handleWebhook = async (req, res) => {
297
287
  let matchedInvoiceNo = null;
298
288
  let matchedTxHash = null;
299
289
  for (const [txHash, txInfo] of Object.entries(pendingTransactions)) {
300
- const paymentDetails = Array.isArray(txInfo.paymentDetails)
290
+ const paymentDetailsList = Array.isArray(txInfo.paymentDetails)
301
291
  ? txInfo.paymentDetails
302
292
  : [txInfo.paymentDetails];
303
- // Safe transactions may be sent from a different address than the Safe itself
304
- // So we'll focus on recipient, token, and amount
305
- for (const payment of paymentDetails) {
306
- // Cast payment to any to access its properties
307
- const typedPayment = payment;
293
+ for (const payment of paymentDetailsList) {
308
294
  // Check if recipient address matches
309
- if (typedPayment.payeeWallet &&
310
- typedPayment.payeeWallet.address.toLowerCase() === toAddress) {
295
+ if (payment.payeeWallet &&
296
+ payment.payeeWallet.address.toLowerCase() === toAddress) {
311
297
  // Check if token address matches
312
- if (typedPayment.token &&
313
- typedPayment.token.evmAddress.toLowerCase() === tokenAddress) {
298
+ if (payment.token &&
299
+ payment.token.evmAddress.toLowerCase() === tokenAddress) {
314
300
  // Check if amount is similar (allowing for some precision loss)
315
- // Convert both to a common format for comparison
316
- const expectedAmount = parseFloat(typedPayment.amount);
317
- const actualAmount = parseFloat(tokenValue);
301
+ const expectedAmount = parseFloat(String(payment.amount));
302
+ const actualAmount = parseFloat(String(tokenValue));
318
303
  // Allow for a small difference due to precision issues
319
304
  const amountDifference = Math.abs(expectedAmount - actualAmount);
320
305
  const isAmountSimilar = amountDifference < 0.0001 ||
@@ -332,11 +317,11 @@ export const handleWebhook = async (req, res) => {
332
317
  }
333
318
  }
334
319
  else {
335
- console.log(`Token addresses don't match. Expected: ${typedPayment.token?.evmAddress}, Actual: ${tokenAddress}`);
320
+ console.log(`Token addresses don't match. Expected: ${payment.token?.evmAddress}, Actual: ${tokenAddress}`);
336
321
  }
337
322
  }
338
323
  else {
339
- console.log(`Recipient addresses don't match. Expected: ${typedPayment.payeeWallet?.address}, Actual: ${toAddress}`);
324
+ console.log(`Recipient addresses don't match. Expected: ${payment.payeeWallet?.address}, Actual: ${toAddress}`);
340
325
  }
341
326
  }
342
327
  if (matchedInvoiceNo)