@usebillow/sdk 0.7.0 → 0.8.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 +7 -0
- package/dist/{chunk-JG2OOAMX.js → chunk-J6JIZGWB.js} +68 -2
- package/dist/chunk-J6JIZGWB.js.map +1 -0
- package/dist/config.d.cts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/{hosted-domains-z_I0edmM.d.ts → hosted-domains-BP91tg9P.d.ts} +53 -1
- package/dist/{hosted-domains-BYYl2DSa.d.cts → hosted-domains-BbuyxnuH.d.cts} +53 -1
- package/dist/index.cjs +66 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +65 -5
- package/dist/index.d.ts +65 -5
- package/dist/index.js +1 -1
- package/dist/ingestion.d.cts +1 -1
- package/dist/ingestion.d.ts +1 -1
- package/dist/react.js +1 -1
- package/dist/server.d.cts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/webhooks.d.cts +1 -1
- package/dist/webhooks.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunk-JG2OOAMX.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -6,8 +6,8 @@ import { SubscriptionStatus } from './status.cjs';
|
|
|
6
6
|
export { ACTIVE_SUBSCRIPTION_STATUSES, NEVER_ACTIVATED_SUBSCRIPTION_STATUSES, SUBSCRIPTION_STATUSES, TERMINAL_SUBSCRIPTION_STATUSES, grantsAccess, isTerminal } from './status.cjs';
|
|
7
7
|
import { c as TaxBehavior, d as Customer, U as UnappliedPaymentReason, e as CreateChargeInput, R as RequestOptions, f as Charge, g as CreateMerchantInitiatedChargeInput, I as IdempotentRequestOptions, h as CallOptions, C as CreateProductInput, i as UpdateProductInput, j as MigrationResult, k as CreateSubscriptionInput, B as BillowOptions, a as CreateCouponInput, l as Coupon, F as FeatureKind, M as MeterConfig, m as Feature, n as UpdateFeatureInput, o as UsageAlert, p as CreateUsageAlertInput, b as CheckResult, T as TrackResult, E as EntitlementView, A as AttachResult } from './billing-B-VyZCXV.cjs';
|
|
8
8
|
export { q as ActivatedSubscriptionResult, r as BillingInterval, s as CouponDuration, t as CouponKind, u as CreateSubscriptionResult, v as EntitlementInput, w as MeterAggregation, x as MeterFilter, y as MeterRoundingMode, z as PendingSubscriptionCheckoutResult, D as PriceInput, P as Product, G as ProductEntitlement, H as ProductPrice, S as Subscription, J as SubscriptionDetail, K as SubscriptionItem, L as UpdatePriceInput, N as UsageAlertKind, O as UsageAlertMetric, Q as UsageModel, V as UsageTier } from './billing-B-VyZCXV.cjs';
|
|
9
|
-
import { a as CreditThresholdLevel, e as CreditGrant, f as CreditTopUp, g as CreateCreditGrantInput, h as CreditGrantRequestResult, i as CreditPacks, j as CreateCreditPackInput, k as CreditPack, U as UpdateCreditPackInput, l as
|
|
10
|
-
export {
|
|
9
|
+
import { a as CreditThresholdLevel, e as CreditGrant, f as CreditTopUp, g as CreateCreditGrantInput, h as CreditGrantRequestResult, i as CreditPacks, j as CreateCreditPackInput, k as CreditPack, U as UpdateCreditPackInput, l as CreateCreditIncludedRuleInput, m as CreditIncludedRule, n as UpdateCreditIncludedRuleInput, o as CreateCreditTopUpInput, p as CreditTopUpRequestResult, q as CreditTopUpListParams, r as CreditBalance, s as CreditLedgerEntry, t as CreditUsageParams, u as CreditUsage } from './hosted-domains-BbuyxnuH.cjs';
|
|
10
|
+
export { v as CreditAccountStatus, w as CreditAllocationInterval, C as CreditGrantKind, x as CreditMoney, y as CreditPackBreakdown, z as CreditPackListItem, A as CreditTopUpStatus, B as CreditTransactionType, D as CreditUsageGroupBy, H as HostedDomainActivatedData, d as HostedDomainDisabledData, b as HostedDomainDnsFailingData, E as HostedDomainEventBase, c as HostedDomainReassignmentPendingData, F as HostedDomainStatus, G as HostedDomainStatusReason } from './hosted-domains-BbuyxnuH.cjs';
|
|
11
11
|
import 'zod';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -261,9 +261,9 @@ interface CursorPaginated<T> {
|
|
|
261
261
|
* The return type of a cursor-paginated `.list()`: like {@link ListPromise}, BOTH a Promise for
|
|
262
262
|
* the first page AND async-iterable across ALL pages (`for await`, or `.listAll()`). The walk
|
|
263
263
|
* follows `nextCursor` until it is null, so rows arriving at the head meanwhile never make it skip
|
|
264
|
-
* or repeat a row.
|
|
264
|
+
* or repeat a row. `Page` is the first page's type, for a list whose pages carry more than rows.
|
|
265
265
|
*/
|
|
266
|
-
interface CursorListPromise<T
|
|
266
|
+
interface CursorListPromise<T, Page extends CursorPaginated<T> = CursorPaginated<T>> extends Promise<Page>, AsyncIterable<T> {
|
|
267
267
|
/** Page through the entire list and collect every item into one array. */
|
|
268
268
|
listAll(): Promise<T[]>;
|
|
269
269
|
}
|
|
@@ -716,6 +716,7 @@ interface Whoami {
|
|
|
716
716
|
* Every credit quantity - and every count of units - is a `string` of a whole number, e.g.
|
|
717
717
|
* `"5000000"` for 5 credits: never a `number`, which would silently round past 2^53.
|
|
718
718
|
*/
|
|
719
|
+
|
|
719
720
|
/** One Credit Action's price in a Rate Card version: `ceil(units * unitPrice / perUnits)` a line. */
|
|
720
721
|
interface CreditRateCardItem {
|
|
721
722
|
/** The Credit Action key, e.g. `send_message`. */
|
|
@@ -829,6 +830,29 @@ interface CreditReservation {
|
|
|
829
830
|
metadata: Record<string, string> | null;
|
|
830
831
|
createdAt: string;
|
|
831
832
|
}
|
|
833
|
+
/** Narrow the project's reservations list. */
|
|
834
|
+
interface CreditReservationListParams {
|
|
835
|
+
/** Page size: 1 to 100 (default 25); the server clamps a larger one. */
|
|
836
|
+
limit?: number;
|
|
837
|
+
/** A `nextCursor` to continue from; omit to start at the oldest reservation. */
|
|
838
|
+
cursor?: string;
|
|
839
|
+
status?: CreditReservationStatus;
|
|
840
|
+
/** Only this customer's reservations (by external id). */
|
|
841
|
+
customer?: string;
|
|
842
|
+
/**
|
|
843
|
+
* Only reservations protected more than this many seconds ago, whatever their status now (with
|
|
844
|
+
* `status: "protected"`, the ones still waiting). A reservation never protected never matches.
|
|
845
|
+
*/
|
|
846
|
+
protectedLongerThan?: number;
|
|
847
|
+
}
|
|
848
|
+
/** A page of the project's reservations, oldest first. */
|
|
849
|
+
interface CreditReservationPage extends CursorPaginated<CreditReservation> {
|
|
850
|
+
/**
|
|
851
|
+
* Your project's protected-hold maximum, in seconds (7 days unless configured): a protected hold
|
|
852
|
+
* never expires, so one protected longer than this needs your decision - commit or release it.
|
|
853
|
+
*/
|
|
854
|
+
protectedHoldMaxSeconds: number;
|
|
855
|
+
}
|
|
832
856
|
/** What a reservation holds for and how it is identified; give `quoteId` or `items`. */
|
|
833
857
|
interface CreateCreditReservationBase {
|
|
834
858
|
/** The customer's external id. */
|
|
@@ -1445,6 +1469,33 @@ declare function createCreditsResource(ctx: RequestContext): {
|
|
|
1445
1469
|
/** Edit a pack's terms or Price, or archive it; top-ups already made keep their terms. */
|
|
1446
1470
|
update: (packId: string, input: UpdateCreditPackInput, options?: CallOptions) => Promise<CreditPack>;
|
|
1447
1471
|
};
|
|
1472
|
+
includedRules: {
|
|
1473
|
+
/**
|
|
1474
|
+
* Configure an Included Credit Rule on a recurring base Price: the credits a subscription on
|
|
1475
|
+
* it includes for each period Billow grants it - per billing period, or per month of a Price
|
|
1476
|
+
* billed for longer than a month - and for a trial. Configuration, so no idempotency key:
|
|
1477
|
+
* a second live rule for the same Price throws `conflict` (409,
|
|
1478
|
+
* `details.reason: "included_rule_exists"`, with the live rule's `ruleId`). Throws
|
|
1479
|
+
* `validation_error` (422) with `details.reason: "not_a_base_price"` for a Price that is not
|
|
1480
|
+
* a recurring base Price, or `"allocation_not_shorter_than_billing"` for a monthly
|
|
1481
|
+
* allocation on a Price not billed for longer than a month.
|
|
1482
|
+
*/
|
|
1483
|
+
create: (input: CreateCreditIncludedRuleInput, options?: CallOptions) => Promise<CreditIncludedRule>;
|
|
1484
|
+
/** A rule, archived or not. */
|
|
1485
|
+
get: (ruleId: string, options?: CallOptions) => Promise<CreditIncludedRule>;
|
|
1486
|
+
/**
|
|
1487
|
+
* Every rule, archived ones included, newest first. Auto-paginating by cursor: `await` the
|
|
1488
|
+
* first page, `for await (…)` every rule, or `.listAll()` to collect them.
|
|
1489
|
+
*/
|
|
1490
|
+
list: (params?: CursorListParams, options?: CallOptions) => CursorListPromise<CreditIncludedRule>;
|
|
1491
|
+
/**
|
|
1492
|
+
* Edit a rule's credits, per-seat choice, trial credits or allocation interval, or archive
|
|
1493
|
+
* it (`archived: false` brings it back). It takes effect from the next period granted;
|
|
1494
|
+
* periods already granted keep what they were granted. A rule left live is judged against
|
|
1495
|
+
* its Price as it is now, with the same errors as `create`.
|
|
1496
|
+
*/
|
|
1497
|
+
update: (ruleId: string, input: UpdateCreditIncludedRuleInput, options?: CallOptions) => Promise<CreditIncludedRule>;
|
|
1498
|
+
};
|
|
1448
1499
|
topUps: {
|
|
1449
1500
|
/**
|
|
1450
1501
|
* Buy a Credit Pack for a customer: answers the top-up with `checkoutUrl`, the hosted
|
|
@@ -1535,6 +1586,15 @@ declare function createCreditsResource(ctx: RequestContext): {
|
|
|
1535
1586
|
create: (input: CreateCreditReservationInput, options: IdempotentRequestOptions) => Promise<CreditReservationRequestResult>;
|
|
1536
1587
|
/** A reservation as it now stands. */
|
|
1537
1588
|
get: (reservationId: string, options?: CallOptions) => Promise<CreditReservation>;
|
|
1589
|
+
/**
|
|
1590
|
+
* Your project's reservations, oldest first, optionally of one `status`, one `customer` (by
|
|
1591
|
+
* external id), or protected more than `protectedLongerThan` seconds ago - with
|
|
1592
|
+
* `{ status: "protected", protectedLongerThan: page.protectedHoldMaxSeconds }`, the paid
|
|
1593
|
+
* operations waiting past your maximum for a decision (commit or release each). Every page
|
|
1594
|
+
* carries `protectedHoldMaxSeconds`. Auto-paginating by cursor: `await` the first page,
|
|
1595
|
+
* `for await (…)` every reservation, or `.listAll()` to collect them.
|
|
1596
|
+
*/
|
|
1597
|
+
list: (params?: CreditReservationListParams, options?: CallOptions) => CursorListPromise<CreditReservation, CreditReservationPage>;
|
|
1538
1598
|
/**
|
|
1539
1599
|
* A customer's reservation (by external id) made with `operationKey` - how to find one whose
|
|
1540
1600
|
* reply was lost. Throws `not_found` (404) when there is none.
|
|
@@ -2913,4 +2973,4 @@ declare class BillowPortal {
|
|
|
2913
2973
|
};
|
|
2914
2974
|
}
|
|
2915
2975
|
|
|
2916
|
-
export { AttachResult, BILLOW_ERROR_CODES, Billow, BillowApiError, type BillowErrorCode, BillowOptions, BillowPortal, BillowPublishable, type BusinessProfile, CallOptions, type CatalogItem, Charge, type ChargeListItem, type ChargeListParams, type ChargeSearchHit, ChargeStatus, CheckResult, type CheckoutMethodInfo, type ConfigField, type ConfigFieldOption, type ConfigFieldType, Coupon, CreateChargeInput, CreateCouponInput, CreateCreditGrantInput, CreateCreditPackInput, type CreateCreditQuoteInput, type CreateCreditReservationInput, CreateCreditTopUpInput, CreateHostedDomainInput, CreateMerchantInitiatedChargeInput, type CreatePortalSessionInput, CreateProductInput, CreateSubscriptionInput, CreateUsageAlertInput, type CreateWebhookEndpointInput, type CredentialSet, CreditBalance, type CreditDimensions, CreditGrant, CreditGrantRequestResult, CreditLedgerEntry, type CreditLineItem, CreditPack, CreditPacks, type CreditPricedLine, type CreditQuote, type CreditRateCard, type CreditRateCardItem, type CreditReservation, type CreditReservationRequestResult, type CreditReservationStatus, type CreditReversal, type CreditReversalRequestResult, CreditThresholdLevel, CreditTopUp, CreditTopUpListParams, CreditTopUpRequestResult, CreditUsage, CreditUsageParams, type CursorListParams, type CursorListPromise, type CursorPaginated, Customer, type CustomerAnonymizationResult, type CustomerCreditsExport, type CustomerDataExport, type CustomerListItem, type CustomerListParams, type CustomerOverview, type CustomerSearchHit, type CustomerUsage, type CustomerUsageDetail, type EmailDeliveryListItem, type EmailDeliveryListParams, type EmailDeliveryStatus, type EmailTemplateSetting, EntitlementView, type ExchangeRate, type ExportJsonValue, type ExternalPaymentMethod, type ExternalPaymentResult, Feature, FeatureKind, IdempotentRequestOptions, type InboundWebhookListItem, type InboundWebhookListParams, type InboundWebhookOutcome, type IntegrationDefinition, type IntegrationKind, type IntegrationTier, type Invoice, type InvoiceDetail, type InvoiceLineItem, type InvoiceListItem, type InvoiceListParams, type InvoiceSearchHit, InvoiceStatus, type ListParams, type ListPromise, MeterConfig, type MetricsOverview, type MetricsParams, type MetricsRollup, MigrationResult, type OutboxEventListItem, type OutboxEventListParams, type OutboxEventStatus, type Paginated, PayInvoiceInput, type PaymentMethod, PaymentMethodStatus, type PaymentProviderDefinition, type PortalCardSetupResult, type PortalCheckout, type PortalPlanChange, type PortalSession, type PortalSessionExchange, type PortalSessionExchangeInput, type PortalSessionFlow, type PortalSessionInfo, type PortalSubscriptionStatus, type PortalView, type ProviderCredentialSummary, type ProviderVerifyResult, type ProviderVerifyTarget, type ProviderVerifyTargetResult, type PublishCreditRateCardInput, type RecordExternalPaymentInput, type Refund, type RefundChargeInput, type RefundRequestResult, type RefundReviewReason, RefundStatus, RequestOptions, type ResolveRefundInput, type ReverseCreditConsumptionInput, SavedPaymentMethod, type ScheduledSubscriptionChange, type SearchResults, type SubscriptionListItem, type SubscriptionListParams, type SubscriptionSearchHit, SubscriptionStatus, TaxBehavior, type TimeseriesInterval, type TimeseriesMetric, type TimeseriesParams, type TimeseriesPoint, type TimeseriesResult, TrackResult, UnappliedPaymentReason, type UpdateBusinessProfileInput, UpdateCreditPackInput, type UpdateEmailTemplateInput, UpdateFeatureInput, UpdateProductInput, type UpdateWebhookEndpointInput, type UpsertCredentialsInput, UsageAlert, type WebhookDelivery, WebhookDeliveryStatus, type WebhookEndpoint, type WebhookEndpointWithSecret, type Whoami, currencyExponent, formatMoney, isSecretField, toMajorUnits, toMinorUnits };
|
|
2976
|
+
export { AttachResult, BILLOW_ERROR_CODES, Billow, BillowApiError, type BillowErrorCode, BillowOptions, BillowPortal, BillowPublishable, type BusinessProfile, CallOptions, type CatalogItem, Charge, type ChargeListItem, type ChargeListParams, type ChargeSearchHit, ChargeStatus, CheckResult, type CheckoutMethodInfo, type ConfigField, type ConfigFieldOption, type ConfigFieldType, Coupon, CreateChargeInput, CreateCouponInput, CreateCreditGrantInput, CreateCreditIncludedRuleInput, CreateCreditPackInput, type CreateCreditQuoteInput, type CreateCreditReservationInput, CreateCreditTopUpInput, CreateHostedDomainInput, CreateMerchantInitiatedChargeInput, type CreatePortalSessionInput, CreateProductInput, CreateSubscriptionInput, CreateUsageAlertInput, type CreateWebhookEndpointInput, type CredentialSet, CreditBalance, type CreditDimensions, CreditGrant, CreditGrantRequestResult, CreditIncludedRule, CreditLedgerEntry, type CreditLineItem, CreditPack, CreditPacks, type CreditPricedLine, type CreditQuote, type CreditRateCard, type CreditRateCardItem, type CreditReservation, type CreditReservationListParams, type CreditReservationPage, type CreditReservationRequestResult, type CreditReservationStatus, type CreditReversal, type CreditReversalRequestResult, CreditThresholdLevel, CreditTopUp, CreditTopUpListParams, CreditTopUpRequestResult, CreditUsage, CreditUsageParams, type CursorListParams, type CursorListPromise, type CursorPaginated, Customer, type CustomerAnonymizationResult, type CustomerCreditsExport, type CustomerDataExport, type CustomerListItem, type CustomerListParams, type CustomerOverview, type CustomerSearchHit, type CustomerUsage, type CustomerUsageDetail, type EmailDeliveryListItem, type EmailDeliveryListParams, type EmailDeliveryStatus, type EmailTemplateSetting, EntitlementView, type ExchangeRate, type ExportJsonValue, type ExternalPaymentMethod, type ExternalPaymentResult, Feature, FeatureKind, IdempotentRequestOptions, type InboundWebhookListItem, type InboundWebhookListParams, type InboundWebhookOutcome, type IntegrationDefinition, type IntegrationKind, type IntegrationTier, type Invoice, type InvoiceDetail, type InvoiceLineItem, type InvoiceListItem, type InvoiceListParams, type InvoiceSearchHit, InvoiceStatus, type ListParams, type ListPromise, MeterConfig, type MetricsOverview, type MetricsParams, type MetricsRollup, MigrationResult, type OutboxEventListItem, type OutboxEventListParams, type OutboxEventStatus, type Paginated, PayInvoiceInput, type PaymentMethod, PaymentMethodStatus, type PaymentProviderDefinition, type PortalCardSetupResult, type PortalCheckout, type PortalPlanChange, type PortalSession, type PortalSessionExchange, type PortalSessionExchangeInput, type PortalSessionFlow, type PortalSessionInfo, type PortalSubscriptionStatus, type PortalView, type ProviderCredentialSummary, type ProviderVerifyResult, type ProviderVerifyTarget, type ProviderVerifyTargetResult, type PublishCreditRateCardInput, type RecordExternalPaymentInput, type Refund, type RefundChargeInput, type RefundRequestResult, type RefundReviewReason, RefundStatus, RequestOptions, type ResolveRefundInput, type ReverseCreditConsumptionInput, SavedPaymentMethod, type ScheduledSubscriptionChange, type SearchResults, type SubscriptionListItem, type SubscriptionListParams, type SubscriptionSearchHit, SubscriptionStatus, TaxBehavior, type TimeseriesInterval, type TimeseriesMetric, type TimeseriesParams, type TimeseriesPoint, type TimeseriesResult, TrackResult, UnappliedPaymentReason, type UpdateBusinessProfileInput, UpdateCreditIncludedRuleInput, UpdateCreditPackInput, type UpdateEmailTemplateInput, UpdateFeatureInput, UpdateProductInput, type UpdateWebhookEndpointInput, type UpsertCredentialsInput, UsageAlert, type WebhookDelivery, WebhookDeliveryStatus, type WebhookEndpoint, type WebhookEndpointWithSecret, type Whoami, currencyExponent, formatMoney, isSecretField, toMajorUnits, toMinorUnits };
|
package/dist/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ import { SubscriptionStatus } from './status.js';
|
|
|
6
6
|
export { ACTIVE_SUBSCRIPTION_STATUSES, NEVER_ACTIVATED_SUBSCRIPTION_STATUSES, SUBSCRIPTION_STATUSES, TERMINAL_SUBSCRIPTION_STATUSES, grantsAccess, isTerminal } from './status.js';
|
|
7
7
|
import { c as TaxBehavior, d as Customer, U as UnappliedPaymentReason, e as CreateChargeInput, R as RequestOptions, f as Charge, g as CreateMerchantInitiatedChargeInput, I as IdempotentRequestOptions, h as CallOptions, C as CreateProductInput, i as UpdateProductInput, j as MigrationResult, k as CreateSubscriptionInput, B as BillowOptions, a as CreateCouponInput, l as Coupon, F as FeatureKind, M as MeterConfig, m as Feature, n as UpdateFeatureInput, o as UsageAlert, p as CreateUsageAlertInput, b as CheckResult, T as TrackResult, E as EntitlementView, A as AttachResult } from './billing-CgjcWmvb.js';
|
|
8
8
|
export { q as ActivatedSubscriptionResult, r as BillingInterval, s as CouponDuration, t as CouponKind, u as CreateSubscriptionResult, v as EntitlementInput, w as MeterAggregation, x as MeterFilter, y as MeterRoundingMode, z as PendingSubscriptionCheckoutResult, D as PriceInput, P as Product, G as ProductEntitlement, H as ProductPrice, S as Subscription, J as SubscriptionDetail, K as SubscriptionItem, L as UpdatePriceInput, N as UsageAlertKind, O as UsageAlertMetric, Q as UsageModel, V as UsageTier } from './billing-CgjcWmvb.js';
|
|
9
|
-
import { a as CreditThresholdLevel, e as CreditGrant, f as CreditTopUp, g as CreateCreditGrantInput, h as CreditGrantRequestResult, i as CreditPacks, j as CreateCreditPackInput, k as CreditPack, U as UpdateCreditPackInput, l as
|
|
10
|
-
export {
|
|
9
|
+
import { a as CreditThresholdLevel, e as CreditGrant, f as CreditTopUp, g as CreateCreditGrantInput, h as CreditGrantRequestResult, i as CreditPacks, j as CreateCreditPackInput, k as CreditPack, U as UpdateCreditPackInput, l as CreateCreditIncludedRuleInput, m as CreditIncludedRule, n as UpdateCreditIncludedRuleInput, o as CreateCreditTopUpInput, p as CreditTopUpRequestResult, q as CreditTopUpListParams, r as CreditBalance, s as CreditLedgerEntry, t as CreditUsageParams, u as CreditUsage } from './hosted-domains-BP91tg9P.js';
|
|
10
|
+
export { v as CreditAccountStatus, w as CreditAllocationInterval, C as CreditGrantKind, x as CreditMoney, y as CreditPackBreakdown, z as CreditPackListItem, A as CreditTopUpStatus, B as CreditTransactionType, D as CreditUsageGroupBy, H as HostedDomainActivatedData, d as HostedDomainDisabledData, b as HostedDomainDnsFailingData, E as HostedDomainEventBase, c as HostedDomainReassignmentPendingData, F as HostedDomainStatus, G as HostedDomainStatusReason } from './hosted-domains-BP91tg9P.js';
|
|
11
11
|
import 'zod';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -261,9 +261,9 @@ interface CursorPaginated<T> {
|
|
|
261
261
|
* The return type of a cursor-paginated `.list()`: like {@link ListPromise}, BOTH a Promise for
|
|
262
262
|
* the first page AND async-iterable across ALL pages (`for await`, or `.listAll()`). The walk
|
|
263
263
|
* follows `nextCursor` until it is null, so rows arriving at the head meanwhile never make it skip
|
|
264
|
-
* or repeat a row.
|
|
264
|
+
* or repeat a row. `Page` is the first page's type, for a list whose pages carry more than rows.
|
|
265
265
|
*/
|
|
266
|
-
interface CursorListPromise<T
|
|
266
|
+
interface CursorListPromise<T, Page extends CursorPaginated<T> = CursorPaginated<T>> extends Promise<Page>, AsyncIterable<T> {
|
|
267
267
|
/** Page through the entire list and collect every item into one array. */
|
|
268
268
|
listAll(): Promise<T[]>;
|
|
269
269
|
}
|
|
@@ -716,6 +716,7 @@ interface Whoami {
|
|
|
716
716
|
* Every credit quantity - and every count of units - is a `string` of a whole number, e.g.
|
|
717
717
|
* `"5000000"` for 5 credits: never a `number`, which would silently round past 2^53.
|
|
718
718
|
*/
|
|
719
|
+
|
|
719
720
|
/** One Credit Action's price in a Rate Card version: `ceil(units * unitPrice / perUnits)` a line. */
|
|
720
721
|
interface CreditRateCardItem {
|
|
721
722
|
/** The Credit Action key, e.g. `send_message`. */
|
|
@@ -829,6 +830,29 @@ interface CreditReservation {
|
|
|
829
830
|
metadata: Record<string, string> | null;
|
|
830
831
|
createdAt: string;
|
|
831
832
|
}
|
|
833
|
+
/** Narrow the project's reservations list. */
|
|
834
|
+
interface CreditReservationListParams {
|
|
835
|
+
/** Page size: 1 to 100 (default 25); the server clamps a larger one. */
|
|
836
|
+
limit?: number;
|
|
837
|
+
/** A `nextCursor` to continue from; omit to start at the oldest reservation. */
|
|
838
|
+
cursor?: string;
|
|
839
|
+
status?: CreditReservationStatus;
|
|
840
|
+
/** Only this customer's reservations (by external id). */
|
|
841
|
+
customer?: string;
|
|
842
|
+
/**
|
|
843
|
+
* Only reservations protected more than this many seconds ago, whatever their status now (with
|
|
844
|
+
* `status: "protected"`, the ones still waiting). A reservation never protected never matches.
|
|
845
|
+
*/
|
|
846
|
+
protectedLongerThan?: number;
|
|
847
|
+
}
|
|
848
|
+
/** A page of the project's reservations, oldest first. */
|
|
849
|
+
interface CreditReservationPage extends CursorPaginated<CreditReservation> {
|
|
850
|
+
/**
|
|
851
|
+
* Your project's protected-hold maximum, in seconds (7 days unless configured): a protected hold
|
|
852
|
+
* never expires, so one protected longer than this needs your decision - commit or release it.
|
|
853
|
+
*/
|
|
854
|
+
protectedHoldMaxSeconds: number;
|
|
855
|
+
}
|
|
832
856
|
/** What a reservation holds for and how it is identified; give `quoteId` or `items`. */
|
|
833
857
|
interface CreateCreditReservationBase {
|
|
834
858
|
/** The customer's external id. */
|
|
@@ -1445,6 +1469,33 @@ declare function createCreditsResource(ctx: RequestContext): {
|
|
|
1445
1469
|
/** Edit a pack's terms or Price, or archive it; top-ups already made keep their terms. */
|
|
1446
1470
|
update: (packId: string, input: UpdateCreditPackInput, options?: CallOptions) => Promise<CreditPack>;
|
|
1447
1471
|
};
|
|
1472
|
+
includedRules: {
|
|
1473
|
+
/**
|
|
1474
|
+
* Configure an Included Credit Rule on a recurring base Price: the credits a subscription on
|
|
1475
|
+
* it includes for each period Billow grants it - per billing period, or per month of a Price
|
|
1476
|
+
* billed for longer than a month - and for a trial. Configuration, so no idempotency key:
|
|
1477
|
+
* a second live rule for the same Price throws `conflict` (409,
|
|
1478
|
+
* `details.reason: "included_rule_exists"`, with the live rule's `ruleId`). Throws
|
|
1479
|
+
* `validation_error` (422) with `details.reason: "not_a_base_price"` for a Price that is not
|
|
1480
|
+
* a recurring base Price, or `"allocation_not_shorter_than_billing"` for a monthly
|
|
1481
|
+
* allocation on a Price not billed for longer than a month.
|
|
1482
|
+
*/
|
|
1483
|
+
create: (input: CreateCreditIncludedRuleInput, options?: CallOptions) => Promise<CreditIncludedRule>;
|
|
1484
|
+
/** A rule, archived or not. */
|
|
1485
|
+
get: (ruleId: string, options?: CallOptions) => Promise<CreditIncludedRule>;
|
|
1486
|
+
/**
|
|
1487
|
+
* Every rule, archived ones included, newest first. Auto-paginating by cursor: `await` the
|
|
1488
|
+
* first page, `for await (…)` every rule, or `.listAll()` to collect them.
|
|
1489
|
+
*/
|
|
1490
|
+
list: (params?: CursorListParams, options?: CallOptions) => CursorListPromise<CreditIncludedRule>;
|
|
1491
|
+
/**
|
|
1492
|
+
* Edit a rule's credits, per-seat choice, trial credits or allocation interval, or archive
|
|
1493
|
+
* it (`archived: false` brings it back). It takes effect from the next period granted;
|
|
1494
|
+
* periods already granted keep what they were granted. A rule left live is judged against
|
|
1495
|
+
* its Price as it is now, with the same errors as `create`.
|
|
1496
|
+
*/
|
|
1497
|
+
update: (ruleId: string, input: UpdateCreditIncludedRuleInput, options?: CallOptions) => Promise<CreditIncludedRule>;
|
|
1498
|
+
};
|
|
1448
1499
|
topUps: {
|
|
1449
1500
|
/**
|
|
1450
1501
|
* Buy a Credit Pack for a customer: answers the top-up with `checkoutUrl`, the hosted
|
|
@@ -1535,6 +1586,15 @@ declare function createCreditsResource(ctx: RequestContext): {
|
|
|
1535
1586
|
create: (input: CreateCreditReservationInput, options: IdempotentRequestOptions) => Promise<CreditReservationRequestResult>;
|
|
1536
1587
|
/** A reservation as it now stands. */
|
|
1537
1588
|
get: (reservationId: string, options?: CallOptions) => Promise<CreditReservation>;
|
|
1589
|
+
/**
|
|
1590
|
+
* Your project's reservations, oldest first, optionally of one `status`, one `customer` (by
|
|
1591
|
+
* external id), or protected more than `protectedLongerThan` seconds ago - with
|
|
1592
|
+
* `{ status: "protected", protectedLongerThan: page.protectedHoldMaxSeconds }`, the paid
|
|
1593
|
+
* operations waiting past your maximum for a decision (commit or release each). Every page
|
|
1594
|
+
* carries `protectedHoldMaxSeconds`. Auto-paginating by cursor: `await` the first page,
|
|
1595
|
+
* `for await (…)` every reservation, or `.listAll()` to collect them.
|
|
1596
|
+
*/
|
|
1597
|
+
list: (params?: CreditReservationListParams, options?: CallOptions) => CursorListPromise<CreditReservation, CreditReservationPage>;
|
|
1538
1598
|
/**
|
|
1539
1599
|
* A customer's reservation (by external id) made with `operationKey` - how to find one whose
|
|
1540
1600
|
* reply was lost. Throws `not_found` (404) when there is none.
|
|
@@ -2913,4 +2973,4 @@ declare class BillowPortal {
|
|
|
2913
2973
|
};
|
|
2914
2974
|
}
|
|
2915
2975
|
|
|
2916
|
-
export { AttachResult, BILLOW_ERROR_CODES, Billow, BillowApiError, type BillowErrorCode, BillowOptions, BillowPortal, BillowPublishable, type BusinessProfile, CallOptions, type CatalogItem, Charge, type ChargeListItem, type ChargeListParams, type ChargeSearchHit, ChargeStatus, CheckResult, type CheckoutMethodInfo, type ConfigField, type ConfigFieldOption, type ConfigFieldType, Coupon, CreateChargeInput, CreateCouponInput, CreateCreditGrantInput, CreateCreditPackInput, type CreateCreditQuoteInput, type CreateCreditReservationInput, CreateCreditTopUpInput, CreateHostedDomainInput, CreateMerchantInitiatedChargeInput, type CreatePortalSessionInput, CreateProductInput, CreateSubscriptionInput, CreateUsageAlertInput, type CreateWebhookEndpointInput, type CredentialSet, CreditBalance, type CreditDimensions, CreditGrant, CreditGrantRequestResult, CreditLedgerEntry, type CreditLineItem, CreditPack, CreditPacks, type CreditPricedLine, type CreditQuote, type CreditRateCard, type CreditRateCardItem, type CreditReservation, type CreditReservationRequestResult, type CreditReservationStatus, type CreditReversal, type CreditReversalRequestResult, CreditThresholdLevel, CreditTopUp, CreditTopUpListParams, CreditTopUpRequestResult, CreditUsage, CreditUsageParams, type CursorListParams, type CursorListPromise, type CursorPaginated, Customer, type CustomerAnonymizationResult, type CustomerCreditsExport, type CustomerDataExport, type CustomerListItem, type CustomerListParams, type CustomerOverview, type CustomerSearchHit, type CustomerUsage, type CustomerUsageDetail, type EmailDeliveryListItem, type EmailDeliveryListParams, type EmailDeliveryStatus, type EmailTemplateSetting, EntitlementView, type ExchangeRate, type ExportJsonValue, type ExternalPaymentMethod, type ExternalPaymentResult, Feature, FeatureKind, IdempotentRequestOptions, type InboundWebhookListItem, type InboundWebhookListParams, type InboundWebhookOutcome, type IntegrationDefinition, type IntegrationKind, type IntegrationTier, type Invoice, type InvoiceDetail, type InvoiceLineItem, type InvoiceListItem, type InvoiceListParams, type InvoiceSearchHit, InvoiceStatus, type ListParams, type ListPromise, MeterConfig, type MetricsOverview, type MetricsParams, type MetricsRollup, MigrationResult, type OutboxEventListItem, type OutboxEventListParams, type OutboxEventStatus, type Paginated, PayInvoiceInput, type PaymentMethod, PaymentMethodStatus, type PaymentProviderDefinition, type PortalCardSetupResult, type PortalCheckout, type PortalPlanChange, type PortalSession, type PortalSessionExchange, type PortalSessionExchangeInput, type PortalSessionFlow, type PortalSessionInfo, type PortalSubscriptionStatus, type PortalView, type ProviderCredentialSummary, type ProviderVerifyResult, type ProviderVerifyTarget, type ProviderVerifyTargetResult, type PublishCreditRateCardInput, type RecordExternalPaymentInput, type Refund, type RefundChargeInput, type RefundRequestResult, type RefundReviewReason, RefundStatus, RequestOptions, type ResolveRefundInput, type ReverseCreditConsumptionInput, SavedPaymentMethod, type ScheduledSubscriptionChange, type SearchResults, type SubscriptionListItem, type SubscriptionListParams, type SubscriptionSearchHit, SubscriptionStatus, TaxBehavior, type TimeseriesInterval, type TimeseriesMetric, type TimeseriesParams, type TimeseriesPoint, type TimeseriesResult, TrackResult, UnappliedPaymentReason, type UpdateBusinessProfileInput, UpdateCreditPackInput, type UpdateEmailTemplateInput, UpdateFeatureInput, UpdateProductInput, type UpdateWebhookEndpointInput, type UpsertCredentialsInput, UsageAlert, type WebhookDelivery, WebhookDeliveryStatus, type WebhookEndpoint, type WebhookEndpointWithSecret, type Whoami, currencyExponent, formatMoney, isSecretField, toMajorUnits, toMinorUnits };
|
|
2976
|
+
export { AttachResult, BILLOW_ERROR_CODES, Billow, BillowApiError, type BillowErrorCode, BillowOptions, BillowPortal, BillowPublishable, type BusinessProfile, CallOptions, type CatalogItem, Charge, type ChargeListItem, type ChargeListParams, type ChargeSearchHit, ChargeStatus, CheckResult, type CheckoutMethodInfo, type ConfigField, type ConfigFieldOption, type ConfigFieldType, Coupon, CreateChargeInput, CreateCouponInput, CreateCreditGrantInput, CreateCreditIncludedRuleInput, CreateCreditPackInput, type CreateCreditQuoteInput, type CreateCreditReservationInput, CreateCreditTopUpInput, CreateHostedDomainInput, CreateMerchantInitiatedChargeInput, type CreatePortalSessionInput, CreateProductInput, CreateSubscriptionInput, CreateUsageAlertInput, type CreateWebhookEndpointInput, type CredentialSet, CreditBalance, type CreditDimensions, CreditGrant, CreditGrantRequestResult, CreditIncludedRule, CreditLedgerEntry, type CreditLineItem, CreditPack, CreditPacks, type CreditPricedLine, type CreditQuote, type CreditRateCard, type CreditRateCardItem, type CreditReservation, type CreditReservationListParams, type CreditReservationPage, type CreditReservationRequestResult, type CreditReservationStatus, type CreditReversal, type CreditReversalRequestResult, CreditThresholdLevel, CreditTopUp, CreditTopUpListParams, CreditTopUpRequestResult, CreditUsage, CreditUsageParams, type CursorListParams, type CursorListPromise, type CursorPaginated, Customer, type CustomerAnonymizationResult, type CustomerCreditsExport, type CustomerDataExport, type CustomerListItem, type CustomerListParams, type CustomerOverview, type CustomerSearchHit, type CustomerUsage, type CustomerUsageDetail, type EmailDeliveryListItem, type EmailDeliveryListParams, type EmailDeliveryStatus, type EmailTemplateSetting, EntitlementView, type ExchangeRate, type ExportJsonValue, type ExternalPaymentMethod, type ExternalPaymentResult, Feature, FeatureKind, IdempotentRequestOptions, type InboundWebhookListItem, type InboundWebhookListParams, type InboundWebhookOutcome, type IntegrationDefinition, type IntegrationKind, type IntegrationTier, type Invoice, type InvoiceDetail, type InvoiceLineItem, type InvoiceListItem, type InvoiceListParams, type InvoiceSearchHit, InvoiceStatus, type ListParams, type ListPromise, MeterConfig, type MetricsOverview, type MetricsParams, type MetricsRollup, MigrationResult, type OutboxEventListItem, type OutboxEventListParams, type OutboxEventStatus, type Paginated, PayInvoiceInput, type PaymentMethod, PaymentMethodStatus, type PaymentProviderDefinition, type PortalCardSetupResult, type PortalCheckout, type PortalPlanChange, type PortalSession, type PortalSessionExchange, type PortalSessionExchangeInput, type PortalSessionFlow, type PortalSessionInfo, type PortalSubscriptionStatus, type PortalView, type ProviderCredentialSummary, type ProviderVerifyResult, type ProviderVerifyTarget, type ProviderVerifyTargetResult, type PublishCreditRateCardInput, type RecordExternalPaymentInput, type Refund, type RefundChargeInput, type RefundRequestResult, type RefundReviewReason, RefundStatus, RequestOptions, type ResolveRefundInput, type ReverseCreditConsumptionInput, SavedPaymentMethod, type ScheduledSubscriptionChange, type SearchResults, type SubscriptionListItem, type SubscriptionListParams, type SubscriptionSearchHit, SubscriptionStatus, TaxBehavior, type TimeseriesInterval, type TimeseriesMetric, type TimeseriesParams, type TimeseriesPoint, type TimeseriesResult, TrackResult, UnappliedPaymentReason, type UpdateBusinessProfileInput, UpdateCreditIncludedRuleInput, UpdateCreditPackInput, type UpdateEmailTemplateInput, UpdateFeatureInput, UpdateProductInput, type UpdateWebhookEndpointInput, type UpsertCredentialsInput, UsageAlert, type WebhookDelivery, WebhookDeliveryStatus, type WebhookEndpoint, type WebhookEndpointWithSecret, type Whoami, currencyExponent, formatMoney, isSecretField, toMajorUnits, toMinorUnits };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { BILLOW_ERROR_CODES, Billow, BillowApiError, BillowPortal, BillowPublishable, currencyExponent, formatMoney, isSecretField, toMajorUnits, toMinorUnits } from './chunk-
|
|
1
|
+
export { BILLOW_ERROR_CODES, Billow, BillowApiError, BillowPortal, BillowPublishable, currencyExponent, formatMoney, isSecretField, toMajorUnits, toMinorUnits } from './chunk-J6JIZGWB.js';
|
|
2
2
|
export { ACTIVE_SUBSCRIPTION_STATUSES, CHARGE_STATUSES, INVOICE_STATUSES, NEVER_ACTIVATED_SUBSCRIPTION_STATUSES, PAYMENT_METHOD_STATUSES, REFUND_STATUSES, SUBSCRIPTION_STATUSES, TERMINAL_SUBSCRIPTION_STATUSES, WEBHOOK_DELIVERY_STATUSES, grantsAccess, isTerminal } from './chunk-CCG4F5FK.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/ingestion.d.cts
CHANGED
|
@@ -4,7 +4,7 @@ import 'zod';
|
|
|
4
4
|
import './billing-status-BZQN_gm7.cjs';
|
|
5
5
|
import './status.cjs';
|
|
6
6
|
import './billing-B-VyZCXV.cjs';
|
|
7
|
-
import './hosted-domains-
|
|
7
|
+
import './hosted-domains-BbuyxnuH.cjs';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Auto-metering (PRD-16): ingestion strategies that call billow's `track()` for you,
|
package/dist/ingestion.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import 'zod';
|
|
|
4
4
|
import './billing-status-BZQN_gm7.js';
|
|
5
5
|
import './status.js';
|
|
6
6
|
import './billing-CgjcWmvb.js';
|
|
7
|
-
import './hosted-domains-
|
|
7
|
+
import './hosted-domains-BP91tg9P.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Auto-metering (PRD-16): ingestion strategies that call billow's `track()` for you,
|
package/dist/react.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { BillowPublishable } from './chunk-
|
|
2
|
+
import { BillowPublishable } from './chunk-J6JIZGWB.js';
|
|
3
3
|
import './chunk-CCG4F5FK.js';
|
|
4
4
|
import { createContext, useCallback, useState, useEffect, useMemo, useContext } from 'react';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
package/dist/server.d.cts
CHANGED
|
@@ -4,7 +4,7 @@ import 'zod';
|
|
|
4
4
|
import './billing-status-BZQN_gm7.cjs';
|
|
5
5
|
import './status.cjs';
|
|
6
6
|
import './billing-B-VyZCXV.cjs';
|
|
7
|
-
import './hosted-domains-
|
|
7
|
+
import './hosted-domains-BbuyxnuH.cjs';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Backend handler for the browser-facing surface (the React hooks talk to this,
|
package/dist/server.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import 'zod';
|
|
|
4
4
|
import './billing-status-BZQN_gm7.js';
|
|
5
5
|
import './status.js';
|
|
6
6
|
import './billing-CgjcWmvb.js';
|
|
7
|
-
import './hosted-domains-
|
|
7
|
+
import './hosted-domains-BP91tg9P.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Backend handler for the browser-facing surface (the React hooks talk to this,
|
package/dist/webhooks.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CreditGrantKind, a as CreditThresholdLevel, H as HostedDomainActivatedData, b as HostedDomainDnsFailingData, c as HostedDomainReassignmentPendingData, d as HostedDomainDisabledData } from './hosted-domains-
|
|
1
|
+
import { C as CreditGrantKind, a as CreditThresholdLevel, H as HostedDomainActivatedData, b as HostedDomainDnsFailingData, c as HostedDomainReassignmentPendingData, d as HostedDomainDisabledData } from './hosted-domains-BbuyxnuH.cjs';
|
|
2
2
|
import './index.d-CKQAhQfJ.cjs';
|
|
3
3
|
import 'zod';
|
|
4
4
|
|
package/dist/webhooks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CreditGrantKind, a as CreditThresholdLevel, H as HostedDomainActivatedData, b as HostedDomainDnsFailingData, c as HostedDomainReassignmentPendingData, d as HostedDomainDisabledData } from './hosted-domains-
|
|
1
|
+
import { C as CreditGrantKind, a as CreditThresholdLevel, H as HostedDomainActivatedData, b as HostedDomainDnsFailingData, c as HostedDomainReassignmentPendingData, d as HostedDomainDisabledData } from './hosted-domains-BP91tg9P.js';
|
|
2
2
|
import './index.d-CKQAhQfJ.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
|
package/package.json
CHANGED