@fantastic.dev/better-stripe 0.34.0 → 0.37.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 +260 -0
- package/README.md +1 -1
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +664 -2
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts +332 -1
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +664 -2
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutSyncTestHelpers.d.ts +332 -1
- package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/refundCommandEvidence.d.ts +14 -0
- package/dist/client/connect/refundCommandEvidence.d.ts.map +1 -0
- package/dist/client/connect/refundCommandEvidence.js +20 -0
- package/dist/client/connect/refundCommandEvidence.js.map +1 -0
- package/dist/client/connect/refundCommandNormalization.d.ts +11 -0
- package/dist/client/connect/refundCommandNormalization.d.ts.map +1 -0
- package/dist/client/connect/refundCommandNormalization.js +12 -0
- package/dist/client/connect/refundCommandNormalization.js.map +1 -0
- package/dist/client/financialObservations.d.ts +42 -0
- package/dist/client/financialObservations.d.ts.map +1 -0
- package/dist/client/financialObservations.js +58 -0
- package/dist/client/financialObservations.js.map +1 -0
- package/dist/client/financialOwnership.d.ts +52 -0
- package/dist/client/financialOwnership.d.ts.map +1 -0
- package/dist/client/financialOwnership.js +72 -0
- package/dist/client/financialOwnership.js.map +1 -0
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -2
- package/dist/client/index.js.map +1 -1
- package/dist/client/observationPagination.d.ts +10 -0
- package/dist/client/observationPagination.d.ts.map +1 -0
- package/dist/client/observationPagination.js +12 -0
- package/dist/client/observationPagination.js.map +1 -0
- package/dist/client/operationEvidence.d.ts +37 -0
- package/dist/client/operationEvidence.d.ts.map +1 -0
- package/dist/client/operationEvidence.js +44 -0
- package/dist/client/operationEvidence.js.map +1 -0
- package/dist/client/publicTypes.d.ts +6 -0
- package/dist/client/publicTypes.d.ts.map +1 -1
- package/dist/client/readContracts.d.ts +31 -0
- package/dist/client/readContracts.d.ts.map +1 -1
- package/dist/client/readContracts.js +14 -0
- package/dist/client/readContracts.js.map +1 -1
- package/dist/client/transferObservations.d.ts +59 -0
- package/dist/client/transferObservations.d.ts.map +1 -0
- package/dist/client/transferObservations.js +82 -0
- package/dist/client/transferObservations.js.map +1 -0
- package/dist/component/_generated/component.d.ts +687 -0
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/affiliateRecovery/mutations.d.ts.map +1 -1
- package/dist/component/affiliateRecovery/mutations.js +4 -1
- package/dist/component/affiliateRecovery/mutations.js.map +1 -1
- package/dist/component/connect/mutations.d.ts.map +1 -1
- package/dist/component/connect/mutations.js +18 -2
- package/dist/component/connect/mutations.js.map +1 -1
- package/dist/component/connect/queries.d.ts +8 -0
- package/dist/component/connect/queries.d.ts.map +1 -1
- package/dist/component/connect/reversalClaims.d.ts.map +1 -1
- package/dist/component/connect/reversalClaims.js +7 -1
- package/dist/component/connect/reversalClaims.js.map +1 -1
- package/dist/component/connect/reversalReceipts.d.ts.map +1 -1
- package/dist/component/connect/reversalReceipts.js +2 -0
- package/dist/component/connect/reversalReceipts.js.map +1 -1
- package/dist/component/connect/schema.d.ts +11 -1
- package/dist/component/connect/schema.d.ts.map +1 -1
- package/dist/component/connect/schema.js +9 -1
- package/dist/component/connect/schema.js.map +1 -1
- package/dist/component/connect/validators.d.ts +9 -1
- package/dist/component/connect/validators.d.ts.map +1 -1
- package/dist/component/connect/validators.js +2 -0
- package/dist/component/connect/validators.js.map +1 -1
- package/dist/component/earnings/pairedAdjustment.d.ts +12 -0
- package/dist/component/earnings/pairedAdjustment.d.ts.map +1 -0
- package/dist/component/earnings/pairedAdjustment.js +46 -0
- package/dist/component/earnings/pairedAdjustment.js.map +1 -0
- package/dist/component/earnings/triggers.d.ts +546 -2
- package/dist/component/earnings/triggers.d.ts.map +1 -1
- package/dist/component/earnings/triggers.js +17 -3
- package/dist/component/earnings/triggers.js.map +1 -1
- package/dist/component/financialObservations/continuation.d.ts +7 -0
- package/dist/component/financialObservations/continuation.d.ts.map +1 -0
- package/dist/component/financialObservations/continuation.js +131 -0
- package/dist/component/financialObservations/continuation.js.map +1 -0
- package/dist/component/financialObservations/generations.d.ts +6 -0
- package/dist/component/financialObservations/generations.d.ts.map +1 -0
- package/dist/component/financialObservations/generations.js +46 -0
- package/dist/component/financialObservations/generations.js.map +1 -0
- package/dist/component/financialObservations/mutations.d.ts +62 -0
- package/dist/component/financialObservations/mutations.d.ts.map +1 -0
- package/dist/component/financialObservations/mutations.js +69 -0
- package/dist/component/financialObservations/mutations.js.map +1 -0
- package/dist/component/financialObservations/queries.d.ts +307 -0
- package/dist/component/financialObservations/queries.d.ts.map +1 -0
- package/dist/component/financialObservations/queries.js +219 -0
- package/dist/component/financialObservations/queries.js.map +1 -0
- package/dist/component/financialObservations/schema.d.ts +182 -0
- package/dist/component/financialObservations/schema.d.ts.map +1 -0
- package/dist/component/financialObservations/schema.js +53 -0
- package/dist/component/financialObservations/schema.js.map +1 -0
- package/dist/component/financialObservations/settlement.d.ts +7 -0
- package/dist/component/financialObservations/settlement.d.ts.map +1 -0
- package/dist/component/financialObservations/settlement.js +118 -0
- package/dist/component/financialObservations/settlement.js.map +1 -0
- package/dist/component/financialObservations/settlementHelpers.d.ts +46 -0
- package/dist/component/financialObservations/settlementHelpers.d.ts.map +1 -0
- package/dist/component/financialObservations/settlementHelpers.js +70 -0
- package/dist/component/financialObservations/settlementHelpers.js.map +1 -0
- package/dist/component/financialObservations/transferBatches.d.ts +12 -0
- package/dist/component/financialObservations/transferBatches.d.ts.map +1 -0
- package/dist/component/financialObservations/transferBatches.js +76 -0
- package/dist/component/financialObservations/transferBatches.js.map +1 -0
- package/dist/component/financialObservations/transferContinuation.d.ts +5 -0
- package/dist/component/financialObservations/transferContinuation.d.ts.map +1 -0
- package/dist/component/financialObservations/transferContinuation.js +35 -0
- package/dist/component/financialObservations/transferContinuation.js.map +1 -0
- package/dist/component/financialObservations/transferContinuationState.d.ts +8 -0
- package/dist/component/financialObservations/transferContinuationState.d.ts.map +1 -0
- package/dist/component/financialObservations/transferContinuationState.js +69 -0
- package/dist/component/financialObservations/transferContinuationState.js.map +1 -0
- package/dist/component/financialObservations/transferContinuationSteps.d.ts +5 -0
- package/dist/component/financialObservations/transferContinuationSteps.d.ts.map +1 -0
- package/dist/component/financialObservations/transferContinuationSteps.js +174 -0
- package/dist/component/financialObservations/transferContinuationSteps.js.map +1 -0
- package/dist/component/financialObservations/transferHelpers.d.ts +18 -0
- package/dist/component/financialObservations/transferHelpers.d.ts.map +1 -0
- package/dist/component/financialObservations/transferHelpers.js +37 -0
- package/dist/component/financialObservations/transferHelpers.js.map +1 -0
- package/dist/component/financialObservations/transferReferenceSchema.d.ts +56 -0
- package/dist/component/financialObservations/transferReferenceSchema.d.ts.map +1 -0
- package/dist/component/financialObservations/transferReferenceSchema.js +21 -0
- package/dist/component/financialObservations/transferReferenceSchema.js.map +1 -0
- package/dist/component/financialObservations/transferSchema.d.ts +237 -0
- package/dist/component/financialObservations/transferSchema.d.ts.map +1 -0
- package/dist/component/financialObservations/transferSchema.js +65 -0
- package/dist/component/financialObservations/transferSchema.js.map +1 -0
- package/dist/component/financialObservations/transfers.d.ts +7 -0
- package/dist/component/financialObservations/transfers.d.ts.map +1 -0
- package/dist/component/financialObservations/transfers.js +79 -0
- package/dist/component/financialObservations/transfers.js.map +1 -0
- package/dist/component/financialOwnership/helpers.d.ts +37 -0
- package/dist/component/financialOwnership/helpers.d.ts.map +1 -0
- package/dist/component/financialOwnership/helpers.js +76 -0
- package/dist/component/financialOwnership/helpers.js.map +1 -0
- package/dist/component/financialOwnership/mutations.d.ts +28 -0
- package/dist/component/financialOwnership/mutations.d.ts.map +1 -0
- package/dist/component/financialOwnership/mutations.js +74 -0
- package/dist/component/financialOwnership/mutations.js.map +1 -0
- package/dist/component/financialOwnership/queries.d.ts +57 -0
- package/dist/component/financialOwnership/queries.d.ts.map +1 -0
- package/dist/component/financialOwnership/queries.js +50 -0
- package/dist/component/financialOwnership/queries.js.map +1 -0
- package/dist/component/financialOwnership/schema.d.ts +140 -0
- package/dist/component/financialOwnership/schema.d.ts.map +1 -0
- package/dist/component/financialOwnership/schema.js +35 -0
- package/dist/component/financialOwnership/schema.js.map +1 -0
- package/dist/component/operationEvidence/canonical.d.ts +4 -0
- package/dist/component/operationEvidence/canonical.d.ts.map +1 -0
- package/dist/component/operationEvidence/canonical.js +8 -0
- package/dist/component/operationEvidence/canonical.js.map +1 -0
- package/dist/component/operationEvidence/helpers.d.ts +87 -0
- package/dist/component/operationEvidence/helpers.d.ts.map +1 -0
- package/dist/component/operationEvidence/helpers.js +49 -0
- package/dist/component/operationEvidence/helpers.js.map +1 -0
- package/dist/component/operationEvidence/maintenance.d.ts +88 -0
- package/dist/component/operationEvidence/maintenance.d.ts.map +1 -0
- package/dist/component/operationEvidence/maintenance.js +59 -0
- package/dist/component/operationEvidence/maintenance.js.map +1 -0
- package/dist/component/operationEvidence/mutations.d.ts +97 -0
- package/dist/component/operationEvidence/mutations.d.ts.map +1 -0
- package/dist/component/operationEvidence/mutations.js +14 -0
- package/dist/component/operationEvidence/mutations.js.map +1 -0
- package/dist/component/operationEvidence/queries.d.ts +205 -0
- package/dist/component/operationEvidence/queries.d.ts.map +1 -0
- package/dist/component/operationEvidence/queries.js +75 -0
- package/dist/component/operationEvidence/queries.js.map +1 -0
- package/dist/component/operationEvidence/schema.d.ts +536 -0
- package/dist/component/operationEvidence/schema.d.ts.map +1 -0
- package/dist/component/operationEvidence/schema.js +53 -0
- package/dist/component/operationEvidence/schema.js.map +1 -0
- package/dist/component/refundHistory/commandBinding.d.ts +17 -0
- package/dist/component/refundHistory/commandBinding.d.ts.map +1 -0
- package/dist/component/refundHistory/commandBinding.js +41 -0
- package/dist/component/refundHistory/commandBinding.js.map +1 -0
- package/dist/component/refundHistory/commandEvidence.d.ts +50 -0
- package/dist/component/refundHistory/commandEvidence.d.ts.map +1 -0
- package/dist/component/refundHistory/commandEvidence.js +58 -0
- package/dist/component/refundHistory/commandEvidence.js.map +1 -0
- package/dist/component/refundHistory/commandEvidenceValidator.d.ts +89 -0
- package/dist/component/refundHistory/commandEvidenceValidator.d.ts.map +1 -0
- package/dist/component/refundHistory/commandEvidenceValidator.js +8 -0
- package/dist/component/refundHistory/commandEvidenceValidator.js.map +1 -0
- package/dist/component/refundHistory/commandFields.d.ts +8 -0
- package/dist/component/refundHistory/commandFields.d.ts.map +1 -0
- package/dist/component/refundHistory/commandFields.js +9 -0
- package/dist/component/refundHistory/commandFields.js.map +1 -0
- package/dist/component/refundHistory/mutations.d.ts +8 -0
- package/dist/component/refundHistory/mutations.d.ts.map +1 -0
- package/dist/component/refundHistory/mutations.js +25 -0
- package/dist/component/refundHistory/mutations.js.map +1 -0
- package/dist/component/refundHistory/originalSeller.d.ts +5 -0
- package/dist/component/refundHistory/originalSeller.d.ts.map +1 -0
- package/dist/component/refundHistory/originalSeller.js +35 -0
- package/dist/component/refundHistory/originalSeller.js.map +1 -0
- package/dist/component/refundHistory/queries.d.ts +51 -0
- package/dist/component/refundHistory/queries.d.ts.map +1 -1
- package/dist/component/refundHistory/queries.js +14 -0
- package/dist/component/refundHistory/queries.js.map +1 -1
- package/dist/component/schema.d.ts +332 -1
- package/dist/component/schema.js +15 -0
- package/dist/component/schema.js.map +1 -1
- package/dist/component/settlement/mutations.d.ts.map +1 -1
- package/dist/component/settlement/mutations.js +5 -1
- package/dist/component/settlement/mutations.js.map +1 -1
- package/dist/shared/refundCommandScope.d.ts +10 -0
- package/dist/shared/refundCommandScope.d.ts.map +1 -0
- package/dist/shared/refundCommandScope.js +9 -0
- package/dist/shared/refundCommandScope.js.map +1 -0
- package/docs/financial-observations.md +244 -0
- package/docs/financial-ownership.md +54 -0
- package/docs/refund-command-evidence.md +55 -0
- package/package.json +5 -2
- package/src/client/connect/refundCommandEvidence.ts +41 -0
- package/src/client/connect/refundCommandNormalization.ts +28 -0
- package/src/client/financialObservations.test.ts +109 -0
- package/src/client/financialObservations.ts +106 -0
- package/src/client/financialOwnership.test.ts +80 -0
- package/src/client/financialOwnership.ts +116 -0
- package/src/client/index.ts +2 -2
- package/src/client/observationPagination.ts +11 -0
- package/src/client/operationEvidence.test.ts +110 -0
- package/src/client/operationEvidence.ts +92 -0
- package/src/client/publicTypes.ts +45 -0
- package/src/client/readContracts.ts +25 -0
- package/src/client/refund-command-evidence.test.ts +68 -0
- package/src/client/refund-command-normalization.test.ts +61 -0
- package/src/client/transferContinuation.test.ts +94 -0
- package/src/client/transferObservations.test.ts +98 -0
- package/src/client/transferObservations.ts +180 -0
- package/src/component/_generated/api.ts +54 -0
- package/src/component/_generated/component.ts +797 -0
- package/src/component/affiliateRecovery/mutations.ts +10 -1
- package/src/component/connect/mutations.ts +29 -2
- package/src/component/connect/reversalClaims.ts +19 -1
- package/src/component/connect/reversalReceipts.ts +2 -0
- package/src/component/connect/schema.ts +9 -1
- package/src/component/connect/validators.ts +2 -0
- package/src/component/core/reset.test.ts +8 -1
- package/src/component/earnings/earnings-totals.test.ts +14 -10
- package/src/component/earnings/paired-adjustment.test.ts +258 -0
- package/src/component/earnings/pairedAdjustment.ts +77 -0
- package/src/component/earnings/triggers.ts +23 -11
- package/src/component/financialObservations/continuation.test.ts +445 -0
- package/src/component/financialObservations/continuation.ts +159 -0
- package/src/component/financialObservations/generations.ts +53 -0
- package/src/component/financialObservations/mutations.ts +75 -0
- package/src/component/financialObservations/observation-boundaries.test.ts +466 -0
- package/src/component/financialObservations/queries.ts +246 -0
- package/src/component/financialObservations/schema.ts +68 -0
- package/src/component/financialObservations/settlement-observations.test.ts +86 -0
- package/src/component/financialObservations/settlement.ts +142 -0
- package/src/component/financialObservations/settlementHelpers.ts +92 -0
- package/src/component/financialObservations/transfer-batches.test.ts +61 -0
- package/src/component/financialObservations/transfer-boundaries.test.ts +116 -0
- package/src/component/financialObservations/transfer-continuation-guards.test.ts +428 -0
- package/src/component/financialObservations/transfer-continuation.test.ts +154 -0
- package/src/component/financialObservations/transfer-observations.test.ts +212 -0
- package/src/component/financialObservations/transfer-overflow.test.ts +181 -0
- package/src/component/financialObservations/transfer-writers.test.ts +162 -0
- package/src/component/financialObservations/transferBatches.ts +96 -0
- package/src/component/financialObservations/transferContinuation.ts +53 -0
- package/src/component/financialObservations/transferContinuationState.ts +85 -0
- package/src/component/financialObservations/transferContinuationSteps.ts +232 -0
- package/src/component/financialObservations/transferHelpers.ts +38 -0
- package/src/component/financialObservations/transferReferenceSchema.ts +20 -0
- package/src/component/financialObservations/transferSchema.ts +74 -0
- package/src/component/financialObservations/transfers.ts +99 -0
- package/src/component/financialOwnership/financial-ownership.test.ts +102 -0
- package/src/component/financialOwnership/helpers.ts +98 -0
- package/src/component/financialOwnership/mutations.ts +83 -0
- package/src/component/financialOwnership/ownership-boundaries.test.ts +308 -0
- package/src/component/financialOwnership/queries.ts +65 -0
- package/src/component/financialOwnership/schema.ts +35 -0
- package/src/component/operationEvidence/canonical.ts +10 -0
- package/src/component/operationEvidence/helpers.ts +65 -0
- package/src/component/operationEvidence/integrity.test.ts +257 -0
- package/src/component/operationEvidence/maintenance.test.ts +152 -0
- package/src/component/operationEvidence/maintenance.ts +89 -0
- package/src/component/operationEvidence/mutations.ts +14 -0
- package/src/component/operationEvidence/queries.ts +108 -0
- package/src/component/operationEvidence/reads.test.ts +140 -0
- package/src/component/operationEvidence/schema.ts +62 -0
- package/src/component/refundHistory/command-evidence.test.ts +288 -0
- package/src/component/refundHistory/command-normalization-resource.test.ts +77 -0
- package/src/component/refundHistory/command-normalization.test.ts +229 -0
- package/src/component/refundHistory/command-provenance.test.ts +59 -0
- package/src/component/refundHistory/commandBinding.ts +54 -0
- package/src/component/refundHistory/commandEvidence.ts +76 -0
- package/src/component/refundHistory/commandEvidenceValidator.ts +18 -0
- package/src/component/refundHistory/commandFields.ts +9 -0
- package/src/component/refundHistory/mutations.ts +33 -0
- package/src/component/refundHistory/original-seller-boundaries.test.ts +138 -0
- package/src/component/refundHistory/original-seller.test.ts +175 -0
- package/src/component/refundHistory/originalSeller.ts +48 -0
- package/src/component/refundHistory/queries.ts +15 -0
- package/src/component/schema.ts +28 -0
- package/src/component/settlement/mutations.ts +5 -1
- package/src/shared/refundCommandScope.ts +19 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { v } from "convex/values";
|
|
2
|
+
import { mutation } from "../_generated/server.js";
|
|
3
|
+
import { assertOwner, assertSelector, ownerGeneration, physicalSource, registrationByKey, sameOwner, } from "./helpers.js";
|
|
4
|
+
import { ownerFields, registrationResult, sourceValidator } from "./schema.js";
|
|
5
|
+
/** Trusted host-server provenance. Authenticate and verify logical source ownership before calling. */
|
|
6
|
+
export const register = mutation({
|
|
7
|
+
args: {
|
|
8
|
+
bucketKey: v.string(),
|
|
9
|
+
kind: v.union(v.literal("stripe_account"), v.literal("logical")),
|
|
10
|
+
...ownerFields,
|
|
11
|
+
source: v.optional(sourceValidator),
|
|
12
|
+
},
|
|
13
|
+
returns: registrationResult,
|
|
14
|
+
handler: async (ctx, args) => {
|
|
15
|
+
assertOwner(args);
|
|
16
|
+
assertSelector(args.bucketKey);
|
|
17
|
+
if (args.kind === "logical") {
|
|
18
|
+
if (!args.source)
|
|
19
|
+
throw new Error("Trusted logical ownership source is required");
|
|
20
|
+
assertSelector(args.source.integration);
|
|
21
|
+
assertSelector(args.source.recordId);
|
|
22
|
+
}
|
|
23
|
+
else if (args.source !== undefined)
|
|
24
|
+
throw new Error("Physical ownership proof is component-owned");
|
|
25
|
+
const existing = await registrationByKey(ctx, args.bucketKey);
|
|
26
|
+
if (existing) {
|
|
27
|
+
if (!sameOwner(existing, args) ||
|
|
28
|
+
existing.kind !== args.kind ||
|
|
29
|
+
(args.kind === "logical" &&
|
|
30
|
+
(existing.source.integration !== args.source.integration ||
|
|
31
|
+
existing.source.recordId !== args.source.recordId)))
|
|
32
|
+
throw new Error("Financial ownership is immutable");
|
|
33
|
+
return {
|
|
34
|
+
status: "registered",
|
|
35
|
+
coverage: "unknown",
|
|
36
|
+
registration: existing,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const source = args.kind === "logical"
|
|
40
|
+
? args.source
|
|
41
|
+
: await physicalSource(ctx, args.bucketKey, args);
|
|
42
|
+
const prior = await ownerGeneration(ctx, args);
|
|
43
|
+
const generation = (prior?.generation ?? 0) + 1;
|
|
44
|
+
if (!Number.isSafeInteger(generation))
|
|
45
|
+
throw new Error("Financial ownership generation overflow");
|
|
46
|
+
const owner = {
|
|
47
|
+
userId: args.userId,
|
|
48
|
+
...(args.orgId === undefined ? {} : { orgId: args.orgId }),
|
|
49
|
+
};
|
|
50
|
+
if (prior)
|
|
51
|
+
await ctx.db.patch("financialOwnershipGenerations", prior._id, {
|
|
52
|
+
generation,
|
|
53
|
+
});
|
|
54
|
+
else
|
|
55
|
+
await ctx.db.insert("financialOwnershipGenerations", {
|
|
56
|
+
...owner,
|
|
57
|
+
generation,
|
|
58
|
+
});
|
|
59
|
+
const id = await ctx.db.insert("financialOwnership", {
|
|
60
|
+
bucketKey: args.bucketKey,
|
|
61
|
+
kind: args.kind,
|
|
62
|
+
...owner,
|
|
63
|
+
source,
|
|
64
|
+
generation,
|
|
65
|
+
});
|
|
66
|
+
const registration = (await ctx.db.get("financialOwnership", id));
|
|
67
|
+
return {
|
|
68
|
+
status: "registered",
|
|
69
|
+
coverage: "unknown",
|
|
70
|
+
registration,
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=mutations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../../src/component/financialOwnership/mut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AAG,CAAC,EAAE,CAAC,KAAK,CAAC,+BAA+B,EAAE,KAAK,CAAC,GAAG,EAAE;gBAC7D,UAAU;aACX,CAAC,CAAC;;YAEH,MAAM,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,+BAA+B,EAAE;gBACnD,GAAG,KAAK;gBACR,UAAU;aACX,CAAC,CAAC;QACL,MAAM,EAAE,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,oBAAoB,EAAE;YACnD,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,GAAG,KAAK;YACR,MAAM;YACN,UAAU;SACX,CAAC,CAAC;QACH,MAAM,YAAY,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAE,CAAC;QACnE,OAAO;YACL,MAAM,EAAE,YAAqB;YAC7B,QAAQ,EAAE,SAAkB;YAC5B,YAAY;SACb,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/** Trusted host reader; a bucket key is not end-user authorization. */
|
|
2
|
+
export declare const lookup: import("convex/server").RegisteredQuery<"public", {
|
|
3
|
+
bucketKey: string;
|
|
4
|
+
}, Promise<{
|
|
5
|
+
status: "registered";
|
|
6
|
+
coverage: "unknown";
|
|
7
|
+
registration: {
|
|
8
|
+
_creationTime: number;
|
|
9
|
+
_id: import("convex/values").GenericId<"financialOwnership">;
|
|
10
|
+
bucketKey: string;
|
|
11
|
+
generation: number;
|
|
12
|
+
kind: "logical" | "stripe_account";
|
|
13
|
+
orgId?: string | undefined;
|
|
14
|
+
source: {
|
|
15
|
+
integration: string;
|
|
16
|
+
recordId: string;
|
|
17
|
+
};
|
|
18
|
+
userId: string;
|
|
19
|
+
};
|
|
20
|
+
} | {
|
|
21
|
+
registration?: undefined;
|
|
22
|
+
status: "unknown";
|
|
23
|
+
coverage: "unknown";
|
|
24
|
+
}>>;
|
|
25
|
+
export declare const discover: import("convex/server").RegisteredQuery<"public", {
|
|
26
|
+
orgId?: string | undefined;
|
|
27
|
+
paginationOpts: {
|
|
28
|
+
id?: number;
|
|
29
|
+
endCursor?: string | null;
|
|
30
|
+
maximumRowsRead?: number;
|
|
31
|
+
maximumBytesRead?: number;
|
|
32
|
+
numItems: number;
|
|
33
|
+
cursor: string | null;
|
|
34
|
+
};
|
|
35
|
+
userId: string;
|
|
36
|
+
}, Promise<{
|
|
37
|
+
page: {
|
|
38
|
+
_creationTime: number;
|
|
39
|
+
_id: import("convex/values").GenericId<"financialOwnership">;
|
|
40
|
+
bucketKey: string;
|
|
41
|
+
generation: number;
|
|
42
|
+
kind: "logical" | "stripe_account";
|
|
43
|
+
orgId?: string | undefined;
|
|
44
|
+
source: {
|
|
45
|
+
integration: string;
|
|
46
|
+
recordId: string;
|
|
47
|
+
};
|
|
48
|
+
userId: string;
|
|
49
|
+
}[];
|
|
50
|
+
isDone: boolean;
|
|
51
|
+
continueCursor: import("convex/server").Cursor;
|
|
52
|
+
splitCursor?: import("convex/server").Cursor | null;
|
|
53
|
+
pageStatus?: "SplitRecommended" | "SplitRequired" | null;
|
|
54
|
+
coverage: "unknown";
|
|
55
|
+
generation: number;
|
|
56
|
+
}>>;
|
|
57
|
+
//# sourceMappingURL=queries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/component/financialOwnership/queries.ts"],"names":[],"mappings":"AAgBA,uEAAuE;AACvE,eAAO,MAAM,MAAM;;;YAWD,YAAY;cACV,SAAS;;;;;;;;;;;;;;;;YAGX,SAAS;cAAqB,SAAS;GAEvD,CAAC;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA2BW,SAAS;;GAEvC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { paginationOptsValidator, paginationResultValidator, } from "convex/server";
|
|
2
|
+
import { paginator } from "convex-helpers/server/pagination";
|
|
3
|
+
import { v } from "convex/values";
|
|
4
|
+
import { query } from "../_generated/server.js";
|
|
5
|
+
import schema from "../schema.js";
|
|
6
|
+
import { assertOwner, assertSelector, ownerGeneration, registrationByKey, } from "./helpers.js";
|
|
7
|
+
import { ownerFields, registrationDoc, registrationResult } from "./schema.js";
|
|
8
|
+
/** Trusted host reader; a bucket key is not end-user authorization. */
|
|
9
|
+
export const lookup = query({
|
|
10
|
+
args: { bucketKey: v.string() },
|
|
11
|
+
returns: v.union(registrationResult, v.object({ status: v.literal("unknown"), coverage: v.literal("unknown") })),
|
|
12
|
+
handler: async (ctx, { bucketKey }) => {
|
|
13
|
+
assertSelector(bucketKey);
|
|
14
|
+
const registration = await registrationByKey(ctx, bucketKey);
|
|
15
|
+
return registration
|
|
16
|
+
? {
|
|
17
|
+
status: "registered",
|
|
18
|
+
coverage: "unknown",
|
|
19
|
+
registration,
|
|
20
|
+
}
|
|
21
|
+
: { status: "unknown", coverage: "unknown" };
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
export const discover = query({
|
|
25
|
+
args: { ...ownerFields, paginationOpts: paginationOptsValidator },
|
|
26
|
+
returns: v.object({
|
|
27
|
+
...paginationResultValidator(registrationDoc).fields,
|
|
28
|
+
coverage: v.literal("unknown"),
|
|
29
|
+
generation: v.number(),
|
|
30
|
+
}),
|
|
31
|
+
handler: async (ctx, args) => {
|
|
32
|
+
assertOwner(args);
|
|
33
|
+
if (!Number.isInteger(args.paginationOpts.numItems) ||
|
|
34
|
+
args.paginationOpts.numItems < 1 ||
|
|
35
|
+
args.paginationOpts.numItems > 100)
|
|
36
|
+
throw new Error("Ownership page size must be between 1 and 100");
|
|
37
|
+
const generation = (await ownerGeneration(ctx, args))?.generation ?? 0;
|
|
38
|
+
const page = await paginator(ctx.db, schema)
|
|
39
|
+
.query("financialOwnership")
|
|
40
|
+
.withIndex("by_owner", (q) => q.eq("userId", args.userId).eq("orgId", args.orgId))
|
|
41
|
+
.order("desc")
|
|
42
|
+
.paginate({
|
|
43
|
+
...args.paginationOpts,
|
|
44
|
+
maximumRowsRead: 200,
|
|
45
|
+
maximumBytesRead: 1_000_000,
|
|
46
|
+
});
|
|
47
|
+
return { ...page, coverage: "unknown", generation };
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=queries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/component/financialOwnership/queries.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,EACL,WAAW,EACX,cAAc,EACd,eAAe,EACf,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE/E,uEAAuE;AACvE,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,CAAC;IAC1B,IAAI,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE;IAC/B,OAAO,EAAE,CAAC,CAAC,KAAK,CACd,kBAAkB,EAClB,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAC3E;IACD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;QACpC,cAAc,CAAC,SAAS,CAAC,CAAC;QAC1B,MAAM,YAA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AAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CACpD;aACA,KAAK,CAAC,MAAM,CAAC;aACb,QAAQ,CAAC;YACR,GAAG,IAAI,CAAC,cAAc;YACtB,eAAe,EAAE,GAAG;YACpB,gBAAgB,EAAE,SAAS;SAC5B,CAAC,CAAC;QACL,OAAO,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,SAAkB,EAAE,UAAU,EAAE,CAAC;IAC/D,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
export declare const ownerFields: {
|
|
2
|
+
userId: import("convex/values").VString<string, "required">;
|
|
3
|
+
orgId: import("convex/values").VString<string | undefined, "optional">;
|
|
4
|
+
};
|
|
5
|
+
export declare const sourceValidator: import("convex/values").VObject<{
|
|
6
|
+
integration: string;
|
|
7
|
+
recordId: string;
|
|
8
|
+
}, {
|
|
9
|
+
integration: import("convex/values").VString<string, "required">;
|
|
10
|
+
recordId: import("convex/values").VString<string, "required">;
|
|
11
|
+
}, "required", "integration" | "recordId">;
|
|
12
|
+
export declare const registrationFields: {
|
|
13
|
+
userId: import("convex/values").VString<string, "required">;
|
|
14
|
+
orgId: import("convex/values").VString<string | undefined, "optional">;
|
|
15
|
+
bucketKey: import("convex/values").VString<string, "required">;
|
|
16
|
+
kind: import("convex/values").VUnion<"logical" | "stripe_account", [import("convex/values").VLiteral<"stripe_account", "required">, import("convex/values").VLiteral<"logical", "required">], "required", never>;
|
|
17
|
+
source: import("convex/values").VObject<{
|
|
18
|
+
integration: string;
|
|
19
|
+
recordId: string;
|
|
20
|
+
}, {
|
|
21
|
+
integration: import("convex/values").VString<string, "required">;
|
|
22
|
+
recordId: import("convex/values").VString<string, "required">;
|
|
23
|
+
}, "required", "integration" | "recordId">;
|
|
24
|
+
generation: import("convex/values").VFloat64<number, "required">;
|
|
25
|
+
};
|
|
26
|
+
export declare const registrationDoc: import("convex/values").VObject<{
|
|
27
|
+
_creationTime: number;
|
|
28
|
+
_id: import("convex/values").GenericId<"financialOwnership">;
|
|
29
|
+
bucketKey: string;
|
|
30
|
+
generation: number;
|
|
31
|
+
kind: "logical" | "stripe_account";
|
|
32
|
+
orgId?: string | undefined;
|
|
33
|
+
source: {
|
|
34
|
+
integration: string;
|
|
35
|
+
recordId: string;
|
|
36
|
+
};
|
|
37
|
+
userId: string;
|
|
38
|
+
}, {
|
|
39
|
+
userId: import("convex/values").VString<string, "required">;
|
|
40
|
+
orgId: import("convex/values").VString<string | undefined, "optional">;
|
|
41
|
+
bucketKey: import("convex/values").VString<string, "required">;
|
|
42
|
+
kind: import("convex/values").VUnion<"logical" | "stripe_account", [import("convex/values").VLiteral<"stripe_account", "required">, import("convex/values").VLiteral<"logical", "required">], "required", never>;
|
|
43
|
+
source: import("convex/values").VObject<{
|
|
44
|
+
integration: string;
|
|
45
|
+
recordId: string;
|
|
46
|
+
}, {
|
|
47
|
+
integration: import("convex/values").VString<string, "required">;
|
|
48
|
+
recordId: import("convex/values").VString<string, "required">;
|
|
49
|
+
}, "required", "integration" | "recordId">;
|
|
50
|
+
generation: import("convex/values").VFloat64<number, "required">;
|
|
51
|
+
_id: import("convex/values").VId<import("convex/values").GenericId<"financialOwnership">, "required">;
|
|
52
|
+
_creationTime: import("convex/values").VFloat64<number, "required">;
|
|
53
|
+
}, "required", "_creationTime" | "_id" | "bucketKey" | "generation" | "kind" | "orgId" | "source" | "source.integration" | "source.recordId" | "userId">;
|
|
54
|
+
export declare const ownershipTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
55
|
+
bucketKey: string;
|
|
56
|
+
generation: number;
|
|
57
|
+
kind: "logical" | "stripe_account";
|
|
58
|
+
orgId?: string | undefined;
|
|
59
|
+
source: {
|
|
60
|
+
integration: string;
|
|
61
|
+
recordId: string;
|
|
62
|
+
};
|
|
63
|
+
userId: string;
|
|
64
|
+
}, {
|
|
65
|
+
userId: import("convex/values").VString<string, "required">;
|
|
66
|
+
orgId: import("convex/values").VString<string | undefined, "optional">;
|
|
67
|
+
bucketKey: import("convex/values").VString<string, "required">;
|
|
68
|
+
kind: import("convex/values").VUnion<"logical" | "stripe_account", [import("convex/values").VLiteral<"stripe_account", "required">, import("convex/values").VLiteral<"logical", "required">], "required", never>;
|
|
69
|
+
source: import("convex/values").VObject<{
|
|
70
|
+
integration: string;
|
|
71
|
+
recordId: string;
|
|
72
|
+
}, {
|
|
73
|
+
integration: import("convex/values").VString<string, "required">;
|
|
74
|
+
recordId: import("convex/values").VString<string, "required">;
|
|
75
|
+
}, "required", "integration" | "recordId">;
|
|
76
|
+
generation: import("convex/values").VFloat64<number, "required">;
|
|
77
|
+
}, "required", "bucketKey" | "generation" | "kind" | "orgId" | "source" | "source.integration" | "source.recordId" | "userId">, {
|
|
78
|
+
by_bucket_key: ["bucketKey", "_creationTime"];
|
|
79
|
+
by_owner: ["userId", "orgId", "_creationTime"];
|
|
80
|
+
}, {}, {}>;
|
|
81
|
+
export declare const generationsTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
82
|
+
generation: number;
|
|
83
|
+
orgId?: string | undefined;
|
|
84
|
+
userId: string;
|
|
85
|
+
}, {
|
|
86
|
+
userId: import("convex/values").VString<string, "required">;
|
|
87
|
+
orgId: import("convex/values").VString<string | undefined, "optional">;
|
|
88
|
+
generation: import("convex/values").VFloat64<number, "required">;
|
|
89
|
+
}, "required", "generation" | "orgId" | "userId">, {
|
|
90
|
+
by_owner: ["userId", "orgId", "_creationTime"];
|
|
91
|
+
}, {}, {}>;
|
|
92
|
+
export declare const registrationResult: import("convex/values").VObject<{
|
|
93
|
+
coverage: "unknown";
|
|
94
|
+
registration: {
|
|
95
|
+
_creationTime: number;
|
|
96
|
+
_id: import("convex/values").GenericId<"financialOwnership">;
|
|
97
|
+
bucketKey: string;
|
|
98
|
+
generation: number;
|
|
99
|
+
kind: "logical" | "stripe_account";
|
|
100
|
+
orgId?: string | undefined;
|
|
101
|
+
source: {
|
|
102
|
+
integration: string;
|
|
103
|
+
recordId: string;
|
|
104
|
+
};
|
|
105
|
+
userId: string;
|
|
106
|
+
};
|
|
107
|
+
status: "registered";
|
|
108
|
+
}, {
|
|
109
|
+
status: import("convex/values").VLiteral<"registered", "required">;
|
|
110
|
+
coverage: import("convex/values").VLiteral<"unknown", "required">;
|
|
111
|
+
registration: import("convex/values").VObject<{
|
|
112
|
+
_creationTime: number;
|
|
113
|
+
_id: import("convex/values").GenericId<"financialOwnership">;
|
|
114
|
+
bucketKey: string;
|
|
115
|
+
generation: number;
|
|
116
|
+
kind: "logical" | "stripe_account";
|
|
117
|
+
orgId?: string | undefined;
|
|
118
|
+
source: {
|
|
119
|
+
integration: string;
|
|
120
|
+
recordId: string;
|
|
121
|
+
};
|
|
122
|
+
userId: string;
|
|
123
|
+
}, {
|
|
124
|
+
userId: import("convex/values").VString<string, "required">;
|
|
125
|
+
orgId: import("convex/values").VString<string | undefined, "optional">;
|
|
126
|
+
bucketKey: import("convex/values").VString<string, "required">;
|
|
127
|
+
kind: import("convex/values").VUnion<"logical" | "stripe_account", [import("convex/values").VLiteral<"stripe_account", "required">, import("convex/values").VLiteral<"logical", "required">], "required", never>;
|
|
128
|
+
source: import("convex/values").VObject<{
|
|
129
|
+
integration: string;
|
|
130
|
+
recordId: string;
|
|
131
|
+
}, {
|
|
132
|
+
integration: import("convex/values").VString<string, "required">;
|
|
133
|
+
recordId: import("convex/values").VString<string, "required">;
|
|
134
|
+
}, "required", "integration" | "recordId">;
|
|
135
|
+
generation: import("convex/values").VFloat64<number, "required">;
|
|
136
|
+
_id: import("convex/values").VId<import("convex/values").GenericId<"financialOwnership">, "required">;
|
|
137
|
+
_creationTime: import("convex/values").VFloat64<number, "required">;
|
|
138
|
+
}, "required", "_creationTime" | "_id" | "bucketKey" | "generation" | "kind" | "orgId" | "source" | "source.integration" | "source.recordId" | "userId">;
|
|
139
|
+
}, "required", "coverage" | "registration" | "registration._creationTime" | "registration._id" | "registration.bucketKey" | "registration.generation" | "registration.kind" | "registration.orgId" | "registration.source" | "registration.source.integration" | "registration.source.recordId" | "registration.userId" | "status">;
|
|
140
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/component/financialOwnership/schema.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW;IACtB,MAAM;IACN,KAAK;CACN,CAAC;AACF,eAAO,MAAM,eAAe;;;;;;0CAG1B,CAAC;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;CAM9B,CAAC;AACF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;wJAI1B,CAAC;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;UAEc,CAAC;AAC1C,eAAO,MAAM,gBAAgB;;;;;;;;;;UAGY,CAAC;AAC1C,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mUAI7B,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { defineTable } from "convex/server";
|
|
2
|
+
import { v } from "convex/values";
|
|
3
|
+
export const ownerFields = {
|
|
4
|
+
userId: v.string(),
|
|
5
|
+
orgId: v.optional(v.string()),
|
|
6
|
+
};
|
|
7
|
+
export const sourceValidator = v.object({
|
|
8
|
+
integration: v.string(),
|
|
9
|
+
recordId: v.string(),
|
|
10
|
+
});
|
|
11
|
+
export const registrationFields = {
|
|
12
|
+
bucketKey: v.string(),
|
|
13
|
+
kind: v.union(v.literal("stripe_account"), v.literal("logical")),
|
|
14
|
+
...ownerFields,
|
|
15
|
+
source: sourceValidator,
|
|
16
|
+
generation: v.number(),
|
|
17
|
+
};
|
|
18
|
+
export const registrationDoc = v.object({
|
|
19
|
+
...registrationFields,
|
|
20
|
+
_id: v.id("financialOwnership"),
|
|
21
|
+
_creationTime: v.number(),
|
|
22
|
+
});
|
|
23
|
+
export const ownershipTable = defineTable(registrationFields)
|
|
24
|
+
.index("by_bucket_key", ["bucketKey"])
|
|
25
|
+
.index("by_owner", ["userId", "orgId"]);
|
|
26
|
+
export const generationsTable = defineTable({
|
|
27
|
+
...ownerFields,
|
|
28
|
+
generation: v.number(),
|
|
29
|
+
}).index("by_owner", ["userId", "orgId"]);
|
|
30
|
+
export const registrationResult = v.object({
|
|
31
|
+
status: v.literal("registered"),
|
|
32
|
+
coverage: v.literal("unknown"),
|
|
33
|
+
registration: registrationDoc,
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/component/financialOwnership/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAElC,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC9B,CAAC;AACF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;CACrB,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChE,GAAG,WAAW;IACd,MAAM,EAAE,eAAe;IACvB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;CACvB,CAAC;AACF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,GAAG,kBAAkB;IACrB,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,oBAAoB,CAAC;IAC/B,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;CAC1B,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAC,kBAAkB,CAAC;KAC1D,KAAK,CAAC,eAAe,EAAE,CAAC,WAAW,CAAC,CAAC;KACrC,KAAK,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;AAC1C,MAAM,CAAC,MAAM,gBAAgB,GAAG,WAAW,CAAC;IAC1C,GAAG,WAAW;IACd,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;CACvB,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;AAC1C,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;IAC/B,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;IAC9B,YAAY,EAAE,eAAe;CAC9B,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical.d.ts","sourceRoot":"","sources":["../../../src/component/operationEvidence/canonical.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AAEzD,kFAAkF;AAClF,wBAAsB,oBAAoB,CAAC,KAAK,EAAE,KAAK,mBAMtD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { convexToJson } from "convex/values";
|
|
2
|
+
/** Convex encoding preserves special floats and recursively sorts object keys. */
|
|
3
|
+
export async function canonicalFingerprint(value) {
|
|
4
|
+
const bytes = new TextEncoder().encode(JSON.stringify(convexToJson(value)));
|
|
5
|
+
const hash = await crypto.subtle.digest("SHA-256", bytes);
|
|
6
|
+
return Array.from(new Uint8Array(hash), (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=canonical.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical.js","sourceRoot":"","sources":["../../../src/component/operationEvidence/canonical.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAc,MAAM,eAAe,CAAC;AAEzD,kFAAkF;AAClF,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,KAAY;IACrD,MAAM,KAAK,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC5E,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAC1D,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAC/C,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CACnC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { Doc, Id } from "../_generated/dataModel.js";
|
|
2
|
+
import type { QueryCtx } from "../_generated/server.js";
|
|
3
|
+
export declare const operationEvidenceScope = "operation-evidence-maintenance-v1";
|
|
4
|
+
export declare function readState(ctx: QueryCtx): Promise<{
|
|
5
|
+
coverage: "unknown";
|
|
6
|
+
evidenceGeneration: number | null;
|
|
7
|
+
}>;
|
|
8
|
+
export declare function bodyOf(row: Doc<"transferReversalOps"> | Doc<"operationEvidencePayloads">): {
|
|
9
|
+
commissionExposure?: {
|
|
10
|
+
chargeAmount: number;
|
|
11
|
+
disputeId?: string | undefined;
|
|
12
|
+
disputeState?: "lost" | "open" | "won" | undefined;
|
|
13
|
+
finalized: boolean;
|
|
14
|
+
kind: "dispute" | "refund";
|
|
15
|
+
principal: number;
|
|
16
|
+
refundId?: string | undefined;
|
|
17
|
+
refundedPrincipal?: number | undefined;
|
|
18
|
+
} | undefined;
|
|
19
|
+
operationId: string;
|
|
20
|
+
slices: {
|
|
21
|
+
from: number;
|
|
22
|
+
stripeTransferId: string;
|
|
23
|
+
to: number;
|
|
24
|
+
}[];
|
|
25
|
+
sourceChargeId: string;
|
|
26
|
+
} | {
|
|
27
|
+
commissionExposure?: {
|
|
28
|
+
chargeAmount: number;
|
|
29
|
+
disputeId?: string | undefined;
|
|
30
|
+
disputeState?: "lost" | "open" | "won" | undefined;
|
|
31
|
+
finalized: boolean;
|
|
32
|
+
kind: "dispute" | "refund";
|
|
33
|
+
principal: number;
|
|
34
|
+
refundId?: string | undefined;
|
|
35
|
+
refundedPrincipal?: number | undefined;
|
|
36
|
+
} | undefined;
|
|
37
|
+
operationId: string;
|
|
38
|
+
slices: {
|
|
39
|
+
from: number;
|
|
40
|
+
stripeTransferId: string;
|
|
41
|
+
to: number;
|
|
42
|
+
}[];
|
|
43
|
+
sourceChargeId: string;
|
|
44
|
+
};
|
|
45
|
+
export declare function sourceFingerprint(body: ReturnType<typeof bodyOf>): Promise<string>;
|
|
46
|
+
export declare function identityFingerprint(body: ReturnType<typeof bodyOf>): Promise<string>;
|
|
47
|
+
export declare function selectorDigest(selector: "operationId" | "sourceChargeId", value: string): Promise<string>;
|
|
48
|
+
export declare function isValidHeader(header: Doc<"operationEvidenceHeaders">): boolean;
|
|
49
|
+
export declare function uniqueSourceHeader(ctx: QueryCtx, sourceId: Id<"transferReversalOps">): Promise<{
|
|
50
|
+
headers: {
|
|
51
|
+
_creationTime: number;
|
|
52
|
+
_id: import("convex/values").GenericId<"operationEvidenceHeaders">;
|
|
53
|
+
firstObservedAt: number;
|
|
54
|
+
generation: number;
|
|
55
|
+
isContradictory: boolean;
|
|
56
|
+
latestFingerprint: string;
|
|
57
|
+
latestPayloadId: import("convex/values").GenericId<"operationEvidencePayloads">;
|
|
58
|
+
operationDigest: string;
|
|
59
|
+
originalFingerprint: string;
|
|
60
|
+
originalIdentityFingerprint: string;
|
|
61
|
+
originalPayloadId: import("convex/values").GenericId<"operationEvidencePayloads">;
|
|
62
|
+
producer: "trusted_host_maintenance";
|
|
63
|
+
producerVersion: 1;
|
|
64
|
+
sourceChargeDigest: string;
|
|
65
|
+
sourceCreatedAt: number;
|
|
66
|
+
sourceId: import("convex/values").GenericId<"transferReversalOps">;
|
|
67
|
+
}[];
|
|
68
|
+
header: {
|
|
69
|
+
_creationTime: number;
|
|
70
|
+
_id: import("convex/values").GenericId<"operationEvidenceHeaders">;
|
|
71
|
+
firstObservedAt: number;
|
|
72
|
+
generation: number;
|
|
73
|
+
isContradictory: boolean;
|
|
74
|
+
latestFingerprint: string;
|
|
75
|
+
latestPayloadId: import("convex/values").GenericId<"operationEvidencePayloads">;
|
|
76
|
+
operationDigest: string;
|
|
77
|
+
originalFingerprint: string;
|
|
78
|
+
originalIdentityFingerprint: string;
|
|
79
|
+
originalPayloadId: import("convex/values").GenericId<"operationEvidencePayloads">;
|
|
80
|
+
producer: "trusted_host_maintenance";
|
|
81
|
+
producerVersion: 1;
|
|
82
|
+
sourceChargeDigest: string;
|
|
83
|
+
sourceCreatedAt: number;
|
|
84
|
+
sourceId: import("convex/values").GenericId<"transferReversalOps">;
|
|
85
|
+
} | null;
|
|
86
|
+
}>;
|
|
87
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/component/operationEvidence/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAIxD,eAAO,MAAM,sBAAsB,sCAAsC,CAAC;AAC1E,wBAAsB,SAAS,CAAC,GAAG,EAAE,QAAQ;cAE/B,SAAS;;GAMtB;AACD,wBAAgB,MAAM,CACpB,GAAG,EAAE,GAAG,CAAC,qBAAqB,CAAC,GAAG,GAAG,CAAC,2BAA2B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMnE;AACD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,mBAEhE;AACD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,mBAOlE;AACD,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,aAAa,GAAG,gBAAgB,EAC1C,KAAK,EAAE,MAAM,mBAOd;AACD,wBAAgB,aAAa,CAAC,MAAM,EAAE,GAAG,CAAC,0BAA0B,CAAC,WAMpE;AACD,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,QAAQ,EACb,QAAQ,EAAE,EAAE,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAWpC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { observationGeneration } from "../financialObservations/generations.js";
|
|
2
|
+
import { canonicalFingerprint } from "./canonical.js";
|
|
3
|
+
export const operationEvidenceScope = "operation-evidence-maintenance-v1";
|
|
4
|
+
export async function readState(ctx) {
|
|
5
|
+
return {
|
|
6
|
+
coverage: "unknown",
|
|
7
|
+
evidenceGeneration: await observationGeneration(ctx, operationEvidenceScope),
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export function bodyOf(row) {
|
|
11
|
+
const { _id, _creationTime, ...fields } = row;
|
|
12
|
+
void _id;
|
|
13
|
+
void _creationTime;
|
|
14
|
+
return fields;
|
|
15
|
+
}
|
|
16
|
+
export function sourceFingerprint(body) {
|
|
17
|
+
return canonicalFingerprint({ domain: "operation-evidence-source-v1", body });
|
|
18
|
+
}
|
|
19
|
+
export function identityFingerprint(body) {
|
|
20
|
+
return canonicalFingerprint({
|
|
21
|
+
domain: "operation-evidence-identity-v1",
|
|
22
|
+
operationId: body.operationId,
|
|
23
|
+
sourceChargeId: body.sourceChargeId,
|
|
24
|
+
slices: body.slices,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export function selectorDigest(selector, value) {
|
|
28
|
+
return canonicalFingerprint({
|
|
29
|
+
domain: "operation-evidence-selector-v1",
|
|
30
|
+
selector,
|
|
31
|
+
value,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
export function isValidHeader(header) {
|
|
35
|
+
return (Number.isSafeInteger(header.generation) &&
|
|
36
|
+
header.generation >= 1 &&
|
|
37
|
+
header.originalPayloadId !== header.latestPayloadId);
|
|
38
|
+
}
|
|
39
|
+
export async function uniqueSourceHeader(ctx, sourceId) {
|
|
40
|
+
const headers = await ctx.db
|
|
41
|
+
.query("operationEvidenceHeaders")
|
|
42
|
+
.withIndex("by_source_id", (q) => q.eq("sourceId", sourceId))
|
|
43
|
+
.take(2);
|
|
44
|
+
return {
|
|
45
|
+
headers,
|
|
46
|
+
header: headers.length === 1 && isValidHeader(headers[0]) ? headers[0] : null,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/component/operationEvidence/helpers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEtD,MAAM,CAAC,MAAM,sBAAsB,GAAG,mCAAmC,CAAC;AAC1E,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,GAAa;IAC3C,OAAO;QACL,QAAQ,EAAE,SAAkB;QAC5B,kBAAk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CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;SAC5D,IAAI,CAAC,CAAC,CAAC,CAAC;IACX,OAAO;QACL,OAAO;QACP,MAAM,EACJ,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,IAAI;KAC1E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { Id } from "../_generated/dataModel.js";
|
|
2
|
+
import type { MutationCtx } from "../_generated/server.js";
|
|
3
|
+
/** Explicit evidence maintenance only. Never called from a financial writer here. */
|
|
4
|
+
export declare function captureSource(ctx: MutationCtx, sourceId: Id<"transferReversalOps">): Promise<{
|
|
5
|
+
status: "unavailable";
|
|
6
|
+
header: null;
|
|
7
|
+
} | {
|
|
8
|
+
status: "source_unavailable";
|
|
9
|
+
header: {
|
|
10
|
+
_creationTime: number;
|
|
11
|
+
_id: import("convex/values").GenericId<"operationEvidenceHeaders">;
|
|
12
|
+
firstObservedAt: number;
|
|
13
|
+
generation: number;
|
|
14
|
+
isContradictory: boolean;
|
|
15
|
+
latestFingerprint: string;
|
|
16
|
+
latestPayloadId: import("convex/values").GenericId<"operationEvidencePayloads">;
|
|
17
|
+
operationDigest: string;
|
|
18
|
+
originalFingerprint: string;
|
|
19
|
+
originalIdentityFingerprint: string;
|
|
20
|
+
originalPayloadId: import("convex/values").GenericId<"operationEvidencePayloads">;
|
|
21
|
+
producer: "trusted_host_maintenance";
|
|
22
|
+
producerVersion: 1;
|
|
23
|
+
sourceChargeDigest: string;
|
|
24
|
+
sourceCreatedAt: number;
|
|
25
|
+
sourceId: import("convex/values").GenericId<"transferReversalOps">;
|
|
26
|
+
} | null;
|
|
27
|
+
} | {
|
|
28
|
+
status: "unchanged";
|
|
29
|
+
header: {
|
|
30
|
+
_creationTime: number;
|
|
31
|
+
_id: import("convex/values").GenericId<"operationEvidenceHeaders">;
|
|
32
|
+
firstObservedAt: number;
|
|
33
|
+
generation: number;
|
|
34
|
+
isContradictory: boolean;
|
|
35
|
+
latestFingerprint: string;
|
|
36
|
+
latestPayloadId: import("convex/values").GenericId<"operationEvidencePayloads">;
|
|
37
|
+
operationDigest: string;
|
|
38
|
+
originalFingerprint: string;
|
|
39
|
+
originalIdentityFingerprint: string;
|
|
40
|
+
originalPayloadId: import("convex/values").GenericId<"operationEvidencePayloads">;
|
|
41
|
+
producer: "trusted_host_maintenance";
|
|
42
|
+
producerVersion: 1;
|
|
43
|
+
sourceChargeDigest: string;
|
|
44
|
+
sourceCreatedAt: number;
|
|
45
|
+
sourceId: import("convex/values").GenericId<"transferReversalOps">;
|
|
46
|
+
};
|
|
47
|
+
} | {
|
|
48
|
+
status: "updated";
|
|
49
|
+
header: {
|
|
50
|
+
_creationTime: number;
|
|
51
|
+
_id: import("convex/values").GenericId<"operationEvidenceHeaders">;
|
|
52
|
+
firstObservedAt: number;
|
|
53
|
+
generation: number;
|
|
54
|
+
isContradictory: boolean;
|
|
55
|
+
latestFingerprint: string;
|
|
56
|
+
latestPayloadId: import("convex/values").GenericId<"operationEvidencePayloads">;
|
|
57
|
+
operationDigest: string;
|
|
58
|
+
originalFingerprint: string;
|
|
59
|
+
originalIdentityFingerprint: string;
|
|
60
|
+
originalPayloadId: import("convex/values").GenericId<"operationEvidencePayloads">;
|
|
61
|
+
producer: "trusted_host_maintenance";
|
|
62
|
+
producerVersion: 1;
|
|
63
|
+
sourceChargeDigest: string;
|
|
64
|
+
sourceCreatedAt: number;
|
|
65
|
+
sourceId: import("convex/values").GenericId<"transferReversalOps">;
|
|
66
|
+
};
|
|
67
|
+
} | {
|
|
68
|
+
status: "captured";
|
|
69
|
+
header: {
|
|
70
|
+
_creationTime: number;
|
|
71
|
+
_id: import("convex/values").GenericId<"operationEvidenceHeaders">;
|
|
72
|
+
firstObservedAt: number;
|
|
73
|
+
generation: number;
|
|
74
|
+
isContradictory: boolean;
|
|
75
|
+
latestFingerprint: string;
|
|
76
|
+
latestPayloadId: import("convex/values").GenericId<"operationEvidencePayloads">;
|
|
77
|
+
operationDigest: string;
|
|
78
|
+
originalFingerprint: string;
|
|
79
|
+
originalIdentityFingerprint: string;
|
|
80
|
+
originalPayloadId: import("convex/values").GenericId<"operationEvidencePayloads">;
|
|
81
|
+
producer: "trusted_host_maintenance";
|
|
82
|
+
producerVersion: 1;
|
|
83
|
+
sourceChargeDigest: string;
|
|
84
|
+
sourceCreatedAt: number;
|
|
85
|
+
sourceId: import("convex/values").GenericId<"transferReversalOps">;
|
|
86
|
+
};
|
|
87
|
+
}>;
|
|
88
|
+
//# sourceMappingURL=maintenance.d.ts.map
|