@fantastic.dev/better-stripe 0.24.0 → 0.25.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 +7 -0
- package/README.md +7 -1
- package/dist/client/billing/checkout.d.ts +3 -43
- package/dist/client/billing/checkout.d.ts.map +1 -1
- package/dist/client/billing/checkout.js +5 -260
- package/dist/client/billing/checkout.js.map +1 -1
- package/dist/client/billing/checkoutRequest.d.ts +129 -0
- package/dist/client/billing/checkoutRequest.d.ts.map +1 -0
- package/dist/client/billing/checkoutRequest.js +263 -0
- package/dist/client/billing/checkoutRequest.js.map +1 -0
- package/dist/client/billing/preparedCheckout.d.ts +22 -0
- package/dist/client/billing/preparedCheckout.d.ts.map +1 -0
- package/dist/client/billing/preparedCheckout.js +86 -0
- package/dist/client/billing/preparedCheckout.js.map +1 -0
- package/dist/client/checkoutRequests.d.ts +80 -0
- package/dist/client/checkoutRequests.d.ts.map +1 -0
- package/dist/client/checkoutRequests.js +28 -0
- package/dist/client/checkoutRequests.js.map +1 -0
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +464 -0
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutCollection.d.ts +21 -0
- package/dist/client/connect/payoutCollection.d.ts.map +1 -0
- package/dist/client/connect/payoutCollection.js +47 -0
- package/dist/client/connect/payoutCollection.js.map +1 -0
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts +1805 -0
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -0
- package/dist/client/connect/payoutExecutionTestHelpers.js +194 -0
- package/dist/client/connect/payoutExecutionTestHelpers.js.map +1 -0
- package/dist/client/connect/payoutSyncTestHelpers.d.ts +232 -0
- package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutWorker.d.ts +48 -0
- package/dist/client/connect/payoutWorker.d.ts.map +1 -0
- package/dist/client/connect/payoutWorker.js +78 -0
- package/dist/client/connect/payoutWorker.js.map +1 -0
- package/dist/client/index.d.ts +4 -11
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +4 -9
- package/dist/client/index.js.map +1 -1
- package/dist/client/payoutPolicy.d.ts +67 -0
- package/dist/client/payoutPolicy.d.ts.map +1 -1
- package/dist/client/payoutPolicy.js +10 -0
- package/dist/client/payoutPolicy.js.map +1 -1
- package/dist/client/readContracts.d.ts +11 -1
- package/dist/client/readContracts.d.ts.map +1 -1
- package/dist/client/readContracts.js +10 -0
- package/dist/client/readContracts.js.map +1 -1
- package/dist/component/_generated/component.d.ts +293 -0
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/core/mutations.d.ts.map +1 -1
- package/dist/component/core/mutations.js +2 -0
- package/dist/component/core/mutations.js.map +1 -1
- package/dist/component/core/resetSafety.d.ts +4 -0
- package/dist/component/core/resetSafety.d.ts.map +1 -0
- package/dist/component/core/resetSafety.js +54 -0
- package/dist/component/core/resetSafety.js.map +1 -0
- package/dist/component/earnings/triggers.d.ts +418 -0
- package/dist/component/earnings/triggers.d.ts.map +1 -1
- package/dist/component/earnings/triggers.js +2 -0
- package/dist/component/earnings/triggers.js.map +1 -1
- package/dist/component/payoutPolicy/schema.d.ts +2 -0
- package/dist/component/payoutPolicy/schema.d.ts.map +1 -1
- package/dist/component/payoutPolicy/schema.js +3 -1
- package/dist/component/payoutPolicy/schema.js.map +1 -1
- package/dist/component/payoutRelease/mutations.js +1 -1
- package/dist/component/payoutRelease/schema.d.ts +1 -0
- package/dist/component/payoutRelease/schema.d.ts.map +1 -1
- package/dist/component/payoutRelease/schema.js +1 -0
- package/dist/component/payoutRelease/schema.js.map +1 -1
- package/dist/component/payoutSnapshots/localState.d.ts +89 -0
- package/dist/component/payoutSnapshots/localState.d.ts.map +1 -0
- package/dist/component/payoutSnapshots/localState.js +186 -0
- package/dist/component/payoutSnapshots/localState.js.map +1 -0
- package/dist/component/payoutSnapshots/mutations.d.ts +108 -0
- package/dist/component/payoutSnapshots/mutations.d.ts.map +1 -0
- package/dist/component/payoutSnapshots/mutations.js +263 -0
- package/dist/component/payoutSnapshots/mutations.js.map +1 -0
- package/dist/component/payoutSnapshots/revisions.d.ts +12 -0
- package/dist/component/payoutSnapshots/revisions.d.ts.map +1 -0
- package/dist/component/payoutSnapshots/revisions.js +173 -0
- package/dist/component/payoutSnapshots/revisions.js.map +1 -0
- package/dist/component/payoutSnapshots/schema.d.ts +285 -0
- package/dist/component/payoutSnapshots/schema.d.ts.map +1 -0
- package/dist/component/payoutSnapshots/schema.js +108 -0
- package/dist/component/payoutSnapshots/schema.js.map +1 -0
- package/dist/component/payoutSnapshots/scope.d.ts +7 -0
- package/dist/component/payoutSnapshots/scope.d.ts.map +1 -0
- package/dist/component/payoutSnapshots/scope.js +8 -0
- package/dist/component/payoutSnapshots/scope.js.map +1 -0
- package/dist/component/payoutWorker/helpers.d.ts +30 -0
- package/dist/component/payoutWorker/helpers.d.ts.map +1 -0
- package/dist/component/payoutWorker/helpers.js +21 -0
- package/dist/component/payoutWorker/helpers.js.map +1 -0
- package/dist/component/payoutWorker/mutations.d.ts +68 -0
- package/dist/component/payoutWorker/mutations.d.ts.map +1 -0
- package/dist/component/payoutWorker/mutations.js +161 -0
- package/dist/component/payoutWorker/mutations.js.map +1 -0
- package/dist/component/payoutWorker/queries.d.ts +123 -0
- package/dist/component/payoutWorker/queries.d.ts.map +1 -0
- package/dist/component/payoutWorker/queries.js +61 -0
- package/dist/component/payoutWorker/queries.js.map +1 -0
- package/dist/component/payoutWorker/schema.d.ts +91 -0
- package/dist/component/payoutWorker/schema.d.ts.map +1 -0
- package/dist/component/payoutWorker/schema.js +27 -0
- package/dist/component/payoutWorker/schema.js.map +1 -0
- package/dist/component/schema.d.ts +232 -0
- package/dist/component/schema.js +10 -0
- package/dist/component/schema.js.map +1 -1
- package/docs/read-contracts.md +48 -0
- package/docs/settlement.md +128 -1
- package/package.json +1 -1
- package/src/client/billing/checkout.ts +11 -359
- package/src/client/billing/checkoutRequest.ts +362 -0
- package/src/client/billing/prepared-checkout.test.ts +430 -0
- package/src/client/billing/preparedCheckout.ts +143 -0
- package/src/client/checkoutRequests.ts +40 -0
- package/src/client/connect/payoutCollection.test.ts +74 -0
- package/src/client/connect/payoutCollection.ts +82 -0
- package/src/client/connect/payoutExecution.test.ts +1 -211
- package/src/client/connect/payoutExecutionTestHelpers.ts +213 -0
- package/src/client/connect/payoutWorker.test.ts +145 -0
- package/src/client/connect/payoutWorker.ts +144 -0
- package/src/client/index.ts +10 -21
- package/src/client/payoutPolicy.ts +26 -1
- package/src/client/readContracts.ts +23 -0
- package/src/component/_generated/api.ts +16 -0
- package/src/component/_generated/component.ts +361 -0
- package/src/component/core/mutations.ts +2 -0
- package/src/component/core/resetSafety.ts +67 -0
- package/src/component/earnings/triggers.ts +2 -0
- package/src/component/payout-reset-safety.test.ts +148 -0
- package/src/component/payout-revisions.test.ts +125 -0
- package/src/component/payout-snapshots.test.ts +395 -0
- package/src/component/payout-worker.test.ts +165 -0
- package/src/component/payoutPolicy/schema.ts +3 -1
- package/src/component/payoutRelease/mutations.ts +1 -1
- package/src/component/payoutRelease/schema.ts +1 -0
- package/src/component/payoutSnapshots/localState.ts +238 -0
- package/src/component/payoutSnapshots/mutations.ts +275 -0
- package/src/component/payoutSnapshots/revisions.ts +247 -0
- package/src/component/payoutSnapshots/schema.ts +125 -0
- package/src/component/payoutSnapshots/scope.ts +7 -0
- package/src/component/payoutWorker/helpers.ts +30 -0
- package/src/component/payoutWorker/mutations.ts +181 -0
- package/src/component/payoutWorker/queries.ts +64 -0
- package/src/component/payoutWorker/schema.ts +26 -0
- package/src/component/public.test.ts +2 -2
- package/src/component/schema.ts +18 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
export declare const financialRevisionsTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
2
|
+
accountId: string;
|
|
3
|
+
revision: number;
|
|
4
|
+
riskRevision: number;
|
|
5
|
+
}, {
|
|
6
|
+
accountId: import("convex/values").VString<string, "required">;
|
|
7
|
+
revision: import("convex/values").VFloat64<number, "required">;
|
|
8
|
+
riskRevision: import("convex/values").VFloat64<number, "required">;
|
|
9
|
+
}, "required", "accountId" | "revision" | "riskRevision">, {
|
|
10
|
+
by_account: ["accountId", "_creationTime"];
|
|
11
|
+
}, {}, {}>;
|
|
12
|
+
export declare const riskKind: import("convex/values").VUnion<"allocation" | "claim" | "fee" | "provider_payout" | "transfer", [import("convex/values").VLiteral<"transfer", "required">, import("convex/values").VLiteral<"provider_payout", "required">, import("convex/values").VLiteral<"allocation", "required">, import("convex/values").VLiteral<"claim", "required">, import("convex/values").VLiteral<"fee", "required">], "required", never>;
|
|
13
|
+
export declare const riskEventsTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
14
|
+
accountId: string;
|
|
15
|
+
key: string;
|
|
16
|
+
kind: "allocation" | "claim" | "fee" | "provider_payout" | "transfer";
|
|
17
|
+
removed?: boolean | undefined;
|
|
18
|
+
riskRevision: number;
|
|
19
|
+
}, {
|
|
20
|
+
accountId: import("convex/values").VString<string, "required">;
|
|
21
|
+
riskRevision: import("convex/values").VFloat64<number, "required">;
|
|
22
|
+
kind: import("convex/values").VUnion<"allocation" | "claim" | "fee" | "provider_payout" | "transfer", [import("convex/values").VLiteral<"transfer", "required">, import("convex/values").VLiteral<"provider_payout", "required">, import("convex/values").VLiteral<"allocation", "required">, import("convex/values").VLiteral<"claim", "required">, import("convex/values").VLiteral<"fee", "required">], "required", never>;
|
|
23
|
+
key: import("convex/values").VString<string, "required">;
|
|
24
|
+
removed: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
25
|
+
}, "required", "accountId" | "key" | "kind" | "removed" | "riskRevision">, {
|
|
26
|
+
by_account_revision: ["accountId", "riskRevision", "_creationTime"];
|
|
27
|
+
}, {}, {}>;
|
|
28
|
+
export declare const collectionPhase: import("convex/values").VUnion<"allocations" | "check" | "claims" | "discarding" | "fees" | "invalidated" | "local_ready" | "repair" | "sources", [import("convex/values").VLiteral<"sources", "required">, import("convex/values").VLiteral<"allocations", "required">, import("convex/values").VLiteral<"fees", "required">, import("convex/values").VLiteral<"claims", "required">, import("convex/values").VLiteral<"repair", "required">, import("convex/values").VLiteral<"check", "required">, import("convex/values").VLiteral<"local_ready", "required">, import("convex/values").VLiteral<"invalidated", "required">, import("convex/values").VLiteral<"discarding", "required">], "required", never>;
|
|
29
|
+
export declare const snapshotFields: {
|
|
30
|
+
readOnly: import("convex/values").VBoolean<boolean, "required">;
|
|
31
|
+
accountId: import("convex/values").VString<string, "required">;
|
|
32
|
+
ownerKey: import("convex/values").VString<string, "required">;
|
|
33
|
+
operationKey: import("convex/values").VString<string, "required">;
|
|
34
|
+
expectedRevision: import("convex/values").VFloat64<number, "required">;
|
|
35
|
+
policyMode: import("convex/values").VString<string | undefined, "optional">;
|
|
36
|
+
policyOperationKey: import("convex/values").VString<string | undefined, "optional">;
|
|
37
|
+
phase: import("convex/values").VUnion<"allocations" | "check" | "claims" | "discarding" | "fees" | "invalidated" | "local_ready" | "repair" | "sources", [import("convex/values").VLiteral<"sources", "required">, import("convex/values").VLiteral<"allocations", "required">, import("convex/values").VLiteral<"fees", "required">, import("convex/values").VLiteral<"claims", "required">, import("convex/values").VLiteral<"repair", "required">, import("convex/values").VLiteral<"check", "required">, import("convex/values").VLiteral<"local_ready", "required">, import("convex/values").VLiteral<"invalidated", "required">, import("convex/values").VLiteral<"discarding", "required">], "required", never>;
|
|
38
|
+
step: import("convex/values").VFloat64<number, "required">;
|
|
39
|
+
sourceFence: import("convex/values").VFloat64<number, "required">;
|
|
40
|
+
sourceCursor: import("convex/values").VString<string | undefined, "optional">;
|
|
41
|
+
allocationCursor: import("convex/values").VString<string | undefined, "optional">;
|
|
42
|
+
feeCursor: import("convex/values").VString<string | undefined, "optional">;
|
|
43
|
+
claimCursor: import("convex/values").VString<string | undefined, "optional">;
|
|
44
|
+
initialRevision: import("convex/values").VFloat64<number, "required">;
|
|
45
|
+
initialRiskRevision: import("convex/values").VFloat64<number, "required">;
|
|
46
|
+
riskRevision: import("convex/values").VFloat64<number, "required">;
|
|
47
|
+
observedRevision: import("convex/values").VFloat64<number, "required">;
|
|
48
|
+
sourceCount: import("convex/values").VFloat64<number, "required">;
|
|
49
|
+
allocationCount: import("convex/values").VFloat64<number, "required">;
|
|
50
|
+
claimCount: import("convex/values").VFloat64<number, "required">;
|
|
51
|
+
feeCount: import("convex/values").VFloat64<number, "required">;
|
|
52
|
+
deferredPositiveChanges: import("convex/values").VBoolean<boolean, "required">;
|
|
53
|
+
providerChanged: import("convex/values").VBoolean<boolean, "required">;
|
|
54
|
+
expiresAt: import("convex/values").VFloat64<number, "required">;
|
|
55
|
+
reason: import("convex/values").VString<string | undefined, "optional">;
|
|
56
|
+
};
|
|
57
|
+
export declare const snapshotDoc: import("convex/values").VObject<{
|
|
58
|
+
_creationTime: number;
|
|
59
|
+
_id: import("convex/values").GenericId<"payoutSnapshots">;
|
|
60
|
+
accountId: string;
|
|
61
|
+
allocationCount: number;
|
|
62
|
+
allocationCursor?: string | undefined;
|
|
63
|
+
claimCount: number;
|
|
64
|
+
claimCursor?: string | undefined;
|
|
65
|
+
deferredPositiveChanges: boolean;
|
|
66
|
+
expectedRevision: number;
|
|
67
|
+
expiresAt: number;
|
|
68
|
+
feeCount: number;
|
|
69
|
+
feeCursor?: string | undefined;
|
|
70
|
+
initialRevision: number;
|
|
71
|
+
initialRiskRevision: number;
|
|
72
|
+
observedRevision: number;
|
|
73
|
+
operationKey: string;
|
|
74
|
+
ownerKey: string;
|
|
75
|
+
phase: "allocations" | "check" | "claims" | "discarding" | "fees" | "invalidated" | "local_ready" | "repair" | "sources";
|
|
76
|
+
policyMode?: string | undefined;
|
|
77
|
+
policyOperationKey?: string | undefined;
|
|
78
|
+
providerChanged: boolean;
|
|
79
|
+
readOnly: boolean;
|
|
80
|
+
reason?: string | undefined;
|
|
81
|
+
riskRevision: number;
|
|
82
|
+
sourceCount: number;
|
|
83
|
+
sourceCursor?: string | undefined;
|
|
84
|
+
sourceFence: number;
|
|
85
|
+
step: number;
|
|
86
|
+
}, {
|
|
87
|
+
readOnly: import("convex/values").VBoolean<boolean, "required">;
|
|
88
|
+
accountId: import("convex/values").VString<string, "required">;
|
|
89
|
+
ownerKey: import("convex/values").VString<string, "required">;
|
|
90
|
+
operationKey: import("convex/values").VString<string, "required">;
|
|
91
|
+
expectedRevision: import("convex/values").VFloat64<number, "required">;
|
|
92
|
+
policyMode: import("convex/values").VString<string | undefined, "optional">;
|
|
93
|
+
policyOperationKey: import("convex/values").VString<string | undefined, "optional">;
|
|
94
|
+
phase: import("convex/values").VUnion<"allocations" | "check" | "claims" | "discarding" | "fees" | "invalidated" | "local_ready" | "repair" | "sources", [import("convex/values").VLiteral<"sources", "required">, import("convex/values").VLiteral<"allocations", "required">, import("convex/values").VLiteral<"fees", "required">, import("convex/values").VLiteral<"claims", "required">, import("convex/values").VLiteral<"repair", "required">, import("convex/values").VLiteral<"check", "required">, import("convex/values").VLiteral<"local_ready", "required">, import("convex/values").VLiteral<"invalidated", "required">, import("convex/values").VLiteral<"discarding", "required">], "required", never>;
|
|
95
|
+
step: import("convex/values").VFloat64<number, "required">;
|
|
96
|
+
sourceFence: import("convex/values").VFloat64<number, "required">;
|
|
97
|
+
sourceCursor: import("convex/values").VString<string | undefined, "optional">;
|
|
98
|
+
allocationCursor: import("convex/values").VString<string | undefined, "optional">;
|
|
99
|
+
feeCursor: import("convex/values").VString<string | undefined, "optional">;
|
|
100
|
+
claimCursor: import("convex/values").VString<string | undefined, "optional">;
|
|
101
|
+
initialRevision: import("convex/values").VFloat64<number, "required">;
|
|
102
|
+
initialRiskRevision: import("convex/values").VFloat64<number, "required">;
|
|
103
|
+
riskRevision: import("convex/values").VFloat64<number, "required">;
|
|
104
|
+
observedRevision: import("convex/values").VFloat64<number, "required">;
|
|
105
|
+
sourceCount: import("convex/values").VFloat64<number, "required">;
|
|
106
|
+
allocationCount: import("convex/values").VFloat64<number, "required">;
|
|
107
|
+
claimCount: import("convex/values").VFloat64<number, "required">;
|
|
108
|
+
feeCount: import("convex/values").VFloat64<number, "required">;
|
|
109
|
+
deferredPositiveChanges: import("convex/values").VBoolean<boolean, "required">;
|
|
110
|
+
providerChanged: import("convex/values").VBoolean<boolean, "required">;
|
|
111
|
+
expiresAt: import("convex/values").VFloat64<number, "required">;
|
|
112
|
+
reason: import("convex/values").VString<string | undefined, "optional">;
|
|
113
|
+
_id: import("convex/values").VId<import("convex/values").GenericId<"payoutSnapshots">, "required">;
|
|
114
|
+
_creationTime: import("convex/values").VFloat64<number, "required">;
|
|
115
|
+
}, "required", "_creationTime" | "_id" | "accountId" | "allocationCount" | "allocationCursor" | "claimCount" | "claimCursor" | "deferredPositiveChanges" | "expectedRevision" | "expiresAt" | "feeCount" | "feeCursor" | "initialRevision" | "initialRiskRevision" | "observedRevision" | "operationKey" | "ownerKey" | "phase" | "policyMode" | "policyOperationKey" | "providerChanged" | "readOnly" | "reason" | "riskRevision" | "sourceCount" | "sourceCursor" | "sourceFence" | "step">;
|
|
116
|
+
export declare const snapshotsTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
117
|
+
accountId: string;
|
|
118
|
+
allocationCount: number;
|
|
119
|
+
allocationCursor?: string | undefined;
|
|
120
|
+
claimCount: number;
|
|
121
|
+
claimCursor?: string | undefined;
|
|
122
|
+
deferredPositiveChanges: boolean;
|
|
123
|
+
expectedRevision: number;
|
|
124
|
+
expiresAt: number;
|
|
125
|
+
feeCount: number;
|
|
126
|
+
feeCursor?: string | undefined;
|
|
127
|
+
initialRevision: number;
|
|
128
|
+
initialRiskRevision: number;
|
|
129
|
+
observedRevision: number;
|
|
130
|
+
operationKey: string;
|
|
131
|
+
ownerKey: string;
|
|
132
|
+
phase: "allocations" | "check" | "claims" | "discarding" | "fees" | "invalidated" | "local_ready" | "repair" | "sources";
|
|
133
|
+
policyMode?: string | undefined;
|
|
134
|
+
policyOperationKey?: string | undefined;
|
|
135
|
+
providerChanged: boolean;
|
|
136
|
+
readOnly: boolean;
|
|
137
|
+
reason?: string | undefined;
|
|
138
|
+
riskRevision: number;
|
|
139
|
+
sourceCount: number;
|
|
140
|
+
sourceCursor?: string | undefined;
|
|
141
|
+
sourceFence: number;
|
|
142
|
+
step: number;
|
|
143
|
+
}, {
|
|
144
|
+
readOnly: import("convex/values").VBoolean<boolean, "required">;
|
|
145
|
+
accountId: import("convex/values").VString<string, "required">;
|
|
146
|
+
ownerKey: import("convex/values").VString<string, "required">;
|
|
147
|
+
operationKey: import("convex/values").VString<string, "required">;
|
|
148
|
+
expectedRevision: import("convex/values").VFloat64<number, "required">;
|
|
149
|
+
policyMode: import("convex/values").VString<string | undefined, "optional">;
|
|
150
|
+
policyOperationKey: import("convex/values").VString<string | undefined, "optional">;
|
|
151
|
+
phase: import("convex/values").VUnion<"allocations" | "check" | "claims" | "discarding" | "fees" | "invalidated" | "local_ready" | "repair" | "sources", [import("convex/values").VLiteral<"sources", "required">, import("convex/values").VLiteral<"allocations", "required">, import("convex/values").VLiteral<"fees", "required">, import("convex/values").VLiteral<"claims", "required">, import("convex/values").VLiteral<"repair", "required">, import("convex/values").VLiteral<"check", "required">, import("convex/values").VLiteral<"local_ready", "required">, import("convex/values").VLiteral<"invalidated", "required">, import("convex/values").VLiteral<"discarding", "required">], "required", never>;
|
|
152
|
+
step: import("convex/values").VFloat64<number, "required">;
|
|
153
|
+
sourceFence: import("convex/values").VFloat64<number, "required">;
|
|
154
|
+
sourceCursor: import("convex/values").VString<string | undefined, "optional">;
|
|
155
|
+
allocationCursor: import("convex/values").VString<string | undefined, "optional">;
|
|
156
|
+
feeCursor: import("convex/values").VString<string | undefined, "optional">;
|
|
157
|
+
claimCursor: import("convex/values").VString<string | undefined, "optional">;
|
|
158
|
+
initialRevision: import("convex/values").VFloat64<number, "required">;
|
|
159
|
+
initialRiskRevision: import("convex/values").VFloat64<number, "required">;
|
|
160
|
+
riskRevision: import("convex/values").VFloat64<number, "required">;
|
|
161
|
+
observedRevision: import("convex/values").VFloat64<number, "required">;
|
|
162
|
+
sourceCount: import("convex/values").VFloat64<number, "required">;
|
|
163
|
+
allocationCount: import("convex/values").VFloat64<number, "required">;
|
|
164
|
+
claimCount: import("convex/values").VFloat64<number, "required">;
|
|
165
|
+
feeCount: import("convex/values").VFloat64<number, "required">;
|
|
166
|
+
deferredPositiveChanges: import("convex/values").VBoolean<boolean, "required">;
|
|
167
|
+
providerChanged: import("convex/values").VBoolean<boolean, "required">;
|
|
168
|
+
expiresAt: import("convex/values").VFloat64<number, "required">;
|
|
169
|
+
reason: import("convex/values").VString<string | undefined, "optional">;
|
|
170
|
+
}, "required", "accountId" | "allocationCount" | "allocationCursor" | "claimCount" | "claimCursor" | "deferredPositiveChanges" | "expectedRevision" | "expiresAt" | "feeCount" | "feeCursor" | "initialRevision" | "initialRiskRevision" | "observedRevision" | "operationKey" | "ownerKey" | "phase" | "policyMode" | "policyOperationKey" | "providerChanged" | "readOnly" | "reason" | "riskRevision" | "sourceCount" | "sourceCursor" | "sourceFence" | "step">, {
|
|
171
|
+
by_account_phase: ["accountId", "phase", "_creationTime"];
|
|
172
|
+
by_operation: ["operationKey", "_creationTime"];
|
|
173
|
+
by_read_only: ["readOnly", "_creationTime"];
|
|
174
|
+
}, {}, {}>;
|
|
175
|
+
export declare const snapshotSourcesTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
176
|
+
allocationCurrency?: string | undefined;
|
|
177
|
+
allocationPresent: boolean;
|
|
178
|
+
amount: number;
|
|
179
|
+
currency: string;
|
|
180
|
+
expectedPaid: number;
|
|
181
|
+
expectedReserved: number;
|
|
182
|
+
ledgerFingerprint: string;
|
|
183
|
+
needsCheck: boolean;
|
|
184
|
+
paidAmount: number;
|
|
185
|
+
reinstatement: boolean;
|
|
186
|
+
reservedAmount: number;
|
|
187
|
+
reversalClaimedAmount: number;
|
|
188
|
+
reversedAmount: number;
|
|
189
|
+
role?: string | undefined;
|
|
190
|
+
snapshotId: import("convex/values").GenericId<"payoutSnapshots">;
|
|
191
|
+
sourceChargeId?: string | undefined;
|
|
192
|
+
sourceCreatedAt: number;
|
|
193
|
+
status: string;
|
|
194
|
+
stripeTransferId: string;
|
|
195
|
+
}, {
|
|
196
|
+
snapshotId: import("convex/values").VId<import("convex/values").GenericId<"payoutSnapshots">, "required">;
|
|
197
|
+
stripeTransferId: import("convex/values").VString<string, "required">;
|
|
198
|
+
ledgerFingerprint: import("convex/values").VString<string, "required">;
|
|
199
|
+
sourceCreatedAt: import("convex/values").VFloat64<number, "required">;
|
|
200
|
+
currency: import("convex/values").VString<string, "required">;
|
|
201
|
+
amount: import("convex/values").VFloat64<number, "required">;
|
|
202
|
+
status: import("convex/values").VString<string, "required">;
|
|
203
|
+
role: import("convex/values").VString<string | undefined, "optional">;
|
|
204
|
+
sourceChargeId: import("convex/values").VString<string | undefined, "optional">;
|
|
205
|
+
reversedAmount: import("convex/values").VFloat64<number, "required">;
|
|
206
|
+
reversalClaimedAmount: import("convex/values").VFloat64<number, "required">;
|
|
207
|
+
reinstatement: import("convex/values").VBoolean<boolean, "required">;
|
|
208
|
+
allocationPresent: import("convex/values").VBoolean<boolean, "required">;
|
|
209
|
+
allocationCurrency: import("convex/values").VString<string | undefined, "optional">;
|
|
210
|
+
paidAmount: import("convex/values").VFloat64<number, "required">;
|
|
211
|
+
reservedAmount: import("convex/values").VFloat64<number, "required">;
|
|
212
|
+
expectedPaid: import("convex/values").VFloat64<number, "required">;
|
|
213
|
+
expectedReserved: import("convex/values").VFloat64<number, "required">;
|
|
214
|
+
needsCheck: import("convex/values").VBoolean<boolean, "required">;
|
|
215
|
+
}, "required", "allocationCurrency" | "allocationPresent" | "amount" | "currency" | "expectedPaid" | "expectedReserved" | "ledgerFingerprint" | "needsCheck" | "paidAmount" | "reinstatement" | "reservedAmount" | "reversalClaimedAmount" | "reversedAmount" | "role" | "snapshotId" | "sourceChargeId" | "sourceCreatedAt" | "status" | "stripeTransferId">, {
|
|
216
|
+
by_snapshot: ["snapshotId", "_creationTime"];
|
|
217
|
+
by_snapshot_check: ["snapshotId", "needsCheck", "_creationTime"];
|
|
218
|
+
by_snapshot_transfer: ["snapshotId", "stripeTransferId", "_creationTime"];
|
|
219
|
+
}, {}, {}>;
|
|
220
|
+
export declare const snapshotClaimsTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
221
|
+
allocations: {
|
|
222
|
+
amount: number;
|
|
223
|
+
role?: string | undefined;
|
|
224
|
+
stripeTransferId: string;
|
|
225
|
+
}[];
|
|
226
|
+
amount: number;
|
|
227
|
+
currency: string;
|
|
228
|
+
fingerprint: string;
|
|
229
|
+
historical?: boolean | undefined;
|
|
230
|
+
operationKey: string;
|
|
231
|
+
providerFee?: number | undefined;
|
|
232
|
+
snapshotId: import("convex/values").GenericId<"payoutSnapshots">;
|
|
233
|
+
status: string;
|
|
234
|
+
stripePayoutId?: string | undefined;
|
|
235
|
+
}, {
|
|
236
|
+
snapshotId: import("convex/values").VId<import("convex/values").GenericId<"payoutSnapshots">, "required">;
|
|
237
|
+
operationKey: import("convex/values").VString<string, "required">;
|
|
238
|
+
fingerprint: import("convex/values").VString<string, "required">;
|
|
239
|
+
currency: import("convex/values").VString<string, "required">;
|
|
240
|
+
amount: import("convex/values").VFloat64<number, "required">;
|
|
241
|
+
status: import("convex/values").VString<string, "required">;
|
|
242
|
+
stripePayoutId: import("convex/values").VString<string | undefined, "optional">;
|
|
243
|
+
historical: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
244
|
+
providerFee: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
245
|
+
allocations: import("convex/values").VArray<{
|
|
246
|
+
amount: number;
|
|
247
|
+
role?: string | undefined;
|
|
248
|
+
stripeTransferId: string;
|
|
249
|
+
}[], import("convex/values").VObject<{
|
|
250
|
+
amount: number;
|
|
251
|
+
role?: string | undefined;
|
|
252
|
+
stripeTransferId: string;
|
|
253
|
+
}, {
|
|
254
|
+
stripeTransferId: import("convex/values").VString<string, "required">;
|
|
255
|
+
amount: import("convex/values").VFloat64<number, "required">;
|
|
256
|
+
role: import("convex/values").VString<string | undefined, "optional">;
|
|
257
|
+
}, "required", "amount" | "role" | "stripeTransferId">, "required">;
|
|
258
|
+
}, "required", "allocations" | "amount" | "currency" | "fingerprint" | "historical" | "operationKey" | "providerFee" | "snapshotId" | "status" | "stripePayoutId">, {
|
|
259
|
+
by_snapshot: ["snapshotId", "_creationTime"];
|
|
260
|
+
by_snapshot_operation: ["snapshotId", "operationKey", "_creationTime"];
|
|
261
|
+
}, {}, {}>;
|
|
262
|
+
export declare const snapshotFeesTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
263
|
+
amount: number;
|
|
264
|
+
currency: string;
|
|
265
|
+
revision: number;
|
|
266
|
+
snapshotId: import("convex/values").GenericId<"payoutSnapshots">;
|
|
267
|
+
}, {
|
|
268
|
+
snapshotId: import("convex/values").VId<import("convex/values").GenericId<"payoutSnapshots">, "required">;
|
|
269
|
+
currency: import("convex/values").VString<string, "required">;
|
|
270
|
+
amount: import("convex/values").VFloat64<number, "required">;
|
|
271
|
+
revision: import("convex/values").VFloat64<number, "required">;
|
|
272
|
+
}, "required", "amount" | "currency" | "revision" | "snapshotId">, {
|
|
273
|
+
by_snapshot: ["snapshotId", "_creationTime"];
|
|
274
|
+
by_snapshot_currency: ["snapshotId", "currency", "_creationTime"];
|
|
275
|
+
}, {}, {}>;
|
|
276
|
+
export declare const riskRevisionsTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
277
|
+
accountId: string;
|
|
278
|
+
riskRevision: number;
|
|
279
|
+
}, {
|
|
280
|
+
accountId: import("convex/values").VString<string, "required">;
|
|
281
|
+
riskRevision: import("convex/values").VFloat64<number, "required">;
|
|
282
|
+
}, "required", "accountId" | "riskRevision">, {
|
|
283
|
+
by_account: ["accountId", "_creationTime"];
|
|
284
|
+
}, {}, {}>;
|
|
285
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/component/payoutSnapshots/schema.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,uBAAuB;;;;;;;;;;UAIC,CAAC;AACtC,eAAO,MAAM,QAAQ,yZAMpB,CAAC;AACF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;UAMkC,CAAC;AAC/D,eAAO,MAAM,eAAe,irBAU3B,CAAC;AACF,eAAO,MAAM,cAAc;IACzB,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,YAAY;IACZ,gBAAgB;IAChB,UAAU;IACV,kBAAkB;IAClB,KAAK;IACL,IAAI;IACJ,WAAW;IACX,YAAY;IACZ,gBAAgB;IAChB,SAAS;IACT,WAAW;IACX,eAAe;IACf,mBAAmB;IACnB,YAAY;IACZ,gBAAgB;IAChB,WAAW;IACX,eAAe;IACf,UAAU;IACV,QAAQ;IACR,uBAAuB;IACvB,eAAe;IACf,SAAS;IACT,MAAM;CACP,CAAC;AACF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6dAItB,CAAC;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAGyB,CAAC;AACrD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAuB0B,CAAC;AAC5D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAmBiC,CAAC;AAClE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;UAO8B,CAAC;AAC7D,eAAO,MAAM,kBAAkB;;;;;;;;UAGM,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { defineTable } from "convex/server";
|
|
2
|
+
import { v } from "convex/values";
|
|
3
|
+
export const financialRevisionsTable = defineTable({
|
|
4
|
+
accountId: v.string(),
|
|
5
|
+
revision: v.number(),
|
|
6
|
+
riskRevision: v.number(),
|
|
7
|
+
}).index("by_account", ["accountId"]);
|
|
8
|
+
export const riskKind = v.union(v.literal("transfer"), v.literal("provider_payout"), v.literal("allocation"), v.literal("claim"), v.literal("fee"));
|
|
9
|
+
export const riskEventsTable = defineTable({
|
|
10
|
+
accountId: v.string(),
|
|
11
|
+
riskRevision: v.number(),
|
|
12
|
+
kind: riskKind,
|
|
13
|
+
key: v.string(),
|
|
14
|
+
removed: v.optional(v.boolean()),
|
|
15
|
+
}).index("by_account_revision", ["accountId", "riskRevision"]);
|
|
16
|
+
export const collectionPhase = v.union(v.literal("sources"), v.literal("allocations"), v.literal("fees"), v.literal("claims"), v.literal("repair"), v.literal("check"), v.literal("local_ready"), v.literal("invalidated"), v.literal("discarding"));
|
|
17
|
+
export const snapshotFields = {
|
|
18
|
+
readOnly: v.boolean(),
|
|
19
|
+
accountId: v.string(),
|
|
20
|
+
ownerKey: v.string(),
|
|
21
|
+
operationKey: v.string(),
|
|
22
|
+
expectedRevision: v.number(),
|
|
23
|
+
policyMode: v.optional(v.string()),
|
|
24
|
+
policyOperationKey: v.optional(v.string()),
|
|
25
|
+
phase: collectionPhase,
|
|
26
|
+
step: v.number(),
|
|
27
|
+
sourceFence: v.number(),
|
|
28
|
+
sourceCursor: v.optional(v.string()),
|
|
29
|
+
allocationCursor: v.optional(v.string()),
|
|
30
|
+
feeCursor: v.optional(v.string()),
|
|
31
|
+
claimCursor: v.optional(v.string()),
|
|
32
|
+
initialRevision: v.number(),
|
|
33
|
+
initialRiskRevision: v.number(),
|
|
34
|
+
riskRevision: v.number(),
|
|
35
|
+
observedRevision: v.number(),
|
|
36
|
+
sourceCount: v.number(),
|
|
37
|
+
allocationCount: v.number(),
|
|
38
|
+
claimCount: v.number(),
|
|
39
|
+
feeCount: v.number(),
|
|
40
|
+
deferredPositiveChanges: v.boolean(),
|
|
41
|
+
providerChanged: v.boolean(),
|
|
42
|
+
expiresAt: v.number(),
|
|
43
|
+
reason: v.optional(v.string()),
|
|
44
|
+
};
|
|
45
|
+
export const snapshotDoc = v.object({
|
|
46
|
+
...snapshotFields,
|
|
47
|
+
_id: v.id("payoutSnapshots"),
|
|
48
|
+
_creationTime: v.number(),
|
|
49
|
+
});
|
|
50
|
+
export const snapshotsTable = defineTable(snapshotFields)
|
|
51
|
+
.index("by_operation", ["operationKey"])
|
|
52
|
+
.index("by_read_only", ["readOnly"])
|
|
53
|
+
.index("by_account_phase", ["accountId", "phase"]);
|
|
54
|
+
export const snapshotSourcesTable = defineTable({
|
|
55
|
+
snapshotId: v.id("payoutSnapshots"),
|
|
56
|
+
stripeTransferId: v.string(),
|
|
57
|
+
ledgerFingerprint: v.string(),
|
|
58
|
+
sourceCreatedAt: v.number(),
|
|
59
|
+
currency: v.string(),
|
|
60
|
+
amount: v.number(),
|
|
61
|
+
status: v.string(),
|
|
62
|
+
role: v.optional(v.string()),
|
|
63
|
+
sourceChargeId: v.optional(v.string()),
|
|
64
|
+
reversedAmount: v.number(),
|
|
65
|
+
reversalClaimedAmount: v.number(),
|
|
66
|
+
reinstatement: v.boolean(),
|
|
67
|
+
allocationPresent: v.boolean(),
|
|
68
|
+
allocationCurrency: v.optional(v.string()),
|
|
69
|
+
paidAmount: v.number(),
|
|
70
|
+
reservedAmount: v.number(),
|
|
71
|
+
expectedPaid: v.number(),
|
|
72
|
+
expectedReserved: v.number(),
|
|
73
|
+
needsCheck: v.boolean(),
|
|
74
|
+
})
|
|
75
|
+
.index("by_snapshot", ["snapshotId"])
|
|
76
|
+
.index("by_snapshot_transfer", ["snapshotId", "stripeTransferId"])
|
|
77
|
+
.index("by_snapshot_check", ["snapshotId", "needsCheck"]);
|
|
78
|
+
export const snapshotClaimsTable = defineTable({
|
|
79
|
+
snapshotId: v.id("payoutSnapshots"),
|
|
80
|
+
operationKey: v.string(),
|
|
81
|
+
fingerprint: v.string(),
|
|
82
|
+
currency: v.string(),
|
|
83
|
+
amount: v.number(),
|
|
84
|
+
status: v.string(),
|
|
85
|
+
stripePayoutId: v.optional(v.string()),
|
|
86
|
+
historical: v.optional(v.boolean()),
|
|
87
|
+
providerFee: v.optional(v.number()),
|
|
88
|
+
allocations: v.array(v.object({
|
|
89
|
+
stripeTransferId: v.string(),
|
|
90
|
+
amount: v.number(),
|
|
91
|
+
role: v.optional(v.string()),
|
|
92
|
+
})),
|
|
93
|
+
})
|
|
94
|
+
.index("by_snapshot", ["snapshotId"])
|
|
95
|
+
.index("by_snapshot_operation", ["snapshotId", "operationKey"]);
|
|
96
|
+
export const snapshotFeesTable = defineTable({
|
|
97
|
+
snapshotId: v.id("payoutSnapshots"),
|
|
98
|
+
currency: v.string(),
|
|
99
|
+
amount: v.number(),
|
|
100
|
+
revision: v.number(),
|
|
101
|
+
})
|
|
102
|
+
.index("by_snapshot", ["snapshotId"])
|
|
103
|
+
.index("by_snapshot_currency", ["snapshotId", "currency"]);
|
|
104
|
+
export const riskRevisionsTable = defineTable({
|
|
105
|
+
accountId: v.string(),
|
|
106
|
+
riskRevision: v.number(),
|
|
107
|
+
}).index("by_account", ["accountId"]);
|
|
108
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/component/payoutSnapshots/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,MAAM,CAAC,MAAM,uBAAuB,GAAG,WAAW,CAAC;IACjD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;CACzB,CAAC,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;AACtC,MAAM,CAA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;KACpC,KAAK,CAAC,uBAAuB,EAAE,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC,CAAC;AAClE,MAAM,CAAC,MAAM,iBAAiB,GAAG,WAAW,CAAC;IAC3C,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,iBAAiB,CAAC;IACnC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;CACrB,CAAC;KACC,KAAK,CAAC,aAAa,EAAE,CAAC,YAAY,CAAC,CAAC;KACpC,KAAK,CAAC,sBAAsB,EAAE,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC;AAC7D,MAAM,CAAC,MAAM,kBAAkB,GAAG,WAAW,CAAC;IAC5C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;CACzB,CAAC,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { validateIdentity } from "../payoutRelease/helpers.js";
|
|
2
|
+
export declare const identity: {
|
|
3
|
+
accountId: import("convex/values").VString<string, "required">;
|
|
4
|
+
ownerKey: import("convex/values").VString<string, "required">;
|
|
5
|
+
operationKey: import("convex/values").VString<string, "required">;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../../src/component/payoutSnapshots/scope.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,eAAO,MAAM,QAAQ;IACnB,SAAS;IACT,QAAQ;IACR,YAAY;CACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../../src/component/payoutSnapshots/scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;CACzB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { MutationCtx, QueryCtx } from "../_generated/server.js";
|
|
2
|
+
export declare function validate(args: {
|
|
3
|
+
accountId: string;
|
|
4
|
+
ownerKey: string;
|
|
5
|
+
currency: string;
|
|
6
|
+
}): void;
|
|
7
|
+
export declare function readJob(ctx: MutationCtx | QueryCtx, args: {
|
|
8
|
+
accountId: string;
|
|
9
|
+
ownerKey: string;
|
|
10
|
+
currency: string;
|
|
11
|
+
}): Promise<{
|
|
12
|
+
_creationTime: number;
|
|
13
|
+
_id: import("convex/values").GenericId<"payoutWorkerJobs">;
|
|
14
|
+
accountId: string;
|
|
15
|
+
cadenceMs: number;
|
|
16
|
+
completedGeneration?: number | undefined;
|
|
17
|
+
completedOperationKey?: string | undefined;
|
|
18
|
+
currency: string;
|
|
19
|
+
generation: number;
|
|
20
|
+
hasOperation: boolean;
|
|
21
|
+
lastAttemptAt?: number | undefined;
|
|
22
|
+
lastReason?: string | undefined;
|
|
23
|
+
leaseUntil?: number | undefined;
|
|
24
|
+
nextAttemptAt: number;
|
|
25
|
+
operationKey?: string | undefined;
|
|
26
|
+
ownerKey: string;
|
|
27
|
+
sequence: number;
|
|
28
|
+
} | null>;
|
|
29
|
+
export declare function pageSize(n: number): void;
|
|
30
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/component/payoutWorker/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAErE,wBAAgB,QAAQ,CAAC,IAAI,EAAE;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,QAIA;AACD,wBAAsB,OAAO,CAC3B,GAAG,EAAE,WAAW,GAAG,QAAQ,EAC3B,IAAI,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;UAYhE;AACD,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,QAGjC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { validateScope } from "../payoutPolicy/helpers.js";
|
|
2
|
+
export function validate(args) {
|
|
3
|
+
validateScope(args);
|
|
4
|
+
if (!/^[a-z]{3}$/.test(args.currency))
|
|
5
|
+
throw new Error("Invalid worker currency.");
|
|
6
|
+
}
|
|
7
|
+
export async function readJob(ctx, args) {
|
|
8
|
+
validate(args);
|
|
9
|
+
const job = await ctx.db
|
|
10
|
+
.query("payoutWorkerJobs")
|
|
11
|
+
.withIndex("by_account_currency", (q) => q.eq("accountId", args.accountId).eq("currency", args.currency))
|
|
12
|
+
.unique();
|
|
13
|
+
if (job && job.ownerKey !== args.ownerKey)
|
|
14
|
+
throw new Error("Payout worker owner does not match.");
|
|
15
|
+
return job;
|
|
16
|
+
}
|
|
17
|
+
export function pageSize(n) {
|
|
18
|
+
if (!Number.isInteger(n) || n < 1 || n > 25)
|
|
19
|
+
throw new Error("Invalid worker page size.");
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/component/payoutWorker/helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,MAAM,UAAU,QAAQ,CAAC,IAIxB;IACC,aAAa,CAAC,IAAI,CAAC,CAAC;IACpB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;AAChD,CAAC;AACD,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,GAA2B,EAC3B,IAA+D;IAE/D,QAAQ,CAAC,IAAI,CAAC,CAAC;IACf,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,EAAE;SACrB,KAAK,CAAC,kBAAkB,CAAC;SACzB,SAAS,CAAC,qBAAqB,EAAE,CAAC,CAAC,EAAE,EAAE,CACtC,CAAC,CAAC,EAAE,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAChE;SACA,MAAM,EAAE,CAAC;IACZ,IAAI,GAAG,IAAI,GAAG,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ;QACvC,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,OAAO,GAAG,CAAC;AACb,CAAC;AACD,MAAM,UAAU,QAAQ,CAAC,CAAS;IAChC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE;QACzC,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/** A worker lease serializes observations; only the payout claim reserves money. */
|
|
2
|
+
export declare const begin: import("convex/server").RegisteredMutation<"public", {
|
|
3
|
+
accountId: string;
|
|
4
|
+
cadenceMs: number;
|
|
5
|
+
currency: string;
|
|
6
|
+
ownerKey: string;
|
|
7
|
+
}, Promise<{
|
|
8
|
+
status: "held";
|
|
9
|
+
reason: string;
|
|
10
|
+
nextAttemptAt: number;
|
|
11
|
+
job?: undefined;
|
|
12
|
+
reconcileOnly?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
nextAttemptAt?: undefined;
|
|
15
|
+
status: "held";
|
|
16
|
+
reason: string;
|
|
17
|
+
job?: undefined;
|
|
18
|
+
reconcileOnly?: undefined;
|
|
19
|
+
} | {
|
|
20
|
+
reason?: undefined;
|
|
21
|
+
nextAttemptAt?: undefined;
|
|
22
|
+
status: "run";
|
|
23
|
+
job: {
|
|
24
|
+
_creationTime: number;
|
|
25
|
+
_id: import("convex/values").GenericId<"payoutWorkerJobs">;
|
|
26
|
+
accountId: string;
|
|
27
|
+
cadenceMs: number;
|
|
28
|
+
completedGeneration?: number | undefined;
|
|
29
|
+
completedOperationKey?: string | undefined;
|
|
30
|
+
currency: string;
|
|
31
|
+
generation: number;
|
|
32
|
+
hasOperation: boolean;
|
|
33
|
+
lastAttemptAt?: number | undefined;
|
|
34
|
+
lastReason?: string | undefined;
|
|
35
|
+
leaseUntil?: number | undefined;
|
|
36
|
+
nextAttemptAt: number;
|
|
37
|
+
operationKey?: string | undefined;
|
|
38
|
+
ownerKey: string;
|
|
39
|
+
sequence: number;
|
|
40
|
+
};
|
|
41
|
+
reconcileOnly: boolean;
|
|
42
|
+
}>>;
|
|
43
|
+
export declare const finish: import("convex/server").RegisteredMutation<"public", {
|
|
44
|
+
accountId: string;
|
|
45
|
+
currency: string;
|
|
46
|
+
generation: number;
|
|
47
|
+
operationKey: string;
|
|
48
|
+
ownerKey: string;
|
|
49
|
+
reason: string;
|
|
50
|
+
}, Promise<{
|
|
51
|
+
_creationTime: number;
|
|
52
|
+
_id: import("convex/values").GenericId<"payoutWorkerJobs">;
|
|
53
|
+
accountId: string;
|
|
54
|
+
cadenceMs: number;
|
|
55
|
+
completedGeneration?: number | undefined;
|
|
56
|
+
completedOperationKey?: string | undefined;
|
|
57
|
+
currency: string;
|
|
58
|
+
generation: number;
|
|
59
|
+
hasOperation: boolean;
|
|
60
|
+
lastAttemptAt?: number | undefined;
|
|
61
|
+
lastReason?: string | undefined;
|
|
62
|
+
leaseUntil?: number | undefined;
|
|
63
|
+
nextAttemptAt: number;
|
|
64
|
+
operationKey?: string | undefined;
|
|
65
|
+
ownerKey: string;
|
|
66
|
+
sequence: number;
|
|
67
|
+
}>>;
|
|
68
|
+
//# sourceMappingURL=mutations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../../src/component/payoutWorker/mutations.ts"],"names":[],"mappings":"AAYA,oFAAoF;AACpF,eAAO,MAAM,KAAK;;;;;;YAuBF,MAAM;;;;;;;YAiCC,MAAM;;;;;;;YA4Df,KAAK;;;;;;;;;;;;;;;;;;;;GAKjB,CAAC;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;GA6CjB,CAAC"}
|