@fantastic.dev/better-stripe 0.40.0 → 0.41.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 (98) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +1 -1
  3. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +442 -0
  4. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
  5. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +237 -16
  6. package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
  7. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +442 -0
  8. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
  9. package/dist/client/connect/payoutSyncTestHelpers.d.ts +237 -16
  10. package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
  11. package/dist/client/costRecovery-invoices.d.ts +2 -2
  12. package/dist/client/costRecovery-invoices.d.ts.map +1 -1
  13. package/dist/client/costRecovery-invoices.js +4 -1
  14. package/dist/client/costRecovery-invoices.js.map +1 -1
  15. package/dist/client/costRecovery.d.ts +5 -2
  16. package/dist/client/costRecovery.d.ts.map +1 -1
  17. package/dist/client/costRecovery.js +3 -1
  18. package/dist/client/costRecovery.js.map +1 -1
  19. package/dist/client/recoveryWorkflow/client.d.ts +14 -0
  20. package/dist/client/recoveryWorkflow/client.d.ts.map +1 -0
  21. package/dist/client/recoveryWorkflow/client.js +34 -0
  22. package/dist/client/recoveryWorkflow/client.js.map +1 -0
  23. package/dist/client/recoveryWorkflow/contracts.d.ts +63 -0
  24. package/dist/client/recoveryWorkflow/contracts.d.ts.map +1 -0
  25. package/dist/client/recoveryWorkflow/contracts.js +11 -0
  26. package/dist/client/recoveryWorkflow/contracts.js.map +1 -0
  27. package/dist/client/recoveryWorkflow/provider.d.ts +10 -0
  28. package/dist/client/recoveryWorkflow/provider.d.ts.map +1 -0
  29. package/dist/client/recoveryWorkflow/provider.js +80 -0
  30. package/dist/client/recoveryWorkflow/provider.js.map +1 -0
  31. package/dist/client/recoveryWorkflow/settlement.d.ts +6 -0
  32. package/dist/client/recoveryWorkflow/settlement.d.ts.map +1 -0
  33. package/dist/client/recoveryWorkflow/settlement.js +43 -0
  34. package/dist/client/recoveryWorkflow/settlement.js.map +1 -0
  35. package/dist/component/_generated/api.d.ts +12 -0
  36. package/dist/component/_generated/api.d.ts.map +1 -1
  37. package/dist/component/_generated/api.js.map +1 -1
  38. package/dist/component/_generated/component.d.ts +164 -0
  39. package/dist/component/_generated/component.d.ts.map +1 -1
  40. package/dist/component/balanceFunding/mutations.d.ts +16 -16
  41. package/dist/component/balanceFunding/stateHandlers.d.ts +8 -8
  42. package/dist/component/earnings/triggers.d.ts +210 -16
  43. package/dist/component/earnings/triggers.d.ts.map +1 -1
  44. package/dist/component/payoutRelease/queries.d.ts +2 -2
  45. package/dist/component/payoutRelease/queries.d.ts.map +1 -1
  46. package/dist/component/recoveryWorkflow/bridge.d.ts +21 -0
  47. package/dist/component/recoveryWorkflow/bridge.d.ts.map +1 -0
  48. package/dist/component/recoveryWorkflow/bridge.js +52 -0
  49. package/dist/component/recoveryWorkflow/bridge.js.map +1 -0
  50. package/dist/component/recoveryWorkflow/helpers.d.ts +83 -0
  51. package/dist/component/recoveryWorkflow/helpers.d.ts.map +1 -0
  52. package/dist/component/recoveryWorkflow/helpers.js +48 -0
  53. package/dist/component/recoveryWorkflow/helpers.js.map +1 -0
  54. package/dist/component/recoveryWorkflow/mutations.d.ts +91 -0
  55. package/dist/component/recoveryWorkflow/mutations.d.ts.map +1 -0
  56. package/dist/component/recoveryWorkflow/mutations.js +177 -0
  57. package/dist/component/recoveryWorkflow/mutations.js.map +1 -0
  58. package/dist/component/recoveryWorkflow/queries.d.ts +118 -0
  59. package/dist/component/recoveryWorkflow/queries.d.ts.map +1 -0
  60. package/dist/component/recoveryWorkflow/queries.js +20 -0
  61. package/dist/component/recoveryWorkflow/queries.js.map +1 -0
  62. package/dist/component/recoveryWorkflow/schema.d.ts +653 -0
  63. package/dist/component/recoveryWorkflow/schema.d.ts.map +1 -0
  64. package/dist/component/recoveryWorkflow/schema.js +81 -0
  65. package/dist/component/recoveryWorkflow/schema.js.map +1 -0
  66. package/dist/component/recoveryWorkflow/steps.d.ts +70 -0
  67. package/dist/component/recoveryWorkflow/steps.d.ts.map +1 -0
  68. package/dist/component/recoveryWorkflow/steps.js +94 -0
  69. package/dist/component/recoveryWorkflow/steps.js.map +1 -0
  70. package/dist/component/recoveryWorkflow/workflow.d.ts +22 -0
  71. package/dist/component/recoveryWorkflow/workflow.d.ts.map +1 -0
  72. package/dist/component/recoveryWorkflow/workflow.js +56 -0
  73. package/dist/component/recoveryWorkflow/workflow.js.map +1 -0
  74. package/dist/component/schema.d.ts +221 -0
  75. package/dist/component/schema.js +3 -0
  76. package/dist/component/schema.js.map +1 -1
  77. package/package.json +1 -1
  78. package/src/client/costRecovery-invoices.ts +6 -0
  79. package/src/client/costRecovery.ts +8 -3
  80. package/src/client/recoveryWorkflow/client.test.ts +37 -0
  81. package/src/client/recoveryWorkflow/client.ts +76 -0
  82. package/src/client/recoveryWorkflow/contracts.ts +72 -0
  83. package/src/client/recoveryWorkflow/provider.test.ts +424 -0
  84. package/src/client/recoveryWorkflow/provider.ts +119 -0
  85. package/src/client/recoveryWorkflow/settlement.ts +67 -0
  86. package/src/component/_generated/api.ts +12 -0
  87. package/src/component/_generated/component.ts +222 -0
  88. package/src/component/recoveryWorkflow/bridge.test.ts +481 -0
  89. package/src/component/recoveryWorkflow/bridge.ts +66 -0
  90. package/src/component/recoveryWorkflow/helpers.ts +58 -0
  91. package/src/component/recoveryWorkflow/journal.test.ts +104 -0
  92. package/src/component/recoveryWorkflow/mutations.ts +224 -0
  93. package/src/component/recoveryWorkflow/queries.ts +19 -0
  94. package/src/component/recoveryWorkflow/schema.ts +92 -0
  95. package/src/component/recoveryWorkflow/state.test.ts +191 -0
  96. package/src/component/recoveryWorkflow/steps.ts +97 -0
  97. package/src/component/recoveryWorkflow/workflow.ts +73 -0
  98. package/src/component/schema.ts +6 -0
