@fantastic.dev/better-stripe 0.110.0 → 0.111.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +52 -0
  4. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
  5. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +42 -16
  6. package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
  7. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +84 -32
  8. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
  9. package/dist/client/connect/payoutSyncTestHelpers.d.ts +26 -0
  10. package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
  11. package/dist/component/balanceFunding/internal/actions.d.ts +11 -11
  12. package/dist/component/balanceFunding/mutations.d.ts +16 -16
  13. package/dist/component/balanceFunding/workflowValidators.d.ts +16 -16
  14. package/dist/component/earnings/triggers.d.ts +44 -0
  15. package/dist/component/earnings/triggers.d.ts.map +1 -1
  16. package/dist/component/renewalWitnesses/eligibility.d.ts +36 -0
  17. package/dist/component/renewalWitnesses/eligibility.d.ts.map +1 -0
  18. package/dist/component/renewalWitnesses/eligibility.js +60 -0
  19. package/dist/component/renewalWitnesses/eligibility.js.map +1 -0
  20. package/dist/component/renewalWitnesses/protocol.d.ts +75 -0
  21. package/dist/component/renewalWitnesses/protocol.d.ts.map +1 -0
  22. package/dist/component/renewalWitnesses/protocol.js +82 -0
  23. package/dist/component/renewalWitnesses/protocol.js.map +1 -0
  24. package/dist/component/renewalWitnesses/schema.d.ts +99 -0
  25. package/dist/component/renewalWitnesses/schema.d.ts.map +1 -0
  26. package/dist/component/renewalWitnesses/schema.js +36 -0
  27. package/dist/component/renewalWitnesses/schema.js.map +1 -0
  28. package/dist/component/renewalWitnesses/source.d.ts +22 -0
  29. package/dist/component/renewalWitnesses/source.d.ts.map +1 -0
  30. package/dist/component/renewalWitnesses/source.js +108 -0
  31. package/dist/component/renewalWitnesses/source.js.map +1 -0
  32. package/dist/component/schema.d.ts +42 -16
  33. package/dist/component/schema.js +2 -0
  34. package/dist/component/schema.js.map +1 -1
  35. package/dist/component/usage/allowance.fixtures.d.ts +26 -0
  36. package/dist/component/usage/allowance.fixtures.d.ts.map +1 -1
  37. package/dist/component/usageCredits/accounting.fixtures.d.ts +26 -0
  38. package/dist/component/usageCredits/accounting.fixtures.d.ts.map +1 -1
  39. package/dist/shared/renewalWitness.d.ts +51 -0
  40. package/dist/shared/renewalWitness.d.ts.map +1 -0
  41. package/dist/shared/renewalWitness.js +127 -0
  42. package/dist/shared/renewalWitness.js.map +1 -0
  43. package/docs/renewal-witness-protocol.md +88 -0
  44. package/package.json +1 -1
  45. package/src/component/renewalOperations/configureJournal.fixtures.ts +25 -3
  46. package/src/component/renewalWitnesses/bounds.test.ts +204 -0
  47. package/src/component/renewalWitnesses/codec.test.ts +84 -0
  48. package/src/component/renewalWitnesses/controls.test.ts +250 -0
  49. package/src/component/renewalWitnesses/eligibility.ts +78 -0
  50. package/src/component/renewalWitnesses/protocol.test.ts +63 -0
  51. package/src/component/renewalWitnesses/protocol.ts +103 -0
  52. package/src/component/renewalWitnesses/schema.ts +36 -0
  53. package/src/component/renewalWitnesses/source.ts +157 -0
  54. package/src/component/schema.ts +2 -0
  55. package/src/shared/renewalWitness.ts +179 -0
@@ -22,14 +22,6 @@ export declare const begin: import("convex/server").RegisteredMutation<"public",
22
22
  requestKey: string;
23
23
  scopeKey: string;
