@fantastic.dev/better-stripe 0.97.1 → 0.99.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 +12 -0
- package/README.md +1 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/ownedAcquisition.d.ts +11 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/ownedAcquisition.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/ownedAcquisition.js +39 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/ownedAcquisition.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/c10/attachEvents.d.ts +22 -0
- package/dist/client/billing/renewalAttach/internal/c10/attachEvents.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/c10/attachEvents.js +13 -5
- package/dist/client/billing/renewalAttach/internal/c10/attachEvents.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/operations/actorFailureControl.d.ts +17 -0
- package/dist/client/billing/renewalAttach/internal/operations/actorFailureControl.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/actorFailureControl.js +140 -0
- package/dist/client/billing/renewalAttach/internal/operations/actorFailureControl.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/fixedTransport.d.ts +61 -9
- package/dist/client/billing/renewalAttach/internal/operations/fixedTransport.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/operations/fixedTransport.js +41 -411
- package/dist/client/billing/renewalAttach/internal/operations/fixedTransport.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/operations/initialActorData.d.ts +21 -0
- package/dist/client/billing/renewalAttach/internal/operations/initialActorData.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/initialActorData.js +36 -0
- package/dist/client/billing/renewalAttach/internal/operations/initialActorData.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/initialAttach.d.ts +141 -0
- package/dist/client/billing/renewalAttach/internal/operations/initialAttach.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/operations/initialAttach.js +132 -182
- package/dist/client/billing/renewalAttach/internal/operations/initialAttach.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/operations/ownedAwait.d.ts +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/ownedAwait.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/operations/ownedAwait.js +17 -5
- package/dist/client/billing/renewalAttach/internal/operations/ownedAwait.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/operations/transportCapture.d.ts +35 -0
- package/dist/client/billing/renewalAttach/internal/operations/transportCapture.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/transportCapture.js +46 -0
- package/dist/client/billing/renewalAttach/internal/operations/transportCapture.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/transportKernel.d.ts +63 -0
- package/dist/client/billing/renewalAttach/internal/operations/transportKernel.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/transportKernel.js +380 -0
- package/dist/client/billing/renewalAttach/internal/operations/transportKernel.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/producer/invocationProducer.d.ts +8 -0
- package/dist/client/billing/renewalAttach/internal/producer/invocationProducer.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/producer/invocationProducer.js +25 -0
- package/dist/client/billing/renewalAttach/internal/producer/invocationProducer.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/producer/journalWorkFactory.d.ts +56 -0
- package/dist/client/billing/renewalAttach/internal/producer/journalWorkFactory.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/producer/journalWorkFactory.js +49 -0
- package/dist/client/billing/renewalAttach/internal/producer/journalWorkFactory.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/producer/lineageAuthority.d.ts +1 -0
- package/dist/client/billing/renewalAttach/internal/producer/lineageAuthority.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/producer/lineageAuthority.js +3 -0
- package/dist/client/billing/renewalAttach/internal/producer/lineageAuthority.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/producer/operationFactory.d.ts +65 -0
- package/dist/client/billing/renewalAttach/internal/producer/operationFactory.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/producer/operationFactory.js +162 -0
- package/dist/client/billing/renewalAttach/internal/producer/operationFactory.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/producer/recoveryEntry.d.ts +4 -0
- package/dist/client/billing/renewalAttach/internal/producer/recoveryEntry.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/producer/recoveryEntry.js +87 -0
- package/dist/client/billing/renewalAttach/internal/producer/recoveryEntry.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/producer/recoveryFactory.d.ts +368 -0
- package/dist/client/billing/renewalAttach/internal/producer/recoveryFactory.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/producer/recoveryFactory.js +106 -0
- package/dist/client/billing/renewalAttach/internal/producer/recoveryFactory.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/producer/stockDelegateFactory.d.ts +4 -0
- package/dist/client/billing/renewalAttach/internal/producer/stockDelegateFactory.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/producer/stockDelegateFactory.js +24 -3
- package/dist/client/billing/renewalAttach/internal/producer/stockDelegateFactory.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/recovery/output.d.ts +1 -0
- package/dist/client/billing/renewalAttach/internal/recovery/output.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/recovery/output.js +22 -8
- package/dist/client/billing/renewalAttach/internal/recovery/output.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/recovery/record.d.ts +1 -0
- package/dist/client/billing/renewalAttach/internal/recovery/record.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/recovery/record.js +10 -2
- package/dist/client/billing/renewalAttach/internal/recovery/record.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/recovery/recoveryActor.d.ts +3 -0
- package/dist/client/billing/renewalAttach/internal/recovery/recoveryActor.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/recovery/recoveryActor.js +69 -156
- package/dist/client/billing/renewalAttach/internal/recovery/recoveryActor.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/recovery/relation.d.ts +18 -0
- package/dist/client/billing/renewalAttach/internal/recovery/relation.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/recovery/relation.js +15 -1
- package/dist/client/billing/renewalAttach/internal/recovery/relation.js.map +1 -1
- package/docs/renewal-context-reads.md +69 -8
- package/package.json +1 -1
- package/src/client/billing/renewalAttach/internal/acquisition/ownedAcquisition.ts +45 -3
- package/src/client/billing/renewalAttach/internal/c10/attachEvents.ts +17 -5
- package/src/client/billing/renewalAttach/internal/operations/actorFailureControl.ts +165 -0
- package/src/client/billing/renewalAttach/internal/operations/fixedTransport.ts +48 -535
- package/src/client/billing/renewalAttach/internal/operations/initialActorData.ts +41 -0
- package/src/client/billing/renewalAttach/internal/operations/initialAttach.ts +168 -209
- package/src/client/billing/renewalAttach/internal/operations/ownedAwait.ts +23 -5
- package/src/client/billing/renewalAttach/internal/operations/transportCapture.ts +60 -0
- package/src/client/billing/renewalAttach/internal/operations/transportKernel.ts +500 -0
- package/src/client/billing/renewalAttach/internal/producer/invocationProducer.ts +28 -0
- package/src/client/billing/renewalAttach/internal/producer/journalWorkFactory.ts +54 -0
- package/src/client/billing/renewalAttach/internal/producer/lineageAuthority.ts +3 -0
- package/src/client/billing/renewalAttach/internal/producer/operationFactory.ts +176 -0
- package/src/client/billing/renewalAttach/internal/producer/producerAcquisition.integration.test.ts +240 -0
- package/src/client/billing/renewalAttach/internal/producer/producerActor.integration.test.ts +526 -0
- package/src/client/billing/renewalAttach/internal/producer/producerRecovery.integration.test.ts +394 -0
- package/src/client/billing/renewalAttach/internal/producer/producerRecoveryControls.integration.test.ts +437 -0
- package/src/client/billing/renewalAttach/internal/producer/producerRecoveryIsolation.integration.test.ts +332 -0
- package/src/client/billing/renewalAttach/internal/producer/producerTransport.integration.test.ts +440 -0
- package/src/client/billing/renewalAttach/internal/producer/recoveryEntry.ts +109 -0
- package/src/client/billing/renewalAttach/internal/producer/recoveryFactory.ts +135 -0
- package/src/client/billing/renewalAttach/internal/producer/stockDelegateFactory.ts +29 -5
- package/src/client/billing/renewalAttach/internal/recovery/output.ts +34 -8
- package/src/client/billing/renewalAttach/internal/recovery/record.ts +16 -2
- package/src/client/billing/renewalAttach/internal/recovery/recoveryActor.ts +107 -188
- package/src/client/billing/renewalAttach/internal/recovery/relation.ts +17 -1
- package/src/client/billing/renewalAttach/internal/test-fixtures/producerInitialOperation.ts +82 -11
|
@@ -36,7 +36,11 @@ export async function initialOperations(
|
|
|
36
36
|
endWallMs?: number;
|
|
37
37
|
afterBind?: () => Promise<void>;
|
|
38
38
|
afterAppend?: () => Promise<void>;
|
|
39
|
+
beforeAppend?: () => Promise<void>;
|
|
40
|
+
afterRetain?: () => Promise<void>;
|
|
39
41
|
source?: RetainedInput;
|
|
42
|
+
sources?: readonly RetainedInput[];
|
|
43
|
+
keys?: readonly string[];
|
|
40
44
|
} = {},
|
|
41
45
|
) {
|
|
42
46
|
const h = await codecFixture();
|
|
@@ -107,17 +111,72 @@ export async function initialOperations(
|
|
|
107
111
|
periodEnd: prepared.expected.periodEnd,
|
|
108
112
|
},
|
|
109
113
|
};
|
|
114
|
+
assert(!options.sources || options.sources.length === count);
|
|
115
|
+
assert(!options.keys || options.keys.length === count);
|
|
116
|
+
const records = options.sources
|
|
117
|
+
? await Promise.all(
|
|
118
|
+
options.sources.map(async (original) => {
|
|
119
|
+
const raw = original.attachRequest;
|
|
120
|
+
const prepared = await prepareRenewalPriceReplacementV2(
|
|
121
|
+
raw.preparation,
|
|
122
|
+
);
|
|
123
|
+
const request = await prepareRenewalScheduleAttachmentV2({
|
|
124
|
+
prepared,
|
|
125
|
+
apiVersion: raw.apiVersion,
|
|
126
|
+
attachKey: raw.attachKey,
|
|
127
|
+
firstDispatchedAt: raw.firstDispatchedAt,
|
|
128
|
+
});
|
|
129
|
+
return {
|
|
130
|
+
...record,
|
|
131
|
+
attachRequest: raw,
|
|
132
|
+
originalBundle: original.originalBundle,
|
|
133
|
+
requestBinding: request.requestIdentity.binding,
|
|
134
|
+
dispatch: {
|
|
135
|
+
scope: request.scope,
|
|
136
|
+
apiVersion: request.apiVersion,
|
|
137
|
+
method: request.method,
|
|
138
|
+
path: request.path,
|
|
139
|
+
payload: request.payload,
|
|
140
|
+
key: request.key,
|
|
141
|
+
firstDispatchedAt: request.firstDispatchedAt,
|
|
142
|
+
},
|
|
143
|
+
timingPolicy: {
|
|
144
|
+
...record.timingPolicy,
|
|
145
|
+
firstDispatchedAt: raw.firstDispatchedAt,
|
|
146
|
+
periodStart: prepared.expected.periodStart,
|
|
147
|
+
periodEnd: prepared.expected.periodEnd,
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
}),
|
|
151
|
+
)
|
|
152
|
+
: null;
|
|
110
153
|
const sdk = new BetterStripe(components.betterStripe, {
|
|
111
154
|
STRIPE_SECRET_KEY: "sk_test_invalid_owner_core",
|
|
112
155
|
});
|
|
156
|
+
const sdks = options.keys?.map(
|
|
157
|
+
(key) =>
|
|
158
|
+
new BetterStripe(components.betterStripe, { STRIPE_SECRET_KEY: key }),
|
|
159
|
+
);
|
|
113
160
|
const refs = components.betterStripe.renewalOperations;
|
|
114
161
|
const host = {
|
|
115
162
|
run: actionGeneric({
|
|
116
163
|
args: {},
|
|
117
164
|
handler: async (ctx): Promise<null> => {
|
|
118
165
|
const runMutation = ctx.runMutation;
|
|
119
|
-
if (
|
|
166
|
+
if (
|
|
167
|
+
options.afterBind ||
|
|
168
|
+
options.afterAppend ||
|
|
169
|
+
options.afterRetain ||
|
|
170
|
+
options.beforeAppend
|
|
171
|
+
)
|
|
120
172
|
ctx.runMutation = async (ref, ...args) => {
|
|
173
|
+
if (
|
|
174
|
+
getFunctionAddress(ref).reference?.endsWith(
|
|
175
|
+
"/appendStageEvent",
|
|
176
|
+
) &&
|
|
177
|
+
options.beforeAppend
|
|
178
|
+
)
|
|
179
|
+
await options.beforeAppend();
|
|
121
180
|
const result = await runMutation(ref, ...args);
|
|
122
181
|
if (
|
|
123
182
|
getFunctionAddress(ref).reference?.endsWith(
|
|
@@ -133,35 +192,47 @@ export async function initialOperations(
|
|
|
133
192
|
options.afterAppend
|
|
134
193
|
)
|
|
135
194
|
await options.afterAppend();
|
|
195
|
+
if (
|
|
196
|
+
getFunctionAddress(ref).reference?.endsWith(
|
|
197
|
+
"/retainProviderAcknowledgement",
|
|
198
|
+
) &&
|
|
199
|
+
options.afterRetain
|
|
200
|
+
)
|
|
201
|
+
await options.afterRetain();
|
|
136
202
|
return result;
|
|
137
203
|
};
|
|
138
204
|
await Promise.all(
|
|
139
205
|
Array.from({ length: count }, async (_, index) => {
|
|
206
|
+
const current = records?.[index] ?? record;
|
|
207
|
+
const selectedSDK = sdks?.[index] ?? sdk;
|
|
140
208
|
const logicalOperationId =
|
|
141
|
-
|
|
142
|
-
const recordJSON = canonical({ ...
|
|
209
|
+
current.logicalOperationId + "-owner-" + index;
|
|
210
|
+
const recordJSON = canonical({ ...current, logicalOperationId });
|
|
143
211
|
const created = await ctx.runMutation(
|
|
144
212
|
refs.mutations.createAuthorizedOperation,
|
|
145
213
|
{
|
|
146
|
-
authorizationScope:
|
|
147
|
-
authorizationRevision:
|
|
214
|
+
authorizationScope: current.authorization.scope,
|
|
215
|
+
authorizationRevision: current.authorization.revision,
|
|
148
216
|
logicalOperationId,
|
|
149
217
|
recordJSON,
|
|
150
218
|
},
|
|
151
219
|
);
|
|
152
220
|
assert(created.status === "created");
|
|
153
|
-
const journal = await createClassActionOperationJournal(
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
221
|
+
const journal = await createClassActionOperationJournal(
|
|
222
|
+
selectedSDK,
|
|
223
|
+
{
|
|
224
|
+
actualActionCtx: ctx,
|
|
225
|
+
operationId: created.operationId,
|
|
226
|
+
},
|
|
227
|
+
);
|
|
157
228
|
const fresh = await journal.reserveFreshAttempt({
|
|
158
229
|
expectedRevision: 0,
|
|
159
230
|
stage: "attach",
|
|
160
|
-
expectedRequestBinding:
|
|
231
|
+
expectedRequestBinding: current.requestBinding,
|
|
161
232
|
recordJSON,
|
|
162
233
|
});
|
|
163
234
|
assert(fresh.result.disposition === "acquired" && fresh.call);
|
|
164
|
-
await work({ journal, fresh, sdk, index });
|
|
235
|
+
await work({ journal, fresh, sdk: selectedSDK, index });
|
|
165
236
|
}),
|
|
166
237
|
);
|
|
167
238
|
return null;
|