@fantastic.dev/better-stripe 0.59.0 → 0.60.0

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 (124) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +3 -1
  3. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +650 -44
  4. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
  5. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +309 -6
  6. package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
  7. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +618 -12
  8. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
  9. package/dist/client/connect/payoutSyncTestHelpers.d.ts +325 -22
  10. package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
  11. package/dist/client/index.d.ts +4 -0
  12. package/dist/client/index.d.ts.map +1 -1
  13. package/dist/client/paymentSource/resolver.d.ts +12 -1
  14. package/dist/client/paymentSource/resolver.d.ts.map +1 -1
  15. package/dist/client/paymentSource/resolver.fixtures.d.ts +220 -0
  16. package/dist/client/paymentSource/resolver.fixtures.d.ts.map +1 -0
  17. package/dist/client/paymentSource/resolver.fixtures.js +189 -0
  18. package/dist/client/paymentSource/resolver.fixtures.js.map +1 -0
  19. package/dist/client/paymentSource/resolver.js +28 -3
  20. package/dist/client/paymentSource/resolver.js.map +1 -1
  21. package/dist/client/settlement/execution.d.ts +25 -0
  22. package/dist/client/settlement/execution.d.ts.map +1 -1
  23. package/dist/client/settlement/execution.js +2 -0
  24. package/dist/client/settlement/execution.js.map +1 -1
  25. package/dist/client/usage/catalogPrices.d.ts +1 -1
  26. package/dist/client/usage/catalogPrices.d.ts.map +1 -1
  27. package/dist/client/usage/catalogPrices.js +4 -4
  28. package/dist/client/usage/catalogPrices.js.map +1 -1
  29. package/dist/client/usage/client.d.ts +2 -2
  30. package/dist/client/usage/client.js +2 -2
  31. package/dist/client/usage/creditRevenue.d.ts +22 -0
  32. package/dist/client/usage/creditRevenue.d.ts.map +1 -0
  33. package/dist/client/usage/creditRevenue.js +118 -0
  34. package/dist/client/usage/creditRevenue.js.map +1 -0
  35. package/dist/client/usage/creditSettlement.d.ts +29 -0
  36. package/dist/client/usage/creditSettlement.d.ts.map +1 -0
  37. package/dist/client/usage/creditSettlement.fixtures.d.ts +215 -0
  38. package/dist/client/usage/creditSettlement.fixtures.d.ts.map +1 -0
  39. package/dist/client/usage/creditSettlement.fixtures.js +59 -0
  40. package/dist/client/usage/creditSettlement.fixtures.js.map +1 -0
  41. package/dist/client/usage/creditSettlement.js +70 -0
  42. package/dist/client/usage/creditSettlement.js.map +1 -0
  43. package/dist/client/usage/creditTransport.fixtures.d.ts +7 -1
  44. package/dist/client/usage/creditTransport.fixtures.d.ts.map +1 -1
  45. package/dist/client/usage/creditTransport.fixtures.js +25 -4
  46. package/dist/client/usage/creditTransport.fixtures.js.map +1 -1
  47. package/dist/client/usage/index.d.ts +4 -0
  48. package/dist/client/usage/index.d.ts.map +1 -1
  49. package/dist/client/usage/invoiceSale.d.ts +22 -0
  50. package/dist/client/usage/invoiceSale.d.ts.map +1 -0
  51. package/dist/client/usage/invoiceSale.fixtures.d.ts +285 -0
  52. package/dist/client/usage/invoiceSale.fixtures.d.ts.map +1 -0
  53. package/dist/client/usage/invoiceSale.fixtures.js +104 -0
  54. package/dist/client/usage/invoiceSale.fixtures.js.map +1 -0
  55. package/dist/client/usage/invoiceSale.js +117 -0
  56. package/dist/client/usage/invoiceSale.js.map +1 -0
  57. package/dist/client/usage/observationClient.d.ts +2 -2
  58. package/dist/client/usage/observationClient.d.ts.map +1 -1
  59. package/dist/client/usage/settlement.d.ts +32 -0
  60. package/dist/client/usage/settlement.d.ts.map +1 -0
  61. package/dist/client/usage/settlement.js +60 -0
  62. package/dist/client/usage/settlement.js.map +1 -0
  63. package/dist/client/usage/settlementClient.d.ts +51 -0
  64. package/dist/client/usage/settlementClient.d.ts.map +1 -0
  65. package/dist/client/usage/settlementClient.js +35 -0
  66. package/dist/client/usage/settlementClient.js.map +1 -0
  67. package/dist/component/_generated/component.d.ts +125 -0
  68. package/dist/component/_generated/component.d.ts.map +1 -1
  69. package/dist/component/balanceFunding/internal/actions.d.ts +11 -11
  70. package/dist/component/balanceFunding/mutations.d.ts +27 -27
  71. package/dist/component/earnings/triggers.d.ts +156 -6
  72. package/dist/component/earnings/triggers.d.ts.map +1 -1
  73. package/dist/component/financialObservations/settlementHelpers.d.ts.map +1 -1
  74. package/dist/component/financialObservations/settlementHelpers.js +2 -0
  75. package/dist/component/financialObservations/settlementHelpers.js.map +1 -1
  76. package/dist/component/recoveryWorkflow/helpers.d.ts +25 -0
  77. package/dist/component/recoveryWorkflow/helpers.d.ts.map +1 -1
  78. package/dist/component/recoveryWorkflow/mutations.d.ts +25 -0
  79. package/dist/component/recoveryWorkflow/mutations.d.ts.map +1 -1
  80. package/dist/component/recoveryWorkflow/queries.d.ts +50 -0
  81. package/dist/component/recoveryWorkflow/queries.d.ts.map +1 -1
  82. package/dist/component/recoveryWorkflow/schema.d.ts +566 -10
  83. package/dist/component/recoveryWorkflow/schema.d.ts.map +1 -1
  84. package/dist/component/schema.d.ts +309 -6
  85. package/dist/component/settlement/mutations.d.ts +50 -0
  86. package/dist/component/settlement/mutations.d.ts.map +1 -1
  87. package/dist/component/settlement/mutations.js +8 -1
  88. package/dist/component/settlement/mutations.js.map +1 -1
  89. package/dist/component/settlement/queries.d.ts +25 -0
  90. package/dist/component/settlement/queries.d.ts.map +1 -1
  91. package/dist/component/settlement/schema.d.ts +128 -1
  92. package/dist/component/settlement/schema.d.ts.map +1 -1
  93. package/dist/component/settlement/schema.js +22 -0
  94. package/dist/component/settlement/schema.js.map +1 -1
  95. package/docs/README.md +2 -0
  96. package/docs/settlement.md +4 -0
  97. package/docs/usage-settlement.md +162 -0
  98. package/package.json +2 -1
  99. package/src/client/index.ts +9 -0
  100. package/src/client/paymentSource/resolver.fixtures.ts +216 -0
  101. package/src/client/paymentSource/resolver.test.ts +11 -207
  102. package/src/client/paymentSource/resolver.ts +54 -2
  103. package/src/client/settlement/execution.ts +24 -0
  104. package/src/client/usage/catalogPrices.ts +4 -2
  105. package/src/client/usage/client.ts +2 -2
  106. package/src/client/usage/creditRevenue.test.ts +105 -0
  107. package/src/client/usage/creditRevenue.ts +163 -0
  108. package/src/client/usage/creditSettlement.fixtures.ts +70 -0
  109. package/src/client/usage/creditSettlement.test.ts +66 -0
  110. package/src/client/usage/creditSettlement.ts +94 -0
  111. package/src/client/usage/creditSettlementRecovery.test.ts +173 -0
  112. package/src/client/usage/creditTransport.fixtures.ts +29 -4
  113. package/src/client/usage/index.ts +9 -0
  114. package/src/client/usage/invoiceSale.fixtures.ts +103 -0
  115. package/src/client/usage/invoiceSale.test.ts +184 -0
  116. package/src/client/usage/invoiceSale.ts +155 -0
  117. package/src/client/usage/settlement.test.ts +179 -0
  118. package/src/client/usage/settlement.ts +81 -0
  119. package/src/client/usage/settlementClient.ts +84 -0
  120. package/src/component/_generated/component.ts +110 -0
  121. package/src/component/financialObservations/settlementHelpers.ts +2 -0
  122. package/src/component/settlement/mutations.ts +10 -1
  123. package/src/component/settlement/schema.ts +26 -0
  124. package/src/component/settlement/settlement-claims.test.ts +54 -0
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/component/recoveryWorkflow/schema.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWzB,CAAC;AACF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAA+C,CAAC;AACxE,eAAO,MAAM,SAAS;;;;;;;CAKrB,CAAC;AACF,eAAO,MAAM,KAAK,kMAAwD,CAAC;AAC3E,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;y/CAIvB,CAAC;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;CAOxB,CAAC;AACF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;qKAAyB,CAAC;AACjD,eAAO,MAAM,QAAQ;;;;;;;;iDAInB,CAAC;AACH,eAAO,MAAM,WAAW;;;;;;;;iDAItB,CAAC;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+OAA6C,CAAC;AACtE,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uEAcnB,CAAC"}
@@ -1104,6 +1104,15 @@ declare const _default: import("convex/server").SchemaDefinition<{
1104
1104
  activePhase?: "execute" | "reconcile" | undefined;
1105
1105
  allocation?: {
1106
1106
  adjustmentAmount?: number | undefined;
1107
+ creditSource?: {
1108
+ creditGrantId: string;
1109
+ customerAccount: string;
1110
+ livemode: boolean;
1111
+ purchaseId: string;
1112
+ stripeAccountId: string;
1113
+ stripePriceId: string;
1114
+ stripeProductId: string;
1115
+ } | undefined;
1107
1116
  currency: string;
1108
1117
  gross: number;
1109
1118
  paymentId?: string | undefined;
@@ -1117,6 +1126,22 @@ declare const _default: import("convex/server").SchemaDefinition<{
1117
1126
  destinationAccountId: string;
1118
1127
  role: "affiliate" | "other" | "store";
1119
1128
  }[];
1129
+ usageSource?: {
1130
+ customerAccount: string;
1131
+ invoicePaymentId: string;
1132
+ livemode: boolean;
1133
+ meterId: string;
1134
+ model: "included_overage" | "pay_as_you_go";
1135
+ period: {
1136
+ end: number;
1137
+ start: number;
1138
+ };
1139
+ stripeAccountId: string;
1140
+ stripePriceId: string;
1141
+ stripeProductId: string;
1142
+ subscriptionId: string;
1143
+ subscriptionItemId: string;
1144
+ } | undefined;
1120
1145
  } | undefined;
1121
1146
  cancelRequested: boolean;
1122
1147
  completion?: string | undefined;
@@ -1151,6 +1176,15 @@ declare const _default: import("convex/server").SchemaDefinition<{
1151
1176
  retryDelayMs: import("convex/values").VFloat64<number, "required">;
1152
1177
  allocation: import("convex/values").VObject<{
1153
1178
  adjustmentAmount?: number | undefined;
1179
+ creditSource?: {
1180
+ creditGrantId: string;
1181
+ customerAccount: string;
1182
+ livemode: boolean;
1183
+ purchaseId: string;
1184
+ stripeAccountId: string;
1185
+ stripePriceId: string;
1186
+ stripeProductId: string;
1187
+ } | undefined;
1154
1188
  currency: string;
1155
1189
  gross: number;
1156
1190
  paymentId?: string | undefined;
@@ -1164,10 +1198,77 @@ declare const _default: import("convex/server").SchemaDefinition<{
1164
1198
  destinationAccountId: string;
1165
1199
  role: "affiliate" | "other" | "store";
1166
1200
  }[];
1201
+ usageSource?: {
1202
+ customerAccount: string;
1203
+ invoicePaymentId: string;
1204
+ livemode: boolean;
1205
+ meterId: string;
1206
+ model: "included_overage" | "pay_as_you_go";
1207
+ period: {
1208
+ end: number;
1209
+ start: number;
1210
+ };
1211
+ stripeAccountId: string;
1212
+ stripePriceId: string;
1213
+ stripeProductId: string;
1214
+ subscriptionId: string;
1215
+ subscriptionItemId: string;
1216
+ } | undefined;
1167
1217
  } | undefined, {
1168
1218
  sourceChargeId: import("convex/values").VString<string, "required">;
1169
1219
  paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
1170
1220
  sourceInvoiceId: import("convex/values").VString<string | undefined, "optional">;
1221
+ usageSource: import("convex/values").VObject<{
1222
+ customerAccount: string;
1223
+ invoicePaymentId: string;
1224
+ livemode: boolean;
1225
+ meterId: string;
1226
+ model: "included_overage" | "pay_as_you_go";
1227
+ period: {
1228
+ end: number;
1229
+ start: number;
1230
+ };
1231
+ stripeAccountId: string;
1232
+ stripePriceId: string;
1233
+ stripeProductId: string;
1234
+ subscriptionId: string;
1235
+ subscriptionItemId: string;
1236
+ } | undefined, {
1237
+ stripeAccountId: import("convex/values").VString<string, "required">;
1238
+ customerAccount: import("convex/values").VString<string, "required">;
1239
+ livemode: import("convex/values").VBoolean<boolean, "required">;
1240
+ meterId: import("convex/values").VString<string, "required">;
1241
+ stripePriceId: import("convex/values").VString<string, "required">;
1242
+ stripeProductId: import("convex/values").VString<string, "required">;
1243
+ subscriptionId: import("convex/values").VString<string, "required">;
1244
+ subscriptionItemId: import("convex/values").VString<string, "required">;
1245
+ invoicePaymentId: import("convex/values").VString<string, "required">;
1246
+ period: import("convex/values").VObject<{
1247
+ end: number;
1248
+ start: number;
1249
+ }, {
1250
+ start: import("convex/values").VFloat64<number, "required">;
1251
+ end: import("convex/values").VFloat64<number, "required">;
1252
+ }, "required", "end" | "start">;
1253
+ model: import("convex/values").VUnion<"included_overage" | "pay_as_you_go", [import("convex/values").VLiteral<"pay_as_you_go", "required">, import("convex/values").VLiteral<"included_overage", "required">], "required", never>;
1254
+ }, "optional", "customerAccount" | "invoicePaymentId" | "livemode" | "meterId" | "model" | "period" | "period.end" | "period.start" | "stripeAccountId" | "stripePriceId" | "stripeProductId" | "subscriptionId" | "subscriptionItemId">;
1255
+ creditSource: import("convex/values").VObject<{
1256
+ creditGrantId: string;
1257
+ customerAccount: string;
1258
+ livemode: boolean;
1259
+ purchaseId: string;
1260
+ stripeAccountId: string;
1261
+ stripePriceId: string;
1262
+ stripeProductId: string;
1263
+ } | undefined, {
1264
+ stripeAccountId: import("convex/values").VString<string, "required">;
1265
+ customerAccount: import("convex/values").VString<string, "required">;
1266
+ livemode: import("convex/values").VBoolean<boolean, "required">;
1267
+ purchaseId: import("convex/values").VString<string, "required">;
1268
+ creditGrantId: import("convex/values").VString<string, "required">;
1269
+ stripePriceId: import("convex/values").VString<string, "required">;
1270
+ stripeProductId: import("convex/values").VString<string, "required">;
1271
+ }, "optional", "creditGrantId" | "customerAccount" | "livemode" | "purchaseId" | "stripeAccountId" | "stripePriceId" | "stripeProductId">;
1171
1272
  gross: import("convex/values").VFloat64<number, "required">;
1172
1273
  currency: import("convex/values").VString<string, "required">;
1173
1274
  processingFee: import("convex/values").VFloat64<number, "required">;
@@ -1187,7 +1288,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
1187
1288
  role: import("convex/values").VUnion<"affiliate" | "other" | "store", [import("convex/values").VLiteral<"store", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"other", "required">], "required", never>;
1188
1289
  amount: import("convex/values").VFloat64<number, "required">;
1189
1290
  }, "required", "amount" | "destinationAccountId" | "role">, "required">;
1190
- }, "optional", "adjustmentAmount" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers">;
1291
+ }, "optional", "adjustmentAmount" | "creditSource" | "creditSource.creditGrantId" | "creditSource.customerAccount" | "creditSource.livemode" | "creditSource.purchaseId" | "creditSource.stripeAccountId" | "creditSource.stripePriceId" | "creditSource.stripeProductId" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers" | "usageSource" | "usageSource.customerAccount" | "usageSource.invoicePaymentId" | "usageSource.livemode" | "usageSource.meterId" | "usageSource.model" | "usageSource.period" | "usageSource.period.end" | "usageSource.period.start" | "usageSource.stripeAccountId" | "usageSource.stripePriceId" | "usageSource.stripeProductId" | "usageSource.subscriptionId" | "usageSource.subscriptionItemId">;
1191
1292
  version: import("convex/values").VFloat64<number, "required">;
