@fantastic.dev/better-stripe 0.86.0 → 0.87.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/renewalV2/binding.d.ts +1 -1
- package/dist/client/billing/renewalV2/binding.d.ts.map +1 -1
- package/dist/client/billing/renewalV2/binding.js.map +1 -1
- package/dist/client/billing/renewalV2/configureInput.d.ts +1 -0
- package/dist/client/billing/renewalV2/configureInput.d.ts.map +1 -1
- package/dist/client/billing/renewalV2/configureInput.js +3 -3
- package/dist/client/billing/renewalV2/configureInput.js.map +1 -1
- package/dist/client/billing/renewalV2/configureReceipt.d.ts +19 -0
- package/dist/client/billing/renewalV2/configureReceipt.d.ts.map +1 -0
- package/dist/client/billing/renewalV2/configureReceipt.js +91 -0
- package/dist/client/billing/renewalV2/configureReceipt.js.map +1 -0
- package/dist/client/billing/renewalV2/index.d.ts +34 -0
- package/dist/client/billing/renewalV2/index.d.ts.map +1 -1
- package/dist/client/billing/renewalV2/index.js +65 -0
- package/dist/client/billing/renewalV2/index.js.map +1 -1
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +32 -32
- package/dist/client/connect/payoutSyncTestHelpers.d.ts +16 -16
- package/dist/client/renewal.d.ts +2 -2
- package/dist/client/renewal.d.ts.map +1 -1
- package/dist/client/renewal.js +1 -1
- package/dist/client/renewal.js.map +1 -1
- package/dist/client/usage/observationClient.d.ts +2 -2
- package/dist/client/usage/observationClient.d.ts.map +1 -1
- package/dist/component/balanceFunding/mutations.d.ts +16 -16
- package/dist/component/balanceFunding/preparationHandlers.d.ts +8 -8
- package/dist/component/balanceFunding/stateHandlers.d.ts +8 -8
- package/dist/component/balanceFunding/workflowValidators.d.ts +16 -16
- package/dist/component/earnings/triggers.d.ts +16 -16
- package/docs/renewal-context-reads.md +5 -1
- package/docs/renewal-phase-assembly.md +68 -0
- package/package.json +1 -1
- package/src/client/billing/renewalV2/binding.ts +4 -1
- package/src/client/billing/renewalV2/configureInput.ts +3 -3
- package/src/client/billing/renewalV2/configureReceipt.test.ts +558 -0
- package/src/client/billing/renewalV2/configureReceipt.ts +96 -0
- package/src/client/billing/renewalV2/index.ts +117 -0
- package/src/client/renewal.ts +3 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observationClient.d.ts","sourceRoot":"","sources":["../../../src/client/usage/observationClient.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAI5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAE1E,OAAO,EAGL,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC/B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAA4B,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE7E,MAAM,MAAM,0BAA0B,GAAG,uBAAuB,GAAG;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AACF,8EAA8E;AAC9E,qBAAa,sBAAuB,SAAQ,mBAAmB;IACvD,UAAU,CACd,GAAG,EAAE,MAAM,EACX,KAAK,EAAE;QAAE,KAAK,EAAE,UAAU,CAAC;QAAC,MAAM,EAAE,WAAW,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GACrE,OAAO,CAAC,iBAAiB,CAAC,CAY5B;IACK,gBAAgB,CACpB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,0BAA0B,GAChC,OAAO,CAAC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AAE,0BAA0B;;;;;YAqBhE,MAAM,EAAE,aAAa;YACrB,MAAM;YACN,SAAS;;;;oBAIG,WAAW;;;;;;;;oBAKX,aAAa;;;;;OAM9B;IACK,SAAS,CACb,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,0BAA0B,EACjC,OAAO,EAAE,4BAA4B;;;;;YArBjC,MAAM,EAAE,aAAa;YACrB,MAAM;YACN,SAAS;;;;oBAIG,WAAW;;;;;;;;oBAKX,aAAa;;;;;OAc9B;CACF"}
|
|
@@ -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;
|
|
@@ -2,14 +2,6 @@ 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
|
-
} | {
|
|
13
5
|
operation: {
|
|
14
6
|
accountId: string;
|
|
15
7
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
@@ -20,6 +12,14 @@ export declare function prepareHandler(ctx: MutationCtx, args: Infer<typeof prep
|
|
|
20
12
|
} | {
|
|
21
13
|
enabled: boolean;
|
|
22
14
|
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;
|
|
@@ -5,6 +5,14 @@ export declare function savePreparationHandler(ctx: MutationCtx, args: Infer<typ
|
|
|
5
5
|
preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
|
|
6
6
|
}>;
|
|
7
7
|
export declare function beginHandler(ctx: MutationCtx, args: Infer<typeof beginArgs>): Promise<{
|
|
8
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
9
|
+
retryable: false;
|
|
10
|
+
status: "conflict";
|
|
11
|
+
} | {
|
|
12
|
+
reason: "policy_invalid";
|
|
13
|
+
retryable: false;
|
|
14
|
+
status: "rejected";
|
|
15
|
+
} | {
|
|
8
16
|
operation: {
|
|
9
17
|
accountId: string;
|
|
10
18
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
@@ -15,14 +23,6 @@ export declare function beginHandler(ctx: MutationCtx, args: Infer<typeof beginA
|
|
|
15
23
|
} | {
|
|
16
24
|
enabled: boolean;
|
|
17
25
|
status: "unchanged";
|
|
18
|
-
} | {
|
|
19
|
-
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
20
|
-
retryable: false;
|
|
21
|
-
status: "conflict";
|
|
22
|
-
} | {
|
|
23
|
-
reason: "policy_invalid";
|
|
24
|
-
retryable: false;
|
|
25
|
-
status: "rejected";
|
|
26
26
|
} | {
|
|
27
27
|
reason: "provider_pending";
|
|
28
28
|
retryable: true;
|
|
@@ -60,6 +60,22 @@ 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
|
+
} | {
|
|
63
79
|
operation: {
|
|
64
80
|
accountId: string;
|
|
65
81
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
@@ -76,22 +92,6 @@ export declare const workflowStartResult: import("convex/values").VUnion<{
|
|
|
76
92
|
version: number;
|
|
77
93
|
};
|
|
78
94
|
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;
|
|
@@ -372,6 +372,14 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
|
|
|
372
372
|
preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
|
|
373
373
|
requestKey: string;
|
|
374
374
|
result?: {
|
|
375
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
376
|
+
retryable: false;
|
|
377
|
+
status: "conflict";
|
|
378
|
+
} | {
|
|
379
|
+
reason: "policy_invalid";
|
|
380
|
+
retryable: false;
|
|
381
|
+
status: "rejected";
|
|
382
|
+
} | {
|
|
375
383
|
operation: {
|
|
376
384
|
accountId: string;
|
|
377
385
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
@@ -382,14 +390,6 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
|
|
|
382
390
|
} | {
|
|
383
391
|
enabled: boolean;
|
|
384
392
|
status: "unchanged";
|
|
385
|
-
} | {
|
|
386
|
-
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
387
|
-
retryable: false;
|
|
388
|
-
status: "conflict";
|
|
389
|
-
} | {
|
|
390
|
-
reason: "policy_invalid";
|
|
391
|
-
retryable: false;
|
|
392
|
-
status: "rejected";
|
|
393
393
|
} | {
|
|
394
394
|
reason: "provider_pending";
|
|
395
395
|
retryable: true;
|
|
@@ -3270,6 +3270,14 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
|
|
|
3270
3270
|
preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
|
|
3271
3271
|
requestKey: string;
|
|
3272
3272
|
result?: {
|
|
3273
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
3274
|
+
retryable: false;
|
|
3275
|
+
status: "conflict";
|
|
3276
|
+
} | {
|
|
3277
|
+
reason: "policy_invalid";
|
|
3278
|
+
retryable: false;
|
|
3279
|
+
status: "rejected";
|
|
3280
|
+
} | {
|
|
3273
3281
|
operation: {
|
|
3274
3282
|
accountId: string;
|
|
3275
3283
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
@@ -3280,14 +3288,6 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
|
|
|
3280
3288
|
} | {
|
|
3281
3289
|
enabled: boolean;
|
|
3282
3290
|
status: "unchanged";
|
|
3283
|
-
} | {
|
|
3284
|
-
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
3285
|
-
retryable: false;
|
|
3286
|
-
status: "conflict";
|
|
3287
|
-
} | {
|
|
3288
|
-
reason: "policy_invalid";
|
|
3289
|
-
retryable: false;
|
|
3290
|
-
status: "rejected";
|
|
3291
3291
|
} | {
|
|
3292
3292
|
reason: "provider_pending";
|
|
3293
3293
|
retryable: true;
|
|
@@ -182,7 +182,8 @@ there is no automatic migration or fallback. Existing V1 projection, receipt
|
|
|
182
182
|
and configure consumers do not accept V2 records. V2 adds pure preparation,
|
|
183
183
|
request and attachment-receipt construction, plus
|
|
184
184
|
[raw configuration projection](renewal-phase-assembly.md#raw-v2-configuration-projection).
|
|
185
|
-
It
|
|
185
|
+
It also adds [configured-response receipt consistency](renewal-phase-assembly.md#raw-v2-configuration-receipts).
|
|
186
|
+
These constructors do not add a provider writer.
|
|
186
187
|
|
|
187
188
|
V2 retains the same raw preparation semantic checks and bounded JSON policy as
|
|
188
189
|
V1. It adds a limit of 500,000 UTF-8 bytes on each exact encoded hash preimage,
|
|
@@ -204,6 +205,9 @@ complete attachment receipt.
|
|
|
204
205
|
Configuration projection also selects `renewal-baseline`, `renewal-defaults`
|
|
205
206
|
and `renewal-configure` internally for its complete baseline, defaults and
|
|
206
207
|
unsigned request. No caller-supplied family selector is exposed.
|
|
208
|
+
Configured-response receipts select `renewal-configured-baseline` for the full
|
|
209
|
+
response body, `renewal-configured-defaults` when that body owns default settings,
|
|
210
|
+
and `renewal-configure-receipt` for the complete unsigned receipt.
|
|
207
211
|
|
|
208
212
|
The preparation preimage contains version, platform scope, expected selectors,
|
|
209
213
|
quantity and complete provider snapshot. Its logical key is separately retained
|
|
@@ -84,6 +84,74 @@ effectiveness. Protect original records and enforce host authorization and all
|
|
|
84
84
|
provider qualification gates before dispatch. Existing V1 APIs and record
|
|
85
85
|
formats are unchanged.
|
|
86
86
|
|
|
87
|
+
## Raw V2 configuration receipts
|
|
88
|
+
|
|
89
|
+
`constructRenewalConfigurationReceiptV2` records unsigned operation consistency
|
|
90
|
+
from raw configuration inputs and a retained response:
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
import { constructRenewalConfigurationReceiptV2 } from "@fantastic.dev/better-stripe";
|
|
94
|
+
|
|
95
|
+
const receipt = await constructRenewalConfigurationReceiptV2({
|
|
96
|
+
configuration: originalRawConfigurationInputs,
|
|
97
|
+
actualDispatch: {
|
|
98
|
+
scope: "platform",
|
|
99
|
+
apiVersion,
|
|
100
|
+
method: "POST",
|
|
101
|
+
path: projectedRequest.path,
|
|
102
|
+
payload: projectedRequest.payload,
|
|
103
|
+
key: projectedRequest.key,
|
|
104
|
+
firstDispatchedAt: projectedRequest.firstDispatchedAt,
|
|
105
|
+
},
|
|
106
|
+
providerSnapshot: retainedConfiguredScheduleBody,
|
|
107
|
+
transport: {
|
|
108
|
+
status: retainedStatus,
|
|
109
|
+
...(retainedRequestId === undefined
|
|
110
|
+
? {}
|
|
111
|
+
: { requestId: retainedRequestId }),
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
`configuration` is the complete raw input to `projectRenewalConfigurationV2`,
|
|
117
|
+
including its repeated original preparation and raw attachment receipt inputs.
|
|
118
|
+
Do not supply a projected request, stored receipt or verification handle in its
|
|
119
|
+
place. The constructor captures the entire input before its first await and
|
|
120
|
+
rebuilds C6 internally. Any returned C6 Failure rejects C9 with a fixed error;
|
|
121
|
+
C6's own Failure union remains unchanged. All seven actual dispatch fields,
|
|
122
|
+
including the complete payload, key and first-dispatch time, must equal C6.
|
|
123
|
+
|
|
124
|
+
Transport is closed `{ status, requestId? }`. Status must be an integer from
|
|
125
|
+
200 through 299. A present request ID must contain 1–255 characters; omit it
|
|
126
|
+
when absent. Null, empty or explicitly undefined IDs reject. Supply the complete
|
|
127
|
+
plain JSON Schedule body rather than an SDK wrapper: any own `lastResponse`
|
|
128
|
+
property, including hidden metadata, rejects. The public bounded JSON limits and
|
|
129
|
+
own-data constructor checks remain; captured required fields are checked again
|
|
130
|
+
before hashing.
|
|
131
|
+
|
|
132
|
+
Available response identity relations must agree with C6's Schedule,
|
|
133
|
+
Subscription, Customer, account and mode. The complete response body, including
|
|
134
|
+
unknown safe JSON keys, remains in C7 (`renewal-configured-baseline`). C8
|
|
135
|
+
(`renewal-configured-defaults`) is present only when the response owns
|
|
136
|
+
`default_settings`: absent stays absent, own null is hashed as null, and a present
|
|
137
|
+
object is hashed in full. C9 (`renewal-configure-receipt`) binds the complete
|
|
138
|
+
unsigned receipt, including the full C6 request, response, exact transport and
|
|
139
|
+
C7/optional C8. Each exact UTF-8 preimage retains the 500,000-byte limit; the
|
|
140
|
+
whole input and result retain the existing JSON traversal and size limits.
|
|
141
|
+
|
|
142
|
+
The result uses version `2`, stage `configure_acknowledged` and verification
|
|
143
|
+
`owned_response_only`. These are unsigned data-format literals. They do not
|
|
144
|
+
authenticate acknowledgement or ownership. A caller can manufacture coherent
|
|
145
|
+
data that passes. This operation-only constructor does not require response
|
|
146
|
+
phases or defaults to match the requested configuration and cannot certify that
|
|
147
|
+
they were applied. Full phase/material comparison, response acquisition and
|
|
148
|
+
same-call provenance, authorization, custody, provider qualification and renewal
|
|
149
|
+
effectiveness remain separate requirements.
|
|
150
|
+
|
|
151
|
+
No provider call, retry, key rotation, storage write, V1 conversion or native
|
|
152
|
+
qualification occurs. Keep the original operation records protected, and do not
|
|
153
|
+
treat the receipt or a matching digest as permission to write or grant service.
|
|
154
|
+
|
|
87
155
|
A candidate always has `providerQualification: "required"`. This describes a
|
|
88
156
|
remaining requirement, not authorization to dispatch. Host-supplied flags cannot
|
|
89
157
|
prove provider behavior, ownership, original configuration or historical intent.
|
package/package.json
CHANGED
|
@@ -8,7 +8,10 @@ export async function renewalBindingV2(
|
|
|
8
8
|
| "renewal-attach-receipt"
|
|
9
9
|
| "renewal-baseline"
|
|
10
10
|
| "renewal-defaults"
|
|
11
|
-
| "renewal-configure"
|
|
11
|
+
| "renewal-configure"
|
|
12
|
+
| "renewal-configured-baseline"
|
|
13
|
+
| "renewal-configured-defaults"
|
|
14
|
+
| "renewal-configure-receipt",
|
|
12
15
|
preimage: unknown,
|
|
13
16
|
): Promise<string> {
|
|
14
17
|
// Finish all input capture and canonical bytes before the first await.
|
|
@@ -26,7 +26,7 @@ function ownData(raw: unknown, required: string[], optional: string[] = []) {
|
|
|
26
26
|
}
|
|
27
27
|
return fields;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
export function validateConfigurationFields(raw: unknown) {
|
|
30
30
|
const root = ownData(
|
|
31
31
|
raw,
|
|
32
32
|
[
|
|
@@ -73,9 +73,9 @@ const input = z
|
|
|
73
73
|
})
|
|
74
74
|
.strict();
|
|
75
75
|
export function captureConfiguration(raw: unknown) {
|
|
76
|
-
|
|
76
|
+
validateConfigurationFields(raw);
|
|
77
77
|
const captured = renewalSnapshot(raw);
|
|
78
|
-
|
|
78
|
+
validateConfigurationFields(captured);
|
|
79
79
|
const args = input.parse(captured);
|
|
80
80
|
return {
|
|
81
81
|
...args,
|