@fantastic.dev/better-stripe 0.107.0 → 0.108.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 (40) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/dist/client/billing/renewalAttach/internal/observation/reader.d.ts +64 -0
  4. package/dist/client/billing/renewalAttach/internal/observation/reader.d.ts.map +1 -0
  5. package/dist/client/billing/renewalAttach/internal/observation/reader.js +170 -0
  6. package/dist/client/billing/renewalAttach/internal/observation/reader.js.map +1 -0
  7. package/dist/client/billing/renewalAttach/internal/observation/readerAuthorization.d.ts +44 -0
  8. package/dist/client/billing/renewalAttach/internal/observation/readerAuthorization.d.ts.map +1 -0
  9. package/dist/client/billing/renewalAttach/internal/observation/readerAuthorization.js +145 -0
  10. package/dist/client/billing/renewalAttach/internal/observation/readerAuthorization.js.map +1 -0
  11. package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.d.ts +2 -0
  12. package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.d.ts.map +1 -1
  13. package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.js +1 -0
  14. package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.js.map +1 -1
  15. package/dist/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.d.ts +2 -0
  16. package/dist/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.d.ts.map +1 -1
  17. package/dist/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.js +9 -0
  18. package/dist/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.js.map +1 -1
  19. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +16 -16
  20. package/dist/client/connect/payoutSyncTestHelpers.d.ts +16 -16
  21. package/dist/component/balanceFunding/internal/actions.d.ts +11 -11
  22. package/dist/component/balanceFunding/mutations.d.ts +27 -27
  23. package/dist/component/balanceFunding/stateHandlers.d.ts +8 -8
  24. package/dist/component/earnings/triggers.d.ts +16 -16
  25. package/dist/component/financialObservations/settlementHelpers.d.ts +3 -3
  26. package/dist/component/payoutRelease/queries.d.ts +2 -2
  27. package/dist/component/payoutRelease/queries.d.ts.map +1 -1
  28. package/dist/component/processingCostReconciliation/rollback.d.ts +1 -1
  29. package/dist/component/usage/allowance.fixtures.d.ts +16 -16
  30. package/docs/renewal-context-reads.md +52 -0
  31. package/package.json +1 -1
  32. package/src/client/billing/renewalAttach/internal/observation/reader.integration.test.ts +93 -0
  33. package/src/client/billing/renewalAttach/internal/observation/reader.ts +241 -0
  34. package/src/client/billing/renewalAttach/internal/observation/readerAuthorization.ts +179 -0
  35. package/src/client/billing/renewalAttach/internal/observation/readerControls.integration.test.ts +553 -0
  36. package/src/client/billing/renewalAttach/internal/operations/sourceOperations.ts +3 -0
  37. package/src/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.ts +12 -0
  38. package/src/client/billing/renewalAttach/internal/test-fixtures/observationReader.ts +100 -0
  39. package/src/client/billing/renewalAttach/internal/test-fixtures/producerConfigureAdmission.ts +9 -0
  40. package/src/client/billing/renewalAttach/internal/test-fixtures/producerInitialOperation.ts +5 -1
@@ -30,6 +30,7 @@ const controls = vi.hoisted(() => ({
30
30
  }[],
31
31
  legacy: 0,
32
32
  selectors: 0,
33
+ history: [] as unknown[],
33
34
  }));
34
35
  vi.mock("../operations/sourceOperations.js", () => {
35
36
  const poison = () => {
@@ -41,6 +42,7 @@ vi.mock("../operations/sourceOperations.js", () => {
41
42
  COMPILED_RECOVERY_ENTRIES: controls.recovery,
42
43
  COMPILED_PREFLIGHT_ENTRIES: controls.preflight,
43
44
  COMPILED_CONFIGURE_WRITE_ENTRIES: controls.write,
45
+ COMPILED_OBSERVATION_HISTORY_ENTRIES: controls.history,
44
46
  loadConfigureWriteTransportSource: poison,
45
47
  loadConfigureReplayTransportSource: poison,
46
48
  loadFixedConfigureWriteOperation: poison,
@@ -89,6 +91,7 @@ beforeEach(() => {
89
91
  controls.preflight.splice(0);
90
92
  controls.write.splice(0);
91
93
  controls.selectors = 0;
94
+ controls.history.splice(0);
92
95
  controls.entries.splice(0, controls.entries.length, {
93
96
  coversRetained: () => true,
94
97
  coversFresh: () => true,
@@ -369,6 +372,10 @@ async function setup(
369
372
  export async function configureAdmissionFixture(
370
373
  work: (h: Awaited<ReturnType<typeof setup>>) => Promise<void>,
371
374
  options: {
375
+ identity?: NonNullable<Parameters<typeof initialOperations>[2]>["identity"];
376
+ hostQuery?: NonNullable<
377
+ Parameters<typeof initialOperations>[2]
378
+ >["hostQuery"];
372
379
  count?: number;
373
380
  keys?: readonly string[];
374
381
  afterBind?: (reply: unknown) => Promise<void>;
@@ -397,6 +404,8 @@ export async function configureAdmissionFixture(
397
404
  options.count ?? 1,
398
405
  {
399
406
  keys: options.keys,
407
+ identity: options.identity,
408
+ hostQuery: options.hostQuery,
400
409
  source: captureRetainedInput(baseline.original),
401
410
  afterBind: options.afterBind,
402
411
  afterQuery: options.afterQuery,
@@ -3,6 +3,7 @@ import { v } from "convex/values";
3
3
  import { convexTest } from "convex-test";
4
4
  import {
5
5
  actionGeneric,
6
+ queryGeneric,
6
7
  defineSchema,
7
8
  makeFunctionReference,
8
9
  getFunctionAddress,
@@ -38,6 +39,8 @@ export async function initialOperations(
38
39
  }) => Promise<void>,
39
40
  count = 1,
40
41
  options: {
42
+ identity?: { subject: string; issuer: string; tokenIdentifier: string };
43
+ hostQuery?: ReturnType<typeof queryGeneric>;
41
44
  epochMs?: number;
42
45
  workEndWallMs?: number;
43
46
  endWallMs?: number;
@@ -176,6 +179,7 @@ export async function initialOperations(
176
179
  >();
177
180
  let secondaryId = 0;
178
181
  const host = {
182
+ ...(options.hostQuery ? { authorize: options.hostQuery } : {}),
179
183
  secondary: actionGeneric({
180
184
  args: { id: v.string() },
181
185
  handler: async (ctx, args): Promise<null> => {
@@ -302,7 +306,7 @@ export async function initialOperations(
302
306
  "./initialOwner.ts": async () => host,
303
307
  });
304
308
  t.registerComponent("betterStripe", schema, modules);
305
- await t.action(
309
+ await (options.identity ? t.withIdentity(options.identity) : t).action(
306
310
  makeFunctionReference<"action", {}, null>("initialOwner:run"),
307
311
  {},
308
312
  );