1192
1293
  sourceKind: import("convex/values").VUnion<"invoice" | "settlement", [import("convex/values").VLiteral<"settlement", "required">, import("convex/values").VLiteral<"invoice", "required">], "required", never>;
1193
1294
  sourceId: import("convex/values").VString<string, "required">;
@@ -1198,7 +1299,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
1198
1299
  activePhase: import("convex/values").VUnion<"execute" | "reconcile" | undefined, [import("convex/values").VLiteral<"execute", "required">, import("convex/values").VLiteral<"reconcile", "required">], "optional", never>;
1199
1300
  resumeQueued: import("convex/values").VBoolean<boolean, "required">;
1200
1301
  outcome: import("convex/values").VUnion<"collect" | "release" | undefined, [import("convex/values").VLiteral<"collect", "required">, import("convex/values").VLiteral<"release", "required">], "optional", never>;
1201
- }, "required", "accountId" | "activePhase" | "allocation" | "allocation.adjustmentAmount" | "allocation.currency" | "allocation.gross" | "allocation.paymentId" | "allocation.paymentIntentId" | "allocation.platformNet" | "allocation.processingFee" | "allocation.sourceChargeId" | "allocation.sourceInvoiceId" | "allocation.transfers" | "cancelRequested" | "completion" | "currency" | "definitionVersion" | "groupKey" | "maxAttempts" | "outcome" | "provider" | "providerApiVersion" | "providerStarted" | "releaseUncollectible" | "resumeQueued" | "retryDelayMs" | "scopeKey" | "sourceId" | "sourceKind" | "status" | "version" | "workflowId">, {
1302
+ }, "required", "accountId" | "activePhase" | "allocation" | "allocation.adjustmentAmount" | "allocation.creditSource" | "allocation.creditSource.creditGrantId" | "allocation.creditSource.customerAccount" | "allocation.creditSource.livemode" | "allocation.creditSource.purchaseId" | "allocation.creditSource.stripeAccountId" | "allocation.creditSource.stripePriceId" | "allocation.creditSource.stripeProductId" | "allocation.currency" | "allocation.gross" | "allocation.paymentId" | "allocation.paymentIntentId" | "allocation.platformNet" | "allocation.processingFee" | "allocation.sourceChargeId" | "allocation.sourceInvoiceId" | "allocation.transfers" | "allocation.usageSource" | "allocation.usageSource.customerAccount" | "allocation.usageSource.invoicePaymentId" | "allocation.usageSource.livemode" | "allocation.usageSource.meterId" | "allocation.usageSource.model" | "allocation.usageSource.period" | "allocation.usageSource.period.end" | "allocation.usageSource.period.start" | "allocation.usageSource.stripeAccountId" | "allocation.usageSource.stripePriceId" | "allocation.usageSource.stripeProductId" | "allocation.usageSource.subscriptionId" | "allocation.usageSource.subscriptionItemId" | "cancelRequested" | "completion" | "currency" | "definitionVersion" | "groupKey" | "maxAttempts" | "outcome" | "provider" | "providerApiVersion" | "providerStarted" | "releaseUncollectible" | "resumeQueued" | "retryDelayMs" | "scopeKey" | "sourceId" | "sourceKind" | "status" | "version" | "workflowId">, {
1202
1303
  by_group: ["groupKey", "_creationTime"];
1203
1304
  by_source: ["sourceKind", "sourceId", "_creationTime"];
1204
1305
  }, {}, {}>;