24
24
  }, Promise<{
25
- reason: "identity_changed" | "revision_changed" | "scope_busy";
26
- retryable: false;
27
- status: "conflict";
28
- } | {
29
- reason: "policy_invalid";
30
- retryable: false;
31
- status: "rejected";
32
- } | {
33
25
  operation: {
34
26
  accountId: string;
35
27
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -40,6 +32,14 @@ export declare const begin: import("convex/server").RegisteredMutation<"public",
40
32
  } | {
41
33
  enabled: boolean;
42
34
  status: "unchanged";
35
+ } | {
36
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
37
+ retryable: false;
38
+ status: "conflict";
39
+ } | {
40
+ reason: "policy_invalid";
41
+ retryable: false;
42
+ status: "rejected";
43
43
  } | {
44
44
  reason: "provider_pending";
45
45
  retryable: true;
@@ -395,14 +395,6 @@ export declare const prepare: import("convex/server").RegisteredMutation<"public
395
395
  requestKey: string;
396
396
  scopeKey: string;
397
397
  }, Promise<{
398
- reason: "identity_changed" | "revision_changed" | "scope_busy";
399
- retryable: false;
400
- status: "conflict";
401
- } | {
402
- reason: "policy_invalid";
403
- retryable: false;
404
- status: "rejected";
405
- } | {
406
398
  operation: {
407
399
  accountId: string;
408
400
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -413,6 +405,14 @@ export declare const prepare: import("convex/server").RegisteredMutation<"public
413
405
  } | {
414
406
  enabled: boolean;
415
407
  status: "unchanged";
408
+ } | {
409
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
410
+ retryable: false;
411
+ status: "conflict";
412
+ } | {
413
+ reason: "policy_invalid";
414
+ retryable: false;
415
+ status: "rejected";
416
416
  } | {
417
417
  reason: "provider_pending";
418
418
  retryable: true;
@@ -60,22 +60,6 @@ export declare const phaseRef: import("convex/values").VObject<{
60
60
  }, "required", "accountId" | "definitionVersion" | "operationId" | "phase" | "providerApiVersion" | "providerKey" | "scopeKey" | "stripeSubscriptionId" | "version">;
61
61
  export type FundingPhaseRef = Infer<typeof phaseRef>;
62
62
  export declare const workflowStartResult: import("convex/values").VUnion<{
63
- reason: "history_incomplete" | "provider_outcome_unknown";
64
- retryable: false;
65
- status: "unknown";
66
- } | {
67
- reason: "identity_changed" | "revision_changed" | "scope_busy";
68
- retryable: false;
69
- status: "conflict";
70
- } | {
71
- reason: "invalid_scope" | "policy_invalid" | "unsupported_source";
72
- retryable: false;
73
- status: "rejected";
74
- } | {
75
- reason: "provider_pending";
76
- retryable: true;
77
- status: "not_ready";
78
- } | {
79
63
  operation: {
80
64
  accountId: string;
81
65
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -92,6 +76,22 @@ export declare const workflowStartResult: import("convex/values").VUnion<{
92
76
  version: number;
93
77
  };
94
78
  status: "canceled";
79
+ } | {
80
+ reason: "history_incomplete" | "provider_outcome_unknown";
81
+ retryable: false;
82
+ status: "unknown";
83
+ } | {
84
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
85
+ retryable: false;
86
+ status: "conflict";
87
+ } | {
88
+ reason: "invalid_scope" | "policy_invalid" | "unsupported_source";
89
+ retryable: false;
90
+ status: "rejected";
91
+ } | {
92
+ reason: "provider_pending";
93
+ retryable: true;
94
+ status: "not_ready";
95
95
  }, [import("convex/values").VObject<{
96
96
  operation: {
97
97
  accountId: string;
@@ -2005,6 +2005,28 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
2005
2005
  searchIndexes: {};
2006
2006
  vectorIndexes: {};
2007
2007
  };
2008
+ renewalObservationWitnesses: {
2009
+ document: {
2010
+ _creationTime: number;
2011
+ _id: import("convex/values").GenericId<"renewalObservationWitnesses">;
2012
+ identity: {
2013
+ componentScope: string;
2014
+ operationId: import("convex/values").GenericId<"renewalOperations">;
2015
+ parentOperationId: import("convex/values").GenericId<"renewalOperations">;
2016
+ witnessId: string;
2017
+ };
2018
+ payloadBinding: string;
2019
+ payloadJSON: string;
2020
+ };
2021
+ fieldPaths: "_id" | ("_creationTime" | "identity" | "identity.componentScope" | "identity.operationId" | "identity.parentOperationId" | "identity.witnessId" | "payloadBinding" | "payloadJSON");
2022
+ indexes: {
2023
+ by_id: ["_id"];
2024
+ by_creation_time: ["_creationTime"];
2025
+ by_componentScope_and_witnessId: ["identity.componentScope", "identity.witnessId", "_creationTime"];
2026
+ };
2027
+ searchIndexes: {};
2028
+ vectorIndexes: {};
2029
+ };
2008
2030
  renewalOperationAttempts: {
2009
2031
  document: {
2010
2032
  _creationTime: number;
@@ -5050,6 +5072,28 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
5050
5072
  searchIndexes: {};
5051
5073
  vectorIndexes: {};
5052
5074
  };
5075
+ renewalObservationWitnesses: {
5076
+ document: {
5077
+ _creationTime: number;
5078
+ _id: import("convex/values").GenericId<"renewalObservationWitnesses">;
5079
+ identity: {
5080
+ componentScope: string;
5081
+ operationId: import("convex/values").GenericId<"renewalOperations">;
5082
+ parentOperationId: import("convex/values").GenericId<"renewalOperations">;
5083
+ witnessId: string;
5084
+ };
5085
+ payloadBinding: string;
5086
+ payloadJSON: string;
5087
+ };
5088
+ fieldPaths: "_id" | ("_creationTime" | "identity" | "identity.componentScope" | "identity.operationId" | "identity.parentOperationId" | "identity.witnessId" | "payloadBinding" | "payloadJSON");
5089
+ indexes: {
5090
+ by_id: ["_id"];
5091
+ by_creation_time: ["_creationTime"];
5092
+ by_componentScope_and_witnessId: ["identity.componentScope", "identity.witnessId", "_creationTime"];
5093
+ };
5094
+ searchIndexes: {};
5095
+ vectorIndexes: {};
5096
+ };
5053
5097
  renewalOperationAttempts: {
5054
5098
  document: {
5055
5099
  _creationTime: number;
@@ -1 +1 @@
1
- {"version":3,"file":"triggers.d.ts","sourceRoot":"","sources":["../../../src/component/earnings/triggers.ts"],"names":[],"mappings":"AA6GA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCAA0D,CAAC"}
@@ -0,0 +1,36 @@
1
+ import type { QueryCtx } from "../_generated/server.js";
2
+ import { type WitnessPayload } from "../../shared/renewalWitness.js";
3
+ /** Full material and exact source qualify unsigned storage DATA, not provider provenance. */
4
+ export declare function validateWitness(ctx: Pick<QueryCtx, "db">, raw: string): Promise<{
5
+ payload: Readonly<{
6
+ json: string;
7
+ value: WitnessPayload;
8
+ }>;
9
+ fields: {
10
+ version: 1;
11
+ identity: {
12
+ componentScope: string;
13
+ witnessId: string;
14
+ parentOperationId: import("convex/values").GenericId<"renewalOperations">;
15
+ operationId: import("convex/values").GenericId<"renewalOperations">;
16
+ };
17
+ capturedSubject: string;
18
+ observedAtMs: number;
19
+ customerAccountId: string;
20
+ customerId: string;
21
+ livemode: boolean;
22
+ subscriptionId: string;
23
+ scheduleId: string;
24
+ observedItemId: string;
25
+ nativePeriod: Readonly<{
26
+ start: number;
27
+ end: number;
28
+ }>;
29
+ operationalAuthority: false;
30
+ authenticationEstablished: false;
31
+ publicDeliveryEstablished: false;
32
+ providerQualificationRequired: true;
33
+ };
34
+ payloadBinding: string;
35
+ }>;
36
+ //# sourceMappingURL=eligibility.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eligibility.d.ts","sourceRoot":"","sources":["../../../src/component/renewalWitnesses/eligibility.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,gCAAgC,CAAC;AAkBxC,6FAA6F;AAC7F,wBAAsB,eAAe,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM;;;;;;iBAwB/D,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;GA4Bb"}
@@ -0,0 +1,60 @@
1
+ import { inspectRenewalEvidenceV1 } from "../../client/billing/renewalObservation/evidence-v1.js";
2
+ import { canonicalWitnessJSON, witnessNeed as need, } from "../../shared/renewalWitness.js";
3
+ import { validateWitnessSource } from "./source.js";
4
+ function configureInput(value, configuration, dispatch) {
5
+ const known = value.source.configure.acknowledgement;
6
+ return known === null
7
+ ? null
8
+ : {
9
+ configuration,
10
+ actualDispatch: dispatch,
11
+ providerSnapshot: known.receipt.providerSnapshot,
12
+ transport: known.receipt.transport,
13
+ };
14
+ }
15
+ /** Full material and exact source qualify unsigned storage DATA, not provider provenance. */
16
+ export async function validateWitness(ctx, raw) {
17
+ const payload = canonicalWitnessJSON(raw);
18
+ const source = await validateWitnessSource(ctx, payload.value);
19
+ const evidence = await inspectRenewalEvidenceV1({
20
+ version: 1,
21
+ apiVersion: "2026-09-30.endive",
22
+ configuration: source.configuration,
23
+ configureReceipt: configureInput(payload.value, source.configuration, source.dispatch),
24
+ reads: payload.value.reads,
25
+ invoiceContext: payload.value.invoiceContext,
26
+ historicalSnapshot: null,
27
+ });
28
+ need(evidence.identity &&
29
+ evidence.currentMaterial.predicate === "current_target_material_match");
30
+ if (payload.value.invoiceContext !== null)
31
+ need(evidence.invoiceEvidence.predicate === "invoice_lines_correlated");
32
+ const { identity } = evidence;
33
+ const fields = {
34
+ version: 1,
35
+ identity: source.identity,
36
+ capturedSubject: payload.value.capturedSubject,
37
+ observedAtMs: payload.value.acquisition.observedAtMs,
38
+ customerAccountId: identity.customerAccountId,
39
+ customerId: identity.customerId,
40
+ livemode: identity.livemode,
41
+ subscriptionId: identity.subscriptionId,
42
+ scheduleId: identity.scheduleId,
43
+ observedItemId: evidence.currentMaterial.observedItemId,
44
+ nativePeriod: evidence.currentMaterial.nativePeriod,
45
+ operationalAuthority: false,
46
+ authenticationEstablished: false,
47
+ publicDeliveryEstablished: false,
48
+ providerQualificationRequired: true,
49
+ };
50
+ const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode("renewal-witness:v1\u0000" + payload.json));
51
+ const hex = [...new Uint8Array(digest)]
52
+ .map((n) => n.toString(16).padStart(2, "0"))
53
+ .join("");
54
+ return {
55
+ payload,
56
+ fields,
57
+ payloadBinding: "renewal-witness:v1:sha256:" + hex,
58
+ };
59
+ }
60
+ //# sourceMappingURL=eligibility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eligibility.js","sourceRoot":"","sources":["../../../src/component/renewalWitnesses/eligibility.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,wDAAwD,CAAC;AAClG,OAAO,EACL,oBAAoB,EACpB,WAAW,IAAI,IAAI,GAEpB,MAAM,gCA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x } from "../_generated/server.js";
2
+ import { type WitnessIdentity } from "../../shared/renewalWitness.js";
3
+ type Reader = Pick<QueryCtx, "db">;
4
+ /** Trusted component helper only. A host retention capability and live capture remain required. */
5
+ export declare function retainWitness(ctx: Pick<MutationCtx, "db">, args: {
6
+ identity: WitnessIdentity;
7
+ payloadJSON: string;
8
+ }): Promise<{
9
+ status: "conflict";
10
+ reason: "identity_changed";
11
+ descriptor?: undefined;
12
+ } | {
13
+ reason?: undefined;
14
+ status: "retained";
15
+ descriptor: {
16
+ version: 1;
17
+ identity: {
18
+ componentScope: string;
19
+ witnessId: string;
20
+ parentOperationId: import("convex/values").GenericId<"renewalOperations">;
21
+ operationId: import("convex/values").GenericId<"renewalOperations">;
22
+ };
23
+ capturedSubject: string;
24
+ observedAtMs: number;
25
+ customerAccountId: string;
26
+ customerId: string;
27
+ livemode: boolean;
28
+ subscriptionId: string;
29
+ scheduleId: string;
30
+ observedItemId: string;
31
+ nativePeriod: Readonly<{
32
+ start: number;
33
+ end: number;
34
+ }>;
35
+ operationalAuthority: false;
36
+ authenticationEstablished: false;
37
+ publicDeliveryEstablished: false;
38
+ providerQualificationRequired: true;
39
+ payloadBinding: string;
40
+ witnessRowId: import("convex/values").GenericId<"renewalObservationWitnesses">;
41
+ };
42
+ }>;
43
+ /** Fresh host read authorization belongs to the caller; this cannot establish public ACK delivery. */
44
+ export declare function readWitness(ctx: Reader, raw: WitnessIdentity): Promise<{
45
+ descriptor: {
46
+ version: 1;
47
+ identity: {
48
+ componentScope: string;
49
+ witnessId: string;
50
+ parentOperationId: import("convex/values").GenericId<"renewalOperations">;
51
+ operationId: import("convex/values").GenericId<"renewalOperations">;
52
+ };
53
+ capturedSubject: string;
54
+ observedAtMs: number;
55
+ customerAccountId: string;
56
+ customerId: string;
57
+ livemode: boolean;
58
+ subscriptionId: string;
59
+ scheduleId: string;
60
+ observedItemId: string;
61
+ nativePeriod: Readonly<{
62
+ start: number;
63
+ end: number;
64
+ }>;
65
+ operationalAuthority: false;
66
+ authenticationEstablished: false;
67
+ publicDeliveryEstablished: false;
68
+ providerQualificationRequired: true;
69
+ payloadBinding: string;
70
+ witnessRowId: import("convex/values").GenericId<"renewalObservationWitnesses">;
71
+ };
72
+ payloadJSON: string;
73
+ } | null>;
74
+ export {};
75
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../src/component/renewalWitnesses/protocol.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAErE,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,gCAAgC,CAAC;AAIxC,KAAK,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAiDnC,mGAAmG;AACnG,wBAAsB,aAAa,CACjC,GAAG,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,EAC5B,IAAI,EAAE;IAAE,QAAQ,EAAE,eAAe,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE;YAc1C,UAAU;YACV,kBAAkB;;;;YAEb,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAe9B;AACD,sGAAsG;AACtG,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAKlE"}
@@ -0,0 +1,82 @@
1
+ import { getConvexSize } from "convex/values";
2
+ import { sameJSON } from "../renewalOperations/attachValidation.js";
3
+ import { witnessNeed as need, witnessIdentity, } from "../../shared/renewalWitness.js";
4
+ import { normalizedWitnessIdentity } from "./source.js";
5
+ import { validateWitness } from "./eligibility.js";
6
+ async function find(ctx, identity) {
7
+ const rows = await ctx.db
8
+ .query("renewalObservationWitnesses")
9
+ .withIndex("by_componentScope_and_witnessId", (q) => q
10
+ .eq("identity.componentScope", identity.componentScope)
11
+ .eq("identity.witnessId", identity.witnessId))
12
+ .take(2);
13
+ need(rows.length <= 1);
14
+ return rows[0] ?? null;
15
+ }
16
+ function budget(admitted) {
17
+ const { payload, fields, payloadBinding } = admitted;
18
+ need(getConvexSize({
19
+ identity: fields.identity,
20
+ payloadJSON: payload.json,
21
+ payloadBinding,
22
+ }) <= 500000);
23
+ // Reserve the maximum admitted opaque ID length before making any insert.
24
+ need(getConvexSize({
25
+ descriptor: { ...fields, payloadBinding, witnessRowId: "x".repeat(255) },
26
+ payloadJSON: payload.json,
27
+ }) <= 500000);
28
+ }
29
+ async function checked(ctx, row) {
30
+ const admitted = await validateWitness(ctx, row.payloadJSON);
31
+ budget(admitted);
32
+ need(sameJSON(admitted.fields.identity, row.identity) &&
33
+ admitted.payloadBinding === row.payloadBinding);
34
+ return {
35
+ descriptor: {
36
+ ...admitted.fields,
37
+ payloadBinding: admitted.payloadBinding,
38
+ witnessRowId: row._id,
39
+ },
40
+ payloadJSON: admitted.payload.json,
41
+ };
42
+ }
43
+ /** Trusted component helper only. A host retention capability and live capture remain required. */
44
+ export async function retainWitness(ctx, args) {
45
+ const identity = normalizedWitnessIdentity(ctx, args.identity);
46
+ const admitted = await validateWitness(ctx, args.payloadJSON);
47
+ need(sameJSON(admitted.fields.identity, identity));
48
+ budget(admitted);
49
+ const existing = await find(ctx, identity);
50
+ if (existing) {
51
+ const original = await checked(ctx, existing);
52
+ if (existing.payloadJSON !== admitted.payload.json ||
53
+ !sameJSON(existing.identity, identity))
54
+ return {
55
+ status: "conflict",
56
+ reason: "identity_changed",
57
+ };
58
+ return { status: "retained", descriptor: original.descriptor };
59
+ }
60
+ const witnessRowId = await ctx.db.insert("renewalObservationWitnesses", {
61
+ identity,
62
+ payloadJSON: admitted.payload.json,
63
+ payloadBinding: admitted.payloadBinding,
64
+ });
65
+ return {
66
+ status: "retained",
67
+ descriptor: {
68
+ ...admitted.fields,
69
+ payloadBinding: admitted.payloadBinding,
70
+ witnessRowId,
71
+ },
72
+ };
73
+ }
74
+ /** Fresh host read authorization belongs to the caller; this cannot establish public ACK delivery. */
75
+ export async function readWitness(ctx, raw) {
76
+ const identity = witnessIdentity(raw);
77
+ const row = await find(ctx, identity);
78
+ if (!row || !sameJSON(row.identity, identity))
79
+ return null;
80
+ return checked(ctx, row);
81
+ }
82
+ //# sourceMappingURL=protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../src/component/renewalWitnesses/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AACpE,OAAO,EACL,WAAW,IAAI,IAAI,EACnB,eAAe,GAEhB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGnD,KAAK,UAAU,IAAI,CAAC,GAAW,EAAE,QAAyB;IACxD,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,EAAE;SACtB,KAAK,CAAC,6BAA6B,CAAC;SACpC,SAAS,CAAC,iCAAiC,EAAE,CAAC,CAAC,EAAE,EAAE,CAClD,CAAC;SACE,EAAE,CAAC,yBAAyB,EAAE,QAAQ,CAAC,cAAc,CAAC;SACtD,EAAE,CAAC,oBAAoB,EAAE,QAAQ,CAAC,SAAS,CAAC,CAChD;SACA,IAAI,CAAC,CAAC,CAAC,CAAC;IACX,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;IACvB,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AACzB,CAAC;AACD,SAAS,MAAM,CAAC,QAAqD;IACnE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,QAAQ,CAAC;IACrD,IAAI,CACF,aAAa,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB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"}
@@ -0,0 +1,99 @@
1
+ export declare const identity: import("convex/values").VObject<{
2
+ componentScope: string;
3
+ operationId: import("convex/values").GenericId<"renewalOperations">;
4
+ parentOperationId: import("convex/values").GenericId<"renewalOperations">;
5
+ witnessId: string;
6
+ }, {
7
+ componentScope: import("convex/values").VString<string, "required">;
8
+ witnessId: import("convex/values").VString<string, "required">;
9
+ parentOperationId: import("convex/values").VId<import("convex/values").GenericId<"renewalOperations">, "required">;
10
+ operationId: import("convex/values").VId<import("convex/values").GenericId<"renewalOperations">, "required">;
11
+ }, "required", "componentScope" | "operationId" | "parentOperationId" | "witnessId">;
12
+ export declare const descriptor: import("convex/values").VObject<{
13
+ authenticationEstablished: false;
14
+ capturedSubject: string;
15
+ customerAccountId: string;
16
+ customerId: string;
17
+ identity: {
18
+ componentScope: string;
19
+ operationId: import("convex/values").GenericId<"renewalOperations">;
20
+ parentOperationId: import("convex/values").GenericId<"renewalOperations">;
21
+ witnessId: string;
22
+ };
23
+ livemode: boolean;
24
+ nativePeriod: {
25
+ end: number;
26
+ start: number;
27
+ };
28
+ observedAtMs: number;
29
+ observedItemId: string;
30
+ operationalAuthority: false;
31
+ payloadBinding: string;
32
+ providerQualificationRequired: true;
33
+ publicDeliveryEstablished: false;
34
+ scheduleId: string;
35
+ subscriptionId: string;
36
+ version: 1;
37
+ witnessRowId: import("convex/values").GenericId<"renewalObservationWitnesses">;
38
+ }, {
39
+ version: import("convex/values").VLiteral<1, "required">;
40
+ witnessRowId: import("convex/values").VId<import("convex/values").GenericId<"renewalObservationWitnesses">, "required">;
41
+ identity: import("convex/values").VObject<{
42
+ componentScope: string;
43
+ operationId: import("convex/values").GenericId<"renewalOperations">;
44
+ parentOperationId: import("convex/values").GenericId<"renewalOperations">;
45
+ witnessId: string;
46
+ }, {
47
+ componentScope: import("convex/values").VString<string, "required">;
48
+ witnessId: import("convex/values").VString<string, "required">;
49
+ parentOperationId: import("convex/values").VId<import("convex/values").GenericId<"renewalOperations">, "required">;
50
+ operationId: import("convex/values").VId<import("convex/values").GenericId<"renewalOperations">, "required">;
51
+ }, "required", "componentScope" | "operationId" | "parentOperationId" | "witnessId">;
52
+ payloadBinding: import("convex/values").VString<string, "required">;
53
+ capturedSubject: import("convex/values").VString<string, "required">;
54
+ observedAtMs: import("convex/values").VFloat64<number, "required">;
55
+ customerAccountId: import("convex/values").VString<string, "required">;
56
+ customerId: import("convex/values").VString<string, "required">;
57
+ livemode: import("convex/values").VBoolean<boolean, "required">;
58
+ subscriptionId: import("convex/values").VString<string, "required">;
59
+ scheduleId: import("convex/values").VString<string, "required">;
60
+ observedItemId: import("convex/values").VString<string, "required">;
61
+ nativePeriod: import("convex/values").VObject<{
62
+ end: number;
63
+ start: number;
64
+ }, {
65
+ start: import("convex/values").VFloat64<number, "required">;
66
+ end: import("convex/values").VFloat64<number, "required">;
67
+ }, "required", "end" | "start">;
68
+ operationalAuthority: import("convex/values").VLiteral<false, "required">;
69
+ authenticationEstablished: import("convex/values").VLiteral<false, "required">;
70
+ publicDeliveryEstablished: import("convex/values").VLiteral<false, "required">;
71
+ providerQualificationRequired: import("convex/values").VLiteral<true, "required">;
72
+ }, "required", "authenticationEstablished" | "capturedSubject" | "customerAccountId" | "customerId" | "identity" | "identity.componentScope" | "identity.operationId" | "identity.parentOperationId" | "identity.witnessId" | "livemode" | "nativePeriod" | "nativePeriod.end" | "nativePeriod.start" | "observedAtMs" | "observedItemId" | "operationalAuthority" | "payloadBinding" | "providerQualificationRequired" | "publicDeliveryEstablished" | "scheduleId" | "subscriptionId" | "version" | "witnessRowId">;
73
+ export declare const witnessesTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
74
+ identity: {
75
+ componentScope: string;
76
+ operationId: import("convex/values").GenericId<"renewalOperations">;
77
+ parentOperationId: import("convex/values").GenericId<"renewalOperations">;
78
+ witnessId: string;
79
+ };
80
+ payloadBinding: string;
81
+ payloadJSON: string;
82
+ }, {
83
+ identity: import("convex/values").VObject<{
84
+ componentScope: string;
85
+ operationId: import("convex/values").GenericId<"renewalOperations">;
86
+ parentOperationId: import("convex/values").GenericId<"renewalOperations">;
87
+ witnessId: string;
88
+ }, {
89
+ componentScope: import("convex/values").VString<string, "required">;
90
+ witnessId: import("convex/values").VString<string, "required">;
91
+ parentOperationId: import("convex/values").VId<import("convex/values").GenericId<"renewalOperations">, "required">;
92
+ operationId: import("convex/values").VId<import("convex/values").GenericId<"renewalOperations">, "required">;
93
+ }, "required", "componentScope" | "operationId" | "parentOperationId" | "witnessId">;
94
+ payloadJSON: import("convex/values").VString<string, "required">;
95
+ payloadBinding: import("convex/values").VString<string, "required">;
96
+ }, "required", "identity" | "identity.componentScope" | "identity.operationId" | "identity.parentOperationId" | "identity.witnessId" | "payloadBinding" | "payloadJSON">, {
97
+ by_componentScope_and_witnessId: ["identity.componentScope", "identity.witnessId", "_creationTime"];
98
+ }, {}, {}>;
99
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/component/renewalWitnesses/schema.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,QAAQ;;;;;;;;;;oFAKnB,CAAC;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qfAkBrB,CAAC;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;UAOzB,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { defineTable } from "convex/server";
2
+ import { v } from "convex/values";
3
+ export const identity = v.object({
4
+ componentScope: v.string(),
5
+ witnessId: v.string(),
6
+ parentOperationId: v.id("renewalOperations"),
7
+ operationId: v.id("renewalOperations"),
8
+ });
9
+ export const descriptor = v.object({
10
+ version: v.literal(1),
11
+ witnessRowId: v.id("renewalObservationWitnesses"),
12
+ identity,
13
+ payloadBinding: v.string(),
14
+ capturedSubject: v.string(),
15
+ observedAtMs: v.number(),
16
+ customerAccountId: v.string(),
17
+ customerId: v.string(),
18
+ livemode: v.boolean(),
19
+ subscriptionId: v.string(),
20
+ scheduleId: v.string(),
21
+ observedItemId: v.string(),
22
+ nativePeriod: v.object({ start: v.number(), end: v.number() }),
23
+ operationalAuthority: v.literal(false),
24
+ authenticationEstablished: v.literal(false),
25
+ publicDeliveryEstablished: v.literal(false),
26
+ providerQualificationRequired: v.literal(true),
27
+ });
28
+ export const witnessesTable = defineTable({
29
+ identity,
30
+ payloadJSON: v.string(),
31
+ payloadBinding: v.string(),
32
+ }).index("by_componentScope_and_witnessId", [
33
+ "identity.componentScope",
34
+ "identity.witnessId",
35
+ ]);
36
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/component/renewalWitnesses/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAElC,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,iBAAiB,EAAE,CAAC,CAAC,EAAE,CAAC,mBAAmB,CAAC;IAC5C,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,mBAAmB,CAAC;CACvC,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IACrB,YAAY,EAAE,CAAC,CAAC,EAAE,CAAC,6BAA6B,CAAC;IACjD,QAAQ;IACR,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;IAC3B,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE;IAC7B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;IACrB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;IAC9D,oBAAoB,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IACtC,yBAAyB,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IAC3C,yBAAyB,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IAC3C,6BAA6B,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;CAC/C,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAC;IACxC,QAAQ;IACR,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;CAC3B,CAAC,CAAC,KAAK,CAAC,iCAAiC,EAAE;IAC1C,yBAAyB;IACzB,oBAAoB;CACrB,CAAC,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { QueryCtx } from "../_generated/server.js";
2
+ import { type WitnessIdentity, type WitnessPayload } from "../../shared/renewalWitness.js";
3
+ type Reader = Pick<QueryCtx, "db">;
4
+ export declare function normalizedWitnessIdentity(ctx: Reader, raw: WitnessIdentity): {
5
+ componentScope: string;
6
+ witnessId: string;
7
+ parentOperationId: import("convex/values").GenericId<"renewalOperations">;
8
+ operationId: import("convex/values").GenericId<"renewalOperations">;
9
+ };
10
+ /** Reload complete actual chains/owners on every boundary; never trust stored flags. */
11
+ export declare function validateWitnessSource(ctx: Reader, value: WitnessPayload): Promise<{
12
+ identity: {
13
+ componentScope: string;
14
+ witnessId: string;
15
+ parentOperationId: import("convex/values").GenericId<"renewalOperations">;
16
+ operationId: import("convex/values").GenericId<"renewalOperations">;
17
+ };
18
+ configuration: unknown;
19
+ dispatch: unknown;
20
+ }>;
21
+ export {};
22
+ //# sourceMappingURL=source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../../src/component/renewalWitnesses/source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAWxD,OAAO,EAKL,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,gCAAgC,CAAC;AAExC,KAAK,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACnC,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,eAAe;;;;;EAY1E;AAwFD,wFAAwF;AACxF,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,cAAc;;;;;;;;;GAgCtB"}