@fantastic.dev/better-stripe 0.111.0 → 0.112.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 +6 -0
- package/README.md +1 -1
- package/dist/client/billing/renewalAttach/internal/observation/freshActor.d.ts +564 -0
- package/dist/client/billing/renewalAttach/internal/observation/freshActor.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/observation/freshActor.js +103 -21
- package/dist/client/billing/renewalAttach/internal/observation/freshActor.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/observation/freshTransport.d.ts +18 -1
- package/dist/client/billing/renewalAttach/internal/observation/freshTransport.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/observation/freshTransport.js +54 -1
- package/dist/client/billing/renewalAttach/internal/observation/freshTransport.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/observation/invocation.d.ts +4 -0
- package/dist/client/billing/renewalAttach/internal/observation/invocation.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/observation/invocation.js +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/invocation.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/observation/readerAuthorization.d.ts +4 -0
- package/dist/client/billing/renewalAttach/internal/observation/readerAuthorization.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/observation/readerAuthorization.js +6 -1
- package/dist/client/billing/renewalAttach/internal/observation/readerAuthorization.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/observation/witnessAuthorization.d.ts +38 -0
- package/dist/client/billing/renewalAttach/internal/observation/witnessAuthorization.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/witnessAuthorization.js +172 -0
- package/dist/client/billing/renewalAttach/internal/observation/witnessAuthorization.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/witnessData.d.ts +135 -0
- package/dist/client/billing/renewalAttach/internal/observation/witnessData.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/witnessData.js +143 -0
- package/dist/client/billing/renewalAttach/internal/observation/witnessData.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/witnessOperation.d.ts +85 -0
- package/dist/client/billing/renewalAttach/internal/observation/witnessOperation.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/witnessOperation.js +121 -0
- package/dist/client/billing/renewalAttach/internal/observation/witnessOperation.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/witnessProfiles.d.ts +44 -0
- package/dist/client/billing/renewalAttach/internal/operations/witnessProfiles.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/witnessProfiles.js +4 -0
- package/dist/client/billing/renewalAttach/internal/operations/witnessProfiles.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/producer/configureJournalWork.d.ts +1 -1
- package/dist/client/billing/renewalAttach/internal/producer/configureLineage.d.ts +21 -21
- package/dist/client/billing/renewalAttach/internal/producer/journalWorkFactory.d.ts +3 -3
- package/dist/client/billing/renewalAttach/internal/producer/operationFactory.d.ts +1 -1
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +32 -32
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts +16 -16
- package/dist/component/_generated/api.d.ts +24 -0
- package/dist/component/_generated/api.d.ts.map +1 -1
- package/dist/component/_generated/api.js.map +1 -1
- package/dist/component/_generated/component.d.ts +94 -10
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/balanceFunding/preparationHandlers.d.ts +8 -8
- package/dist/component/balanceFunding/queries.d.ts +1 -1
- package/dist/component/financialObservations/settlementHelpers.d.ts +3 -3
- package/dist/component/renewalWitnesses/mutations.d.ts +45 -0
- package/dist/component/renewalWitnesses/mutations.d.ts.map +1 -0
- package/dist/component/renewalWitnesses/mutations.js +14 -0
- package/dist/component/renewalWitnesses/mutations.js.map +1 -0
- package/dist/component/renewalWitnesses/queries.d.ts +39 -0
- package/dist/component/renewalWitnesses/queries.d.ts.map +1 -0
- package/dist/component/renewalWitnesses/queries.js +11 -0
- package/dist/component/renewalWitnesses/queries.js.map +1 -0
- package/dist/component/usage/allowance.fixtures.d.ts +16 -16
- package/docs/renewal-witness-protocol.md +61 -10
- package/package.json +1 -1
- package/src/client/billing/renewalAttach/internal/observation/freshActor.ts +142 -19
- package/src/client/billing/renewalAttach/internal/observation/freshTransport.ts +90 -1
- package/src/client/billing/renewalAttach/internal/observation/invocation.ts +2 -0
- package/src/client/billing/renewalAttach/internal/observation/readerAuthorization.ts +6 -1
- package/src/client/billing/renewalAttach/internal/observation/witnessAcquisition.integration.test.ts +348 -0
- package/src/client/billing/renewalAttach/internal/observation/witnessActor.integration.test.ts +204 -0
- package/src/client/billing/renewalAttach/internal/observation/witnessAuthorization.ts +239 -0
- package/src/client/billing/renewalAttach/internal/observation/witnessCapabilities.integration.test.ts +231 -0
- package/src/client/billing/renewalAttach/internal/observation/witnessData.ts +189 -0
- package/src/client/billing/renewalAttach/internal/observation/witnessHistorical.integration.test.ts +98 -0
- package/src/client/billing/renewalAttach/internal/observation/witnessImmutable.integration.test.ts +78 -0
- package/src/client/billing/renewalAttach/internal/observation/witnessInvoice.integration.test.ts +85 -0
- package/src/client/billing/renewalAttach/internal/observation/witnessLifecycle.integration.test.ts +264 -0
- package/src/client/billing/renewalAttach/internal/observation/witnessOperation.ts +205 -0
- package/src/client/billing/renewalAttach/internal/observation/witnessProfile.integration.test.ts +93 -0
- package/src/client/billing/renewalAttach/internal/observation/witnessRPCControls.integration.test.ts +256 -0
- package/src/client/billing/renewalAttach/internal/operations/witnessProfiles.ts +58 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/invoiceObservation.ts +3 -1
- package/src/client/billing/renewalAttach/internal/test-fixtures/producerConfigureAdmission.ts +8 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/producerInitialOperation.ts +18 -7
- package/src/client/billing/renewalAttach/internal/test-fixtures/witnessHistory.ts +70 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/witnessObservation.ts +353 -0
- package/src/component/_generated/api.ts +24 -0
- package/src/component/_generated/component.ts +98 -10
- package/src/component/renewalWitnesses/mutations.ts +17 -0
- package/src/component/renewalWitnesses/queries.ts +11 -0
- package/src/component/renewalWitnesses/routes.test.ts +154 -0
|
@@ -2,6 +2,14 @@ import type { Infer } from "convex/values";
|
|
|
2
2
|
import type { MutationCtx } from "../_generated/server.js";
|
|
3
3
|
import { prepareArgs, finishPreparationArgs } from "./mutationValidators.js";
|
|
4
4
|
export declare function prepareHandler(ctx: MutationCtx, args: Infer<typeof prepareArgs>): Promise<{
|
|
5
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
6
|
+
retryable: false;
|
|
7
|
+
status: "conflict";
|
|
8
|
+
} | {
|
|
9
|
+
reason: "policy_invalid";
|
|
10
|
+
retryable: false;
|
|
11
|
+
status: "rejected";
|
|
12
|
+
} | {
|
|
5
13
|
operation: {
|
|
6
14
|
accountId: string;
|
|
7
15
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
@@ -12,14 +20,6 @@ export declare function prepareHandler(ctx: MutationCtx, args: Infer<typeof prep
|
|
|
12
20
|
} | {
|
|
13
21
|
enabled: boolean;
|
|
14
22
|
status: "unchanged";
|
|
15
|
-
} | {
|
|
16
|
-
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
17
|
-
retryable: false;
|
|
18
|
-
status: "conflict";
|
|
19
|
-
} | {
|
|
20
|
-
reason: "policy_invalid";
|
|
21
|
-
retryable: false;
|
|
22
|
-
status: "rejected";
|
|
23
23
|
} | {
|
|
24
24
|
reason: "provider_pending";
|
|
25
25
|
retryable: true;
|
|
@@ -180,11 +180,11 @@ export declare const findPreparationOperation: import("convex/server").Registere
|
|
|
180
180
|
retryable: false;
|
|
181
181
|
} | {
|
|
182
182
|
reason?: undefined;
|
|
183
|
+
retryable?: undefined;
|
|
183
184
|
accountId: string;
|
|
184
185
|
scopeKey: string;
|
|
185
186
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
186
187
|
version: number;
|
|
187
|
-
retryable?: undefined;
|
|
188
188
|
status?: undefined;
|
|
189
189
|
state: "canceled" | "failed" | "pending" | "running" | "succeeded" | "unknown";
|
|
190
190
|
cancelRequested: boolean;
|
|
@@ -9,9 +9,9 @@ export declare function legOwnership(ctx: MutationCtx, bucketKey: string, prior:
|
|
|
9
9
|
orgId: string | undefined;
|
|
10
10
|
ownershipStatus: "ambiguous";
|
|
11
11
|
} | {
|
|
12
|
-
registrationId?: undefined;
|
|
13
12
|
userId?: undefined;
|
|
14
13
|
orgId?: undefined;
|
|
14
|
+
registrationId?: undefined;
|
|
15
15
|
ownershipStatus: "ambiguous";
|
|
16
16
|
} | {
|
|
17
17
|
registrationId: import("convex/values").GenericId<"financialOwnership">;
|
|
@@ -19,9 +19,9 @@ export declare function legOwnership(ctx: MutationCtx, bucketKey: string, prior:
|
|
|
19
19
|
orgId: string | undefined;
|
|
20
20
|
ownershipStatus: "unknown";
|
|
21
21
|
} | {
|
|
22
|
-
registrationId?: undefined;
|
|
23
22
|
userId?: undefined;
|
|
24
23
|
orgId?: undefined;
|
|
24
|
+
registrationId?: undefined;
|
|
25
25
|
ownershipStatus: "unknown";
|
|
26
26
|
} | {
|
|
27
27
|
registrationId: import("convex/values").GenericId<"financialOwnership">;
|
|
@@ -29,9 +29,9 @@ export declare function legOwnership(ctx: MutationCtx, bucketKey: string, prior:
|
|
|
29
29
|
orgId: string | undefined;
|
|
30
30
|
ownershipStatus: "contradictory";
|
|
31
31
|
} | {
|
|
32
|
-
registrationId?: undefined;
|
|
33
32
|
userId?: undefined;
|
|
34
33
|
orgId?: undefined;
|
|
34
|
+
registrationId?: undefined;
|
|
35
35
|
ownershipStatus: "contradictory";
|
|
36
36
|
} | {
|
|
37
37
|
registrationId: import("convex/values").GenericId<"financialOwnership">;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** Trusted host component API. Host authorization and live capture remain separate requirements. */
|
|
2
|
+
export declare const retainAuthorizedWitness: import("convex/server").RegisteredMutation<"public", {
|
|
3
|
+
identity: {
|
|
4
|
+
componentScope: string;
|
|
5
|
+
operationId: import("convex/values").GenericId<"renewalOperations">;
|
|
6
|
+
parentOperationId: import("convex/values").GenericId<"renewalOperations">;
|
|
7
|
+
witnessId: string;
|
|
8
|
+
};
|
|
9
|
+
payloadJSON: string;
|
|
10
|
+
}, Promise<{
|
|
11
|
+
status: "conflict";
|
|
12
|
+
reason: "identity_changed";
|
|
13
|
+
descriptor?: undefined;
|
|
14
|
+
} | {
|
|
15
|
+
reason?: undefined;
|
|
16
|
+
status: "retained";
|
|
17
|
+
descriptor: {
|
|
18
|
+
version: 1;
|
|
19
|
+
identity: {
|
|
20
|
+
componentScope: string;
|
|
21
|
+
witnessId: string;
|
|
22
|
+
parentOperationId: import("convex/values").GenericId<"renewalOperations">;
|
|
23
|
+
operationId: import("convex/values").GenericId<"renewalOperations">;
|
|
24
|
+
};
|
|
25
|
+
capturedSubject: string;
|
|
26
|
+
observedAtMs: number;
|
|
27
|
+
customerAccountId: string;
|
|
28
|
+
customerId: string;
|
|
29
|
+
livemode: boolean;
|
|
30
|
+
subscriptionId: string;
|
|
31
|
+
scheduleId: string;
|
|
32
|
+
observedItemId: string;
|
|
33
|
+
nativePeriod: Readonly<{
|
|
34
|
+
start: number;
|
|
35
|
+
end: number;
|
|
36
|
+
}>;
|
|
37
|
+
operationalAuthority: false;
|
|
38
|
+
authenticationEstablished: false;
|
|
39
|
+
publicDeliveryEstablished: false;
|
|
40
|
+
providerQualificationRequired: true;
|
|
41
|
+
payloadBinding: string;
|
|
42
|
+
witnessRowId: import("convex/values").GenericId<"renewalObservationWitnesses">;
|
|
43
|
+
};
|
|
44
|
+
}>>;
|
|
45
|
+
//# sourceMappingURL=mutations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../../src/component/renewalWitnesses/mutations.ts"],"names":[],"mappings":"AAKA,oGAAoG;AACpG,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAUlC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { v } from "convex/values";
|
|
2
|
+
import { mutation } from "../_generated/server.js";
|
|
3
|
+
import { descriptor, identity } from "./schema.js";
|
|
4
|
+
import { retainWitness } from "./protocol.js";
|
|
5
|
+
/** Trusted host component API. Host authorization and live capture remain separate requirements. */
|
|
6
|
+
export const retainAuthorizedWitness = mutation({
|
|
7
|
+
args: { identity, payloadJSON: v.string() },
|
|
8
|
+
returns: v.union(v.object({ status: v.literal("retained"), descriptor }), v.object({
|
|
9
|
+
status: v.literal("conflict"),
|
|
10
|
+
reason: v.literal("identity_changed"),
|
|
11
|
+
})),
|
|
12
|
+
handler: retainWitness,
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=mutations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../../src/component/renewalWitnesses/mutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,oGAAoG;AACpG,MAAM,CAAC,MAAM,uBAAuB,GAAG,QAAQ,CAAC;IAC9C,IAAI,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE;IAC3C,OAAO,EAAE,CAAC,CAAC,KAAK,CACd,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,UAAU,EAAE,CAAC,EACvD,CAAC,CAAC,MAAM,CAAC;QACP,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;QAC7B,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC;KACtC,CAAC,CACH;IACD,OAAO,EAAE,aAAa;CACvB,CAAC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** Trusted host component API. A fresh host read grant must precede any external release. */
|
|
2
|
+
export declare const readAuthorizedWitness: import("convex/server").RegisteredQuery<"public", {
|
|
3
|
+
identity: {
|
|
4
|
+
componentScope: string;
|
|
5
|
+
operationId: import("convex/values").GenericId<"renewalOperations">;
|
|
6
|
+
parentOperationId: import("convex/values").GenericId<"renewalOperations">;
|
|
7
|
+
witnessId: string;
|
|
8
|
+
};
|
|
9
|
+
}, Promise<{
|
|
10
|
+
descriptor: {
|
|
11
|
+
version: 1;
|
|
12
|
+
identity: {
|
|
13
|
+
componentScope: string;
|
|
14
|
+
witnessId: string;
|
|
15
|
+
parentOperationId: import("convex/values").GenericId<"renewalOperations">;
|
|
16
|
+
operationId: import("convex/values").GenericId<"renewalOperations">;
|
|
17
|
+
};
|
|
18
|
+
capturedSubject: string;
|
|
19
|
+
observedAtMs: number;
|
|
20
|
+
customerAccountId: string;
|
|
21
|
+
customerId: string;
|
|
22
|
+
livemode: boolean;
|
|
23
|
+
subscriptionId: string;
|
|
24
|
+
scheduleId: string;
|
|
25
|
+
observedItemId: string;
|
|
26
|
+
nativePeriod: Readonly<{
|
|
27
|
+
start: number;
|
|
28
|
+
end: number;
|
|
29
|
+
}>;
|
|
30
|
+
operationalAuthority: false;
|
|
31
|
+
authenticationEstablished: false;
|
|
32
|
+
publicDeliveryEstablished: false;
|
|
33
|
+
providerQualificationRequired: true;
|
|
34
|
+
payloadBinding: string;
|
|
35
|
+
witnessRowId: import("convex/values").GenericId<"renewalObservationWitnesses">;
|
|
36
|
+
};
|
|
37
|
+
payloadJSON: string;
|
|
38
|
+
} | null>>;
|
|
39
|
+
//# sourceMappingURL=queries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/component/renewalWitnesses/queries.ts"],"names":[],"mappings":"AAKA,6FAA6F;AAC7F,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAIhC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { v } from "convex/values";
|
|
2
|
+
import { query } from "../_generated/server.js";
|
|
3
|
+
import { descriptor, identity } from "./schema.js";
|
|
4
|
+
import { readWitness } from "./protocol.js";
|
|
5
|
+
/** Trusted host component API. A fresh host read grant must precede any external release. */
|
|
6
|
+
export const readAuthorizedWitness = query({
|
|
7
|
+
args: { identity },
|
|
8
|
+
returns: v.union(v.null(), v.object({ descriptor, payloadJSON: v.string() })),
|
|
9
|
+
handler: (ctx, args) => readWitness(ctx, args.identity),
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=queries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/component/renewalWitnesses/queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,6FAA6F;AAC7F,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,CAAC;IACzC,IAAI,EAAE,EAAE,QAAQ,EAAE;IAClB,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC7E,OAAO,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC;CACxD,CAAC,CAAC"}
|
|
@@ -2658,6 +2658,14 @@ export declare function setupAllowance(): Promise<{
|
|
|
2658
2658
|
preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
|
|
2659
2659
|
requestKey: string;
|
|
2660
2660
|
result?: {
|
|
2661
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
2662
|
+
retryable: false;
|
|
2663
|
+
status: "conflict";
|
|
2664
|
+
} | {
|
|
2665
|
+
reason: "policy_invalid";
|
|
2666
|
+
retryable: false;
|
|
2667
|
+
status: "rejected";
|
|
2668
|
+
} | {
|
|
2661
2669
|
operation: {
|
|
2662
2670
|
accountId: string;
|
|
2663
2671
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
@@ -2668,14 +2676,6 @@ export declare function setupAllowance(): Promise<{
|
|
|
2668
2676
|
} | {
|
|
2669
2677
|
enabled: boolean;
|
|
2670
2678
|
status: "unchanged";
|
|
2671
|
-
} | {
|
|
2672
|
-
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
2673
|
-
retryable: false;
|
|
2674
|
-
status: "conflict";
|
|
2675
|
-
} | {
|
|
2676
|
-
reason: "policy_invalid";
|
|
2677
|
-
retryable: false;
|
|
2678
|
-
status: "rejected";
|
|
2679
2679
|
} | {
|
|
2680
2680
|
reason: "provider_pending";
|
|
2681
2681
|
retryable: true;
|
|
@@ -2686,6 +2686,14 @@ export declare function setupAllowance(): Promise<{
|
|
|
2686
2686
|
payload: import("convex/values").VString<string, "required">;
|
|
2687
2687
|
preparationId: import("convex/values").VId<import("convex/values").GenericId<"balanceFundingPreparations">, "required">;
|
|
2688
2688
|
result: import("convex/values").VUnion<{
|
|
2689
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
2690
|
+
retryable: false;
|
|
2691
|
+
status: "conflict";
|
|
2692
|
+
} | {
|
|
2693
|
+
reason: "policy_invalid";
|
|
2694
|
+
retryable: false;
|
|
2695
|
+
status: "rejected";
|
|
2696
|
+
} | {
|
|
2689
2697
|
operation: {
|
|
2690
2698
|
accountId: string;
|
|
2691
2699
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
@@ -2696,14 +2704,6 @@ export declare function setupAllowance(): Promise<{
|
|
|
2696
2704
|
} | {
|
|
2697
2705
|
enabled: boolean;
|
|
2698
2706
|
status: "unchanged";
|
|
2699
|
-
} | {
|
|
2700
|
-
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
2701
|
-
retryable: false;
|
|
2702
|
-
status: "conflict";
|
|
2703
|
-
} | {
|
|
2704
|
-
reason: "policy_invalid";
|
|
2705
|
-
retryable: false;
|
|
2706
|
-
status: "rejected";
|
|
2707
2707
|
} | {
|
|
2708
2708
|
reason: "provider_pending";
|
|
2709
2709
|
retryable: true;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
# Immutable renewal witness protocol
|
|
2
2
|
|
|
3
|
-
This component protocol stores complete unsigned renewal snapshot DATA.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
This component protocol stores complete unsigned renewal snapshot DATA. Its
|
|
4
|
+
trusted host component routes retain and read immutable witnesses through strict
|
|
5
|
+
argument and return validators. Host authentication and authorization must precede
|
|
6
|
+
component calls; storage DATA does not supply either permission.
|
|
7
|
+
|
|
8
|
+
Private source wrappers connect the protocol to a fresh observation invocation.
|
|
9
|
+
Their production capture and read profiles remain frozen and EMPTY. Genuine
|
|
10
|
+
generated references, qualified host bindings, deployed compatibility and provider
|
|
11
|
+
qualification remain required before activation. These private wrappers are not
|
|
12
|
+
public SDK entrypoints.
|
|
9
13
|
|
|
10
14
|
## Payload and source checks
|
|
11
15
|
|
|
@@ -65,6 +69,34 @@ transaction concurrency provides the first-wins behavior across calls.
|
|
|
65
69
|
|
|
66
70
|
## Retention and historical meaning
|
|
67
71
|
|
|
72
|
+
The private capture wrapper uses the actual fresh Action, selected SDK and original
|
|
73
|
+
30-second observation lifetime. It accepts the operation pair and one fixed
|
|
74
|
+
witness identity, acquires complete current reads, and requires
|
|
75
|
+
`current_target_material_match`. A selected invoice profile must acquire its full
|
|
76
|
+
context and establish complete paired correlation. The existing base and invoice
|
|
77
|
+
wrappers retain their own outputs and provider GET bounds.
|
|
78
|
+
|
|
79
|
+
The original transport privately registers one acquisition cell per invocation
|
|
80
|
+
after actual SDK selection. It records only its settled original GET bodies and
|
|
81
|
+
complete fenced invoice context. Retention consumes that acquisition once; it
|
|
82
|
+
accepts no supplied reads, invoice context or guard callback. A fresh invocation,
|
|
83
|
+
selected SDK or copied observation DATA alone cannot create this receipt. Partial
|
|
84
|
+
reads and a second transport under the same invocation refuse.
|
|
85
|
+
|
|
86
|
+
A separate fixed host retention capability binds installation, current subject,
|
|
87
|
+
operation pair, Customer/account/mode, schedule/subscription, complete C7 request
|
|
88
|
+
binding, successor item and native period. Invoice permission does not imply
|
|
89
|
+
retention permission. The wrapper awaits the original native mutation Promise,
|
|
90
|
+
checks the complete descriptor, reads back the exact full payload, then rechecks
|
|
91
|
+
the base, applicable invoice and retention grants before returning retention DATA.
|
|
92
|
+
Public `.then` substitutions and copied replies cannot replace the original RPC
|
|
93
|
+
settlement. Pending or rejected replies do not become acknowledgements. The wrapper
|
|
94
|
+
does not retry a lost reply or choose another witness identity.
|
|
95
|
+
|
|
96
|
+
Acquisition metadata measures the same fresh lifetime used for those reads. It
|
|
97
|
+
does not reuse the old write Owner or restart a deadline. Its wall and monotonic
|
|
98
|
+
durations remain unsigned host observation metadata.
|
|
99
|
+
|
|
68
100
|
A successful transaction returns a row descriptor and full payload binding. It
|
|
69
101
|
does not prove that an external caller received that result. A lost response can
|
|
70
102
|
leave a durable row with no returned public acknowledgement. An explicit later
|
|
@@ -82,7 +114,26 @@ not revive a write Owner, manufacture a native past observation, prove atomic
|
|
|
82
114
|
acquisition or establish exclusive causality. Fetching an old invoice later is
|
|
83
115
|
not a substitute for the complete active snapshot.
|
|
84
116
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
117
|
+
A later fresh invocation obtains a distinct host read grant before loading the
|
|
118
|
+
complete stored witness. The grant binds its full scope, row identity and payload
|
|
119
|
+
digest and is rechecked before release. A separately authorized later subject can
|
|
120
|
+
read without replacing the immutable captured subject. Source/material/digest
|
|
121
|
+
checks and the current immutable C7 context still apply.
|
|
122
|
+
|
|
123
|
+
Current and lifecycle analysis use the later invocation's current C9 context.
|
|
124
|
+
Historical material analysis uses the witness's own stored C7 and nullable C9
|
|
125
|
+
context. A C9 retained later is not injected into a captured-null witness. This
|
|
126
|
+
keeps historical material independent of current settings, terminal status or
|
|
127
|
+
invoice-read availability while preserving the existing seven-field evidence
|
|
128
|
+
input and twelve-field result. The stored full invoice context can establish
|
|
129
|
+
historical material even when the later invocation has no invoice-read capability.
|
|
130
|
+
If live acquisition fails before intent identity can be reconstructed, the read
|
|
131
|
+
wrapper preserves the already validated immutable C7 identity. Current and
|
|
132
|
+
lifecycle evidence remain unknown; stored historical material does not replace
|
|
133
|
+
those axes.
|
|
134
|
+
|
|
135
|
+
The controlled tests exercise actual registered component transactions, complete
|
|
136
|
+
journal records and private Action/SDK capture and readback. Genuine route
|
|
137
|
+
generation, deployment, native/provider qualification, complete integration and
|
|
138
|
+
release acceptance and Dojo adoption remain separate requirements. Existing
|
|
139
|
+
execution holds remain in force.
|
package/package.json
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import { getFunctionAddress } from "convex/server";
|
|
2
|
+
import { types } from "node:util";
|
|
3
|
+
import { closed } from "../c10/ownData.js";
|
|
4
|
+
import {
|
|
5
|
+
witnessIdentity,
|
|
6
|
+
witnessText,
|
|
7
|
+
} from "../../../../../shared/renewalWitness.js";
|
|
8
|
+
import {
|
|
9
|
+
captureWitnessProfile,
|
|
10
|
+
witnessProfileGuard,
|
|
11
|
+
witnessAddress,
|
|
12
|
+
type WitnessMode,
|
|
13
|
+
type WitnessProfile,
|
|
14
|
+
} from "./witnessAuthorization.js";
|
|
15
|
+
import { createWitnessOperation } from "./witnessOperation.js";
|
|
2
16
|
import {
|
|
3
17
|
captureInvoiceObservationProfile,
|
|
4
18
|
invoiceProfileGuard,
|
|
@@ -45,16 +59,77 @@ export async function captureFreshInvoiceRenewalObservation(
|
|
|
45
59
|
const profile = captureInvoiceObservationProfile(root);
|
|
46
60
|
return captureFreshObservation(root, raw, profile);
|
|
47
61
|
}
|
|
62
|
+
type WitnessSpec = Readonly<{
|
|
63
|
+
profile: WitnessProfile;
|
|
64
|
+
mode: WitnessMode;
|
|
65
|
+
identity: ReturnType<typeof witnessIdentity>;
|
|
66
|
+
}>;
|
|
67
|
+
export async function captureFreshWitnessRenewalObservation(
|
|
68
|
+
root: object,
|
|
69
|
+
raw: unknown,
|
|
70
|
+
) {
|
|
71
|
+
need(arguments.length === 2);
|
|
72
|
+
return captureWitnessObservation(root, raw, "retain");
|
|
73
|
+
}
|
|
74
|
+
export async function captureHistoricalWitnessRenewalObservation(
|
|
75
|
+
root: object,
|
|
76
|
+
raw: unknown,
|
|
77
|
+
) {
|
|
78
|
+
need(arguments.length === 2);
|
|
79
|
+
return captureWitnessObservation(root, raw, "read");
|
|
80
|
+
}
|
|
81
|
+
function captureWitnessObservation(
|
|
82
|
+
root: object,
|
|
83
|
+
raw: unknown,
|
|
84
|
+
mode: WitnessMode,
|
|
85
|
+
) {
|
|
86
|
+
const profile = captureWitnessProfile(root, mode);
|
|
87
|
+
need(!types.isProxy(raw));
|
|
88
|
+
const input = closed(raw, [
|
|
89
|
+
"actualActionCtx",
|
|
90
|
+
"parentOperationId",
|
|
91
|
+
"operationId",
|
|
92
|
+
"witnessId",
|
|
93
|
+
]);
|
|
94
|
+
const identity = witnessIdentity({
|
|
95
|
+
componentScope: profile.freshProfile.historyEntry.componentScope,
|
|
96
|
+
witnessId: witnessText(input.witnessId),
|
|
97
|
+
parentOperationId: input.parentOperationId,
|
|
98
|
+
operationId: input.operationId,
|
|
99
|
+
});
|
|
100
|
+
return captureFreshObservation(
|
|
101
|
+
root,
|
|
102
|
+
{
|
|
103
|
+
actualActionCtx: input.actualActionCtx,
|
|
104
|
+
parentOperationId: identity.parentOperationId,
|
|
105
|
+
operationId: identity.operationId,
|
|
106
|
+
},
|
|
107
|
+
profile.invoiceProfile,
|
|
108
|
+
{ profile, mode, identity },
|
|
109
|
+
);
|
|
110
|
+
}
|
|
48
111
|
async function captureFreshObservation(
|
|
49
112
|
root: object,
|
|
50
113
|
raw: unknown,
|
|
51
114
|
invoiceProfile: InvoiceObservationProfile | null,
|
|
115
|
+
witnessSpec: WitnessSpec | null = null,
|
|
52
116
|
) {
|
|
53
117
|
const profile = captureFreshObservationProfile(root);
|
|
118
|
+
const witnessQueryAddress =
|
|
119
|
+
witnessSpec && witnessAddress(witnessSpec.profile.authorizationQuery);
|
|
54
120
|
const invoiceAddress =
|
|
55
121
|
invoiceProfile &&
|
|
56
122
|
JSON.stringify(getFunctionAddress(invoiceProfile.authorizationQuery));
|
|
57
123
|
const invoiceGuard = () => {
|
|
124
|
+
if (witnessSpec) {
|
|
125
|
+
witnessProfileGuard(witnessSpec.profile, witnessSpec.mode);
|
|
126
|
+
need(
|
|
127
|
+
witnessSpec.profile.freshProfile === profile &&
|
|
128
|
+
witnessSpec.profile.invoiceProfile === invoiceProfile &&
|
|
129
|
+
witnessAddress(witnessSpec.profile.authorizationQuery) ===
|
|
130
|
+
witnessQueryAddress,
|
|
131
|
+
);
|
|
132
|
+
}
|
|
58
133
|
if (invoiceProfile) {
|
|
59
134
|
invoiceProfileGuard(invoiceProfile);
|
|
60
135
|
need(
|
|
@@ -90,9 +165,42 @@ async function captureFreshObservation(
|
|
|
90
165
|
profile,
|
|
91
166
|
invoiceProfile,
|
|
92
167
|
);
|
|
168
|
+
const witness =
|
|
169
|
+
witnessSpec &&
|
|
170
|
+
createWitnessOperation(
|
|
171
|
+
token,
|
|
172
|
+
witnessSpec.profile,
|
|
173
|
+
witnessSpec.mode,
|
|
174
|
+
witnessSpec.identity,
|
|
175
|
+
);
|
|
176
|
+
if (witnessSpec?.mode === "read") await witness!.load();
|
|
93
177
|
let invoiceResult: Awaited<
|
|
94
178
|
ReturnType<typeof transport.acquireInvoices>
|
|
95
179
|
> | null = null;
|
|
180
|
+
async function analyze(reads: ObservationReads | null) {
|
|
181
|
+
return state.owned(async () => {
|
|
182
|
+
try {
|
|
183
|
+
const evidence = await inspectRenewalEvidenceV1({
|
|
184
|
+
version: 1,
|
|
185
|
+
apiVersion: "2026-09-30.endive",
|
|
186
|
+
configuration: captured.history.record.configuration,
|
|
187
|
+
configureReceipt: captured.history.rawConfigureReceipt,
|
|
188
|
+
reads,
|
|
189
|
+
invoiceContext: invoiceResult?.context ?? null,
|
|
190
|
+
historicalSnapshot: null,
|
|
191
|
+
});
|
|
192
|
+
if (witnessSpec?.mode !== "read") return evidence;
|
|
193
|
+
const historical = await witness!.historicalEvidence();
|
|
194
|
+
return {
|
|
195
|
+
...evidence,
|
|
196
|
+
identity: evidence.identity ?? historical.identity,
|
|
197
|
+
historicalMaterial: historical.material,
|
|
198
|
+
};
|
|
199
|
+
} catch {
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
}, transport.guard);
|
|
203
|
+
}
|
|
96
204
|
async function release(
|
|
97
205
|
status:
|
|
98
206
|
| "fresh_observation_data"
|
|
@@ -107,8 +215,33 @@ async function captureFreshObservation(
|
|
|
107
215
|
) {
|
|
108
216
|
await transport.finalizeInvoices();
|
|
109
217
|
transport.guard();
|
|
218
|
+
let witnessRetention: Awaited<
|
|
219
|
+
ReturnType<ReturnType<typeof createWitnessOperation>["retain"]>
|
|
220
|
+
> | null = null;
|
|
221
|
+
if (witnessSpec?.mode === "retain") {
|
|
222
|
+
need(
|
|
223
|
+
status === "fresh_observation_data" &&
|
|
224
|
+
reads &&
|
|
225
|
+
evidence?.currentMaterial.predicate ===
|
|
226
|
+
"current_target_material_match" &&
|
|
227
|
+
couponInventory === "complete",
|
|
228
|
+
);
|
|
229
|
+
if (invoiceProfile)
|
|
230
|
+
need(
|
|
231
|
+
invoiceResult?.status === "complete" && invoiceResult.context,
|
|
232
|
+
);
|
|
233
|
+
witnessRetention = await witness!.retain();
|
|
234
|
+
await transport.finalizeInvoices();
|
|
235
|
+
} else if (witnessSpec?.mode === "read" && evidence === null)
|
|
236
|
+
evidence = await analyze(reads);
|
|
237
|
+
if (witness) await witness.finalize();
|
|
110
238
|
const output = captureReaderQueryDATA({
|
|
111
239
|
status,
|
|
240
|
+
...(witnessSpec?.mode === "retain"
|
|
241
|
+
? { witnessRetention }
|
|
242
|
+
: witnessSpec?.mode === "read"
|
|
243
|
+
? { witness: { descriptor: witness!.descriptor() } }
|
|
244
|
+
: {}),
|
|
112
245
|
...(invoiceProfile
|
|
113
246
|
? {
|
|
114
247
|
invoiceContext: invoiceResult?.context ?? null,
|
|
@@ -130,11 +263,14 @@ async function captureFreshObservation(
|
|
|
130
263
|
operationalAuthority: false as const,
|
|
131
264
|
});
|
|
132
265
|
transport.guard();
|
|
266
|
+
witness?.guard();
|
|
133
267
|
return output;
|
|
134
268
|
}
|
|
135
269
|
const base: unknown[] = [];
|
|
136
270
|
for (const row of baseReadRows(captured.history.record)) {
|
|
271
|
+
witness?.guard();
|
|
137
272
|
const result = await transport.read(row);
|
|
273
|
+
witness?.guard();
|
|
138
274
|
if (result.kind === "provider_rejected")
|
|
139
275
|
return await release(
|
|
140
276
|
"observation_provider_rejected",
|
|
@@ -164,23 +300,6 @@ async function captureFreshObservation(
|
|
|
164
300
|
"PROVIDER_IDENTITY_CONFLICT",
|
|
165
301
|
);
|
|
166
302
|
}
|
|
167
|
-
async function analyze() {
|
|
168
|
-
return state.owned(async () => {
|
|
169
|
-
try {
|
|
170
|
-
return await inspectRenewalEvidenceV1({
|
|
171
|
-
version: 1,
|
|
172
|
-
apiVersion: "2026-09-30.endive",
|
|
173
|
-
configuration: captured.history.record.configuration,
|
|
174
|
-
configureReceipt: captured.history.rawConfigureReceipt,
|
|
175
|
-
reads,
|
|
176
|
-
invoiceContext: invoiceResult?.context ?? null,
|
|
177
|
-
historicalSnapshot: null,
|
|
178
|
-
});
|
|
179
|
-
} catch {
|
|
180
|
-
return null;
|
|
181
|
-
}
|
|
182
|
-
}, transport.guard);
|
|
183
|
-
}
|
|
184
303
|
let ids: readonly string[];
|
|
185
304
|
try {
|
|
186
305
|
validateBaseRouting(captured.history.record, reads);
|
|
@@ -189,7 +308,7 @@ async function captureFreshObservation(
|
|
|
189
308
|
reads.subscription,
|
|
190
309
|
);
|
|
191
310
|
} catch {
|
|
192
|
-
const analysis = await analyze();
|
|
311
|
+
const analysis = await analyze(reads);
|
|
193
312
|
return await release(
|
|
194
313
|
"unsupported_observation_profile",
|
|
195
314
|
reads,
|
|
@@ -200,7 +319,9 @@ async function captureFreshObservation(
|
|
|
200
319
|
}
|
|
201
320
|
for (const id of ids) {
|
|
202
321
|
const row = couponReadRow(id, 5 + reads.coupons.length);
|
|
322
|
+
witness?.guard();
|
|
203
323
|
const result = await transport.read(row);
|
|
324
|
+
witness?.guard();
|
|
204
325
|
if (result.kind === "provider_rejected")
|
|
205
326
|
return await release(
|
|
206
327
|
"observation_provider_rejected",
|
|
@@ -214,7 +335,9 @@ async function captureFreshObservation(
|
|
|
214
335
|
reads.coupons.push(result.body);
|
|
215
336
|
}
|
|
216
337
|
if (invoiceProfile) {
|
|
338
|
+
witness?.guard();
|
|
217
339
|
invoiceResult = await transport.acquireInvoices();
|
|
340
|
+
witness?.guard();
|
|
218
341
|
if (invoiceResult.status === "provider_rejected")
|
|
219
342
|
return await release(
|
|
220
343
|
"observation_provider_rejected",
|
|
@@ -225,7 +348,7 @@ async function captureFreshObservation(
|
|
|
225
348
|
invoiceResult.failure,
|
|
226
349
|
);
|
|
227
350
|
}
|
|
228
|
-
const evidence = await analyze();
|
|
351
|
+
const evidence = await analyze(reads);
|
|
229
352
|
return await release(
|
|
230
353
|
"fresh_observation_data",
|
|
231
354
|
reads,
|