@@ -1207,6 +1308,15 @@ declare const _default: import("convex/server").SchemaDefinition<{
1207
1308
  accountId: string;
1208
1309
  allocation?: {
1209
1310
  adjustmentAmount?: number | undefined;
1311
+ creditSource?: {
1312
+ creditGrantId: string;
1313
+ customerAccount: string;
1314
+ livemode: boolean;
1315
+ purchaseId: string;
1316
+ stripeAccountId: string;
1317
+ stripePriceId: string;
1318
+ stripeProductId: string;
1319
+ } | undefined;
1210
1320
  currency: string;
1211
1321
  gross: number;
1212
1322
  paymentId?: string | undefined;
@@ -1220,6 +1330,22 @@ declare const _default: import("convex/server").SchemaDefinition<{
1220
1330
  destinationAccountId: string;
1221
1331
  role: "affiliate" | "other" | "store";
1222
1332
  }[];
1333
+ usageSource?: {
1334
+ customerAccount: string;
1335
+ invoicePaymentId: string;
1336
+ livemode: boolean;
1337
+ meterId: string;
1338
+ model: "included_overage" | "pay_as_you_go";
1339
+ period: {
1340
+ end: number;
1341
+ start: number;
1342
+ };
1343
+ stripeAccountId: string;
1344
+ stripePriceId: string;
1345
+ stripeProductId: string;
1346
+ subscriptionId: string;
1347
+ subscriptionItemId: string;
1348
+ } | undefined;
1223
1349
  } | undefined;
1224
1350
  completion?: string | undefined;
1225
1351
  currency: string;
@@ -1240,6 +1366,15 @@ declare const _default: import("convex/server").SchemaDefinition<{
1240
1366
  accountId: string;
1241
1367
  allocation?: {
1242
1368
  adjustmentAmount?: number | undefined;
1369
+ creditSource?: {
1370
+ creditGrantId: string;
1371
+ customerAccount: string;
1372
+ livemode: boolean;
1373
+ purchaseId: string;
1374
+ stripeAccountId: string;
1375
+ stripePriceId: string;
1376
+ stripeProductId: string;
1377
+ } | undefined;
1243
1378
  currency: string;
1244
1379
  gross: number;
1245
1380
  paymentId?: string | undefined;
@@ -1253,6 +1388,22 @@ declare const _default: import("convex/server").SchemaDefinition<{
1253
1388
  destinationAccountId: string;
1254
1389
  role: "affiliate" | "other" | "store";
1255
1390
  }[];
1391
+ usageSource?: {
1392
+ customerAccount: string;
1393
+ invoicePaymentId: string;
1394
+ livemode: boolean;
1395
+ meterId: string;
1396
+ model: "included_overage" | "pay_as_you_go";
1397
+ period: {
1398
+ end: number;
1399
+ start: number;
1400
+ };
1401
+ stripeAccountId: string;
1402
+ stripePriceId: string;
1403
+ stripeProductId: string;
1404
+ subscriptionId: string;
1405
+ subscriptionItemId: string;
1406
+ } | undefined;
1256
1407
  } | undefined;
1257
1408
  completion?: string | undefined;
1258
1409
  currency: string;
@@ -1278,6 +1429,15 @@ declare const _default: import("convex/server").SchemaDefinition<{
1278
1429
  retryDelayMs: import("convex/values").VFloat64<number, "required">;
1279
1430
  allocation: import("convex/values").VObject<{
1280
1431
  adjustmentAmount?: number | undefined;
1432
+ creditSource?: {
1433
+ creditGrantId: string;
1434
+ customerAccount: string;
1435
+ livemode: boolean;
1436
+ purchaseId: string;
1437
+ stripeAccountId: string;
1438
+ stripePriceId: string;
1439
+ stripeProductId: string;
1440
+ } | undefined;
1281
1441
  currency: string;
1282
1442
  gross: number;
1283
1443
  paymentId?: string | undefined;
@@ -1291,10 +1451,77 @@ declare const _default: import("convex/server").SchemaDefinition<{
1291
1451
  destinationAccountId: string;
1292
1452
  role: "affiliate" | "other" | "store";
1293
1453
  }[];
1454
+ usageSource?: {
1455
+ customerAccount: string;
1456
+ invoicePaymentId: string;
1457
+ livemode: boolean;
1458
+ meterId: string;
1459
+ model: "included_overage" | "pay_as_you_go";
1460
+ period: {
1461
+ end: number;
1462
+ start: number;
1463
+ };
1464
+ stripeAccountId: string;
1465
+ stripePriceId: string;
1466
+ stripeProductId: string;
1467
+ subscriptionId: string;
1468
+ subscriptionItemId: string;
1469
+ } | undefined;
1294
1470
  } | undefined, {
1295
1471
  sourceChargeId: import("convex/values").VString<string, "required">;
1296
1472
  paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
1297
1473
  sourceInvoiceId: import("convex/values").VString<string | undefined, "optional">;
1474
+ usageSource: import("convex/values").VObject<{
1475
+ customerAccount: string;
1476
+ invoicePaymentId: string;
1477
+ livemode: boolean;
1478
+ meterId: string;
1479
+ model: "included_overage" | "pay_as_you_go";
1480
+ period: {
1481
+ end: number;
1482
+ start: number;
1483
+ };
1484
+ stripeAccountId: string;
1485
+ stripePriceId: string;
1486
+ stripeProductId: string;
1487
+ subscriptionId: string;
1488
+ subscriptionItemId: string;
1489
+ } | undefined, {
1490
+ stripeAccountId: import("convex/values").VString<string, "required">;
1491
+ customerAccount: import("convex/values").VString<string, "required">;
1492
+ livemode: import("convex/values").VBoolean<boolean, "required">;
1493
+ meterId: import("convex/values").VString<string, "required">;
1494
+ stripePriceId: import("convex/values").VString<string, "required">;
1495
+ stripeProductId: import("convex/values").VString<string, "required">;
1496
+ subscriptionId: import("convex/values").VString<string, "required">;
1497
+ subscriptionItemId: import("convex/values").VString<string, "required">;
1498
+ invoicePaymentId: import("convex/values").VString<string, "required">;
1499
+ period: import("convex/values").VObject<{
1500
+ end: number;
1501
+ start: number;
1502
+ }, {
1503
+ start: import("convex/values").VFloat64<number, "required">;
1504
+ end: import("convex/values").VFloat64<number, "required">;
1505
+ }, "required", "end" | "start">;
1506
+ model: import("convex/values").VUnion<"included_overage" | "pay_as_you_go", [import("convex/values").VLiteral<"pay_as_you_go", "required">, import("convex/values").VLiteral<"included_overage", "required">], "required", never>;
1507
+ }, "optional", "customerAccount" | "invoicePaymentId" | "livemode" | "meterId" | "model" | "period" | "period.end" | "period.start" | "stripeAccountId" | "stripePriceId" | "stripeProductId" | "subscriptionId" | "subscriptionItemId">;
1508
+ creditSource: import("convex/values").VObject<{
1509
+ creditGrantId: string;
1510
+ customerAccount: string;
1511
+ livemode: boolean;
1512
+ purchaseId: string;
1513
+ stripeAccountId: string;
1514
+ stripePriceId: string;
1515
+ stripeProductId: string;
1516
+ } | undefined, {
1517
+ stripeAccountId: import("convex/values").VString<string, "required">;
1518
+ customerAccount: import("convex/values").VString<string, "required">;
1519
+ livemode: import("convex/values").VBoolean<boolean, "required">;
1520
+ purchaseId: import("convex/values").VString<string, "required">;
1521
+ creditGrantId: import("convex/values").VString<string, "required">;
1522
+ stripePriceId: import("convex/values").VString<string, "required">;
1523
+ stripeProductId: import("convex/values").VString<string, "required">;
1524
+ }, "optional", "creditGrantId" | "customerAccount" | "livemode" | "purchaseId" | "stripeAccountId" | "stripePriceId" | "stripeProductId">;
1298
1525
  gross: import("convex/values").VFloat64<number, "required">;
1299
1526
  currency: import("convex/values").VString<string, "required">;
1300
1527
  processingFee: import("convex/values").VFloat64<number, "required">;
@@ -1314,10 +1541,10 @@ declare const _default: import("convex/server").SchemaDefinition<{
1314
1541
  role: import("convex/values").VUnion<"affiliate" | "other" | "store", [import("convex/values").VLiteral<"store", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"other", "required">], "required", never>;
1315
1542
  amount: import("convex/values").VFloat64<number, "required">;
1316
1543
  }, "required", "amount" | "destinationAccountId" | "role">, "required">;
1317
- }, "optional", "adjustmentAmount" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers">;
1318
- }, "required", "accountId" | "allocation" | "allocation.adjustmentAmount" | "allocation.currency" | "allocation.gross" | "allocation.paymentId" | "allocation.paymentIntentId" | "allocation.platformNet" | "allocation.processingFee" | "allocation.sourceChargeId" | "allocation.sourceInvoiceId" | "allocation.transfers" | "completion" | "currency" | "definitionVersion" | "groupKey" | "maxAttempts" | "provider" | "providerApiVersion" | "releaseUncollectible" | "retryDelayMs" | "scopeKey">;
1544
+ }, "optional", "adjustmentAmount" | "creditSource" | "creditSource.creditGrantId" | "creditSource.customerAccount" | "creditSource.livemode" | "creditSource.purchaseId" | "creditSource.stripeAccountId" | "creditSource.stripePriceId" | "creditSource.stripeProductId" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers" | "usageSource" | "usageSource.customerAccount" | "usageSource.invoicePaymentId" | "usageSource.livemode" | "usageSource.meterId" | "usageSource.model" | "usageSource.period" | "usageSource.period.end" | "usageSource.period.start" | "usageSource.stripeAccountId" | "usageSource.stripePriceId" | "usageSource.stripeProductId" | "usageSource.subscriptionId" | "usageSource.subscriptionItemId">;
1545
+ }, "required", "accountId" | "allocation" | "allocation.adjustmentAmount" | "allocation.creditSource" | "allocation.creditSource.creditGrantId" | "allocation.creditSource.customerAccount" | "allocation.creditSource.livemode" | "allocation.creditSource.purchaseId" | "allocation.creditSource.stripeAccountId" | "allocation.creditSource.stripePriceId" | "allocation.creditSource.stripeProductId" | "allocation.currency" | "allocation.gross" | "allocation.paymentId" | "allocation.paymentIntentId" | "allocation.platformNet" | "allocation.processingFee" | "allocation.sourceChargeId" | "allocation.sourceInvoiceId" | "allocation.transfers" | "allocation.usageSource" | "allocation.usageSource.customerAccount" | "allocation.usageSource.invoicePaymentId" | "allocation.usageSource.livemode" | "allocation.usageSource.meterId" | "allocation.usageSource.model" | "allocation.usageSource.period" | "allocation.usageSource.period.end" | "allocation.usageSource.period.start" | "allocation.usageSource.stripeAccountId" | "allocation.usageSource.stripePriceId" | "allocation.usageSource.stripeProductId" | "allocation.usageSource.subscriptionId" | "allocation.usageSource.subscriptionItemId" | "completion" | "currency" | "definitionVersion" | "groupKey" | "maxAttempts" | "provider" | "providerApiVersion" | "releaseUncollectible" | "retryDelayMs" | "scopeKey">;
1319
1546
  operationId: import("convex/values").VId<import("convex/values").GenericId<"recoveryWorkflowOperations">, "required">;