@@ -22,6 +22,14 @@ export declare const begin: import("convex/server").RegisteredMutation<"public",
22
22
  requestKey: string;
23
23
  scopeKey: string;
24
24
  }, Promise<{
25
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
26
+ retryable: false;
27
+ status: "conflict";
28
+ } | {
29
+ reason: "policy_invalid";
30
+ retryable: false;
31
+ status: "rejected";
32
+ } | {
25
33
  operation: {
26
34
  accountId: string;
27
35
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -32,14 +40,6 @@ export declare const begin: import("convex/server").RegisteredMutation<"public",
32
40
  } | {
33
41
  enabled: boolean;
34
42
  status: "unchanged";
35
- } | {
36
- reason: "identity_changed" | "revision_changed" | "scope_busy";
37
- retryable: false;
38
- status: "conflict";
39
- } | {
40
- reason: "policy_invalid";
41
- retryable: false;
42
- status: "rejected";
43
43
  } | {
44
44
  reason: "provider_pending";
45
45
  retryable: true;
@@ -227,6 +227,14 @@ export declare const prepare: import("convex/server").RegisteredMutation<"public
227
227
  requestKey: string;
228
228
  scopeKey: string;
229
229
  }, Promise<{
230
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
231
+ retryable: false;
232
+ status: "conflict";
233
+ } | {
234
+ reason: "policy_invalid";
235
+ retryable: false;
236
+ status: "rejected";
237
+ } | {
230
238
  operation: {
231
239
  accountId: string;
232
240
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -237,14 +245,6 @@ export declare const prepare: import("convex/server").RegisteredMutation<"public
237
245
  } | {
238
246
  enabled: boolean;
239
247
  status: "unchanged";
240
- } | {
241
- reason: "identity_changed" | "revision_changed" | "scope_busy";
242
- retryable: false;
243
- status: "conflict";
244
- } | {
245
- reason: "policy_invalid";
246
- retryable: false;
247
- status: "rejected";
248
248
  } | {
249
249
  reason: "provider_pending";
250
250
  retryable: true;
@@ -5,14 +5,6 @@ export declare function savePreparationHandler(ctx: MutationCtx, args: Infer<typ
5
5
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
6
6
  }>;
7
7
  export declare function beginHandler(ctx: MutationCtx, args: Infer<typeof beginArgs>): Promise<{
8
- reason: "identity_changed" | "revision_changed" | "scope_busy";
9
- retryable: false;
10
- status: "conflict";
11
- } | {
12
- reason: "policy_invalid";
13
- retryable: false;
14
- status: "rejected";
15
- } | {
16
8
  operation: {
17
9
  accountId: string;
18
10
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -23,6 +15,14 @@ export declare function beginHandler(ctx: MutationCtx, args: Infer<typeof beginA
23
15
  } | {
24
16
  enabled: boolean;
25
17
  status: "unchanged";
18
+ } | {
19
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
20
+ retryable: false;
21
+ status: "conflict";
22
+ } | {
23
+ reason: "policy_invalid";
24
+ retryable: false;
25
+ status: "rejected";
26
26
  } | {
27
27
  reason: "provider_pending";
28
28
  retryable: true;
@@ -330,14 +330,6 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
330
330
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
331
331
  requestKey: string;
332
332
  result?: {
333
- reason: "identity_changed" | "revision_changed" | "scope_busy";
334
- retryable: false;
335
- status: "conflict";
336
- } | {
337
- reason: "policy_invalid";
338
- retryable: false;
339
- status: "rejected";
340
- } | {
341
333
  operation: {
342
334
  accountId: string;
343
335
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -348,6 +340,14 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
348
340
  } | {
349
341
  enabled: boolean;
350
342
  status: "unchanged";
343
+ } | {
344
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
345
+ retryable: false;
346
+ status: "conflict";
347
+ } | {
348
+ reason: "policy_invalid";
349
+ retryable: false;
350
+ status: "rejected";
351
351
  } | {
352
352
  reason: "provider_pending";
353
353
  retryable: true;
@@ -1497,6 +1497,103 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
1497
1497
  searchIndexes: {};
1498
1498
  vectorIndexes: {};
1499
1499
  };
1500
+ recoveryWorkflowOperations: {
1501
+ document: {
1502
+ _creationTime: number;
1503
+ _id: import("convex/values").GenericId<"recoveryWorkflowOperations">;
1504
+ accountId: string;
1505
+ activePhase?: "execute" | "reconcile" | undefined;
1506
+ allocation?: {
1507
+ adjustmentAmount?: number | undefined;
1508
+ currency: string;
1509
+ gross: number;
1510
+ paymentId?: string | undefined;
1511
+ paymentIntentId?: string | undefined;
1512
+ platformNet: number;
1513
+ processingFee: number;
1514
+ sourceChargeId: string;
1515
+ sourceInvoiceId?: string | undefined;
1516
+ transfers: {
1517
+ amount: number;
1518
+ destinationAccountId: string;
1519
+ role: "affiliate" | "other" | "store";
1520
+ }[];
1521
+ } | undefined;
1522
+ cancelRequested: boolean;
1523
+ completion?: string | undefined;
1524
+ currency: string;
1525
+ definitionVersion: number;
1526
+ groupKey: string;
1527
+ maxAttempts: number;
1528
+ outcome?: "collect" | "release" | undefined;
1529
+ provider: string;
1530
+ providerApiVersion: string;
1531
+ providerStarted: boolean;
1532
+ releaseUncollectible: boolean;
1533
+ resumeQueued: boolean;
1534
+ retryDelayMs: number;
1535
+ scopeKey: string;
1536
+ sourceId: string;
1537
+ sourceKind: "invoice" | "settlement";
1538
+ status: "canceled" | "completed" | "queued" | "running" | "unknown" | "waiting";
1539
+ version: number;
1540
+ workflowId?: string | undefined;
1541
+ };
1542
+ fieldPaths: "_id" | ("_creationTime" | "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");
1543
+ indexes: {
1544
+ by_id: ["_id"];
1545
+ by_creation_time: ["_creationTime"];
1546
+ by_group: ["groupKey", "_creationTime"];
1547
+ by_source: ["sourceKind", "sourceId", "_creationTime"];
1548
+ };
1549
+ searchIndexes: {};
1550
+ vectorIndexes: {};
1551
+ };
1552
+ recoveryWorkflowRequests: {
1553
+ document: {
1554
+ _creationTime: number;
1555
+ _id: import("convex/values").GenericId<"recoveryWorkflowRequests">;
1556
+ binding: {
1557
+ accountId: string;
1558
+ allocation?: {
1559
+ adjustmentAmount?: number | undefined;
1560
+ currency: string;
1561
+ gross: number;
1562
+ paymentId?: string | undefined;
1563
+ paymentIntentId?: string | undefined;
1564
+ platformNet: number;
1565
+ processingFee: number;
1566
+ sourceChargeId: string;
1567
+ sourceInvoiceId?: string | undefined;
1568
+ transfers: {
1569
+ amount: number;
1570
+ destinationAccountId: string;
1571
+ role: "affiliate" | "other" | "store";
1572
+ }[];
1573
+ } | undefined;
1574
+ completion?: string | undefined;
1575
+ currency: string;
1576
+ definitionVersion: number;
1577
+ groupKey: string;
1578
+ maxAttempts: number;
1579
+ provider: string;
1580
+ providerApiVersion: string;
1581
+ releaseUncollectible: boolean;
1582
+ retryDelayMs: number;
1583
+ scopeKey: string;
1584
+ };
1585
+ operationId: import("convex/values").GenericId<"recoveryWorkflowOperations">;
1586
+ requestKey: string;
1587
+ };
1588
+ fieldPaths: "_id" | ("_creationTime" | "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");
1589
+ indexes: {
1590
+ by_id: ["_id"];
1591
+ by_creation_time: ["_creationTime"];
1592
+ by_key: ["requestKey", "_creationTime"];
1593
+ };
1594
+ searchIndexes: {};
1595
+ vectorIndexes: {};
1596
+ };
1500
1597
  refunds: {
1501
1598
  document: {
1502
1599
  _creationTime: number;
@@ -2028,14 +2125,6 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
2028
2125
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
2029
2126
  requestKey: string;
2030
2127
  result?: {
2031
- reason: "identity_changed" | "revision_changed" | "scope_busy";
2032
- retryable: false;
2033
- status: "conflict";
2034
- } | {
2035
- reason: "policy_invalid";
2036
- retryable: false;
2037
- status: "rejected";
2038
- } | {
2039
2128
  operation: {
2040
2129
  accountId: string;
2041
2130
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -2046,6 +2135,14 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
2046
2135
  } | {
2047
2136
  enabled: boolean;
2048
2137
  status: "unchanged";
2138
+ } | {
2139
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
2140
+ retryable: false;
2141
+ status: "conflict";
2142
+ } | {
2143
+ reason: "policy_invalid";
2144
+ retryable: false;
2145
+ status: "rejected";
2049
2146
  } | {
2050
2147
  reason: "provider_pending";
2051
2148
  retryable: true;
@@ -3195,6 +3292,103 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
3195
3292
  searchIndexes: {};
3196
3293
  vectorIndexes: {};
3197
3294
  };
3295
+ recoveryWorkflowOperations: {
3296
+ document: {
3297
+ _creationTime: number;
3298
+ _id: import("convex/values").GenericId<"recoveryWorkflowOperations">;
3299
+ accountId: string;
3300
+ activePhase?: "execute" | "reconcile" | undefined;
3301
+ allocation?: {
3302
+ adjustmentAmount?: number | undefined;
3303
+ currency: string;
3304
+ gross: number;
3305
+ paymentId?: string | undefined;
3306
+ paymentIntentId?: string | undefined;
3307
+ platformNet: number;
3308
+ processingFee: number;
3309
+ sourceChargeId: string;
3310
+ sourceInvoiceId?: string | undefined;
3311
+ transfers: {
3312
+ amount: number;
3313
+ destinationAccountId: string;
3314
+ role: "affiliate" | "other" | "store";
3315
+ }[];
3316
+ } | undefined;
3317
+ cancelRequested: boolean;
3318
+ completion?: string | undefined;
3319
+ currency: string;
3320
+ definitionVersion: number;
3321
+ groupKey: string;
3322
+ maxAttempts: number;
3323
+ outcome?: "collect" | "release" | undefined;
3324
+ provider: string;
3325
+ providerApiVersion: string;
3326
+ providerStarted: boolean;
3327
+ releaseUncollectible: boolean;
3328
+ resumeQueued: boolean;
3329
+ retryDelayMs: number;
3330
+ scopeKey: string;
3331
+ sourceId: string;
3332
+ sourceKind: "invoice" | "settlement";
3333
+ status: "canceled" | "completed" | "queued" | "running" | "unknown" | "waiting";
3334
+ version: number;
3335
+ workflowId?: string | undefined;
3336
+ };
3337
+ fieldPaths: "_id" | ("_creationTime" | "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");
3338
+ indexes: {
3339
+ by_id: ["_id"];
3340
+ by_creation_time: ["_creationTime"];
3341
+ by_group: ["groupKey", "_creationTime"];
3342
+ by_source: ["sourceKind", "sourceId", "_creationTime"];
3343
+ };
3344
+ searchIndexes: {};
3345
+ vectorIndexes: {};
3346
+ };
3347
+ recoveryWorkflowRequests: {
3348
+ document: {
3349
+ _creationTime: number;
3350
+ _id: import("convex/values").GenericId<"recoveryWorkflowRequests">;
3351
+ binding: {
3352
+ accountId: string;
3353
+ allocation?: {
3354
+ adjustmentAmount?: number | undefined;
3355
+ currency: string;
3356
+ gross: number;
3357
+ paymentId?: string | undefined;
3358
+ paymentIntentId?: string | undefined;
3359
+ platformNet: number;
3360
+ processingFee: number;
3361
+ sourceChargeId: string;
3362
+ sourceInvoiceId?: string | undefined;
3363
+ transfers: {
3364
+ amount: number;
3365
+ destinationAccountId: string;
3366
+ role: "affiliate" | "other" | "store";
3367
+ }[];
3368
+ } | undefined;
3369
+ completion?: string | undefined;
3370
+ currency: string;
3371
+ definitionVersion: number;
3372
+ groupKey: string;
3373
+ maxAttempts: number;
3374
+ provider: string;
3375
+ providerApiVersion: string;
3376
+ releaseUncollectible: boolean;
3377
+ retryDelayMs: number;
3378
+ scopeKey: string;
3379
+ };
3380
+ operationId: import("convex/values").GenericId<"recoveryWorkflowOperations">;
3381
+ requestKey: string;
3382
+ };
3383
+ fieldPaths: "_id" | ("_creationTime" | "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");
3384
+ indexes: {
3385
+ by_id: ["_id"];
3386
+ by_creation_time: ["_creationTime"];
3387
+ by_key: ["requestKey", "_creationTime"];
3388
+ };
3389
+ searchIndexes: {};
3390
+ vectorIndexes: {};
3391
+ };
3198
3392
  refunds: {
3199
3393
  document: {
3200
3394
  _creationTime: number;
@@ -1 +1 @@
1
- {"version":3,"file":"triggers.d.ts","sourceRoot":"","sources":["../../../src/component/earnings/triggers.ts"],"names":[],"mappings":"AA6GA,eAAO,MAAM,Q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ownerKey: string;
165
165
  }, Promise<{
166
- transfers?: undefined;
167
- claims?: undefined;
168
166
  status: "held";
169
167
  reason: "snapshot_limit";
168
+ transfers?: undefined;
169
+ claims?: undefined;
170
170
  } | {
171
171
  reason?: undefined;
172
172
  status: "ready";
@@ -1 +1 @@
1
- {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/component/payoutRelease/queries.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAIlB,CAAC;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAiBd,CAAC;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BlB,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;GAQf,CAAC;AAEH,4FAA4F;AAC5F,eAAO,MAAM,QAAQ;;;;;;YAsBE,MAAM;YAAmB,gBAAgB;;;YAS3C,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAE1B,CAAC"}
1
+ {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/component/payoutRelease/queries.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAIlB,CAAC;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAiBd,CAAC;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BlB,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;GAQf,CAAC;AAEH,4FAA4F;AAC5F,eAAO,MAAM,QAAQ;;;;YAsBE,MAAM;YAAmB,gBAAgB;;;;;YAS3C,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAE1B,CAAC"}
@@ -0,0 +1,21 @@
1
+ export declare const invoke: import("convex/server").RegisteredAction<"internal", {
2
+ accountId: string;
3
+ currency: string;
4
+ groupKey: string;
5
+ operationId: import("convex/values").GenericId<"recoveryWorkflowOperations">;
6
+ phase: "execute" | "reconcile";
7
+ scopeKey: string;
8
+ version: number;
9
+ }, Promise<{
10
+ outcome: "collect" | "release";
11
+ status: "ready";
12
+ } | {
13
+ reason: "provider_pending";
14
+ status: "not_ready";
15
+ } | {
16
+ reason: "provider_outcome_unknown";
17
+ status: "unknown";
18
+ } | {
19
+ status: "canceled";
20
+ }>>;
21
+ //# sourceMappingURL=bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../../../src/component/recoveryWorkflow/bridge.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;GAwDjB,CAAC"}
@@ -0,0 +1,52 @@
1
+ import { anyApi } from "convex/server";
2
+ import { internalAction } from "../_generated/server.js";
3
+ import { refFields, phase, receipt } from "./schema.js";
4
+ import { same } from "./helpers.js";
5
+ const unknown = {
6
+ status: "unknown",
7
+ reason: "provider_outcome_unknown",
8
+ };
9
+ export const invoke = internalAction({
10
+ args: { ...refFields, phase },
11
+ returns: receipt,
12
+ handler: async (ctx, args) => {
13
+ try {
14
+ const { phase: _phase, ...ref } = args;
15
+ const op = await ctx.runQuery(anyApi.recoveryWorkflow.queries.saved, ref);
16
+ if (!(await ctx.runMutation(anyApi.recoveryWorkflow.steps.beginProvider, args)))
17
+ return { status: "canceled" };
18
+ const request = {
19
+ ...args,
20
+ providerApiVersion: op.providerApiVersion,
21
+ definitionVersion: op.definitionVersion,
22
+ };
23
+ const result = await ctx.runAction(op.provider, request);
24
+ if (!result || typeof result !== "object" || Array.isArray(result))
25
+ return unknown;
26
+ const r = result;
27
+ const allowed = [
28
+ ...Object.keys(request),
29
+ "sourceId",
30
+ "status",
31
+ "outcome",
32
+ "reason",
33
+ ];
34
+ if (Object.keys(r).some((k) => !allowed.includes(k)) ||
35
+ !same(Object.fromEntries(Object.keys(request).map((k) => [k, r[k]])), request) ||
36
+ r.sourceId !== op.sourceId)
37
+ return unknown;
38
+ if (r.status === "ready" &&
39
+ (r.outcome === "collect" || r.outcome === "release") &&
40
+ (op.sourceKind !== "settlement" || r.outcome === "collect"))
41
+ return { status: "ready", outcome: r.outcome };
42
+ if (r.status === "not_ready" && r.reason === "provider_pending")
43
+ return { status: "not_ready", reason: "provider_pending" };
44
+ return unknown;
45
+ }
46
+ catch {
47
+ // Never allow an SDK exception, response object, or host payload into Workflow history.
48
+ return unknown;
49
+ }
50
+ },
51
+ });
52
+ //# sourceMappingURL=bridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridge.js","sourceRoot":"","sources":["../../../src/component/recoveryWorkflow/bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAuB,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,MAAM,OAAO,GAAG;IACd,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,0BAA0B;CAC1B,CAAC;AACX,MAAM,CAAC,MAAM,MAAM,GAAG,cAAc,CAAC;IACnC,IAAI,EAAE,EAAE,GAAG,SAAS,EAAE,KAAK,EAAE;IAC7B,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAkC,EAAE;QAC3D,IAAI,CAAC;YACH,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,G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AAK,EAAE,CAAC,QAAQ;gBAE1B,OAAO,OAAO,CAAC;YACjB,IACE,CAAC,CAAC,MAAM,KAAK,OAAO;gBACpB,CAAC,CAAC,CAAC,OAAO,KAAK,SAAS,IAAI,CAAC,CAAC,OAAO,KAAK,SAAS,CAAC;gBACpD,CAAC,EAAE,CAAC,UAAU,KAAK,YAAY,IAAI,CAAC,CAAC,OAAO,KAAK,SAAS,CAAC;gBAE3D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;YACjD,IAAI,CAAC,CAAC,MAAM,KAAK,WAAW,IAAI,CAAC,CAAC,MAAM,KAAK,kBAAkB;gBAC7D,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC;YAC7D,OAAO,OAAO,CAAC;QACjB,CAAC;QAAC,MAAM,CAAC;YACP,wFAAwF;YACxF,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,83 @@
1
+ import type { Doc } from "../_generated/dataModel.js";
2
+ import type { QueryCtx, MutationCtx } from "../_generated/server.js";
3
+ import type { Infer } from "convex/values";
4
+ declare const _ref: import("convex/values").VObject<{
5
+ accountId: string;
6
+ currency: string;
7
+ groupKey: string;
8
+ operationId: import("convex/values").GenericId<"recoveryWorkflowOperations">;
9
+ scopeKey: string;
10
+ version: number;
11
+ }, {
12
+ accountId: import("convex/values").VString<string, "required">;
13
+ scopeKey: import("convex/values").VString<string, "required">;
14
+ currency: import("convex/values").VString<string, "required">;
15
+ groupKey: import("convex/values").VString<string, "required">;
16
+ operationId: import("convex/values").VId<import("convex/values").GenericId<"recoveryWorkflowOperations">, "required">;
17
+ version: import("convex/values").VFloat64<number, "required">;
18
+ }, "required", "accountId" | "currency" | "groupKey" | "operationId" | "scopeKey" | "version">;
19
+ export type OperationRef = Infer<typeof _ref>;
20
+ export declare const identityConflict: {
21
+ readonly status: "conflict";
22
+ readonly reason: "identity_changed";
23
+ readonly retryable: false;
24
+ };
25
+ export declare function reference(op: Doc<"recoveryWorkflowOperations">): OperationRef;
26
+ export declare function status(op: Doc<"recoveryWorkflowOperations">): {
27
+ sourceKind: "invoice" | "settlement";
28
+ sourceId: string;
29
+ status: "canceled" | "completed" | "queued" | "running" | "unknown" | "waiting";
30
+ cancelRequested: boolean;
31
+ outcome?: "collect" | "release" | undefined;
32
+ accountId: string;
33
+ currency: string;
34
+ groupKey: string;
35
+ operationId: import("convex/values").GenericId<"recoveryWorkflowOperations">;
36
+ scopeKey: string;
37
+ version: number;
38
+ };
39
+ export declare function read(ctx: QueryCtx | MutationCtx, args: OperationRef): Promise<{
40
+ _creationTime: number;
41
+ _id: import("convex/values").GenericId<"recoveryWorkflowOperations">;
42
+ accountId: string;
43
+ activePhase?: "execute" | "reconcile" | undefined;
44
+ allocation?: {
45
+ adjustmentAmount?: number | undefined;
46
+ currency: string;
47
+ gross: number;
48
+ paymentId?: string | undefined;
49
+ paymentIntentId?: string | undefined;
50
+ platformNet: number;
51
+ processingFee: number;
52
+ sourceChargeId: string;
53
+ sourceInvoiceId?: string | undefined;
54
+ transfers: {
55
+ amount: number;
56
+ destinationAccountId: string;
57
+ role: "affiliate" | "other" | "store";
58
+ }[];
59
+ } | undefined;
60
+ cancelRequested: boolean;
61
+ completion?: string | undefined;
62
+ currency: string;
63
+ definitionVersion: number;
64
+ groupKey: string;
65
+ maxAttempts: number;
66
+ outcome?: "collect" | "release" | undefined;
67
+ provider: string;
68
+ providerApiVersion: string;
69
+ providerStarted: boolean;
70
+ releaseUncollectible: boolean;
71
+ resumeQueued: boolean;
72
+ retryDelayMs: number;
73
+ scopeKey: string;
74
+ sourceId: string;
75
+ sourceKind: "invoice" | "settlement";
76
+ status: "canceled" | "completed" | "queued" | "running" | "unknown" | "waiting";
77
+ version: number;
78
+ workflowId?: string | undefined;
79
+ }>;
80
+ /** Stable object ordering without admitting arbitrary durable caller payloads. */
81
+ export declare function same(a: unknown, b: unknown): boolean;
82
+ export {};
83
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/component/recoveryWorkflow/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAG3C,QAAA,MAAM,IAAI;;;;;;;;;;;;;;8FAAsB,CAAC;AACjC,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAC9C,eAAO,MAAM,gBAAgB;aAC3B,MAAM,EAAE,UAAU;aAClB,MAAM,EAAE,kBAAkB;aAC1B,SAAS;CACD,CAAC;AACX,wBAAgB,SAAS,CAAC,EAAE,EAAE,GAAG,CAAC,4BAA4B,CAAC,GAAG,YAAY,CAS7E;AACD,wBAAgB,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,4BAA4B,CAAC;;;;;;;;;;;;EAS3D;AACD,wBAAsB,IAAI,CAAC,GAAG,EAAE,QAAQ,GAAG,WAAW,EAAE,IAAI,EAAE,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAUzE;AACD,kFAAkF;AAClF,wBAAgB,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAapD"}
@@ -0,0 +1,48 @@
1
+ import { v } from "convex/values";
2
+ import { refFields } from "./schema.js";
3
+ const _ref = v.object(refFields);
4
+ export const identityConflict = {
5
+ status: "conflict",
6
+ reason: "identity_changed",
7
+ retryable: false,
8
+ };
9
+ export function reference(op) {
10
+ return {
11
+ accountId: op.accountId,
12
+ scopeKey: op.scopeKey,
13
+ currency: op.currency,
14
+ groupKey: op.groupKey,
15
+ operationId: op._id,
16
+ version: op.version,
17
+ };
18
+ }
19
+ export function status(op) {
20
+ return {
21
+ ...reference(op),
22
+ sourceKind: op.sourceKind,
23
+ sourceId: op.sourceId,
24
+ status: op.status,
25
+ cancelRequested: op.cancelRequested,
26
+ ...(op.outcome ? { outcome: op.outcome } : {}),
27
+ };
28
+ }
29
+ export async function read(ctx, args) {
30
+ const op = await ctx.db.get("recoveryWorkflowOperations", args.operationId);
31
+ if (!op ||
32
+ Object.entries(reference(op)).some(([k, value]) => value !== args[k]))
33
+ throw new Error("Recovery operation identity does not match.");
34
+ return op;
35
+ }
36
+ /** Stable object ordering without admitting arbitrary durable caller payloads. */
37
+ export function same(a, b) {
38
+ const canonical = (x) => Array.isArray(x)
39
+ ? x.map(canonical)
40
+ : x && typeof x === "object"
41
+ ? Object.fromEntries(Object.entries(x)
42
+ .filter(([, v]) => v !== undefined)
43
+ .sort(([a], [b]) => a.localeCompare(b))
44
+ .map(([k, v]) => [k, canonical(v)]))
45
+ : x;
46
+ return JSON.stringify(canonical(a)) === JSON.stringify(canonical(b));
47
+ }
48
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/component/recoveryWorkflow/helpers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AAEjC,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,MAAM,EAAE,UAAU;IAClB,MAAM,EAAE,kBAAkB;IAC1B,SAAS,EAAE,KAAK;CACR,CAAC;AACX,MAAM,UAAU,SAAS,CAAC,EAAqC;IAC7D,OAAO;QACL,SAAS,EAAE,EAAE,CAAC,SAAS;QACvB,QAAQ,EAAE,EAAE,CAAC,QAAQ;QACrB,QAAQ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