@fantastic.dev/better-stripe 0.56.0 → 0.58.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 +18 -0
- package/README.md +5 -1
- package/dist/client/billing/setup-intent-read.d.ts +12 -1
- package/dist/client/billing/setup-intent-read.d.ts.map +1 -1
- package/dist/client/billing/setup-intent-read.js +13 -8
- package/dist/client/billing/setup-intent-read.js.map +1 -1
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +366 -2
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts +183 -1
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +366 -2
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutSyncTestHelpers.d.ts +183 -1
- package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
- package/dist/client/index.d.ts +2 -12
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +3 -20
- package/dist/client/index.js.map +1 -1
- package/dist/client/types/triggers.d.ts +3 -1
- package/dist/client/types/triggers.d.ts.map +1 -1
- package/dist/client/usage/allowanceClient.d.ts +51 -0
- package/dist/client/usage/allowanceClient.d.ts.map +1 -0
- package/dist/client/usage/allowanceClient.js +64 -0
- package/dist/client/usage/allowanceClient.js.map +1 -0
- package/dist/client/usage/allowanceTerms.d.ts +64 -0
- package/dist/client/usage/allowanceTerms.d.ts.map +1 -0
- package/dist/client/usage/allowanceTerms.js +101 -0
- package/dist/client/usage/allowanceTerms.js.map +1 -0
- package/dist/client/usage/client.d.ts +2 -2
- package/dist/client/usage/client.d.ts.map +1 -1
- package/dist/client/usage/client.js +4 -4
- package/dist/client/usage/client.js.map +1 -1
- package/dist/client/usage/creditCapacity.d.ts +5 -0
- package/dist/client/usage/creditCapacity.d.ts.map +1 -0
- package/dist/client/usage/creditCapacity.js +47 -0
- package/dist/client/usage/creditCapacity.js.map +1 -0
- package/dist/client/usage/creditClient.d.ts +104 -0
- package/dist/client/usage/creditClient.d.ts.map +1 -0
- package/dist/client/usage/creditClient.js +111 -0
- package/dist/client/usage/creditClient.js.map +1 -0
- package/dist/client/usage/creditDelivery.d.ts +6 -0
- package/dist/client/usage/creditDelivery.d.ts.map +1 -0
- package/dist/client/usage/creditDelivery.js +71 -0
- package/dist/client/usage/creditDelivery.js.map +1 -0
- package/dist/client/usage/creditInvoice.d.ts +6 -0
- package/dist/client/usage/creditInvoice.d.ts.map +1 -0
- package/dist/client/usage/creditInvoice.js +63 -0
- package/dist/client/usage/creditInvoice.js.map +1 -0
- package/dist/client/usage/creditLifecycle.d.ts +14 -0
- package/dist/client/usage/creditLifecycle.d.ts.map +1 -0
- package/dist/client/usage/creditLifecycle.js +90 -0
- package/dist/client/usage/creditLifecycle.js.map +1 -0
- package/dist/client/usage/creditNative.d.ts +20 -0
- package/dist/client/usage/creditNative.d.ts.map +1 -0
- package/dist/client/usage/creditNative.js +100 -0
- package/dist/client/usage/creditNative.js.map +1 -0
- package/dist/client/usage/creditObservation.d.ts +23 -0
- package/dist/client/usage/creditObservation.d.ts.map +1 -0
- package/dist/client/usage/creditObservation.js +54 -0
- package/dist/client/usage/creditObservation.js.map +1 -0
- package/dist/client/usage/creditProofs.d.ts +50 -0
- package/dist/client/usage/creditProofs.d.ts.map +1 -0
- package/dist/client/usage/creditProofs.js +58 -0
- package/dist/client/usage/creditProofs.js.map +1 -0
- package/dist/client/usage/creditProvider.d.ts +11 -0
- package/dist/client/usage/creditProvider.d.ts.map +1 -0
- package/dist/client/usage/creditProvider.js +195 -0
- package/dist/client/usage/creditProvider.js.map +1 -0
- package/dist/client/usage/creditRead.d.ts +47 -0
- package/dist/client/usage/creditRead.d.ts.map +1 -0
- package/dist/client/usage/creditRead.js +18 -0
- package/dist/client/usage/creditRead.js.map +1 -0
- package/dist/client/usage/creditReconciliation.d.ts +20 -0
- package/dist/client/usage/creditReconciliation.d.ts.map +1 -0
- package/dist/client/usage/creditReconciliation.js +157 -0
- package/dist/client/usage/creditReconciliation.js.map +1 -0
- package/dist/client/usage/creditTerms.d.ts +89 -0
- package/dist/client/usage/creditTerms.d.ts.map +1 -0
- package/dist/client/usage/creditTerms.js +76 -0
- package/dist/client/usage/creditTerms.js.map +1 -0
- package/dist/client/usage/creditTransport.fixtures.d.ts +101 -0
- package/dist/client/usage/creditTransport.fixtures.d.ts.map +1 -0
- package/dist/client/usage/creditTransport.fixtures.js +271 -0
- package/dist/client/usage/creditTransport.fixtures.js.map +1 -0
- package/dist/client/usage/deliveryProvider.d.ts.map +1 -1
- package/dist/client/usage/deliveryProvider.js +2 -0
- package/dist/client/usage/deliveryProvider.js.map +1 -1
- package/dist/client/usage/index.d.ts +4 -0
- package/dist/client/usage/index.d.ts.map +1 -1
- package/dist/client/usage/index.js +1 -0
- package/dist/client/usage/index.js.map +1 -1
- package/dist/client/usage/records.d.ts +2 -0
- package/dist/client/usage/records.d.ts.map +1 -1
- package/dist/client/usage/records.js +22 -0
- package/dist/client/usage/records.js.map +1 -1
- package/dist/client/usage/subscriptionTransport.fixtures.d.ts +1 -1
- package/dist/client/usage/subscriptionTransport.fixtures.d.ts.map +1 -1
- package/dist/client/usage/subscriptionTransport.fixtures.js +4 -1
- package/dist/client/usage/subscriptionTransport.fixtures.js.map +1 -1
- package/dist/client/usage/summary.js +2 -2
- package/dist/client/usage/summary.js.map +1 -1
- package/dist/client/usageExports.d.ts +16 -0
- package/dist/client/usageExports.d.ts.map +1 -0
- package/dist/client/usageExports.js +3 -0
- package/dist/client/usageExports.js.map +1 -0
- package/dist/client/webhooks/subscriptionDeleted.d.ts +5 -0
- package/dist/client/webhooks/subscriptionDeleted.d.ts.map +1 -0
- package/dist/client/webhooks/subscriptionDeleted.js +34 -0
- package/dist/client/webhooks/subscriptionDeleted.js.map +1 -0
- package/dist/component/_generated/api.d.ts +18 -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 +360 -0
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/accountClosure/mutations.d.ts.map +1 -1
- package/dist/component/accountClosure/mutations.js +10 -0
- package/dist/component/accountClosure/mutations.js.map +1 -1
- package/dist/component/balanceFunding/internal/actions.d.ts +11 -11
- package/dist/component/balanceFunding/mutations.d.ts +16 -16
- package/dist/component/balanceFunding/preparationHandlers.d.ts +8 -8
- package/dist/component/balanceFunding/queries.d.ts +1 -1
- 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 +352 -18
- package/dist/component/earnings/triggers.d.ts.map +1 -1
- package/dist/component/payoutRelease/queries.d.ts +2 -2
- package/dist/component/payoutRelease/queries.d.ts.map +1 -1
- package/dist/component/schema.d.ts +183 -1
- package/dist/component/schema.js +8 -0
- package/dist/component/schema.js.map +1 -1
- package/dist/component/usage/mutations.d.ts.map +1 -1
- package/dist/component/usage/mutations.js +7 -0
- package/dist/component/usage/mutations.js.map +1 -1
- package/dist/component/usage/schema.d.ts +15 -1
- package/dist/component/usage/schema.d.ts.map +1 -1
- package/dist/component/usage/schema.js +12 -0
- package/dist/component/usage/schema.js.map +1 -1
- package/dist/component/usageAllowance/helpers.d.ts +78 -0
- package/dist/component/usageAllowance/helpers.d.ts.map +1 -0
- package/dist/component/usageAllowance/helpers.js +99 -0
- package/dist/component/usageAllowance/helpers.js.map +1 -0
- package/dist/component/usageAllowance/mutations.d.ts +37 -0
- package/dist/component/usageAllowance/mutations.d.ts.map +1 -0
- package/dist/component/usageAllowance/mutations.js +99 -0
- package/dist/component/usageAllowance/mutations.js.map +1 -0
- package/dist/component/usageAllowance/queries.d.ts +36 -0
- package/dist/component/usageAllowance/queries.d.ts.map +1 -0
- package/dist/component/usageAllowance/queries.js +113 -0
- package/dist/component/usageAllowance/queries.js.map +1 -0
- package/dist/component/usageAllowance/reservations.d.ts +25 -0
- package/dist/component/usageAllowance/reservations.d.ts.map +1 -0
- package/dist/component/usageAllowance/reservations.js +150 -0
- package/dist/component/usageAllowance/reservations.js.map +1 -0
- package/dist/component/usageAllowance/schema.d.ts +77 -0
- package/dist/component/usageAllowance/schema.d.ts.map +1 -0
- package/dist/component/usageAllowance/schema.js +32 -0
- package/dist/component/usageAllowance/schema.js.map +1 -0
- package/dist/component/usageCredits/helpers.d.ts +205 -0
- package/dist/component/usageCredits/helpers.d.ts.map +1 -0
- package/dist/component/usageCredits/helpers.js +129 -0
- package/dist/component/usageCredits/helpers.js.map +1 -0
- package/dist/component/usageCredits/mutations.d.ts +80 -0
- package/dist/component/usageCredits/mutations.d.ts.map +1 -0
- package/dist/component/usageCredits/mutations.js +344 -0
- package/dist/component/usageCredits/mutations.js.map +1 -0
- package/dist/component/usageCredits/purchase.d.ts +23 -0
- package/dist/component/usageCredits/purchase.d.ts.map +1 -0
- package/dist/component/usageCredits/purchase.js +166 -0
- package/dist/component/usageCredits/purchase.js.map +1 -0
- package/dist/component/usageCredits/queries.d.ts +184 -0
- package/dist/component/usageCredits/queries.d.ts.map +1 -0
- package/dist/component/usageCredits/queries.js +243 -0
- package/dist/component/usageCredits/queries.js.map +1 -0
- package/dist/component/usageCredits/reservations.d.ts +16 -0
- package/dist/component/usageCredits/reservations.d.ts.map +1 -0
- package/dist/component/usageCredits/reservations.js +161 -0
- package/dist/component/usageCredits/reservations.js.map +1 -0
- package/dist/component/usageCredits/schema.d.ts +282 -0
- package/dist/component/usageCredits/schema.d.ts.map +1 -0
- package/dist/component/usageCredits/schema.js +92 -0
- package/dist/component/usageCredits/schema.js.map +1 -0
- package/docs/README.md +4 -0
- package/docs/setup-intent-recovery.md +7 -0
- package/docs/usage-credits.md +255 -0
- package/docs/usage-ledger.md +7 -0
- package/docs/usage-limits.md +217 -0
- package/docs/webhooks.md +15 -1
- package/package.json +3 -1
- package/src/client/billing/setup-intent-read.test.ts +40 -0
- package/src/client/billing/setup-intent-read.ts +23 -9
- package/src/client/index.ts +9 -67
- package/src/client/types/triggers.ts +2 -0
- package/src/client/usage/allowanceClient.test.ts +93 -0
- package/src/client/usage/allowanceClient.ts +134 -0
- package/src/client/usage/allowanceTerms.test.ts +131 -0
- package/src/client/usage/allowanceTerms.ts +172 -0
- package/src/client/usage/client.ts +4 -4
- package/src/client/usage/creditCapacity.test.ts +83 -0
- package/src/client/usage/creditCapacity.ts +76 -0
- package/src/client/usage/creditClient.test.ts +221 -0
- package/src/client/usage/creditClient.ts +246 -0
- package/src/client/usage/creditDelivery.ts +105 -0
- package/src/client/usage/creditInvoice.test.ts +149 -0
- package/src/client/usage/creditInvoice.ts +87 -0
- package/src/client/usage/creditLifecycle.ts +175 -0
- package/src/client/usage/creditNative.ts +148 -0
- package/src/client/usage/creditObservation.test.ts +150 -0
- package/src/client/usage/creditObservation.ts +82 -0
- package/src/client/usage/creditProofs.ts +61 -0
- package/src/client/usage/creditProvider.test.ts +202 -0
- package/src/client/usage/creditProvider.ts +304 -0
- package/src/client/usage/creditRead.ts +32 -0
- package/src/client/usage/creditReconciliation.ts +213 -0
- package/src/client/usage/creditTerms.test.ts +48 -0
- package/src/client/usage/creditTerms.ts +140 -0
- package/src/client/usage/creditTransport.fixtures.ts +282 -0
- package/src/client/usage/deliveryProvider.ts +2 -0
- package/src/client/usage/index.ts +16 -0
- package/src/client/usage/record-composition.test.ts +195 -0
- package/src/client/usage/records.ts +26 -0
- package/src/client/usage/subscriptionTransport.fixtures.ts +6 -0
- package/src/client/usage/summary.test.ts +1 -1
- package/src/client/usage/summary.ts +2 -2
- package/src/client/usageExports.ts +56 -0
- package/src/client/webhook-handlers.test.ts +0 -34
- package/src/client/webhooks/subscription-deleted-dispatch.test.ts +61 -0
- package/src/client/webhooks/subscription-deleted.integration.test.ts +313 -0
- package/src/client/webhooks/subscriptionDeleted.ts +56 -0
- package/src/component/_generated/api.ts +18 -0
- package/src/component/_generated/component.ts +486 -0
- package/src/component/accountClosure/mutations.ts +14 -0
- package/src/component/schema.ts +16 -0
- package/src/component/usage/allowance.test.ts +435 -0
- package/src/component/usage/ledger.test.ts +8 -15
- package/src/component/usage/mutations.ts +22 -0
- package/src/component/usage/schema.ts +14 -0
- package/src/component/usageAllowance/helpers.ts +137 -0
- package/src/component/usageAllowance/mutations.ts +139 -0
- package/src/component/usageAllowance/queries.ts +133 -0
- package/src/component/usageAllowance/reservations.ts +220 -0
- package/src/component/usageAllowance/schema.ts +36 -0
- package/src/component/usageCredits/accounting.test.ts +389 -0
- package/src/component/usageCredits/helpers.ts +160 -0
- package/src/component/usageCredits/mutations.ts +451 -0
- package/src/component/usageCredits/purchase.ts +219 -0
- package/src/component/usageCredits/queries.ts +300 -0
- package/src/component/usageCredits/reservations.ts +214 -0
- package/src/component/usageCredits/schema.ts +106 -0
package/CHANGELOG.md
CHANGED
|
@@ -26,6 +26,24 @@
|
|
|
26
26
|
- Remove internal tracker references from public documentation and add a
|
|
27
27
|
regression check that prevents their reintroduction.
|
|
28
28
|
|
|
29
|
+
## [0.58.0](https://github.com/FantasticDevHQ/better-stripe/compare/v0.57.0...v0.58.0) (2026-10-18)
|
|
30
|
+
|
|
31
|
+
### Features
|
|
32
|
+
|
|
33
|
+
- add atomic included usage and optional limits ([#333](https://github.com/FantasticDevHQ/better-stripe/issues/333)) ([3980483](https://github.com/FantasticDevHQ/better-stripe/commit/398048346056f5ca85fd0bfafa2fa4cceab40443))
|
|
34
|
+
|
|
35
|
+
## [0.57.0](https://github.com/FantasticDevHQ/better-stripe/compare/v0.56.0...v0.57.0) (2026-10-18)
|
|
36
|
+
|
|
37
|
+
### Features
|
|
38
|
+
|
|
39
|
+
- add payment-backed prepaid usage accounting ([#331](https://github.com/FantasticDevHQ/better-stripe/issues/331)) ([b38d99c](https://github.com/FantasticDevHQ/better-stripe/commit/b38d99c3c8be133183cf9d8d776dc5149709e7e7))
|
|
40
|
+
|
|
41
|
+
### Bug Fixes
|
|
42
|
+
|
|
43
|
+
- close qualified SetupIntent status contract ([#313](https://github.com/FantasticDevHQ/better-stripe/issues/313)) ([7766f7c](https://github.com/FantasticDevHQ/better-stripe/commit/7766f7cd5fc96596f118e63bf3346d578cc8316a))
|
|
44
|
+
- preserve previous subscription identity for delete triggers ([#317](https://github.com/FantasticDevHQ/better-stripe/issues/317)) ([ccc7b07](https://github.com/FantasticDevHQ/better-stripe/commit/ccc7b0793dd8d9892a35c5373b5ea47a88a7b305))
|
|
45
|
+
- **usage:** compose prepared authorization with ledger recording ([#326](https://github.com/FantasticDevHQ/better-stripe/issues/326)) ([8f1b298](https://github.com/FantasticDevHQ/better-stripe/commit/8f1b298e4a9587f6a82d73ffe28e332144988a7f))
|
|
46
|
+
|
|
29
47
|
## [0.56.0](https://github.com/FantasticDevHQ/better-stripe/compare/v0.55.0...v0.56.0) (2026-10-18)
|
|
30
48
|
|
|
31
49
|
### 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.
|
|
8
|
+
**Version**: `0.58.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.
|
|
@@ -132,3 +132,7 @@ MIT
|
|
|
132
132
|
Native Stripe integration supports shared configuration and exact quantity helpers at `@fantastic.dev/better-stripe/usage`. See the [setup guide for developers and AI agents](docs/metering-setup.md) and [contracts and sandbox evidence](docs/metered-usage.md). Operational billing APIs are still under development.
|
|
133
133
|
|
|
134
134
|
[Managed usage subscriptions](docs/usage-subscriptions.md) supports all three billing models, mixed fixed/metered items and Checkout, with retained renewal and invoice provenance.
|
|
135
|
+
|
|
136
|
+
See [payment-backed prepaid usage](docs/usage-credits.md) for purchases, atomic reservations, credit history and recovery.
|
|
137
|
+
|
|
138
|
+
See [included usage and optional limits](./docs/usage-limits.md) for atomic reservation accounting, monthly resets and overage policy.
|
|
@@ -7,11 +7,21 @@ export type SetupIntentReadOptions = {
|
|
|
7
7
|
setupIntentId: string;
|
|
8
8
|
usage: "on_session" | "off_session";
|
|
9
9
|
};
|
|
10
|
+
declare const observationStatuses: {
|
|
11
|
+
requires_payment_method: boolean;
|
|
12
|
+
requires_confirmation: boolean;
|
|
13
|
+
requires_action: boolean;
|
|
14
|
+
processing: boolean;
|
|
15
|
+
canceled: boolean;
|
|
16
|
+
succeeded: boolean;
|
|
17
|
+
};
|
|
18
|
+
/** Statuses qualified by the exact SetupIntent reader, independent of Stripe's open union. */
|
|
19
|
+
export type SetupIntentObservationStatus = keyof typeof observationStatuses;
|
|
10
20
|
export type SetupIntentObservation = {
|
|
11
21
|
setupIntentId: string;
|
|
12
22
|
customerAccount: string;
|
|
13
23
|
usage: "on_session" | "off_session";
|
|
14
|
-
status:
|
|
24
|
+
status: SetupIntentObservationStatus;
|
|
15
25
|
/** Present only for an incomplete confirmation. Never persist or log it. */
|
|
16
26
|
clientSecret?: string;
|
|
17
27
|
/** Time of this provider observation, in Unix milliseconds. */
|
|
@@ -19,4 +29,5 @@ export type SetupIntentObservation = {
|
|
|
19
29
|
};
|
|
20
30
|
/** Exact platform-realm GET only. Host authorization is required before and after I/O. */
|
|
21
31
|
export declare function getSetupIntentFromStripe(stripe: Stripe, component: Component, ctx: RunCtx, input: SetupIntentReadOptions): Promise<SetupIntentObservation>;
|
|
32
|
+
export {};
|
|
22
33
|
//# sourceMappingURL=setup-intent-read.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-intent-read.d.ts","sourceRoot":"","sources":["../../../src/client/billing/setup-intent-read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAGjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvD,gFAAgF;AAChF,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,YAAY,GAAG,aAAa,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,YAAY,GAAG,aAAa,CAAC;IACpC,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"setup-intent-read.d.ts","sourceRoot":"","sources":["../../../src/client/billing/setup-intent-read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAGjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvD,gFAAgF;AAChF,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,YAAY,GAAG,aAAa,CAAC;CACrC,CAAC;AAEF,QAAA,MAAM,mBAAmB;IACvB,uBAAuB;IACvB,qBAAqB;IACrB,eAAe;IACf,UAAU;IACV,QAAQ;IACR,SAAS;CACV,CAAC;AAEF,8FAA8F;AAC9F,MAAM,MAAM,4BAA4B,GAAG,MAAM,OAAO,mBAAmB,CAAC;AAW5E,MAAM,MAAM,sBAAsB,GAAG;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,YAAY,GAAG,aAAa,CAAC;IACpC,MAAM,EAAE,4BAA4B,CAAC;IACrC,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+DAA+D;IAC/D,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAiBF,0FAA0F;AAC1F,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,sBAAsB,GAC5B,OAAO,CAAC,sBAAsB,CAAC,CA4CjC"}
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import { getAccountByStripeId } from "../core/accounts.js";
|
|
2
|
+
const observationStatuses = {
|
|
3
|
+
requires_payment_method: true,
|
|
4
|
+
requires_confirmation: true,
|
|
5
|
+
requires_action: true,
|
|
6
|
+
processing: true,
|
|
7
|
+
canceled: true,
|
|
8
|
+
succeeded: true,
|
|
9
|
+
};
|
|
10
|
+
function isObservationStatus(value) {
|
|
11
|
+
return (typeof value === "string" &&
|
|
12
|
+
Object.prototype.hasOwnProperty.call(observationStatuses, value));
|
|
13
|
+
}
|
|
2
14
|
function validate(opts) {
|
|
3
15
|
if (typeof opts.userId !== "string" ||
|
|
4
16
|
!opts.userId ||
|
|
@@ -34,14 +46,7 @@ export async function getSetupIntentFromStripe(stripe, component, ctx, input) {
|
|
|
34
46
|
setup.customer_account !== opts.customerAccount ||
|
|
35
47
|
setup.metadata?.userId !== opts.userId ||
|
|
36
48
|
setup.usage !== opts.usage ||
|
|
37
|
-
!
|
|
38
|
-
"requires_payment_method",
|
|
39
|
-
"requires_confirmation",
|
|
40
|
-
"requires_action",
|
|
41
|
-
"processing",
|
|
42
|
-
"canceled",
|
|
43
|
-
"succeeded",
|
|
44
|
-
].includes(setup.status))
|
|
49
|
+
!isObservationStatus(setup.status))
|
|
45
50
|
throw new Error("SetupIntent does not match the original request.");
|
|
46
51
|
const isIncomplete = [
|
|
47
52
|
"requires_payment_method",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-intent-read.js","sourceRoot":"","sources":["../../../src/client/billing/setup-intent-read.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"setup-intent-read.js","sourceRoot":"","sources":["../../../src/client/billing/setup-intent-read.ts"],"names":[],"mappings":"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"}
|
|
@@ -9,6 +9,48 @@ export declare const scope: {
|
|
|
9
9
|
};
|
|
10
10
|
export declare function setup(amounts?: number[], currency?: string): Promise<{
|
|
11
11
|
t: import("convex-test").TestConvex<import("convex/server").SchemaDefinition<{
|
|
12
|
+
usageAllowancePolicies: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
13
|
+
bindingJson: string;
|
|
14
|
+
consumed: string;
|
|
15
|
+
end: number;
|
|
16
|
+
historyCount: number;
|
|
17
|
+
key: string;
|
|
18
|
+
nativeKey: string;
|
|
19
|
+
policyJson: string;
|
|
20
|
+
reserved: string;
|
|
21
|
+
revision: number;
|
|
22
|
+
scopeKey: string;
|
|
23
|
+
start: number;
|
|
24
|
+
}, {
|
|
25
|
+
key: import("convex/values").VString<string, "required">;
|
|
26
|
+
nativeKey: import("convex/values").VString<string, "required">;
|
|
27
|
+
scopeKey: import("convex/values").VString<string, "required">;
|
|
28
|
+
bindingJson: import("convex/values").VString<string, "required">;
|
|
29
|
+
start: import("convex/values").VFloat64<number, "required">;
|
|
30
|
+
end: import("convex/values").VFloat64<number, "required">;
|
|
31
|
+
policyJson: import("convex/values").VString<string, "required">;
|
|
32
|
+
revision: import("convex/values").VFloat64<number, "required">;
|
|
33
|
+
consumed: import("convex/values").VString<string, "required">;
|
|
34
|
+
reserved: import("convex/values").VString<string, "required">;
|
|
35
|
+
historyCount: import("convex/values").VFloat64<number, "required">;
|
|
36
|
+
}, "required", "bindingJson" | "consumed" | "end" | "historyCount" | "key" | "nativeKey" | "policyJson" | "reserved" | "revision" | "scopeKey" | "start">, {
|
|
37
|
+
by_key: ["key", "_creationTime"];
|
|
38
|
+
by_native_start: ["nativeKey", "start", "_creationTime"];
|
|
39
|
+
by_scope_start: ["scopeKey", "start", "_creationTime"];
|
|
40
|
+
}, {}, {}>;
|
|
41
|
+
usageAllowanceHistory: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
42
|
+
at: number;
|
|
43
|
+
evidenceJson: string;
|
|
44
|
+
key: string;
|
|
45
|
+
kind: "commit" | "policy" | "release" | "reservation";
|
|
46
|
+
}, {
|
|
47
|
+
key: import("convex/values").VString<string, "required">;
|
|
48
|
+
kind: import("convex/values").VUnion<"commit" | "policy" | "release" | "reservation", [import("convex/values").VLiteral<"policy", "required">, import("convex/values").VLiteral<"reservation", "required">, import("convex/values").VLiteral<"commit", "required">, import("convex/values").VLiteral<"release", "required">], "required", never>;
|
|
49
|
+
evidenceJson: import("convex/values").VString<string, "required">;
|
|
50
|
+
at: import("convex/values").VFloat64<number, "required">;
|
|
51
|
+
}, "required", "at" | "evidenceJson" | "key" | "kind">, {
|
|
52
|
+
by_key: ["key", "_creationTime"];
|
|
53
|
+
}, {}, {}>;
|
|
12
54
|
usageSubscriptionControls: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
13
55
|
cancelAtPeriodEnd: boolean;
|
|
14
56
|
firstAttemptAt: number;
|
|
@@ -205,6 +247,7 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
|
|
|
205
247
|
}, "required", "acceptedAt" | "identity" | "occurredAt" | "recordJson" | "reservationId" | "scopeKey" | "subscriptionId" | "subscriptionJson">, {
|
|
206
248
|
by_identity: ["identity", "_creationTime"];
|
|
207
249
|
by_scope_subscription: ["scopeKey", "subscriptionId", "_creationTime"];
|
|
250
|
+
by_scope_subscription_time: ["scopeKey", "subscriptionId", "occurredAt", "_creationTime"];
|
|
208
251
|
by_scope_time: ["scopeKey", "occurredAt", "_creationTime"];
|
|
209
252
|
}, {}, {}>;
|
|
210
253
|
usageOutbox: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
@@ -266,12 +309,18 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
|
|
|
266
309
|
by_scope: ["scopeKey", "_creationTime"];
|
|
267
310
|
}, {}, {}>;
|
|
268
311
|
usageReservations: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
312
|
+
accountKey?: string | undefined;
|
|
313
|
+
accountingKind?: "allowance" | "prepaid" | undefined;
|
|
314
|
+
allocationsJson?: string | undefined;
|
|
269
315
|
eventId?: import("convex/values").GenericId<"usageEvents"> | undefined;
|
|
316
|
+
inputJson?: string | undefined;
|
|
270
317
|
planJson: string;
|
|
318
|
+
releaseReason?: string | undefined;
|
|
271
319
|
scaledQuantity: string;
|
|
272
320
|
scopeKey: string;
|
|
273
321
|
sourceEventId: string;
|
|
274
322
|
state: "committed" | "released" | "reserved";
|
|
323
|
+
subscriptionJson?: string | undefined;
|
|
275
324
|
}, {
|
|
276
325
|
scopeKey: import("convex/values").VString<string, "required">;
|
|
277
326
|
sourceEventId: import("convex/values").VString<string, "required">;
|
|
@@ -279,10 +328,143 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
|
|
|
279
328
|
scaledQuantity: import("convex/values").VString<string, "required">;
|
|
280
329
|
state: import("convex/values").VUnion<"committed" | "released" | "reserved", [import("convex/values").VLiteral<"reserved", "required">, import("convex/values").VLiteral<"committed", "required">, import("convex/values").VLiteral<"released", "required">], "required", never>;
|
|
281
330
|
eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents"> | undefined, "optional">;
|
|
282
|
-
|
|
331
|
+
accountingKind: import("convex/values").VUnion<"allowance" | "prepaid" | undefined, [import("convex/values").VLiteral<"prepaid", "required">, import("convex/values").VLiteral<"allowance", "required">], "optional", never>;
|
|
332
|
+
accountKey: import("convex/values").VString<string | undefined, "optional">;
|
|
333
|
+
inputJson: import("convex/values").VString<string | undefined, "optional">;
|
|
334
|
+
subscriptionJson: import("convex/values").VString<string | undefined, "optional">;
|
|
335
|
+
allocationsJson: import("convex/values").VString<string | undefined, "optional">;
|
|
336
|
+
releaseReason: import("convex/values").VString<string | undefined, "optional">;
|
|
337
|
+
}, "required", "accountKey" | "accountingKind" | "allocationsJson" | "eventId" | "inputJson" | "planJson" | "releaseReason" | "scaledQuantity" | "scopeKey" | "sourceEventId" | "state" | "subscriptionJson">, {
|
|
338
|
+
by_account_state: ["accountKey", "state", "_creationTime"];
|
|
283
339
|
by_scope_source: ["scopeKey", "sourceEventId", "_creationTime"];
|
|
284
340
|
by_scope_state: ["scopeKey", "state", "_creationTime"];
|
|
285
341
|
}, {}, {}>;
|
|
342
|
+
usageCreditAccounts: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
343
|
+
bindingJson: string;
|
|
344
|
+
closed: boolean;
|
|
345
|
+
customerAccount: string;
|
|
346
|
+
frozenReason?: string | undefined;
|
|
347
|
+
historyCount: number;
|
|
348
|
+
key: string;
|
|
349
|
+
purchaseCount: number;
|
|
350
|
+
scopeKey: string;
|
|
351
|
+
stripeAccountId: string;
|
|
352
|
+
}, {
|
|
353
|
+
key: import("convex/values").VString<string, "required">;
|
|
354
|
+
scopeKey: import("convex/values").VString<string, "required">;
|
|
355
|
+
bindingJson: import("convex/values").VString<string, "required">;
|
|
356
|
+
stripeAccountId: import("convex/values").VString<string, "required">;
|
|
357
|
+
customerAccount: import("convex/values").VString<string, "required">;
|
|
358
|
+
closed: import("convex/values").VBoolean<boolean, "required">;
|
|
359
|
+
purchaseCount: import("convex/values").VFloat64<number, "required">;
|
|
360
|
+
historyCount: import("convex/values").VFloat64<number, "required">;
|
|
361
|
+
frozenReason: import("convex/values").VString<string | undefined, "optional">;
|
|
362
|
+
}, "required", "bindingJson" | "closed" | "customerAccount" | "frozenReason" | "historyCount" | "key" | "purchaseCount" | "scopeKey" | "stripeAccountId">, {
|
|
363
|
+
by_key: ["key", "_creationTime"];
|
|
364
|
+
by_payer_closed: ["customerAccount", "closed", "_creationTime"];
|
|
365
|
+
by_realm_closed: ["stripeAccountId", "closed", "_creationTime"];
|
|
366
|
+
}, {}, {}>;
|
|
367
|
+
usageCreditPurchases: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
368
|
+
accountKey: string;
|
|
369
|
+
capacityReserved: boolean;
|
|
370
|
+
creditGrantId?: string | undefined;
|
|
371
|
+
firstAttemptAt: number;
|
|
372
|
+
grantFirstAttemptAt?: number | undefined;
|
|
373
|
+
key: string;
|
|
374
|
+
nativeCustomerKey: string;
|
|
375
|
+
paymentAttemptedAt?: number | undefined;
|
|
376
|
+
paymentIntentId?: string | undefined;
|
|
377
|
+
paymentKey?: string | undefined;
|
|
378
|
+
paymentProofJson?: string | undefined;
|
|
379
|
+
refundedAmount?: number | undefined;
|
|
380
|
+
state: "canceled" | "frozen" | "pending" | "ready";
|
|
381
|
+
termsJson: string;
|
|
382
|
+
}, {
|
|
383
|
+
key: import("convex/values").VString<string, "required">;
|
|
384
|
+
accountKey: import("convex/values").VString<string, "required">;
|
|
385
|
+
nativeCustomerKey: import("convex/values").VString<string, "required">;
|
|
386
|
+
capacityReserved: import("convex/values").VBoolean<boolean, "required">;
|
|
387
|
+
paymentAttemptedAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
388
|
+
termsJson: import("convex/values").VString<string, "required">;
|
|
389
|
+
firstAttemptAt: import("convex/values").VFloat64<number, "required">;
|
|
390
|
+
state: import("convex/values").VUnion<"canceled" | "frozen" | "pending" | "ready", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"ready", "required">, import("convex/values").VLiteral<"frozen", "required">, import("convex/values").VLiteral<"canceled", "required">], "required", never>;
|
|
391
|
+
paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
|
|
392
|
+
paymentKey: import("convex/values").VString<string | undefined, "optional">;
|
|
393
|
+
paymentProofJson: import("convex/values").VString<string | undefined, "optional">;
|
|
394
|
+
refundedAmount: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
395
|
+
grantFirstAttemptAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
396
|
+
creditGrantId: import("convex/values").VString<string | undefined, "optional">;
|
|
397
|
+
}, "required", "accountKey" | "capacityReserved" | "creditGrantId" | "firstAttemptAt" | "grantFirstAttemptAt" | "key" | "nativeCustomerKey" | "paymentAttemptedAt" | "paymentIntentId" | "paymentKey" | "paymentProofJson" | "refundedAmount" | "state" | "termsJson">, {
|
|
398
|
+
by_account: ["accountKey", "_creationTime"];
|
|
399
|
+
by_customer_capacity: ["nativeCustomerKey", "capacityReserved", "_creationTime"];
|
|
400
|
+
by_key: ["key", "_creationTime"];
|
|
401
|
+
by_payment: ["paymentKey", "_creationTime"];
|
|
402
|
+
}, {}, {}>;
|
|
403
|
+
usageCreditGrants: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
404
|
+
accountKey: string;
|
|
405
|
+
available: string;
|
|
406
|
+
chargeId: string;
|
|
407
|
+
consumed: string;
|
|
408
|
+
creditGrantId: string;
|
|
409
|
+
effectiveAt: number;
|
|
410
|
+
expiresAt: number | null;
|
|
411
|
+
frozen: boolean;
|
|
412
|
+
nativeCreated: number;
|
|
413
|
+
nativeCustomerKey: string;
|
|
414
|
+
nativeExpired?: boolean | undefined;
|
|
415
|
+
nativeObservationJson?: string | undefined;
|
|
416
|
+
nativeUnused: boolean;
|
|
417
|
+
observedAt?: number | undefined;
|
|
418
|
+
paymentIntentId: string;
|
|
419
|
+
proofJson: string;
|
|
420
|
+
purchaseKey: string;
|
|
421
|
+
reserved: string;
|
|
422
|
+
}, {
|
|
423
|
+
purchaseKey: import("convex/values").VString<string, "required">;
|
|
424
|
+
accountKey: import("convex/values").VString<string, "required">;
|
|
425
|
+
creditGrantId: import("convex/values").VString<string, "required">;
|
|
426
|
+
nativeCustomerKey: import("convex/values").VString<string, "required">;
|
|
427
|
+
nativeUnused: import("convex/values").VBoolean<boolean, "required">;
|
|
428
|
+
nativeCreated: import("convex/values").VFloat64<number, "required">;
|
|
429
|
+
paymentIntentId: import("convex/values").VString<string, "required">;
|
|
430
|
+
chargeId: import("convex/values").VString<string, "required">;
|
|
431
|
+
proofJson: import("convex/values").VString<string, "required">;
|
|
432
|
+
available: import("convex/values").VString<string, "required">;
|
|
433
|
+
reserved: import("convex/values").VString<string, "required">;
|
|
434
|
+
consumed: import("convex/values").VString<string, "required">;
|
|
435
|
+
effectiveAt: import("convex/values").VFloat64<number, "required">;
|
|
436
|
+
expiresAt: import("convex/values").VUnion<number | null, [import("convex/values").VFloat64<number, "required">, import("convex/values").VNull<null, "required">], "required", never>;
|
|
437
|
+
frozen: import("convex/values").VBoolean<boolean, "required">;
|
|
438
|
+
nativeExpired: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
439
|
+
nativeObservationJson: import("convex/values").VString<string | undefined, "optional">;
|
|
440
|
+
observedAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
441
|
+
}, "required", "accountKey" | "available" | "chargeId" | "consumed" | "creditGrantId" | "effectiveAt" | "expiresAt" | "frozen" | "nativeCreated" | "nativeCustomerKey" | "nativeExpired" | "nativeObservationJson" | "nativeUnused" | "observedAt" | "paymentIntentId" | "proofJson" | "purchaseKey" | "reserved">, {
|
|
442
|
+
by_account: ["accountKey", "_creationTime"];
|
|
443
|
+
by_customer_unused: ["nativeCustomerKey", "nativeUnused", "_creationTime"];
|
|
444
|
+
by_native: ["creditGrantId", "_creationTime"];
|
|
445
|
+
by_purchase: ["purchaseKey", "_creationTime"];
|
|
446
|
+
}, {}, {}>;
|
|
447
|
+
usageCreditHistory: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
448
|
+
accountKey: string;
|
|
449
|
+
at: number;
|
|
450
|
+
evidenceJson: string;
|
|
451
|
+
fingerprint: string;
|
|
452
|
+
kind: "closure" | "commit" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation";
|
|
453
|
+
purchaseKey?: string | undefined;
|
|
454
|
+
sourceKey: string;
|
|
455
|
+
}, {
|
|
456
|
+
accountKey: import("convex/values").VString<string, "required">;
|
|
457
|
+
purchaseKey: import("convex/values").VString<string | undefined, "optional">;
|
|
458
|
+
kind: import("convex/values").VUnion<"closure" | "commit" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation", [import("convex/values").VLiteral<"purchase", "required">, import("convex/values").VLiteral<"payment", "required">, import("convex/values").VLiteral<"grant", "required">, import("convex/values").VLiteral<"reservation", "required">, import("convex/values").VLiteral<"commit", "required">, import("convex/values").VLiteral<"release", "required">, import("convex/values").VLiteral<"observation", "required">, import("convex/values").VLiteral<"recovery", "required">, import("convex/values").VLiteral<"closure", "required">], "required", never>;
|
|
459
|
+
sourceKey: import("convex/values").VString<string, "required">;
|
|
460
|
+
fingerprint: import("convex/values").VString<string, "required">;
|
|
461
|
+
evidenceJson: import("convex/values").VString<string, "required">;
|
|
462
|
+
at: import("convex/values").VFloat64<number, "required">;
|
|
463
|
+
}, "required", "accountKey" | "at" | "evidenceJson" | "fingerprint" | "kind" | "purchaseKey" | "sourceKey">, {
|
|
464
|
+
by_account: ["accountKey", "_creationTime"];
|
|
465
|
+
by_fingerprint: ["fingerprint", "_creationTime"];
|
|
466
|
+
by_purchase: ["accountKey", "purchaseKey", "_creationTime"];
|
|
467
|
+
}, {}, {}>;
|
|
286
468
|
refundSyncClaims: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
287
469
|
acceptedAt?: number | undefined;
|
|
288
470
|
acceptedContext?: string | undefined;
|
|
@@ -3690,6 +3872,48 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
|
|
|
3690
3872
|
}>;
|
|
3691
3873
|
export declare function historical(currency?: string): Promise<{
|
|
3692
3874
|
t: import("convex-test").TestConvex<import("convex/server").SchemaDefinition<{
|
|
3875
|
+
usageAllowancePolicies: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
3876
|
+
bindingJson: string;
|
|
3877
|
+
consumed: string;
|
|
3878
|
+
end: number;
|
|
3879
|
+
historyCount: number;
|
|
3880
|
+
key: string;
|
|
3881
|
+
nativeKey: string;
|
|
3882
|
+
policyJson: string;
|
|
3883
|
+
reserved: string;
|
|
3884
|
+
revision: number;
|
|
3885
|
+
scopeKey: string;
|
|
3886
|
+
start: number;
|
|
3887
|
+
}, {
|
|
3888
|
+
key: import("convex/values").VString<string, "required">;
|
|
3889
|
+
nativeKey: import("convex/values").VString<string, "required">;
|
|
3890
|
+
scopeKey: import("convex/values").VString<string, "required">;
|
|
3891
|
+
bindingJson: import("convex/values").VString<string, "required">;
|
|
3892
|
+
start: import("convex/values").VFloat64<number, "required">;
|
|
3893
|
+
end: import("convex/values").VFloat64<number, "required">;
|
|
3894
|
+
policyJson: import("convex/values").VString<string, "required">;
|
|
3895
|
+
revision: import("convex/values").VFloat64<number, "required">;
|
|
3896
|
+
consumed: import("convex/values").VString<string, "required">;
|
|
3897
|
+
reserved: import("convex/values").VString<string, "required">;
|
|
3898
|
+
historyCount: import("convex/values").VFloat64<number, "required">;
|
|
3899
|
+
}, "required", "bindingJson" | "consumed" | "end" | "historyCount" | "key" | "nativeKey" | "policyJson" | "reserved" | "revision" | "scopeKey" | "start">, {
|
|
3900
|
+
by_key: ["key", "_creationTime"];
|
|
3901
|
+
by_native_start: ["nativeKey", "start", "_creationTime"];
|
|
3902
|
+
by_scope_start: ["scopeKey", "start", "_creationTime"];
|
|
3903
|
+
}, {}, {}>;
|
|
3904
|
+
usageAllowanceHistory: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
3905
|
+
at: number;
|
|
3906
|
+
evidenceJson: string;
|
|
3907
|
+
key: string;
|
|
3908
|
+
kind: "commit" | "policy" | "release" | "reservation";
|
|
3909
|
+
}, {
|
|
3910
|
+
key: import("convex/values").VString<string, "required">;
|
|
3911
|
+
kind: import("convex/values").VUnion<"commit" | "policy" | "release" | "reservation", [import("convex/values").VLiteral<"policy", "required">, import("convex/values").VLiteral<"reservation", "required">, import("convex/values").VLiteral<"commit", "required">, import("convex/values").VLiteral<"release", "required">], "required", never>;
|
|
3912
|
+
evidenceJson: import("convex/values").VString<string, "required">;
|
|
3913
|
+
at: import("convex/values").VFloat64<number, "required">;
|
|
3914
|
+
}, "required", "at" | "evidenceJson" | "key" | "kind">, {
|
|
3915
|
+
by_key: ["key", "_creationTime"];
|
|
3916
|
+
}, {}, {}>;
|
|
3693
3917
|
usageSubscriptionControls: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
3694
3918
|
cancelAtPeriodEnd: boolean;
|
|
3695
3919
|
firstAttemptAt: number;
|
|
@@ -3886,6 +4110,7 @@ export declare function historical(currency?: string): Promise<{
|
|
|
3886
4110
|
}, "required", "acceptedAt" | "identity" | "occurredAt" | "recordJson" | "reservationId" | "scopeKey" | "subscriptionId" | "subscriptionJson">, {
|
|
3887
4111
|
by_identity: ["identity", "_creationTime"];
|
|
3888
4112
|
by_scope_subscription: ["scopeKey", "subscriptionId", "_creationTime"];
|
|
4113
|
+
by_scope_subscription_time: ["scopeKey", "subscriptionId", "occurredAt", "_creationTime"];
|
|
3889
4114
|
by_scope_time: ["scopeKey", "occurredAt", "_creationTime"];
|
|
3890
4115
|
}, {}, {}>;
|
|
3891
4116
|
usageOutbox: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
@@ -3947,12 +4172,18 @@ export declare function historical(currency?: string): Promise<{
|
|
|
3947
4172
|
by_scope: ["scopeKey", "_creationTime"];
|
|
3948
4173
|
}, {}, {}>;
|
|
3949
4174
|
usageReservations: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
4175
|
+
accountKey?: string | undefined;
|
|
4176
|
+
accountingKind?: "allowance" | "prepaid" | undefined;
|
|
4177
|
+
allocationsJson?: string | undefined;
|
|
3950
4178
|
eventId?: import("convex/values").GenericId<"usageEvents"> | undefined;
|
|
4179
|
+
inputJson?: string | undefined;
|
|
3951
4180
|
planJson: string;
|
|
4181
|
+
releaseReason?: string | undefined;
|
|
3952
4182
|
scaledQuantity: string;
|
|
3953
4183
|
scopeKey: string;
|
|
3954
4184
|
sourceEventId: string;
|
|
3955
4185
|
state: "committed" | "released" | "reserved";
|
|
4186
|
+
subscriptionJson?: string | undefined;
|
|
3956
4187
|
}, {
|
|
3957
4188
|
scopeKey: import("convex/values").VString<string, "required">;
|
|
3958
4189
|
sourceEventId: import("convex/values").VString<string, "required">;
|
|
@@ -3960,10 +4191,143 @@ export declare function historical(currency?: string): Promise<{
|
|
|
3960
4191
|
scaledQuantity: import("convex/values").VString<string, "required">;
|
|
3961
4192
|
state: import("convex/values").VUnion<"committed" | "released" | "reserved", [import("convex/values").VLiteral<"reserved", "required">, import("convex/values").VLiteral<"committed", "required">, import("convex/values").VLiteral<"released", "required">], "required", never>;
|
|
3962
4193
|
eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents"> | undefined, "optional">;
|
|
3963
|
-
|
|
4194
|
+
accountingKind: import("convex/values").VUnion<"allowance" | "prepaid" | undefined, [import("convex/values").VLiteral<"prepaid", "required">, import("convex/values").VLiteral<"allowance", "required">], "optional", never>;
|
|
4195
|
+
accountKey: import("convex/values").VString<string | undefined, "optional">;
|
|
4196
|
+
inputJson: import("convex/values").VString<string | undefined, "optional">;
|
|
4197
|
+
subscriptionJson: import("convex/values").VString<string | undefined, "optional">;
|
|
4198
|
+
allocationsJson: import("convex/values").VString<string | undefined, "optional">;
|
|
4199
|
+
releaseReason: import("convex/values").VString<string | undefined, "optional">;
|
|
4200
|
+
}, "required", "accountKey" | "accountingKind" | "allocationsJson" | "eventId" | "inputJson" | "planJson" | "releaseReason" | "scaledQuantity" | "scopeKey" | "sourceEventId" | "state" | "subscriptionJson">, {
|
|
4201
|
+
by_account_state: ["accountKey", "state", "_creationTime"];
|
|
3964
4202
|
by_scope_source: ["scopeKey", "sourceEventId", "_creationTime"];
|
|
3965
4203
|
by_scope_state: ["scopeKey", "state", "_creationTime"];
|
|
3966
4204
|
}, {}, {}>;
|
|
4205
|
+
usageCreditAccounts: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
4206
|
+
bindingJson: string;
|
|
4207
|
+
closed: boolean;
|
|
4208
|
+
customerAccount: string;
|
|
4209
|
+
frozenReason?: string | undefined;
|
|
4210
|
+
historyCount: number;
|
|
4211
|
+
key: string;
|
|
4212
|
+
purchaseCount: number;
|
|
4213
|
+
scopeKey: string;
|
|
4214
|
+
stripeAccountId: string;
|
|
4215
|
+
}, {
|
|
4216
|
+
key: import("convex/values").VString<string, "required">;
|
|
4217
|
+
scopeKey: import("convex/values").VString<string, "required">;
|
|
4218
|
+
bindingJson: import("convex/values").VString<string, "required">;
|
|
4219
|
+
stripeAccountId: import("convex/values").VString<string, "required">;
|
|
4220
|
+
customerAccount: import("convex/values").VString<string, "required">;
|
|
4221
|
+
closed: import("convex/values").VBoolean<boolean, "required">;
|
|
4222
|
+
purchaseCount: import("convex/values").VFloat64<number, "required">;
|
|
4223
|
+
historyCount: import("convex/values").VFloat64<number, "required">;
|
|
4224
|
+
frozenReason: import("convex/values").VString<string | undefined, "optional">;
|
|
4225
|
+
}, "required", "bindingJson" | "closed" | "customerAccount" | "frozenReason" | "historyCount" | "key" | "purchaseCount" | "scopeKey" | "stripeAccountId">, {
|
|
4226
|
+
by_key: ["key", "_creationTime"];
|
|
4227
|
+
by_payer_closed: ["customerAccount", "closed", "_creationTime"];
|
|
4228
|
+
by_realm_closed: ["stripeAccountId", "closed", "_creationTime"];
|
|
4229
|
+
}, {}, {}>;
|
|
4230
|
+
usageCreditPurchases: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
4231
|
+
accountKey: string;
|
|
4232
|
+
capacityReserved: boolean;
|
|
4233
|
+
creditGrantId?: string | undefined;
|
|
4234
|
+
firstAttemptAt: number;
|
|
4235
|
+
grantFirstAttemptAt?: number | undefined;
|
|
4236
|
+
key: string;
|
|
4237
|
+
nativeCustomerKey: string;
|
|
4238
|
+
paymentAttemptedAt?: number | undefined;
|
|
4239
|
+
paymentIntentId?: string | undefined;
|
|
4240
|
+
paymentKey?: string | undefined;
|
|
4241
|
+
paymentProofJson?: string | undefined;
|
|
4242
|
+
refundedAmount?: number | undefined;
|
|
4243
|
+
state: "canceled" | "frozen" | "pending" | "ready";
|
|
4244
|
+
termsJson: string;
|
|
4245
|
+
}, {
|
|
4246
|
+
key: import("convex/values").VString<string, "required">;
|
|
4247
|
+
accountKey: import("convex/values").VString<string, "required">;
|
|
4248
|
+
nativeCustomerKey: import("convex/values").VString<string, "required">;
|
|
4249
|
+
capacityReserved: import("convex/values").VBoolean<boolean, "required">;
|
|
4250
|
+
paymentAttemptedAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
4251
|
+
termsJson: import("convex/values").VString<string, "required">;
|
|
4252
|
+
firstAttemptAt: import("convex/values").VFloat64<number, "required">;
|
|
4253
|
+
state: import("convex/values").VUnion<"canceled" | "frozen" | "pending" | "ready", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"ready", "required">, import("convex/values").VLiteral<"frozen", "required">, import("convex/values").VLiteral<"canceled", "required">], "required", never>;
|
|
4254
|
+
paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
|
|
4255
|
+
paymentKey: import("convex/values").VString<string | undefined, "optional">;
|
|
4256
|
+
paymentProofJson: import("convex/values").VString<string | undefined, "optional">;
|
|
4257
|
+
refundedAmount: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
4258
|
+
grantFirstAttemptAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
4259
|
+
creditGrantId: import("convex/values").VString<string | undefined, "optional">;
|
|
4260
|
+
}, "required", "accountKey" | "capacityReserved" | "creditGrantId" | "firstAttemptAt" | "grantFirstAttemptAt" | "key" | "nativeCustomerKey" | "paymentAttemptedAt" | "paymentIntentId" | "paymentKey" | "paymentProofJson" | "refundedAmount" | "state" | "termsJson">, {
|
|
4261
|
+
by_account: ["accountKey", "_creationTime"];
|
|
4262
|
+
by_customer_capacity: ["nativeCustomerKey", "capacityReserved", "_creationTime"];
|
|
4263
|
+
by_key: ["key", "_creationTime"];
|
|
4264
|
+
by_payment: ["paymentKey", "_creationTime"];
|
|
4265
|
+
}, {}, {}>;
|
|
4266
|
+
usageCreditGrants: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
4267
|
+
accountKey: string;
|
|
4268
|
+
available: string;
|
|
4269
|
+
chargeId: string;
|
|
4270
|
+
consumed: string;
|
|
4271
|
+
creditGrantId: string;
|
|
4272
|
+
effectiveAt: number;
|
|
4273
|
+
expiresAt: number | null;
|
|
4274
|
+
frozen: boolean;
|
|
4275
|
+
nativeCreated: number;
|
|
4276
|
+
nativeCustomerKey: string;
|
|
4277
|
+
nativeExpired?: boolean | undefined;
|
|
4278
|
+
nativeObservationJson?: string | undefined;
|
|
4279
|
+
nativeUnused: boolean;
|
|
4280
|
+
observedAt?: number | undefined;
|
|
4281
|
+
paymentIntentId: string;
|
|
4282
|
+
proofJson: string;
|
|
4283
|
+
purchaseKey: string;
|
|
4284
|
+
reserved: string;
|
|
4285
|
+
}, {
|
|
4286
|
+
purchaseKey: import("convex/values").VString<string, "required">;
|
|
4287
|
+
accountKey: import("convex/values").VString<string, "required">;
|
|
4288
|
+
creditGrantId: import("convex/values").VString<string, "required">;
|
|
4289
|
+
nativeCustomerKey: import("convex/values").VString<string, "required">;
|
|
4290
|
+
nativeUnused: import("convex/values").VBoolean<boolean, "required">;
|
|
4291
|
+
nativeCreated: import("convex/values").VFloat64<number, "required">;
|
|
4292
|
+
paymentIntentId: import("convex/values").VString<string, "required">;
|
|
4293
|
+
chargeId: import("convex/values").VString<string, "required">;
|
|
4294
|
+
proofJson: import("convex/values").VString<string, "required">;
|
|
4295
|
+
available: import("convex/values").VString<string, "required">;
|
|
4296
|
+
reserved: import("convex/values").VString<string, "required">;
|
|
4297
|
+
consumed: import("convex/values").VString<string, "required">;
|
|
4298
|
+
effectiveAt: import("convex/values").VFloat64<number, "required">;
|
|
4299
|
+
expiresAt: import("convex/values").VUnion<number | null, [import("convex/values").VFloat64<number, "required">, import("convex/values").VNull<null, "required">], "required", never>;
|
|
4300
|
+
frozen: import("convex/values").VBoolean<boolean, "required">;
|
|
4301
|
+
nativeExpired: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
4302
|
+
nativeObservationJson: import("convex/values").VString<string | undefined, "optional">;
|
|
4303
|
+
observedAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
4304
|
+
}, "required", "accountKey" | "available" | "chargeId" | "consumed" | "creditGrantId" | "effectiveAt" | "expiresAt" | "frozen" | "nativeCreated" | "nativeCustomerKey" | "nativeExpired" | "nativeObservationJson" | "nativeUnused" | "observedAt" | "paymentIntentId" | "proofJson" | "purchaseKey" | "reserved">, {
|
|
4305
|
+
by_account: ["accountKey", "_creationTime"];
|
|
4306
|
+
by_customer_unused: ["nativeCustomerKey", "nativeUnused", "_creationTime"];
|
|
4307
|
+
by_native: ["creditGrantId", "_creationTime"];
|
|
4308
|
+
by_purchase: ["purchaseKey", "_creationTime"];
|
|
4309
|
+
}, {}, {}>;
|
|
4310
|
+
usageCreditHistory: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
4311
|
+
accountKey: string;
|
|
4312
|
+
at: number;
|
|
4313
|
+
evidenceJson: string;
|
|
4314
|
+
fingerprint: string;
|
|
4315
|
+
kind: "closure" | "commit" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation";
|
|
4316
|
+
purchaseKey?: string | undefined;
|
|
4317
|
+
sourceKey: string;
|
|
4318
|
+
}, {
|
|
4319
|
+
accountKey: import("convex/values").VString<string, "required">;
|
|
4320
|
+
purchaseKey: import("convex/values").VString<string | undefined, "optional">;
|
|
4321
|
+
kind: import("convex/values").VUnion<"closure" | "commit" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation", [import("convex/values").VLiteral<"purchase", "required">, import("convex/values").VLiteral<"payment", "required">, import("convex/values").VLiteral<"grant", "required">, import("convex/values").VLiteral<"reservation", "required">, import("convex/values").VLiteral<"commit", "required">, import("convex/values").VLiteral<"release", "required">, import("convex/values").VLiteral<"observation", "required">, import("convex/values").VLiteral<"recovery", "required">, import("convex/values").VLiteral<"closure", "required">], "required", never>;
|
|
4322
|
+
sourceKey: import("convex/values").VString<string, "required">;
|
|
4323
|
+
fingerprint: import("convex/values").VString<string, "required">;
|
|
4324
|
+
evidenceJson: import("convex/values").VString<string, "required">;
|
|
4325
|
+
at: import("convex/values").VFloat64<number, "required">;
|
|
4326
|
+
}, "required", "accountKey" | "at" | "evidenceJson" | "fingerprint" | "kind" | "purchaseKey" | "sourceKey">, {
|
|
4327
|
+
by_account: ["accountKey", "_creationTime"];
|
|
4328
|
+
by_fingerprint: ["fingerprint", "_creationTime"];
|
|
4329
|
+
by_purchase: ["accountKey", "purchaseKey", "_creationTime"];
|
|
4330
|
+
}, {}, {}>;
|
|
3967
4331
|
refundSyncClaims: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
3968
4332
|
acceptedAt?: number | undefined;
|
|
3969
4333
|
acceptedContext?: string | undefined;
|