1320
- }, "required", "binding" | "binding.accountId" | "binding.allocation" | "binding.allocation.adjustmentAmount" | "binding.allocation.currency" | "binding.allocation.gross" | "binding.allocation.paymentId" | "binding.allocation.paymentIntentId" | "binding.allocation.platformNet" | "binding.allocation.processingFee" | "binding.allocation.sourceChargeId" | "binding.allocation.sourceInvoiceId" | "binding.allocation.transfers" | "binding.completion" | "binding.currency" | "binding.definitionVersion" | "binding.groupKey" | "binding.maxAttempts" | "binding.provider" | "binding.providerApiVersion" | "binding.releaseUncollectible" | "binding.retryDelayMs" | "binding.scopeKey" | "operationId" | "requestKey">, {
1547
+ }, "required", "binding" | "binding.accountId" | "binding.allocation" | "binding.allocation.adjustmentAmount" | "binding.allocation.creditSource" | "binding.allocation.creditSource.creditGrantId" | "binding.allocation.creditSource.customerAccount" | "binding.allocation.creditSource.livemode" | "binding.allocation.creditSource.purchaseId" | "binding.allocation.creditSource.stripeAccountId" | "binding.allocation.creditSource.stripePriceId" | "binding.allocation.creditSource.stripeProductId" | "binding.allocation.currency" | "binding.allocation.gross" | "binding.allocation.paymentId" | "binding.allocation.paymentIntentId" | "binding.allocation.platformNet" | "binding.allocation.processingFee" | "binding.allocation.sourceChargeId" | "binding.allocation.sourceInvoiceId" | "binding.allocation.transfers" | "binding.allocation.usageSource" | "binding.allocation.usageSource.customerAccount" | "binding.allocation.usageSource.invoicePaymentId" | "binding.allocation.usageSource.livemode" | "binding.allocation.usageSource.meterId" | "binding.allocation.usageSource.model" | "binding.allocation.usageSource.period" | "binding.allocation.usageSource.period.end" | "binding.allocation.usageSource.period.start" | "binding.allocation.usageSource.stripeAccountId" | "binding.allocation.usageSource.stripePriceId" | "binding.allocation.usageSource.stripeProductId" | "binding.allocation.usageSource.subscriptionId" | "binding.allocation.usageSource.subscriptionItemId" | "binding.completion" | "binding.currency" | "binding.definitionVersion" | "binding.groupKey" | "binding.maxAttempts" | "binding.provider" | "binding.providerApiVersion" | "binding.releaseUncollectible" | "binding.retryDelayMs" | "binding.scopeKey" | "operationId" | "requestKey">, {
1321
1548
  by_key: ["requestKey", "_creationTime"];
1322
1549
  }, {}, {}>;
