@fantastic.dev/better-stripe 0.112.0 → 0.113.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 CHANGED
@@ -26,6 +26,12 @@
26
26
  - Remove internal tracker references from public documentation and add a
27
27
  regression check that prevents their reintroduction.
28
28
 
29
+ ## [0.113.0](https://github.com/FantasticDevHQ/better-stripe/compare/v0.112.0...v0.113.0) (2026-11-01)
30
+
31
+ ### Features
32
+
33
+ - authorize renewal observation in the existing example app ([#470](https://github.com/FantasticDevHQ/better-stripe/issues/470)) ([7250c8d](https://github.com/FantasticDevHQ/better-stripe/commit/7250c8d7df4e1fd441928cc3d1200da09410910a))
34
+
29
35
  ## [0.112.0](https://github.com/FantasticDevHQ/better-stripe/compare/v0.111.0...v0.112.0) (2026-11-01)
30
36
 
31
37
  ### Features
package/README.md CHANGED
@@ -5,7 +5,7 @@ billing, and Connect marketplaces. It provides checkout, subscriptions, webhook
5
5
  syncing, marketplace fees and splits, payouts, refunds, and disputes, with React
6
6
  hooks and headless UI components.
7
7
 
8
- **Version**: `0.112.0` <!-- x-release-please-version --> (pre-1.0). API may change between minor versions until 1.0.
8
+ **Version**: `0.113.0` <!-- x-release-please-version --> (pre-1.0). API may change between minor versions until 1.0.
9
9
 
10
10
  Connect platforms use the default GA API version. Non-Connect merchants using
11
11
  customer-only Accounts v2 need preview access and an explicit preview version.
@@ -0,0 +1,74 @@
1
+ # Renewal authorization in the example app
2
+
3
+ The existing `example/` app is the host for renewal component integration tests.
4
+ Its renewal authorization queries require `ctx.auth.getUserIdentity()` and reuse
5
+ the authenticated billing-history actor lookup. Exactly one buyer or customer
6
+ must map to the identity's `tokenIdentifier`. Missing identity, ambiguous mappings
7
+ and other persona roles reject.
8
+
9
+ The example UI still uses unauthenticated demo personas. Choosing a persona does
10
+ not authenticate a request or grant renewal permission. These queries demonstrate
11
+ an opt-in authenticated host boundary; they do not configure a production identity
12
+ provider or implement a consent flow.
13
+
14
+ ## Fixed query capabilities
15
+
16
+ All four functions are internal queries in
17
+ `example/convex/renewalAuthorization/queries.ts`:
18
+
19
+ | Query | Permission and exact scope |
20
+ | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
21
+ | `observe` | Installation, attachment and configure operation IDs, plus the server-owned platform/account/mode, customer-account, subscription and schedule scope. |
22
+ | `invoices` | An independent invoice permission for the same operations, complete provider scope including Customer ID, and the exact original/current invoice pair. |
23
+ | `retainWitness` | An independent retention permission for the complete witness identity, provider scope, configure request binding, observed item and native period. |
24
+ | `readWitness` | An independent read permission for that immutable scope and the exact stored witness row and payload digest. |
25
+
26
+ The query arguments contain operation/resource selectors, never a caller-chosen
27
+ user ID or authorization snapshot. The authenticated subject is resolved by the
28
+ host. Base observation does not imply invoice, retention or read permission.
29
+ Retention does not imply later read permission.
30
+
31
+ The returned snapshots match the SDK's fixed query contracts. Base observation
32
+ omits Customer ID, while invoice and witness scopes include it. Authorization
33
+ IDs, revisions and expiry timestamps come from the retained permission records
34
+ and are returned unchanged. A query never creates a sliding expiry.
35
+
36
+ ## Trusted permission records
37
+
38
+ `renewalOperationGrants` and `renewalWitnessGrants` are indexed host-owned tables.
39
+ Their indexes include the authenticated user and exact operation or witness
40
+ selection. The query reads at most two matching rows. Duplicate detection occurs
41
+ before expiry or revocation checks, so a revoked duplicate cannot hide an
42
+ ambiguous permission record.
43
+
44
+ Each record also retains the original `tokenIdentifier`. Remapping a user row to
45
+ another subject does not transfer an existing grant. Each capability has its own
46
+ authorization ID, positive safe-integer revision, safe-integer expiry and
47
+ revocation flag. Missing, revoked, expired or malformed permission refuses.
48
+ Witness-read permission additionally binds the exact row ID and versioned
49
+ SHA-256 payload binding.
50
+
51
+ This example increment supplies no public grant-issuing endpoint. The controlled
52
+ tests insert permission rows through trusted `convex-test` setup. Such fixtures
53
+ exercise query behavior; they do not prove real consent or production grant
54
+ issuance. An actual application must issue and revoke grants under its own
55
+ authenticated authorization policy.
56
+
57
+ ## SDK and component integration
58
+
59
+ The SDK reauthorizes through the fixed query and compares complete snapshots.
60
+ A single query cannot detect a revision change that happens later. The example
61
+ integration tests change the revision or provider scope between actual query
62
+ calls and verify that the SDK refuses the changed authorization.
63
+
64
+ The controlled round trips use the example schema and registered BetterStripe
65
+ component, actual example authorization queries, maintained private SDK capture
66
+ and historical-read consumers, complete invoice context and optional configure
67
+ acknowledgement. They verify separate retention/read permission and full stored
68
+ witness identity. Provider responses and grant issuance in these tests are
69
+ controlled fixtures.
70
+
71
+ Production SDK profiles remain empty. Ordinary tests establish neither serving
72
+ deployment compatibility nor provider qualification, payment, entitlement,
73
+ public delivery or Dojo adoption. Native/backend and provider testing require
74
+ their separately approved windows and use this same example app.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fantastic.dev/better-stripe",
3
- "version": "0.112.0",
3
+ "version": "0.113.0",
4
4
  "description": "Convex component for Stripe Accounts v2, subscriptions, metered billing and Connect marketplaces, with React workflows.",
5
5
  "keywords": [
6
6
  "stripe",
@@ -4,7 +4,6 @@ import { convexTest } from "convex-test";
4
4
  import {
5
5
  actionGeneric,
6
6
  queryGeneric,
7
- defineSchema,
8
7
  makeFunctionReference,
9
8
  getFunctionAddress,
10
9
  type GenericActionCtx,
@@ -13,6 +12,11 @@ import {
13
12
  import { BetterStripe } from "../../../../index.js";
14
13
  import { components } from "../../../../../../example/convex/_generated/api.js";
15
14
  import { modules, schema } from "../../../../../test.js";
15
+ import {
16
+ modules as exampleModules,
17
+ schema as exampleSchema,
18
+ } from "../../../../../../example/test.js";
19
+ import type { MutationCtx as ExampleMutationCtx } from "../../../../../../example/convex/_generated/server.js";
16
20
  import {
17
21
  canonical,
18
22
  codecFixture,
@@ -33,6 +37,7 @@ export async function initialOperations(
33
37
  sdk: BetterStripe;
34
38
  index: number;
35
39
  ctx: GenericActionCtx<GenericDataModel>;
40
+ runHost(work: (ctx: ExampleMutationCtx) => Promise<void>): Promise<void>;
36
41
  inAnotherAction(
37
42
  work: (ctx: GenericActionCtx<GenericDataModel>) => Promise<void>,
38
43
  identity?: { subject: string; issuer: string; tokenIdentifier: string },
@@ -293,6 +298,7 @@ export async function initialOperations(
293
298
  sdk: selectedSDK,
294
299
  index,
295
300
  ctx,
301
+ runHost: (work) => t.run(work),
296
302
  async inAnotherAction(work, identity) {
297
303
  const id = String(++secondaryId);
298
304
  secondaryWork.set(id, work);
@@ -316,9 +322,9 @@ export async function initialOperations(
316
322
  },
317
323
  }),
318
324
  };
319
- const t = convexTest(defineSchema({}), {
320
- "./_generated/api.ts": async () => ({}),
321
- "./initialOwner.ts": async () => host,
325
+ const t = convexTest(exampleSchema, {
326
+ ...exampleModules,
327
+ "./convex/initialOwner.ts": async () => host,
322
328
  });
323
329
  t.registerComponent("betterStripe", schema, modules);
324
330
  await (options.identity ? t.withIdentity(options.identity) : t).action(