@fantastic.dev/better-stripe 0.40.0 → 0.42.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.
- package/CHANGELOG.md +20 -0
- package/README.md +1 -1
- package/dist/client/balanceFundingWorkflow/client.d.ts +172 -0
- package/dist/client/balanceFundingWorkflow/client.d.ts.map +1 -0
- package/dist/client/balanceFundingWorkflow/client.js +289 -0
- package/dist/client/balanceFundingWorkflow/client.js.map +1 -0
- package/dist/client/billing/balanceFunding.d.ts +5 -0
- package/dist/client/billing/balanceFunding.d.ts.map +1 -1
- package/dist/client/billing/balanceFunding.js +30 -0
- package/dist/client/billing/balanceFunding.js.map +1 -1
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +808 -2
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts +404 -1
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +808 -2
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutSyncTestHelpers.d.ts +404 -1
- package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
- package/dist/client/costRecovery-invoices.d.ts +2 -2
- package/dist/client/costRecovery-invoices.d.ts.map +1 -1
- package/dist/client/costRecovery-invoices.js +4 -1
- package/dist/client/costRecovery-invoices.js.map +1 -1
- package/dist/client/costRecovery.d.ts +5 -2
- package/dist/client/costRecovery.d.ts.map +1 -1
- package/dist/client/costRecovery.js +3 -1
- package/dist/client/costRecovery.js.map +1 -1
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +4 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/recoveryWorkflow/client.d.ts +14 -0
- package/dist/client/recoveryWorkflow/client.d.ts.map +1 -0
- package/dist/client/recoveryWorkflow/client.js +34 -0
- package/dist/client/recoveryWorkflow/client.js.map +1 -0
- package/dist/client/recoveryWorkflow/contracts.d.ts +63 -0
- package/dist/client/recoveryWorkflow/contracts.d.ts.map +1 -0
- package/dist/client/recoveryWorkflow/contracts.js +11 -0
- package/dist/client/recoveryWorkflow/contracts.js.map +1 -0
- package/dist/client/recoveryWorkflow/provider.d.ts +10 -0
- package/dist/client/recoveryWorkflow/provider.d.ts.map +1 -0
- package/dist/client/recoveryWorkflow/provider.js +80 -0
- package/dist/client/recoveryWorkflow/provider.js.map +1 -0
- package/dist/client/recoveryWorkflow/settlement.d.ts +6 -0
- package/dist/client/recoveryWorkflow/settlement.d.ts.map +1 -0
- package/dist/client/recoveryWorkflow/settlement.js +43 -0
- package/dist/client/recoveryWorkflow/settlement.js.map +1 -0
- package/dist/component/_generated/api.d.ts +30 -0
- package/dist/component/_generated/api.d.ts.map +1 -1
- package/dist/component/_generated/api.js.map +1 -1
- package/dist/component/_generated/component.d.ts +637 -0
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/balanceFunding/helpers.d.ts +42 -0
- package/dist/component/balanceFunding/helpers.d.ts.map +1 -1
- package/dist/component/balanceFunding/internal/actions.d.ts +39 -0
- package/dist/component/balanceFunding/internal/actions.d.ts.map +1 -0
- package/dist/component/balanceFunding/internal/actions.js +80 -0
- package/dist/component/balanceFunding/internal/actions.js.map +1 -0
- package/dist/component/balanceFunding/internal/mutations.d.ts +55 -0
- package/dist/component/balanceFunding/internal/mutations.d.ts.map +1 -0
- package/dist/component/balanceFunding/internal/mutations.js +54 -0
- package/dist/component/balanceFunding/internal/mutations.js.map +1 -0
- package/dist/component/balanceFunding/internal/queries.d.ts +116 -0
- package/dist/component/balanceFunding/internal/queries.d.ts.map +1 -0
- package/dist/component/balanceFunding/internal/queries.js +35 -0
- package/dist/component/balanceFunding/internal/queries.js.map +1 -0
- package/dist/component/balanceFunding/internal/workflow.d.ts +10 -0
- package/dist/component/balanceFunding/internal/workflow.d.ts.map +1 -0
- package/dist/component/balanceFunding/internal/workflow.js +31 -0
- package/dist/component/balanceFunding/internal/workflow.js.map +1 -0
- package/dist/component/balanceFunding/lifecycleHandlers.d.ts +126 -0
- package/dist/component/balanceFunding/lifecycleHandlers.d.ts.map +1 -1
- package/dist/component/balanceFunding/mutations.d.ts +419 -16
- package/dist/component/balanceFunding/mutations.d.ts.map +1 -1
- package/dist/component/balanceFunding/mutations.js +24 -0
- package/dist/component/balanceFunding/mutations.js.map +1 -1
- package/dist/component/balanceFunding/preparationHandlers.d.ts +42 -0
- package/dist/component/balanceFunding/preparationHandlers.d.ts.map +1 -1
- package/dist/component/balanceFunding/queries.d.ts +78 -0
- package/dist/component/balanceFunding/queries.d.ts.map +1 -1
- package/dist/component/balanceFunding/queries.js +35 -0
- package/dist/component/balanceFunding/queries.js.map +1 -1
- package/dist/component/balanceFunding/receipt.d.ts +5 -0
- package/dist/component/balanceFunding/receipt.d.ts.map +1 -0
- package/dist/component/balanceFunding/receipt.js +37 -0
- package/dist/component/balanceFunding/receipt.js.map +1 -0
- package/dist/component/balanceFunding/schema.d.ts +506 -2
- package/dist/component/balanceFunding/schema.d.ts.map +1 -1
- package/dist/component/balanceFunding/schema.js +2 -0
- package/dist/component/balanceFunding/schema.js.map +1 -1
- package/dist/component/balanceFunding/stateHandlers.d.ts +42 -0
- package/dist/component/balanceFunding/stateHandlers.d.ts.map +1 -1
- package/dist/component/balanceFunding/workflowControl.d.ts +19 -0
- package/dist/component/balanceFunding/workflowControl.d.ts.map +1 -0
- package/dist/component/balanceFunding/workflowControl.js +149 -0
- package/dist/component/balanceFunding/workflowControl.js.map +1 -0
- package/dist/component/balanceFunding/workflowSchema.d.ts +356 -0
- package/dist/component/balanceFunding/workflowSchema.d.ts.map +1 -0
- package/dist/component/balanceFunding/workflowSchema.js +48 -0
- package/dist/component/balanceFunding/workflowSchema.js.map +1 -0
- package/dist/component/balanceFunding/workflowState.d.ts +157 -0
- package/dist/component/balanceFunding/workflowState.d.ts.map +1 -0
- package/dist/component/balanceFunding/workflowState.js +194 -0
- package/dist/component/balanceFunding/workflowState.js.map +1 -0
- package/dist/component/balanceFunding/workflowValidators.d.ts +306 -0
- package/dist/component/balanceFunding/workflowValidators.d.ts.map +1 -0
- package/dist/component/balanceFunding/workflowValidators.js +27 -0
- package/dist/component/balanceFunding/workflowValidators.js.map +1 -0
- package/dist/component/earnings/triggers.d.ts +280 -2
- package/dist/component/earnings/triggers.d.ts.map +1 -1
- package/dist/component/payoutRelease/queries.d.ts +2 -2
- package/dist/component/payoutRelease/queries.d.ts.map +1 -1
- package/dist/component/recoveryWorkflow/bridge.d.ts +21 -0
- package/dist/component/recoveryWorkflow/bridge.d.ts.map +1 -0
- package/dist/component/recoveryWorkflow/bridge.js +52 -0
- package/dist/component/recoveryWorkflow/bridge.js.map +1 -0
- package/dist/component/recoveryWorkflow/helpers.d.ts +83 -0
- package/dist/component/recoveryWorkflow/helpers.d.ts.map +1 -0
- package/dist/component/recoveryWorkflow/helpers.js +48 -0
- package/dist/component/recoveryWorkflow/helpers.js.map +1 -0
- package/dist/component/recoveryWorkflow/mutations.d.ts +91 -0
- package/dist/component/recoveryWorkflow/mutations.d.ts.map +1 -0
- package/dist/component/recoveryWorkflow/mutations.js +177 -0
- package/dist/component/recoveryWorkflow/mutations.js.map +1 -0
- package/dist/component/recoveryWorkflow/queries.d.ts +118 -0
- package/dist/component/recoveryWorkflow/queries.d.ts.map +1 -0
- package/dist/component/recoveryWorkflow/queries.js +20 -0
- package/dist/component/recoveryWorkflow/queries.js.map +1 -0
- package/dist/component/recoveryWorkflow/schema.d.ts +653 -0
- package/dist/component/recoveryWorkflow/schema.d.ts.map +1 -0
- package/dist/component/recoveryWorkflow/schema.js +81 -0
- package/dist/component/recoveryWorkflow/schema.js.map +1 -0
- package/dist/component/recoveryWorkflow/steps.d.ts +70 -0
- package/dist/component/recoveryWorkflow/steps.d.ts.map +1 -0
- package/dist/component/recoveryWorkflow/steps.js +94 -0
- package/dist/component/recoveryWorkflow/steps.js.map +1 -0
- package/dist/component/recoveryWorkflow/workflow.d.ts +22 -0
- package/dist/component/recoveryWorkflow/workflow.d.ts.map +1 -0
- package/dist/component/recoveryWorkflow/workflow.js +56 -0
- package/dist/component/recoveryWorkflow/workflow.js.map +1 -0
- package/dist/component/schema.d.ts +404 -1
- package/dist/component/schema.js +3 -0
- package/dist/component/schema.js.map +1 -1
- package/package.json +1 -1
- package/src/client/balanceFundingWorkflow/capture.test.ts +144 -0
- package/src/client/balanceFundingWorkflow/client.ts +419 -0
- package/src/client/billing/balanceFunding.ts +50 -0
- package/src/client/costRecovery-invoices.ts +6 -0
- package/src/client/costRecovery.ts +8 -3
- package/src/client/index.ts +15 -0
- package/src/client/recoveryWorkflow/client.test.ts +37 -0
- package/src/client/recoveryWorkflow/client.ts +76 -0
- package/src/client/recoveryWorkflow/contracts.ts +72 -0
- package/src/client/recoveryWorkflow/provider.test.ts +424 -0
- package/src/client/recoveryWorkflow/provider.ts +119 -0
- package/src/client/recoveryWorkflow/settlement.ts +67 -0
- package/src/component/_generated/api.ts +30 -0
- package/src/component/_generated/component.ts +746 -0
- package/src/component/balanceFunding/internal/actions.ts +107 -0
- package/src/component/balanceFunding/internal/mutations.ts +66 -0
- package/src/component/balanceFunding/internal/queries.ts +34 -0
- package/src/component/balanceFunding/internal/workflow.ts +49 -0
- package/src/component/balanceFunding/mutations.ts +34 -0
- package/src/component/balanceFunding/queries.ts +38 -0
- package/src/component/balanceFunding/receipt.ts +48 -0
- package/src/component/balanceFunding/schema.ts +2 -0
- package/src/component/balanceFunding/scopeLookup.test.ts +94 -0
- package/src/component/balanceFunding/workflow.fixtures.ts +366 -0
- package/src/component/balanceFunding/workflow.test.ts +552 -0
- package/src/component/balanceFunding/workflowControl.ts +198 -0
- package/src/component/balanceFunding/workflowSchema.ts +78 -0
- package/src/component/balanceFunding/workflowState.ts +285 -0
- package/src/component/balanceFunding/workflowValidators.ts +40 -0
- package/src/component/recoveryWorkflow/bridge.test.ts +481 -0
- package/src/component/recoveryWorkflow/bridge.ts +66 -0
- package/src/component/recoveryWorkflow/helpers.ts +58 -0
- package/src/component/recoveryWorkflow/journal.test.ts +104 -0
- package/src/component/recoveryWorkflow/mutations.ts +224 -0
- package/src/component/recoveryWorkflow/queries.ts +19 -0
- package/src/component/recoveryWorkflow/schema.ts +92 -0
- package/src/component/recoveryWorkflow/state.test.ts +191 -0
- package/src/component/recoveryWorkflow/steps.ts +97 -0
- package/src/component/recoveryWorkflow/workflow.ts +73 -0
- package/src/component/schema.ts +6 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export declare const start: import("convex/server").RegisteredMutation<"public", {
|
|
2
|
+
accountId: string;
|
|
3
|
+
allocation?: {
|
|
4
|
+
adjustmentAmount?: number | undefined;
|
|
5
|
+
currency: string;
|
|
6
|
+
gross: number;
|
|
7
|
+
paymentId?: string | undefined;
|
|
8
|
+
paymentIntentId?: string | undefined;
|
|
9
|
+
platformNet: number;
|
|
10
|
+
processingFee: number;
|
|
11
|
+
sourceChargeId: string;
|
|
12
|
+
sourceInvoiceId?: string | undefined;
|
|
13
|
+
transfers: {
|
|
14
|
+
amount: number;
|
|
15
|
+
destinationAccountId: string;
|
|
16
|
+
role: "affiliate" | "other" | "store";
|
|
17
|
+
}[];
|
|
18
|
+
} | undefined;
|
|
19
|
+
completion?: string | undefined;
|
|
20
|
+
currency: string;
|
|
21
|
+
definitionVersion: number;
|
|
22
|
+
groupKey: string;
|
|
23
|
+
maxAttempts: number;
|
|
24
|
+
provider: string;
|
|
25
|
+
providerApiVersion: string;
|
|
26
|
+
releaseUncollectible: boolean;
|
|
27
|
+
requestKey: string;
|
|
28
|
+
retryDelayMs: number;
|
|
29
|
+
scopeKey: string;
|
|
30
|
+
}, Promise<{
|
|
31
|
+
readonly status: "conflict";
|
|
32
|
+
readonly reason: "identity_changed";
|
|
33
|
+
readonly retryable: false;
|
|
34
|
+
} | {
|
|
35
|
+
sourceKind: "invoice" | "settlement";
|
|
36
|
+
sourceId: string;
|
|
37
|
+
status: "canceled" | "completed" | "queued" | "running" | "unknown" | "waiting";
|
|
38
|
+
cancelRequested: boolean;
|
|
39
|
+
outcome?: "collect" | "release" | undefined;
|
|
40
|
+
accountId: string;
|
|
41
|
+
currency: string;
|
|
42
|
+
groupKey: string;
|
|
43
|
+
operationId: import("convex/values").GenericId<"recoveryWorkflowOperations">;
|
|
44
|
+
scopeKey: string;
|
|
45
|
+
version: number;
|
|
46
|
+
} | {
|
|
47
|
+
readonly status: "not_ready";
|
|
48
|
+
readonly reason: "history_incomplete";
|
|
49
|
+
readonly retryable: true;
|
|
50
|
+
}>>;
|
|
51
|
+
export declare const requestCancel: import("convex/server").RegisteredMutation<"public", {
|
|
52
|
+
accountId: string;
|
|
53
|
+
currency: string;
|
|
54
|
+
groupKey: string;
|
|
55
|
+
operationId: import("convex/values").GenericId<"recoveryWorkflowOperations">;
|
|
56
|
+
scopeKey: string;
|
|
57
|
+
version: number;
|
|
58
|
+
}, Promise<{
|
|
59
|
+
sourceKind: "invoice" | "settlement";
|
|
60
|
+
sourceId: string;
|
|
61
|
+
status: "canceled" | "completed" | "queued" | "running" | "unknown" | "waiting";
|
|
62
|
+
cancelRequested: boolean;
|
|
63
|
+
outcome?: "collect" | "release" | undefined;
|
|
64
|
+
accountId: string;
|
|
65
|
+
currency: string;
|
|
66
|
+
groupKey: string;
|
|
67
|
+
operationId: import("convex/values").GenericId<"recoveryWorkflowOperations">;
|
|
68
|
+
scopeKey: string;
|
|
69
|
+
version: number;
|
|
70
|
+
}>>;
|
|
71
|
+
export declare const resume: import("convex/server").RegisteredMutation<"public", {
|
|
72
|
+
accountId: string;
|
|
73
|
+
currency: string;
|
|
74
|
+
groupKey: string;
|
|
75
|
+
operationId: import("convex/values").GenericId<"recoveryWorkflowOperations">;
|
|
76
|
+
scopeKey: string;
|
|
77
|
+
version: number;
|
|
78
|
+
}, Promise<{
|
|
79
|
+
sourceKind: "invoice" | "settlement";
|
|
80
|
+
sourceId: string;
|
|
81
|
+
status: "canceled" | "completed" | "queued" | "running" | "unknown" | "waiting";
|
|
82
|
+
cancelRequested: boolean;
|
|
83
|
+
outcome?: "collect" | "release" | undefined;
|
|
84
|
+
accountId: string;
|
|
85
|
+
currency: string;
|
|
86
|
+
groupKey: string;
|
|
87
|
+
operationId: import("convex/values").GenericId<"recoveryWorkflowOperations">;
|
|
88
|
+
scopeKey: string;
|
|
89
|
+
version: number;
|
|
90
|
+
}>>;
|
|
91
|
+
//# sourceMappingURL=mutations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../../src/component/recoveryWorkflow/mutations.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA6DF,WAAW;qBACX,oBAAoB;;GAwElC,CAAC;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;GAYxB,CAAC;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;GAyDjB,CAAC"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { allocationFields } from "../settlement/schema.js";
|
|
2
|
+
import { anyApi } from "convex/server";
|
|
3
|
+
import { mutation } from "../_generated/server.js";
|
|
4
|
+
import { executionWorkflow } from "../durableExecution/runtime.js";
|
|
5
|
+
import { validateScope } from "../costRecovery/helpers.js";
|
|
6
|
+
import { bindingFields, startFields, startResult, refFields, safeStatus, } from "./schema.js";
|
|
7
|
+
import { identityConflict, read, reference, same, status } from "./helpers.js";
|
|
8
|
+
const workflow = anyApi.recoveryWorkflow.workflow.run;
|
|
9
|
+
export const start = mutation({
|
|
10
|
+
args: startFields,
|
|
11
|
+
returns: startResult,
|
|
12
|
+
handler: async (ctx, args) => {
|
|
13
|
+
validateScope(args);
|
|
14
|
+
if (!args.requestKey ||
|
|
15
|
+
!args.provider ||
|
|
16
|
+
!/^\d{4}-\d{2}-\d{2}\.[a-z][a-z0-9_.-]*$/.test(args.providerApiVersion) ||
|
|
17
|
+
args.definitionVersion !== 1 ||
|
|
18
|
+
!Number.isSafeInteger(args.maxAttempts) ||
|
|
19
|
+
args.maxAttempts < 1 ||
|
|
20
|
+
args.maxAttempts > 20 ||
|
|
21
|
+
!Number.isSafeInteger(args.retryDelayMs) ||
|
|
22
|
+
args.retryDelayMs < 1 ||
|
|
23
|
+
args.retryDelayMs > 86400000)
|
|
24
|
+
throw new Error("Invalid recovery workflow policy.");
|
|
25
|
+
const { requestKey, ...binding } = args;
|
|
26
|
+
const request = await ctx.db
|
|
27
|
+
.query("recoveryWorkflowRequests")
|
|
28
|
+
.withIndex("by_key", (q) => q.eq("requestKey", requestKey))
|
|
29
|
+
.unique();
|
|
30
|
+
if (request) {
|
|
31
|
+
if (!same(request.binding, binding))
|
|
32
|
+
return identityConflict;
|
|
33
|
+
return status((await ctx.db.get("recoveryWorkflowOperations", request.operationId)));
|
|
34
|
+
}
|
|
35
|
+
const group = await ctx.db
|
|
36
|
+
.query("recoveryGroups")
|
|
37
|
+
.withIndex("by_key", (q) => q.eq("groupKey", args.groupKey))
|
|
38
|
+
.unique();
|
|
39
|
+
if (!group ||
|
|
40
|
+
group.accountId !== args.accountId ||
|
|
41
|
+
group.scopeKey !== args.scopeKey ||
|
|
42
|
+
group.currency !== args.currency)
|
|
43
|
+
return identityConflict;
|
|
44
|
+
const existing = await ctx.db
|
|
45
|
+
.query("recoveryWorkflowOperations")
|
|
46
|
+
.withIndex("by_group", (q) => q.eq("groupKey", args.groupKey))
|
|
47
|
+
.unique();
|
|
48
|
+
if (existing) {
|
|
49
|
+
const saved = Object.fromEntries(Object.keys(bindingFields).map((k) => [
|
|
50
|
+
k,
|
|
51
|
+
existing[k],
|
|
52
|
+
]));
|
|
53
|
+
if (!same(saved, binding))
|
|
54
|
+
return identityConflict;
|
|
55
|
+
await ctx.db.insert("recoveryWorkflowRequests", {
|
|
56
|
+
requestKey,
|
|
57
|
+
binding,
|
|
58
|
+
operationId: existing._id,
|
|
59
|
+
});
|
|
60
|
+
return status(existing);
|
|
61
|
+
}
|
|
62
|
+
if (group.status !== "sealed")
|
|
63
|
+
return {
|
|
64
|
+
status: "not_ready",
|
|
65
|
+
reason: "history_incomplete",
|
|
66
|
+
retryable: true,
|
|
67
|
+
};
|
|
68
|
+
if (group.sourceKind === "settlement") {
|
|
69
|
+
const a = args.allocation;
|
|
70
|
+
if (!a ||
|
|
71
|
+
a.sourceChargeId !== group.sourceId ||
|
|
72
|
+
a.currency !== group.currency ||
|
|
73
|
+
a.gross !== group.sourceGross ||
|
|
74
|
+
a.processingFee !== group.sourceProcessingFee ||
|
|
75
|
+
(a.adjustmentAmount ?? 0) !== group.amount)
|
|
76
|
+
return identityConflict;
|
|
77
|
+
const priorOperation = await ctx.db
|
|
78
|
+
.query("recoveryWorkflowOperations")
|
|
79
|
+
.withIndex("by_source", (q) => q.eq("sourceKind", "settlement").eq("sourceId", group.sourceId))
|
|
80
|
+
.first();
|
|
81
|
+
if (priorOperation)
|
|
82
|
+
return identityConflict;
|
|
83
|
+
const prior = await ctx.db
|
|
84
|
+
.query("settlementAllocations")
|
|
85
|
+
.withIndex("by_source_charge", (q) => q.eq("sourceChargeId", a.sourceChargeId))
|
|
86
|
+
.first();
|
|
87
|
+
if (prior &&
|
|
88
|
+
!same(Object.fromEntries(Object.keys(allocationFields).map((k) => [
|
|
89
|
+
k,
|
|
90
|
+
prior[k],
|
|
91
|
+
])), a))
|
|
92
|
+
return identityConflict;
|
|
93
|
+
await ctx.runMutation(anyApi.settlement.mutations.reserveSettlementAllocation, a);
|
|
94
|
+
}
|
|
95
|
+
else if (args.allocation)
|
|
96
|
+
return identityConflict;
|
|
97
|
+
const operationId = await ctx.db.insert("recoveryWorkflowOperations", {
|
|
98
|
+
...binding,
|
|
99
|
+
sourceKind: group.sourceKind,
|
|
100
|
+
sourceId: group.sourceId,
|
|
101
|
+
version: 1,
|
|
102
|
+
status: "queued",
|
|
103
|
+
cancelRequested: false,
|
|
104
|
+
providerStarted: false,
|
|
105
|
+
resumeQueued: false,
|
|
106
|
+
});
|
|
107
|
+
const op = (await ctx.db.get("recoveryWorkflowOperations", operationId));
|
|
108
|
+
await ctx.db.insert("recoveryWorkflowRequests", {
|
|
109
|
+
requestKey,
|
|
110
|
+
binding,
|
|
111
|
+
operationId,
|
|
112
|
+
});
|
|
113
|
+
const workflowId = await executionWorkflow.start(ctx, workflow, { ...reference(op), initialPhase: "execute" }, { startAsync: true });
|
|
114
|
+
await ctx.db.patch("recoveryWorkflowOperations", operationId, {
|
|
115
|
+
workflowId,
|
|
116
|
+
});
|
|
117
|
+
return status(op);
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
export const requestCancel = mutation({
|
|
121
|
+
args: refFields,
|
|
122
|
+
returns: safeStatus,
|
|
123
|
+
handler: async (ctx, args) => {
|
|
124
|
+
const op = await read(ctx, args);
|
|
125
|
+
if (op.status === "completed" || op.status === "canceled")
|
|
126
|
+
return status(op);
|
|
127
|
+
await ctx.db.patch("recoveryWorkflowOperations", op._id, {
|
|
128
|
+
cancelRequested: true,
|
|
129
|
+
});
|
|
130
|
+
return status((await ctx.db.get("recoveryWorkflowOperations", op._id)));
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
export const resume = mutation({
|
|
134
|
+
args: refFields,
|
|
135
|
+
returns: safeStatus,
|
|
136
|
+
handler: async (ctx, args) => {
|
|
137
|
+
const op = await read(ctx, args);
|
|
138
|
+
const workflowStatus = await executionWorkflow.status(ctx, op.workflowId);
|
|
139
|
+
if (workflowStatus.type === "failed") {
|
|
140
|
+
const last = (await executionWorkflow.listSteps(ctx, op.workflowId, {
|
|
141
|
+
order: "desc",
|
|
142
|
+
paginationOpts: { cursor: null, numItems: 1 },
|
|
143
|
+
})).page[0];
|
|
144
|
+
if (last &&
|
|
145
|
+
["receipt", "finish", "completion"].includes(last.name) &&
|
|
146
|
+
last.runResult?.kind === "failed")
|
|
147
|
+
await executionWorkflow.restart(ctx, op.workflowId, {
|
|
148
|
+
from: last.stepNumber,
|
|
149
|
+
startAsync: true,
|
|
150
|
+
});
|
|
151
|
+
else {
|
|
152
|
+
// A bounded/exhausted or unjournaled provider segment must never
|
|
153
|
+
// replay an execute phase. Keep the same operation and money keys.
|
|
154
|
+
const workflowId = await executionWorkflow.start(ctx, workflow, { ...reference(op), initialPhase: "reconcile" }, { startAsync: true });
|
|
155
|
+
await ctx.db.patch("recoveryWorkflowOperations", op._id, {
|
|
156
|
+
workflowId,
|
|
157
|
+
resumeQueued: false,
|
|
158
|
+
status: op.outcome ? "running" : "queued",
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
return status((await ctx.db.get("recoveryWorkflowOperations", op._id)));
|
|
162
|
+
}
|
|
163
|
+
if ((op.status === "unknown" || op.status === "waiting") &&
|
|
164
|
+
!op.resumeQueued) {
|
|
165
|
+
await executionWorkflow.sendEvent(ctx, {
|
|
166
|
+
workflowId: op.workflowId,
|
|
167
|
+
name: "reconcile",
|
|
168
|
+
value: null,
|
|
169
|
+
});
|
|
170
|
+
await ctx.db.patch("recoveryWorkflowOperations", op._id, {
|
|
171
|
+
resumeQueued: true,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
return status((await ctx.db.get("recoveryWorkflowOperations", op._id)));
|
|
175
|
+
},
|
|
176
|
+
});
|
|
177
|
+
//# sourceMappingURL=mutations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../../src/component/recoveryWorkflow/mutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAA0B,MAAM,eAAe,CAAC;AAE/D,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,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AAC;QAC3E,CAAC;QACD,IACE,CAAC,EAAE,CAAC,MAAM,KAAK,SAAS,IAAI,EAAE,CAAC,MAAM,KAAK,SAAS,CAAC;YACpD,CAAC,EAAE,CAAC,YAAY,EAChB,CAAC;YACD,MAAM,iBAAiB,CAAC,SAAS,CAAC,GAAG,EAAE;gBACrC,UAAU,EAAE,EAAE,CAAC,UAAwB;gBACvC,IAAI,EAAE,WAAW;gBACjB,KAAK,EAAE,IAAI;aACZ,CAAC,CAAC;YACH,MAAM,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,4BAA4B,EAAE,EAAE,CAAC,GAAG,EAAE;gBACvD,YAAY,EAAE,IAAI;aACnB,CAAC,CAAC;QACL,CAAC;QACD,OAAO,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,4BAA4B,EAAE,EAAE,CAAC,GAAG,CAAC,CAAE,CAAC,CAAC;IAC3E,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
export declare const get: import("convex/server").RegisteredQuery<"public", {
|
|
2
|
+
accountId: string;
|
|
3
|
+
currency: string;
|
|
4
|
+
groupKey: string;
|
|
5
|
+
operationId: import("convex/values").GenericId<"recoveryWorkflowOperations">;
|
|
6
|
+
scopeKey: string;
|
|
7
|
+
version: number;
|
|
8
|
+
}, Promise<{
|
|
9
|
+
sourceKind: "invoice" | "settlement";
|
|
10
|
+
sourceId: string;
|
|
11
|
+
status: "canceled" | "completed" | "queued" | "running" | "unknown" | "waiting";
|
|
12
|
+
cancelRequested: boolean;
|
|
13
|
+
outcome?: "collect" | "release" | undefined;
|
|
14
|
+
accountId: string;
|
|
15
|
+
currency: string;
|
|
16
|
+
groupKey: string;
|
|
17
|
+
operationId: import("convex/values").GenericId<"recoveryWorkflowOperations">;
|
|
18
|
+
scopeKey: string;
|
|
19
|
+
version: number;
|
|
20
|
+
}>>;
|
|
21
|
+
/** Authorized host action reads the pinned public inputs; credentials are never stored here. */
|
|
22
|
+
export declare const snapshot: import("convex/server").RegisteredQuery<"public", {
|
|
23
|
+
accountId: string;
|
|
24
|
+
currency: string;
|
|
25
|
+
groupKey: string;
|
|
26
|
+
operationId: import("convex/values").GenericId<"recoveryWorkflowOperations">;
|
|
27
|
+
scopeKey: string;
|
|
28
|
+
version: number;
|
|
29
|
+
}, Promise<{
|
|
30
|
+
_creationTime: number;
|
|
31
|
+
_id: import("convex/values").GenericId<"recoveryWorkflowOperations">;
|
|
32
|
+
accountId: string;
|
|
33
|
+
activePhase?: "execute" | "reconcile" | undefined;
|
|
34
|
+
allocation?: {
|
|
35
|
+
adjustmentAmount?: number | undefined;
|
|
36
|
+
currency: string;
|
|
37
|
+
gross: number;
|
|
38
|
+
paymentId?: string | undefined;
|
|
39
|
+
paymentIntentId?: string | undefined;
|
|
40
|
+
platformNet: number;
|
|
41
|
+
processingFee: number;
|
|
42
|
+
sourceChargeId: string;
|
|
43
|
+
sourceInvoiceId?: string | undefined;
|
|
44
|
+
transfers: {
|
|
45
|
+
amount: number;
|
|
46
|
+
destinationAccountId: string;
|
|
47
|
+
role: "affiliate" | "other" | "store";
|
|
48
|
+
}[];
|
|
49
|
+
} | undefined;
|
|
50
|
+
cancelRequested: boolean;
|
|
51
|
+
completion?: string | undefined;
|
|
52
|
+
currency: string;
|
|
53
|
+
definitionVersion: number;
|
|
54
|
+
groupKey: string;
|
|
55
|
+
maxAttempts: number;
|
|
56
|
+
outcome?: "collect" | "release" | undefined;
|
|
57
|
+
provider: string;
|
|
58
|
+
providerApiVersion: string;
|
|
59
|
+
providerStarted: boolean;
|
|
60
|
+
releaseUncollectible: boolean;
|
|
61
|
+
resumeQueued: boolean;
|
|
62
|
+
retryDelayMs: number;
|
|
63
|
+
scopeKey: string;
|
|
64
|
+
sourceId: string;
|
|
65
|
+
sourceKind: "invoice" | "settlement";
|
|
66
|
+
status: "canceled" | "completed" | "queued" | "running" | "unknown" | "waiting";
|
|
67
|
+
version: number;
|
|
68
|
+
workflowId?: string | undefined;
|
|
69
|
+
}>>;
|
|
70
|
+
export declare const saved: import("convex/server").RegisteredQuery<"internal", {
|
|
71
|
+
accountId: string;
|
|
72
|
+
currency: string;
|
|
73
|
+
groupKey: string;
|
|
74
|
+
operationId: import("convex/values").GenericId<"recoveryWorkflowOperations">;
|
|
75
|
+
scopeKey: string;
|
|
76
|
+
version: number;
|
|
77
|
+
}, Promise<{
|
|
78
|
+
_creationTime: number;
|
|
79
|
+
_id: import("convex/values").GenericId<"recoveryWorkflowOperations">;
|
|
80
|
+
accountId: string;
|
|
81
|
+
activePhase?: "execute" | "reconcile" | undefined;
|
|
82
|
+
allocation?: {
|
|
83
|
+
adjustmentAmount?: number | undefined;
|
|
84
|
+
currency: string;
|
|
85
|
+
gross: number;
|
|
86
|
+
paymentId?: string | undefined;
|
|
87
|
+
paymentIntentId?: string | undefined;
|
|
88
|
+
platformNet: number;
|
|
89
|
+
processingFee: number;
|
|
90
|
+
sourceChargeId: string;
|
|
91
|
+
sourceInvoiceId?: string | undefined;
|
|
92
|
+
transfers: {
|
|
93
|
+
amount: number;
|
|
94
|
+
destinationAccountId: string;
|
|
95
|
+
role: "affiliate" | "other" | "store";
|
|
96
|
+
}[];
|
|
97
|
+
} | undefined;
|
|
98
|
+
cancelRequested: boolean;
|
|
99
|
+
completion?: string | undefined;
|
|
100
|
+
currency: string;
|
|
101
|
+
definitionVersion: number;
|
|
102
|
+
groupKey: string;
|
|
103
|
+
maxAttempts: number;
|
|
104
|
+
outcome?: "collect" | "release" | undefined;
|
|
105
|
+
provider: string;
|
|
106
|
+
providerApiVersion: string;
|
|
107
|
+
providerStarted: boolean;
|
|
108
|
+
releaseUncollectible: boolean;
|
|
109
|
+
resumeQueued: boolean;
|
|
110
|
+
retryDelayMs: number;
|
|
111
|
+
scopeKey: string;
|
|
112
|
+
sourceId: string;
|
|
113
|
+
sourceKind: "invoice" | "settlement";
|
|
114
|
+
status: "canceled" | "completed" | "queued" | "running" | "unknown" | "waiting";
|
|
115
|
+
version: number;
|
|
116
|
+
workflowId?: string | undefined;
|
|
117
|
+
}>>;
|
|
118
|
+
//# sourceMappingURL=queries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/component/recoveryWorkflow/queries.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;GAId,CAAC;AACH,gGAAgG;AAChG,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAInB,CAAC;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAIhB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { query, internalQuery } from "../_generated/server.js";
|
|
2
|
+
import { refFields, safeStatus, operationDoc } from "./schema.js";
|
|
3
|
+
import { read, status } from "./helpers.js";
|
|
4
|
+
export const get = query({
|
|
5
|
+
args: refFields,
|
|
6
|
+
returns: safeStatus,
|
|
7
|
+
handler: async (ctx, args) => status(await read(ctx, args)),
|
|
8
|
+
});
|
|
9
|
+
/** Authorized host action reads the pinned public inputs; credentials are never stored here. */
|
|
10
|
+
export const snapshot = query({
|
|
11
|
+
args: refFields,
|
|
12
|
+
returns: operationDoc,
|
|
13
|
+
handler: read,
|
|
14
|
+
});
|
|
15
|
+
export const saved = internalQuery({
|
|
16
|
+
args: refFields,
|
|
17
|
+
returns: operationDoc,
|
|
18
|
+
handler: read,
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=queries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/component/recoveryWorkflow/queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC5C,MAAM,CAAC,MAAM,GAAG,GAAG,KAAK,CAAC;IACvB,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,UAAU;IACnB,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;CAC5D,CAAC,CAAC;AACH,gGAAgG;AAChG,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAAC;IAC5B,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,YAAY;IACrB,OAAO,EAAE,IAAI;CACd,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,aAAa,CAAC;IACjC,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,YAAY;IACrB,OAAO,EAAE,IAAI;CACd,CAAC,CAAC"}
|