1323
1550
  balanceFundingPreparations: import("convex/server").TableDefinition<import("convex/values").VObject<{
@@ -3115,6 +3342,15 @@ declare const _default: import("convex/server").SchemaDefinition<{
3115
3342
  }, {}, {}>;
3116
3343
  settlementAllocations: import("convex/server").TableDefinition<import("convex/values").VObject<{
3117
3344
  adjustmentAmount?: number | undefined;
3345
+ creditSource?: {
3346
+ creditGrantId: string;
3347
+ customerAccount: string;
3348
+ livemode: boolean;
3349
+ purchaseId: string;
3350
+ stripeAccountId: string;
3351
+ stripePriceId: string;
3352
+ stripeProductId: string;
3353
+ } | undefined;
3118
3354
  currency: string;
3119
3355
  gross: number;
3120
3356
  paymentId?: string | undefined;
@@ -3128,10 +3364,77 @@ declare const _default: import("convex/server").SchemaDefinition<{
3128
3364
  destinationAccountId: string;
3129
3365
  role: "affiliate" | "other" | "store";
3130
3366
  }[];
3367
+ usageSource?: {
3368
+ customerAccount: string;
3369
+ invoicePaymentId: string;
3370
+ livemode: boolean;
3371
+ meterId: string;
3372
+ model: "included_overage" | "pay_as_you_go";
3373
+ period: {
3374
+ end: number;
3375
+ start: number;
3376
+ };
3377
+ stripeAccountId: string;
3378
+ stripePriceId: string;
3379
+ stripeProductId: string;
3380
+ subscriptionId: string;
3381
+ subscriptionItemId: string;
3382
+ } | undefined;
3131
3383
  }, {
3132
3384
  sourceChargeId: import("convex/values").VString<string, "required">;
3133
3385
  paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
3134
3386
  sourceInvoiceId: import("convex/values").VString<string | undefined, "optional">;
3387
+ usageSource: import("convex/values").VObject<{
3388
+ customerAccount: string;
3389
+ invoicePaymentId: string;
3390
+ livemode: boolean;
3391
+ meterId: string;
3392
+ model: "included_overage" | "pay_as_you_go";
3393
+ period: {
3394
+ end: number;
3395
+ start: number;
3396
+ };
3397
+ stripeAccountId: string;
3398
+ stripePriceId: string;
3399
+ stripeProductId: string;
3400
+ subscriptionId: string;
3401
+ subscriptionItemId: string;
3402
+ } | undefined, {
3403
+ stripeAccountId: import("convex/values").VString<string, "required">;
3404
+ customerAccount: import("convex/values").VString<string, "required">;
3405
+ livemode: import("convex/values").VBoolean<boolean, "required">;
3406
+ meterId: import("convex/values").VString<string, "required">;
3407
+ stripePriceId: import("convex/values").VString<string, "required">;
3408
+ stripeProductId: import("convex/values").VString<string, "required">;
3409
+ subscriptionId: import("convex/values").VString<string, "required">;
3410
+ subscriptionItemId: import("convex/values").VString<string, "required">;
3411
+ invoicePaymentId: import("convex/values").VString<string, "required">;
3412
+ period: import("convex/values").VObject<{
3413
+ end: number;
3414
+ start: number;
3415
+ }, {
3416
+ start: import("convex/values").VFloat64<number, "required">;
3417
+ end: import("convex/values").VFloat64<number, "required">;
3418
+ }, "required", "end" | "start">;
3419
+ model: import("convex/values").VUnion<"included_overage" | "pay_as_you_go", [import("convex/values").VLiteral<"pay_as_you_go", "required">, import("convex/values").VLiteral<"included_overage", "required">], "required", never>;
3420
+ }, "optional", "customerAccount" | "invoicePaymentId" | "livemode" | "meterId" | "model" | "period" | "period.end" | "period.start" | "stripeAccountId" | "stripePriceId" | "stripeProductId" | "subscriptionId" | "subscriptionItemId">;
3421
+ creditSource: import("convex/values").VObject<{
3422
+ creditGrantId: string;
3423
+ customerAccount: string;
3424
+ livemode: boolean;
3425
+ purchaseId: string;
3426
+ stripeAccountId: string;
3427
+ stripePriceId: string;
3428
+ stripeProductId: string;
3429
+ } | undefined, {
3430
+ stripeAccountId: import("convex/values").VString<string, "required">;
3431
+ customerAccount: import("convex/values").VString<string, "required">;
3432
+ livemode: import("convex/values").VBoolean<boolean, "required">;
3433
+ purchaseId: import("convex/values").VString<string, "required">;
3434
+ creditGrantId: import("convex/values").VString<string, "required">;
3435
+ stripePriceId: import("convex/values").VString<string, "required">;
3436
+ stripeProductId: import("convex/values").VString<string, "required">;
3437
+ }, "optional", "creditGrantId" | "customerAccount" | "livemode" | "purchaseId" | "stripeAccountId" | "stripePriceId" | "stripeProductId">;
3135
3438
  gross: import("convex/values").VFloat64<number, "required">;
3136
3439
  currency: import("convex/values").VString<string, "required">;
3137
3440
  processingFee: import("convex/values").VFloat64<number, "required">;
@@ -3151,7 +3454,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
3151
3454
  role: import("convex/values").VUnion<"affiliate" | "other" | "store", [import("convex/values").VLiteral<"store", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"other", "required">], "required", never>;
3152
3455
  amount: import("convex/values").VFloat64<number, "required">;
3153
3456
  }, "required", "amount" | "destinationAccountId" | "role">, "required">;
3154
- }, "required", "adjustmentAmount" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers">, {
3457
+ }, "required", "adjustmentAmount" | "creditSource" | "creditSource.creditGrantId" | "creditSource.customerAccount" | "creditSource.livemode" | "creditSource.purchaseId" | "creditSource.stripeAccountId" | "creditSource.stripePriceId" | "creditSource.stripeProductId" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers" | "usageSource" | "usageSource.customerAccount" | "usageSource.invoicePaymentId" | "usageSource.livemode" | "usageSource.meterId" | "usageSource.model" | "usageSource.period" | "usageSource.period.end" | "usageSource.period.start" | "usageSource.stripeAccountId" | "usageSource.stripePriceId" | "usageSource.stripeProductId" | "usageSource.subscriptionId" | "usageSource.subscriptionItemId">, {
3155
3458
  by_source_charge: ["sourceChargeId", "_creationTime"];
3156
3459
  }, {}, {}>;
3157
3460
  commissionTerms: import("convex/server").TableDefinition<import("convex/values").VObject<{
@@ -1,5 +1,14 @@
1
1
  export declare const reserveSettlementAllocation: import("convex/server").RegisteredMutation<"public", {
2
2
  adjustmentAmount?: number | undefined;
3
+ creditSource?: {
4
+ creditGrantId: string;
5
+ customerAccount: string;
6
+ livemode: boolean;
7
+ purchaseId: string;
8
+ stripeAccountId: string;
9
+ stripePriceId: string;
10
+ stripeProductId: string;
11
+ } | undefined;
3
12
  currency: string;
4
13
  gross: number;
5
14
  paymentId?: string | undefined;
@@ -13,10 +22,35 @@ export declare const reserveSettlementAllocation: import("convex/server").Regist
13
22
  destinationAccountId: string;
14
23
  role: "affiliate" | "other" | "store";
15
24
  }[];
25
+ usageSource?: {
26
+ customerAccount: string;
27
+ invoicePaymentId: string;
28
+ livemode: boolean;
29
+ meterId: string;
30
+ model: "included_overage" | "pay_as_you_go";
31
+ period: {
32
+ end: number;
33
+ start: number;
34
+ };
35
+ stripeAccountId: string;
36
+ stripePriceId: string;
37
+ stripeProductId: string;
38
+ subscriptionId: string;
39
+ subscriptionItemId: string;
40
+ } | undefined;
16
41
  }, Promise<{
17
42
  _creationTime: number;
18
43
  _id: import("convex/values").GenericId<"settlementAllocations">;
19
44
  adjustmentAmount?: number | undefined;
45
+ creditSource?: {
46
+ creditGrantId: string;
47
+ customerAccount: string;
48
+ livemode: boolean;
49
+ purchaseId: string;
50
+ stripeAccountId: string;
51
+ stripePriceId: string;
52
+ stripeProductId: string;
53
+ } | undefined;
20
54
  currency: string;
21
55
  gross: number;
22
56
  paymentId?: string | undefined;
@@ -30,6 +64,22 @@ export declare const reserveSettlementAllocation: import("convex/server").Regist
30
64
  destinationAccountId: string;
31
65
  role: "affiliate" | "other" | "store";
32
66
  }[];
67
+ usageSource?: {
68
+ customerAccount: string;
69
+ invoicePaymentId: string;
70
+ livemode: boolean;
71
+ meterId: string;
72
+ model: "included_overage" | "pay_as_you_go";
73
+ period: {
74
+ end: number;
75
+ start: number;
76
+ };
77
+ stripeAccountId: string;
78
+ stripePriceId: string;
79
+ stripeProductId: string;
80
+ subscriptionId: string;
81
+ subscriptionItemId: string;
82
+ } | undefined;
33
83
  }>>;
34
84
  export declare const claimCommissionInvoice: import("convex/server").RegisteredMutation<"public", {
35
85
  affiliateAccountId?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../../src/component/settlement/mutations.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDtC,CAAC;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;GA2DjC,CAAC;AAEH,+EAA+E;AAC/E,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;GA8CtC,CAAC"}
1
+ {"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../../src/component/settlement/mutations.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DtC,CAAC;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;GA2DjC,CAAC;AAEH,+EAA+E;AAC/E,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;GA8CtC,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { canonicalFingerprint } from "../operationEvidence/canonical.js";
1
2
  import { observeSettlementAllocation } from "../financialObservations/settlement.js";
2
3
  import { paginator } from "convex-helpers/server/pagination";
3
4
  import schema from "../schema.js";
@@ -16,6 +17,8 @@ export const reserveSettlementAllocation = mutation({
16
17
  args: allocationFields,
17
18
  returns: doc,
18
19
  handler: async (ctx, args) => {
20
+ if (args.usageSource && args.creditSource)
21
+ throw new Error("Settlement cannot combine invoice and credit purchase sources");
19
22
  const existing = await ctx.db
20
23
  .query("settlementAllocations")
21
24
  .withIndex("by_source_charge", (q) => q.eq("sourceChargeId", args.sourceChargeId))
@@ -23,7 +26,11 @@ export const reserveSettlementAllocation = mutation({
23
26
  if (existing) {
24
27
  if (existing.currency !== args.currency ||
25
28
  existing.paymentIntentId !== args.paymentIntentId ||
26
- existing.sourceInvoiceId !== args.sourceInvoiceId)
29
+ existing.sourceInvoiceId !== args.sourceInvoiceId ||
30
+ (await canonicalFingerprint(existing.usageSource ?? null)) !==
31
+ (await canonicalFingerprint(args.usageSource ?? null)) ||
32
+ (await canonicalFingerprint(existing.creditSource ?? null)) !==
33
+ (await canonicalFingerprint(args.creditSource ?? null)))
27
34
  throw new Error("Settlement source identity cannot change.");
28
35
  await observeSettlementAllocation(ctx, existing);
29
36
  return existing;
@@ -1 +1 @@
1
- {"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../../src/component/settlement/mutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAChF,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC;IACnB,GAAG,gBAAgB;IACnB,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,uBAAuB,CAAC;IAClC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;CAC1B,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,QAAQ,CAAC;IAClD,IAAI,EAAE,gBAAgB;IACtB,OAAO,EAAE,GAAG;IACZ,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAC3B,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,EAAE;aAC1B,KAAK,CAAC,uBAAuB,CAAC;aAC9B,SAAS,CAAC,kBAAkB,EAAE,CAAC,CAAC,EAAE,EAAE,CACnC,CAAC,CAAC,EAAE,CAAC,gBAAgB,EAAE,IAAI,CAAC,cAAc,CAAC,CAC5C;aACA,KAAK,EAAE,CAAC;QACX,IAAI,QAAQ,EAAE,CAAC;YACb,IACE,QAAQ,CAAC,QAAQ,KA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