@schematichq/schematic-typescript-node 1.6.1 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +2 -0
  2. package/dist/api/resources/credits/client/requests/AcquireCreditLeaseRequestBody.d.ts +1 -0
  3. package/dist/api/resources/credits/client/requests/ExtendCreditLeaseRequestBody.d.ts +3 -0
  4. package/dist/api/resources/entitlements/client/requests/CreateBillingLinkedPlanEntitlementRequestBody.d.ts +4 -0
  5. package/dist/api/resources/entitlements/client/requests/CreatePlanEntitlementRequestBody.d.ts +4 -0
  6. package/dist/api/resources/entitlements/client/requests/UpdatePlanEntitlementRequestBody.d.ts +4 -0
  7. package/dist/api/resources/features/client/requests/CheckAndReserveFlagRequestBody.d.ts +4 -2
  8. package/dist/api/types/BillingArrearsCadence.d.ts +1 -0
  9. package/dist/api/types/BillingCreditGrantReason.d.ts +3 -0
  10. package/dist/api/types/BillingCreditResponseData.d.ts +1 -0
  11. package/dist/api/types/BillingPlanCreditGrantBillingMode.d.ts +5 -0
  12. package/dist/api/types/BillingPlanCreditGrantPriceTierResponseData.d.ts +10 -0
  13. package/dist/api/types/BillingPlanCreditGrantResponseData.d.ts +12 -0
  14. package/dist/api/types/CompanyPlanCreditGrantView.d.ts +3 -0
  15. package/dist/api/types/CreateBillingPlanCreditGrantRequestBody.d.ts +11 -1
  16. package/dist/api/types/CreateEntitlementInBundleRequestBody.d.ts +4 -0
  17. package/dist/api/types/CreditEventLedgerResponseData.d.ts +1 -0
  18. package/dist/api/types/CreditGrantPriceTierRequestBody.d.ts +8 -0
  19. package/dist/api/types/CreditTransferReason.d.ts +7 -0
  20. package/dist/api/types/PlanCreditGrantView.d.ts +3 -0
  21. package/dist/api/types/PlanEntitlementResponseData.d.ts +4 -0
  22. package/dist/api/types/UpdateBillingPlanCreditGrantRequestBody.d.ts +11 -1
  23. package/dist/api/types/UsageBasedEntitlementRequestBody.d.ts +4 -0
  24. package/dist/api/types/index.d.ts +4 -0
  25. package/dist/cache/redis.d.ts +11 -0
  26. package/dist/credits/check.d.ts +10 -5
  27. package/dist/credits/index.d.ts +3 -3
  28. package/dist/credits/lease-manager.d.ts +74 -2
  29. package/dist/credits/lease-store.d.ts +27 -11
  30. package/dist/credits/redis-lease-store.d.ts +2 -2
  31. package/dist/credits/types.d.ts +1 -0
  32. package/dist/index.js +12 -10
  33. package/dist/serialization/resources/credits/client/requests/ExtendCreditLeaseRequestBody.d.ts +1 -0
  34. package/dist/serialization/resources/entitlements/client/requests/CreateBillingLinkedPlanEntitlementRequestBody.d.ts +4 -0
  35. package/dist/serialization/resources/entitlements/client/requests/CreatePlanEntitlementRequestBody.d.ts +4 -0
  36. package/dist/serialization/resources/entitlements/client/requests/UpdatePlanEntitlementRequestBody.d.ts +4 -0
  37. package/dist/serialization/resources/features/client/requests/CheckAndReserveFlagRequestBody.d.ts +1 -0
  38. package/dist/serialization/types/BillingArrearsCadence.d.ts +1 -1
  39. package/dist/serialization/types/BillingCreditGrantReason.d.ts +1 -1
  40. package/dist/serialization/types/BillingCreditResponseData.d.ts +2 -0
  41. package/dist/serialization/types/BillingPlanCreditGrantBillingMode.d.ts +7 -0
  42. package/dist/serialization/types/BillingPlanCreditGrantPriceTierResponseData.d.ts +12 -0
  43. package/dist/serialization/types/BillingPlanCreditGrantResponseData.d.ts +10 -0
  44. package/dist/serialization/types/CompanyPlanCreditGrantView.d.ts +5 -0
  45. package/dist/serialization/types/CreateBillingPlanCreditGrantRequestBody.d.ts +8 -0
  46. package/dist/serialization/types/CreateEntitlementInBundleRequestBody.d.ts +4 -0
  47. package/dist/serialization/types/CreditEventLedgerResponseData.d.ts +2 -0
  48. package/dist/serialization/types/CreditGrantPriceTierRequestBody.d.ts +11 -0
  49. package/dist/serialization/types/CreditTransferReason.d.ts +7 -0
  50. package/dist/serialization/types/PlanCreditGrantView.d.ts +5 -0
  51. package/dist/serialization/types/PlanEntitlementResponseData.d.ts +4 -0
  52. package/dist/serialization/types/UpdateBillingPlanCreditGrantRequestBody.d.ts +8 -0
  53. package/dist/serialization/types/UsageBasedEntitlementRequestBody.d.ts +4 -0
  54. package/dist/serialization/types/index.d.ts +4 -0
  55. package/dist/wrapper.d.ts +50 -16
  56. package/package.json +1 -1
package/README.md CHANGED
@@ -895,6 +895,8 @@ await client.identify(
895
895
 
896
896
  Or call `client.prewarm(evalCtx, creditTypeIds)` directly. Both are no-ops in server mode.
897
897
 
898
+ Pre-warming resolves the company the way the server does: it looks the keys up first, whatever they are named, and only when nothing matches does it read a value carrying Schematic's `comp_` prefix as the company id.
899
+
898
900
  ### Failure behavior
899
901
 
900
902
  A check that cannot be gated (API unreachable, Redis down, lease exhausted) fails closed by default. Override per check:
@@ -9,6 +9,7 @@
9
9
  export interface AcquireCreditLeaseRequestBody {
10
10
  companyId: string;
11
11
  creditTypeId: string;
12
+ /** When the hold lapses if the lease is never released; defaults to five minutes from now and may be at most one hour out. The unspent hold is refunded on expiry */
12
13
  expiresAt?: Date;
13
14
  requestedAmount: number;
14
15
  }
@@ -6,5 +6,8 @@
6
6
  */
7
7
  export interface ExtendCreditLeaseRequestBody {
8
8
  additionalAmount: number;
9
+ /** Pushes the lease's expiry out; may be at most one hour from now. Leave unset to keep the expiry the lease already has */
9
10
  expiresAt?: Date;
11
+ /** A caller-chosen key for safe retries: a second request with the same key returns the lease as it stands instead of growing it again. Keys are unique per environment across every extend */
12
+ idempotencyKey?: string;
10
13
  }
@@ -24,7 +24,11 @@ export interface CreateBillingLinkedPlanEntitlementRequestBody {
24
24
  monthlyPriceTiers?: Schematic.CreatePriceTierRequestBody[];
25
25
  monthlyUnitPrice?: number;
26
26
  monthlyUnitPriceDecimal?: string;
27
+ /** How often overage charges are assessed and invoiced. Defaults to end_of_billing_period, where the billing provider aggregates usage over the subscription's own period and bills it at period end. Set to monthly or quarterly to have overage assessed each month or quarter and billed on its own invoice, which is the point of the setting on annual plans. A quarter charges each month's usage against that month's allowance. Only applies to overage price behavior. */
28
+ overageBillingCadence?: Schematic.BillingArrearsCadence;
27
29
  overageBillingProductId?: string;
30
+ /** Which boundary closes a monthly or quarterly overage window: the subscription's own recurrence (billing_period_start) or the calendar month (month_end). Quarterly windows run in three-month blocks from the billing period start, held to the subscription's own period, or in calendar quarters at month_end. Only applies when overage_billing_cadence is monthly or quarterly, and must match metric_period_month_reset so each window closes when the allowance resets: billing_period_start for billing_cycle, month_end for first_of_month. Defaults to the anchor that matches the reset. */
31
+ overageInvoiceAnchor?: Schematic.BillingArrearsAnchor;
28
32
  planId: string;
29
33
  planVersionId?: string;
30
34
  priceBehavior?: Schematic.EntitlementPriceBehavior;
@@ -20,7 +20,11 @@ export interface CreatePlanEntitlementRequestBody {
20
20
  monthlyPriceTiers?: Schematic.CreatePriceTierRequestBody[];
21
21
  monthlyUnitPrice?: number;
22
22
  monthlyUnitPriceDecimal?: string;
23
+ /** How often overage charges are assessed and invoiced. Defaults to end_of_billing_period, where the billing provider aggregates usage over the subscription's own period and bills it at period end. Set to monthly or quarterly to have overage assessed each month or quarter and billed on its own invoice, which is the point of the setting on annual plans. A quarter charges each month's usage against that month's allowance. Only applies to overage price behavior. */
24
+ overageBillingCadence?: Schematic.BillingArrearsCadence;
23
25
  overageBillingProductId?: string;
26
+ /** Which boundary closes a monthly or quarterly overage window: the subscription's own recurrence (billing_period_start) or the calendar month (month_end). Quarterly windows run in three-month blocks from the billing period start, held to the subscription's own period, or in calendar quarters at month_end. Only applies when overage_billing_cadence is monthly or quarterly, and must match metric_period_month_reset so each window closes when the allowance resets: billing_period_start for billing_cycle, month_end for first_of_month. Defaults to the anchor that matches the reset. */
27
+ overageInvoiceAnchor?: Schematic.BillingArrearsAnchor;
24
28
  planId: string;
25
29
  planVersionId?: string;
26
30
  priceBehavior?: Schematic.EntitlementPriceBehavior;
@@ -17,7 +17,11 @@ export interface UpdatePlanEntitlementRequestBody {
17
17
  monthlyPriceTiers?: Schematic.CreatePriceTierRequestBody[];
18
18
  monthlyUnitPrice?: number;
19
19
  monthlyUnitPriceDecimal?: string;
20
+ /** How often overage charges are assessed and invoiced. Defaults to end_of_billing_period, where the billing provider aggregates usage over the subscription's own period and bills it at period end. Set to monthly or quarterly to have overage assessed each month or quarter and billed on its own invoice, which is the point of the setting on annual plans. A quarter charges each month's usage against that month's allowance. Only applies to overage price behavior. */
21
+ overageBillingCadence?: Schematic.BillingArrearsCadence;
20
22
  overageBillingProductId?: string;
23
+ /** Which boundary closes a monthly or quarterly overage window: the subscription's own recurrence (billing_period_start) or the calendar month (month_end). Quarterly windows run in three-month blocks from the billing period start, held to the subscription's own period, or in calendar quarters at month_end. Only applies when overage_billing_cadence is monthly or quarterly, and must match metric_period_month_reset so each window closes when the allowance resets: billing_period_start for billing_cycle, month_end for first_of_month. Defaults to the anchor that matches the reset. */
24
+ overageInvoiceAnchor?: Schematic.BillingArrearsAnchor;
21
25
  priceBehavior?: Schematic.EntitlementPriceBehavior;
22
26
  /** Use MonthlyPriceTiers or YearlyPriceTiers instead */
23
27
  priceTiers?: Schematic.CreatePriceTierRequestBody[];
@@ -7,9 +7,11 @@ export interface CheckAndReserveFlagRequestBody {
7
7
  company?: Record<string, string>;
8
8
  /** When the hold lapses if no track event settles it; defaults to one minute from now and may be at most one hour out. The unspent hold is refunded on expiry */
9
9
  expiresAt?: Date;
10
- /** Hypothetical usage to evaluate the flag against. When credit_cost names the entitlement's credit, that cost is what gets held; otherwise the hold is quantity times the entitlement's consumption rate */
10
+ /** A caller-chosen key for safe retries: a second request with the same key returns the original reservation instead of taking another hold */
11
+ idempotencyKey?: string;
12
+ /** Hypothetical usage to evaluate the flag against. When credit_cost names the entitlement's credit, that cost is what gets held; otherwise the hold is the entitlement's consumption rate times quantity, or, when quantity is omitted, times the usage stated here */
11
13
  preflight?: Schematic.PreflightRequestBody;
12
- /** Units of the feature the operation will consume; defaults to 1. Sets the hold size together with the entitlement's consumption rate, and is echoed back on the reservation for the settling track event */
14
+ /** Units of the feature the operation will consume. Sets the hold size together with the entitlement's consumption rate, and is echoed back on the reservation for the settling track event. When it is omitted the units come from preflight.event_usage.quantity, if that event subtype is the entitlement's, else from preflight.usage, else 1 */
13
15
  quantity?: number;
14
16
  user?: Record<string, string>;
15
17
  }
@@ -1,5 +1,6 @@
1
1
  export declare const BillingArrearsCadence: {
2
2
  readonly EndOfBillingPeriod: "end_of_billing_period";
3
3
  readonly Monthly: "monthly";
4
+ readonly Quarterly: "quarterly";
4
5
  };
5
6
  export type BillingArrearsCadence = (typeof BillingArrearsCadence)[keyof typeof BillingArrearsCadence];
@@ -3,6 +3,9 @@ export declare const BillingCreditGrantReason: {
3
3
  readonly BillingCreditAutoTopup: "billing_credit_auto_topup";
4
4
  readonly Free: "free";
5
5
  readonly Plan: "plan";
6
+ readonly PostpaidForgiven: "postpaid_forgiven";
7
+ readonly PostpaidOverdraft: "postpaid_overdraft";
8
+ readonly PostpaidSettlement: "postpaid_settlement";
6
9
  readonly Purchased: "purchased";
7
10
  readonly Rollover: "rollover";
8
11
  };
@@ -10,6 +10,7 @@ export interface BillingCreditResponseData {
10
10
  description: string;
11
11
  icon?: string;
12
12
  id: string;
13
+ ledgerAuthority: Schematic.BillingCreditLedgerAuthority;
13
14
  name: string;
14
15
  pluralName?: string;
15
16
  price?: Schematic.BillingPriceResponseData;
@@ -0,0 +1,5 @@
1
+ export declare const BillingPlanCreditGrantBillingMode: {
2
+ readonly Granted: "granted";
3
+ readonly Billed: "billed";
4
+ };
5
+ export type BillingPlanCreditGrantBillingMode = (typeof BillingPlanCreditGrantBillingMode)[keyof typeof BillingPlanCreditGrantBillingMode];
@@ -0,0 +1,10 @@
1
+ export interface BillingPlanCreditGrantPriceTierResponseData {
2
+ /** Lower bound of the tier, in credits per invoice (inclusive). */
3
+ from: number;
4
+ /** Price per credit in this tier, in the plan currency's smallest unit. */
5
+ perUnitPrice?: number;
6
+ /** Price per credit in this tier as a decimal, for rates below one cent. */
7
+ perUnitPriceDecimal?: string;
8
+ /** Upper bound of the tier, in credits per invoice (inclusive). Null marks the final, unbounded tier. */
9
+ to?: number;
10
+ }
@@ -16,6 +16,8 @@ export interface BillingPlanCreditGrantResponseData {
16
16
  autoTopupSelfService: boolean;
17
17
  autoTopupThresholdCredits?: number;
18
18
  autoTopupThresholdPercent?: number;
19
+ /** Whether the credits are included in the plan price (granted) or billed as their own subscription line at a price per credit (billed). */
20
+ billingMode: Schematic.BillingPlanCreditGrantBillingMode;
19
21
  /** Deprecated: bundle availability is a per-bundle plan compatibility set now; use compatible_plan_ids on credit bundles instead. */
20
22
  canBuyBundles: boolean;
21
23
  /** Credits granted once per company on top of the per-license amount. Always 0 when scaling is fixed. */
@@ -49,6 +51,10 @@ export interface BillingPlanCreditGrantResponseData {
49
51
  postpaidRatePerUnit?: number;
50
52
  /** Decimal form of postpaid_rate_per_unit, for rates finer than one minor unit. */
51
53
  postpaidRatePerUnitDecimal?: string;
54
+ /** The Stripe price a billed grant bills through. Minted when the plan version is published. */
55
+ price?: Schematic.BillingPriceResponseData;
56
+ /** Tier table pricing the credits, cheapest bound first. Empty unless billing_mode is billed and the credits are priced on tiers. */
57
+ priceTiers: Schematic.BillingPlanCreditGrantPriceTierResponseData[];
52
58
  resetCadence?: Schematic.BillingPlanCreditGrantResetCadence;
53
59
  resetStart?: Schematic.BillingPlanCreditGrantResetStart;
54
60
  resetType?: Schematic.BillingPlanCreditGrantResetType;
@@ -56,5 +62,11 @@ export interface BillingPlanCreditGrantResponseData {
56
62
  rolloverPercentage: number;
57
63
  /** Whether the grant is a fixed amount per company, or issued once per license the company holds. */
58
64
  scaling: Schematic.PlanCreditGrantScaling;
65
+ /** How price_tiers apply: volume prices every credit at the rate of the tier the total lands in, graduated prices each tier's own credits at its own rate. Set only when price_tiers is non-empty. */
66
+ tierMode?: Schematic.BillingTiersMode;
67
+ /** Price per credit in the plan currency's smallest unit. Set only when billing_mode is billed and the credits are priced at one rate. */
68
+ unitPrice?: number;
69
+ /** Price per credit as a decimal in the plan currency's smallest unit. Set only when billing_mode is billed and the rate is below one cent. */
70
+ unitPriceDecimal?: string;
59
71
  updatedAt: Date;
60
72
  }
@@ -17,6 +17,8 @@ export interface CompanyPlanCreditGrantView {
17
17
  billingCreditPostpaidEnabled: boolean;
18
18
  billingCreditPostpaidRatePerUnit?: number;
19
19
  billingCreditPostpaidRatePerUnitDecimal?: string;
20
+ billingMode: Schematic.BillingPlanCreditGrantBillingMode;
21
+ billingProductPriceId?: string;
20
22
  companyAutoTopupAmount?: number;
21
23
  companyAutoTopupEnabled?: boolean;
22
24
  companyAutoTopupThresholdCredits?: number;
@@ -41,6 +43,7 @@ export interface CompanyPlanCreditGrantView {
41
43
  planVersionId?: string;
42
44
  /** Deprecated field, will be removed in the future. Use Credit.PluralName instead. */
43
45
  pluralName?: string;
46
+ price?: Schematic.BillingPriceView;
44
47
  resetCadence?: Schematic.BillingPlanCreditGrantResetCadence;
45
48
  resetStart?: Schematic.BillingPlanCreditGrantResetStart;
46
49
  resetType: Schematic.BillingPlanCreditGrantResetType;
@@ -3,7 +3,7 @@ export interface CreateBillingPlanCreditGrantRequestBody {
3
3
  applyToExisting?: boolean;
4
4
  /** Which boundary closes a monthly arrears window: the subscription's own recurrence (billing_period_start) or the calendar month (month_end). Only applies when arrears_cadence is monthly; defaults to billing_period_start. */
5
5
  arrearsAnchor?: Schematic.BillingArrearsAnchor;
6
- /** How often postpaid charges are closed and invoiced: end_of_billing_period (the default) or monthly. */
6
+ /** How often postpaid charges are closed and invoiced: end_of_billing_period (the default) or monthly. Quarterly is not available for postpaid charges. */
7
7
  arrearsCadence?: Schematic.BillingArrearsCadence;
8
8
  autoTopupAmount?: number;
9
9
  autoTopupAmountType?: Schematic.CreditAutoTopupAmountType;
@@ -15,6 +15,8 @@ export interface CreateBillingPlanCreditGrantRequestBody {
15
15
  autoTopupSelfService?: boolean;
16
16
  autoTopupThresholdCredits?: number;
17
17
  autoTopupThresholdPercent?: number;
18
+ /** Whether the credits are included in the plan price (granted) or billed as their own subscription line at a price per credit (billed). Billed is only available on custom plans. Defaults to granted. */
19
+ billingMode?: Schematic.BillingPlanCreditGrantBillingMode;
18
20
  /** Deprecated: use compatible_plan_ids on credit bundles instead. Still accepted; writes through to the credit's bundle compatibility. */
19
21
  canBuyBundles?: boolean;
20
22
  /** Credits granted once per company on top of the per-license amount. Only valid when scaling is per_license. Defaults to 0. */
@@ -36,6 +38,8 @@ export interface CreateBillingPlanCreditGrantRequestBody {
36
38
  postpaidRatePerUnit?: number;
37
39
  /** Decimal string form of postpaid_rate_per_unit, for rates finer than one minor unit (for example 0.0002). Takes precedence over postpaid_rate_per_unit when both are set, matching how the credit's own price_per_unit_decimal behaves. */
38
40
  postpaidRatePerUnitDecimal?: string;
41
+ /** Tier table pricing the credits on this grant, cheapest bound first, the last tier unbounded. Give this instead of unit_price to charge a rate that changes with the number of credits on the invoice. Requires tier_mode. */
42
+ priceTiers?: Schematic.CreditGrantPriceTierRequestBody[];
39
43
  resetCadence: Schematic.BillingPlanCreditGrantResetCadence;
40
44
  resetStart: Schematic.BillingPlanCreditGrantResetStart;
41
45
  resetType?: Schematic.BillingPlanCreditGrantResetType;
@@ -43,4 +47,10 @@ export interface CreateBillingPlanCreditGrantRequestBody {
43
47
  rolloverPercentage?: number;
44
48
  /** Whether the grant is a fixed amount per company, or issued once per license the company holds. Defaults to fixed. */
45
49
  scaling?: Schematic.PlanCreditGrantScaling;
50
+ /** How price_tiers apply: volume prices every credit at the rate of the tier the total lands in, graduated prices each tier's own credits at its own rate. Required with price_tiers. */
51
+ tierMode?: Schematic.BillingTiersMode;
52
+ /** Price per credit in the plan currency's smallest unit. Required when billing_mode is billed, unless unit_price_decimal or price_tiers is set. */
53
+ unitPrice?: number;
54
+ /** Price per credit as a decimal in the plan currency's smallest unit, for prices below one cent. */
55
+ unitPriceDecimal?: string;
46
56
  }
@@ -12,7 +12,11 @@ export interface CreateEntitlementInBundleRequestBody {
12
12
  monthlyPriceTiers?: Schematic.CreatePriceTierRequestBody[];
13
13
  monthlyUnitPrice?: number;
14
14
  monthlyUnitPriceDecimal?: string;
15
+ /** How often overage charges are assessed and invoiced. Defaults to end_of_billing_period, where the billing provider aggregates usage over the subscription's own period and bills it at period end. Set to monthly or quarterly to have overage assessed each month or quarter and billed on its own invoice, which is the point of the setting on annual plans. A quarter charges each month's usage against that month's allowance. Only applies to overage price behavior. */
16
+ overageBillingCadence?: Schematic.BillingArrearsCadence;
15
17
  overageBillingProductId?: string;
18
+ /** Which boundary closes a monthly or quarterly overage window: the subscription's own recurrence (billing_period_start) or the calendar month (month_end). Quarterly windows run in three-month blocks from the billing period start, held to the subscription's own period, or in calendar quarters at month_end. Only applies when overage_billing_cadence is monthly or quarterly, and must match metric_period_month_reset so each window closes when the allowance resets: billing_period_start for billing_cycle, month_end for first_of_month. Defaults to the anchor that matches the reset. */
19
+ overageInvoiceAnchor?: Schematic.BillingArrearsAnchor;
16
20
  planId: string;
17
21
  planVersionId?: string;
18
22
  priceBehavior?: Schematic.EntitlementPriceBehavior;
@@ -29,6 +29,7 @@ export interface CreditEventLedgerResponseData {
29
29
  quantityRemainingAtZeroOut?: number;
30
30
  sourceId: number;
31
31
  toGrantId?: string;
32
+ transferReason?: Schematic.CreditTransferReason;
32
33
  usageEventId?: string;
33
34
  usageReason?: Schematic.CreditUsageReason;
34
35
  zeroedOutReason?: Schematic.BillingCreditGrantZeroedOutReason;
@@ -0,0 +1,8 @@
1
+ export interface CreditGrantPriceTierRequestBody {
2
+ /** Price per credit in this tier, in the plan currency's smallest unit. */
3
+ perUnitPrice?: number;
4
+ /** Price per credit in this tier as a decimal in the plan currency's smallest unit, for prices below one cent. */
5
+ perUnitPriceDecimal?: string;
6
+ /** Inclusive upper bound of this tier, counted in credits per invoice. Null marks the final, unbounded tier. */
7
+ upTo?: number;
8
+ }
@@ -0,0 +1,7 @@
1
+ export declare const CreditTransferReason: {
2
+ readonly OverdraftRecovery: "overdraft_recovery";
3
+ readonly PostpaidDebtMoved: "postpaid_debt_moved";
4
+ readonly PostpaidForgiven: "postpaid_forgiven";
5
+ readonly PostpaidPaid: "postpaid_paid";
6
+ };
7
+ export type CreditTransferReason = (typeof CreditTransferReason)[keyof typeof CreditTransferReason];
@@ -17,6 +17,8 @@ export interface PlanCreditGrantView {
17
17
  billingCreditPostpaidEnabled: boolean;
18
18
  billingCreditPostpaidRatePerUnit?: number;
19
19
  billingCreditPostpaidRatePerUnitDecimal?: string;
20
+ billingMode: Schematic.BillingPlanCreditGrantBillingMode;
21
+ billingProductPriceId?: string;
20
22
  companyCreditAmount: number;
21
23
  createdAt: Date;
22
24
  credit?: Schematic.BillingCreditView;
@@ -38,6 +40,7 @@ export interface PlanCreditGrantView {
38
40
  planVersionId?: string;
39
41
  /** Deprecated field, will be removed in the future. Use Credit.PluralName instead. */
40
42
  pluralName?: string;
43
+ price?: Schematic.BillingPriceView;
41
44
  resetCadence?: Schematic.BillingPlanCreditGrantResetCadence;
42
45
  resetStart?: Schematic.BillingPlanCreditGrantResetStart;
43
46
  resetType: Schematic.BillingPlanCreditGrantResetType;
@@ -14,6 +14,10 @@ export interface PlanEntitlementResponseData {
14
14
  meteredYearlyPrice?: Schematic.BillingPriceView;
15
15
  metricPeriod?: Schematic.MetricPeriod;
16
16
  metricPeriodMonthReset?: Schematic.MetricPeriodMonthReset;
17
+ /** How often overage charges are assessed and invoiced. Null or end_of_billing_period means the billing provider aggregates usage over the subscription's own period and bills it at period end. Monthly and quarterly mean Schematic assesses the overage each month or quarter and bills it on its own invoice. Only applies to overage price behavior. */
18
+ overageBillingCadence?: Schematic.BillingArrearsCadence;
19
+ /** Which boundary closes a monthly or quarterly overage window: the subscription's own recurrence (billing_period_start) or the calendar month (month_end), which for a quarterly window means calendar quarters. Only meaningful when overage_billing_cadence is monthly or quarterly. */
20
+ overageInvoiceAnchor?: Schematic.BillingArrearsAnchor;
17
21
  plan?: Schematic.PlanResponseData;
18
22
  planId: string;
19
23
  priceBehavior?: Schematic.EntitlementPriceBehavior;
@@ -3,7 +3,7 @@ export interface UpdateBillingPlanCreditGrantRequestBody {
3
3
  applyToExisting?: boolean;
4
4
  /** Which boundary closes a monthly arrears window: the subscription's own recurrence (billing_period_start) or the calendar month (month_end). Only applies when arrears_cadence is monthly; defaults to billing_period_start. Send null to fall back to the default. */
5
5
  arrearsAnchor?: Schematic.BillingArrearsAnchor;
6
- /** How often postpaid charges are closed and invoiced: end_of_billing_period (the default) or monthly. Send null to fall back to the default. */
6
+ /** How often postpaid charges are closed and invoiced: end_of_billing_period (the default) or monthly. Quarterly is not available for postpaid charges. Send null to fall back to the default. */
7
7
  arrearsCadence?: Schematic.BillingArrearsCadence;
8
8
  autoTopupAmount?: number;
9
9
  autoTopupAmountType?: Schematic.CreditAutoTopupAmountType;
@@ -15,6 +15,8 @@ export interface UpdateBillingPlanCreditGrantRequestBody {
15
15
  autoTopupSelfService?: boolean;
16
16
  autoTopupThresholdCredits?: number;
17
17
  autoTopupThresholdPercent?: number;
18
+ /** Whether the credits are included in the plan price (granted) or billed as their own subscription line at a price per credit (billed). Billed is only available on custom plans. */
19
+ billingMode?: Schematic.BillingPlanCreditGrantBillingMode;
18
20
  /** Deprecated: use compatible_plan_ids on credit bundles instead. Still accepted; writes through to the credit's bundle compatibility. */
19
21
  canBuyBundles?: boolean;
20
22
  /** Credits granted once per company on top of the per-license amount. Only valid when the grant scales per license. */
@@ -33,6 +35,8 @@ export interface UpdateBillingPlanCreditGrantRequestBody {
33
35
  postpaidRatePerUnit?: number;
34
36
  /** Decimal string form of postpaid_rate_per_unit, for rates finer than one minor unit (for example 0.0002). Takes precedence over postpaid_rate_per_unit when both are set, matching how the credit's own price_per_unit_decimal behaves. Send null to clear it. */
35
37
  postpaidRatePerUnitDecimal?: string;
38
+ /** Tier table pricing the credits on this grant, cheapest bound first, the last tier unbounded. Sending it moves the grant off one rate per credit. Requires tier_mode. */
39
+ priceTiers?: Schematic.CreditGrantPriceTierRequestBody[];
36
40
  resetCadence: Schematic.BillingPlanCreditGrantResetCadence;
37
41
  resetStart: Schematic.BillingPlanCreditGrantResetStart;
38
42
  resetType?: Schematic.BillingPlanCreditGrantResetType;
@@ -40,4 +44,10 @@ export interface UpdateBillingPlanCreditGrantRequestBody {
40
44
  rolloverPercentage?: number;
41
45
  /** Whether the grant is a fixed amount per company, or issued once per license the company holds. Changing this re-issues the credits companies already hold for this grant. */
42
46
  scaling?: Schematic.PlanCreditGrantScaling;
47
+ /** How price_tiers apply: volume prices every credit at the rate of the tier the total lands in, graduated prices each tier's own credits at its own rate. Required with price_tiers. */
48
+ tierMode?: Schematic.BillingTiersMode;
49
+ /** Price per credit in the plan currency's smallest unit. Required when billing_mode is billed, unless unit_price_decimal or price_tiers is set. Sending it moves a tiered grant back to one rate per credit. */
50
+ unitPrice?: number;
51
+ /** Price per credit as a decimal in the plan currency's smallest unit, for prices below one cent. */
52
+ unitPriceDecimal?: string;
43
53
  }
@@ -8,7 +8,11 @@ export interface UsageBasedEntitlementRequestBody {
8
8
  monthlyPriceTiers?: Schematic.CreatePriceTierRequestBody[];
9
9
  monthlyUnitPrice?: number;
10
10
  monthlyUnitPriceDecimal?: string;
11
+ /** How often overage charges are assessed and invoiced. Defaults to end_of_billing_period, where the billing provider aggregates usage over the subscription's own period and bills it at period end. Set to monthly or quarterly to have overage assessed each month or quarter and billed on its own invoice, which is the point of the setting on annual plans. A quarter charges each month's usage against that month's allowance. Only applies to overage price behavior. */
12
+ overageBillingCadence?: Schematic.BillingArrearsCadence;
11
13
  overageBillingProductId?: string;
14
+ /** Which boundary closes a monthly or quarterly overage window: the subscription's own recurrence (billing_period_start) or the calendar month (month_end). Quarterly windows run in three-month blocks from the billing period start, held to the subscription's own period, or in calendar quarters at month_end. Only applies when overage_billing_cadence is monthly or quarterly, and must match metric_period_month_reset so each window closes when the allowance resets: billing_period_start for billing_cycle, month_end for first_of_month. Defaults to the anchor that matches the reset. */
15
+ overageInvoiceAnchor?: Schematic.BillingArrearsAnchor;
12
16
  priceBehavior?: Schematic.EntitlementPriceBehavior;
13
17
  /** Use MonthlyPriceTiers or YearlyPriceTiers instead */
14
18
  priceTiers?: Schematic.CreatePriceTierRequestBody[];
@@ -37,6 +37,8 @@ export * from "./BillingCustomerSubscription";
37
37
  export * from "./BillingCustomerWithSubscriptionsResponseData";
38
38
  export * from "./BillingLinkedResourceResponseData";
39
39
  export * from "./BillingMeterResponseData";
40
+ export * from "./BillingPlanCreditGrantBillingMode";
41
+ export * from "./BillingPlanCreditGrantPriceTierResponseData";
40
42
  export * from "./BillingPlanCreditGrantResetCadence";
41
43
  export * from "./BillingPlanCreditGrantResetStart";
42
44
  export * from "./BillingPlanCreditGrantResetType";
@@ -168,6 +170,7 @@ export * from "./CreditEventLedgerResponseData";
168
170
  export * from "./CreditEventType";
169
171
  export * from "./CreditGrantDetail";
170
172
  export * from "./CreditGrantExpiryRequestBody";
173
+ export * from "./CreditGrantPriceTierRequestBody";
171
174
  export * from "./CreditGrantSortOrder";
172
175
  export * from "./CreditLeaseResponseData";
173
176
  export * from "./CreditReservationResponseData";
@@ -181,6 +184,7 @@ export * from "./CreditsAutoTopupSuccess";
181
184
  export * from "./CreditsCreditPurchaseSuccess";
182
185
  export * from "./CreditsWebhookCompanySummary";
183
186
  export * from "./CreditsWebhookCreditSummary";
187
+ export * from "./CreditTransferReason";
184
188
  export * from "./CreditTransferResponseData";
185
189
  export * from "./CreditTransferView";
186
190
  export * from "./CreditTriggerConfig";
@@ -39,6 +39,17 @@ export interface RedisClient {
39
39
  arguments: string[];
40
40
  }): Promise<unknown>;
41
41
  pExpireAt(key: string, timestamp: number): Promise<unknown>;
42
+ multi?(): RedisMulti;
43
+ }
44
+ /**
45
+ * The queued-command half of MULTI/EXEC, as node-redis v4 returns it from
46
+ * `multi()`. Only the commands the SDK queues are declared; every one of them
47
+ * is single-key, so the transaction is safe under Redis Cluster too.
48
+ */
49
+ export interface RedisMulti {
50
+ hSet(key: string, field: string | Record<string, string | number>, value?: string | number): RedisMulti;
51
+ pExpireAt(key: string, timestamp: number): RedisMulti;
52
+ exec(): Promise<unknown>;
42
53
  }
43
54
  export interface RedisOptions extends CacheOptions {
44
55
  /** Pre-created, connected redis client */
@@ -33,7 +33,7 @@ export interface CreditCheckDeps {
33
33
  * check. Otherwise `creditId` + `consumptionRate` + `eventSubtype` come
34
34
  * straight off the entitlement — no structural flag scan.
35
35
  * 2. Acquire (or reuse) a lease for `(company, creditId)`.
36
- * 3. Try to reserve `quantity × consumptionRate` from the lease.
36
+ * 3. Try to reserve `ceil(quantity) × consumptionRate` from the lease.
37
37
  * 4. Run the WASM rules engine against a substituted company snapshot
38
38
  * (`credit_balances[creditId] = lease.localRemaining` *before* the
39
39
  * reservation we just made was debited), gating with `credit_cost` so the
@@ -45,9 +45,14 @@ export declare function checkWithLease(deps: CreditCheckDeps, key: string, evalC
45
45
  * Build the preflight options envelope for a client-side rules evaluation.
46
46
  * With an `eventSubtype` the quantity goes out as the `event_usage` pair so
47
47
  * the engine matches it to the subtype's condition; without one it goes out
48
- * as the generic `usage` knob. Exported so `client.check`'s fallback path can
49
- * thread the same preflight through a plain flag check — any client-side
50
- * evaluation (datastream, replicator) honors it even when the lease path
51
- * can't run.
48
+ * as the generic `usage` knob. Exported so `client.check`'s fallback path and
49
+ * the server-mode check-and-reserve body can thread the same preflight — any
50
+ * evaluation path honors it even when the lease path can't run.
51
+ *
52
+ * The quantity rounds up here, once, so every consumer of this envelope asks
53
+ * the same whole-unit question: the engine takes an integer, the REST body
54
+ * takes an integer, and the settling Track event bills `ceil(actual)`. A
55
+ * preflight is an upper bound, so rounding up is also the only safe direction
56
+ * — the check must not pass on less usage than the action is about to record.
52
57
  */
53
58
  export declare function buildPreflightOptions(options: CheckOptions): CheckFlagOptions | undefined;
@@ -1,7 +1,7 @@
1
- export { LeaseStore, leaseKey, type LeaseEntry, type ILeaseStore } from "./lease-store";
1
+ export { LeaseStore, leaseKey, type LeaseEntry, type ILeaseStore, type ReserveResult } from "./lease-store";
2
2
  export { ReservationStore, type IReservationStore } from "./reservation-store";
3
- export { CreditLeaseManager } from "./lease-manager";
3
+ export { CreditLeaseManager, settleWithin, unrefTimer } from "./lease-manager";
4
4
  export { RedisLeaseStore } from "./redis-lease-store";
5
5
  export { RedisReservationStore } from "./redis-reservation-store";
6
- export { DEFAULT_LEASE_DURATION_MS, DEFAULT_LEASE_SIZE, DEFAULT_LOW_WATER_MARK, DEFAULT_PREWARM_POLL_INTERVAL_MS, DEFAULT_PREWARM_RESOLVE_TIMEOUT_MS, DEFAULT_RESERVATION_TTL_MS, DEFAULT_SWEEP_INTERVAL_MS, MAX_RESERVATION_TTL_MS, RESERVATION_TTL_SKEW_ALLOWANCE_MS, } from "./types";
6
+ export { DEFAULT_LEASE_DURATION_MS, DEFAULT_LEASE_SIZE, DEFAULT_LOW_WATER_MARK, DEFAULT_PREWARM_POLL_INTERVAL_MS, DEFAULT_PREWARM_RESOLVE_TIMEOUT_MS, DEFAULT_RESERVATION_TTL_MS, DEFAULT_SWEEP_INTERVAL_MS, MAX_RESERVATION_TTL_MS, RESERVATION_TTL_SKEW_ALLOWANCE_MS, SHUTDOWN_DRAIN_TIMEOUT_MS, } from "./types";
7
7
  export type { CreditLeaseConfig, CreditLeaseMode, ResolvedLeaseConfig, Reservation, CheckOptions, CheckResult, OnAcquireFailure, TrackWithReservationOptions, } from "./types";
@@ -2,6 +2,15 @@ import type { CreditsClient } from "../api/resources/credits/client/Client";
2
2
  import type { Logger } from "../logger";
3
3
  import { type ILeaseStore, type LeaseEntry } from "./lease-store";
4
4
  import { type CreditLeaseConfig, type ResolvedLeaseConfig } from "./types";
5
+ /** Drop a timer's hold on the event loop where the runtime has one (Node). */
6
+ export declare function unrefTimer(timer: ReturnType<typeof setTimeout>): void;
7
+ /**
8
+ * Await `promises`, giving up after `timeoutMs`. Reports whether everything
9
+ * landed, so a caller winding down can say what it is abandoning. Abandoned
10
+ * work is not cancelled — promises have no cancellation — it just stops being
11
+ * waited on.
12
+ */
13
+ export declare function settleWithin(promises: Promise<unknown>[], timeoutMs: number): Promise<boolean>;
5
14
  /**
6
15
  * Owns the lifecycle of `credit_lease` rows for a single client: acquire on
7
16
  * first use or after expiry, extend when the local view dips below the low
@@ -20,6 +29,8 @@ export declare class CreditLeaseManager {
20
29
  private readonly config;
21
30
  private readonly inflightAcquire;
22
31
  private readonly inflightExtend;
32
+ private readonly background;
33
+ private stopped;
23
34
  constructor(opts: {
24
35
  creditsClient: CreditsClient;
25
36
  leaseStore: ILeaseStore;
@@ -48,12 +59,71 @@ export declare class CreditLeaseManager {
48
59
  * that figure (a single check just failed a reserve for that many
49
60
  * credits — extend opportunistically instead of waiting for the next
50
61
  * sub-watermark check).
62
+ * A caller arriving while an extend is in flight joins it. If its own
63
+ * shortfall is larger than what that extend asked for, it waits the flight
64
+ * out and then issues exactly one follow-up extend for the remaining
65
+ * difference — otherwise it would inherit a tranche-sized ask and fail its
66
+ * post-extend retry with credits still sitting on the server. A flight it
67
+ * finds on the way back is only joined if that one covers the shortfall
68
+ * too; a smaller one is waited out, never inherited.
51
69
  * Returns the in-flight promise so callers can await it or fire-and-forget.
52
70
  * Never rejects (it is often fire-and-forget — a rejection would surface
53
71
  * as an unhandled promise rejection).
54
72
  */
55
- maybeExtendInBackground(companyId: string, creditTypeId: string, requiredCredits?: number, requestOptions?: CreditsClient.RequestOptions): Promise<LeaseEntry | undefined>;
73
+ maybeExtendInBackground(companyId: string, creditTypeId: string, requiredCredits?: number, requestOptions?: CreditsClient.RequestOptions, joinDeadlineMs?: number): Promise<LeaseEntry | undefined>;
74
+ private extendIfNeeded;
75
+ /** When a joiner's wait on a shared flight runs out, or undefined for no cap. */
76
+ private joinDeadline;
77
+ /**
78
+ * Await a flight somebody else is running, giving up at `deadline`. Giving
79
+ * up abandons only our wait: the flight keeps running for the callers still
80
+ * on it, and whatever it installs is there for our next check to read.
81
+ */
82
+ private joinWithin;
83
+ /**
84
+ * Read the slot, reporting `undefined` when the read fails or the lease is
85
+ * absent or expired. An expired lease is never extended: the server treats
86
+ * it as released (its remainder already refunded to the company balance),
87
+ * so the right move is a fresh acquire, which the next check's
88
+ * `acquireIfNeeded` performs. Extending would at best waste a wire call and
89
+ * at worst resurrect a stale local row.
90
+ */
91
+ private readLiveLease;
92
+ /** Whether `entry` sits low enough to warrant an extend. */
93
+ private needsExtend;
94
+ /**
95
+ * Register and run an extend as the slot's in-flight one. The cleanup is
96
+ * identity-guarded rather than an unconditional `delete`: a joiner whose
97
+ * shortfall outran this flight registers a follow-up for the same key, and
98
+ * this flight's `finally` must not evict it.
99
+ */
100
+ private startExtend;
101
+ /**
102
+ * Re-read the slot now that this flight owns it, and extend only if the
103
+ * fresh row still warrants one. The row that decided this extend was read
104
+ * before the flight was registered, so an extend that landed in that gap,
105
+ * clearing its own flight on the way out, would otherwise be followed by a
106
+ * second extend, under a new idempotency key, for a lease it already topped
107
+ * up. The registered `requestedAdditional` stands: a joiner compares its
108
+ * shortfall against that figure, so the wire body has to carry it.
109
+ */
110
+ private recheckAndExtend;
56
111
  private extend;
112
+ /** Hold a reference to unawaited work so `drain()` can wait it out. */
113
+ private track;
114
+ /**
115
+ * Refuse new lease work. Idempotent, and paired with `drain()`: stopping
116
+ * first is what makes the drain terminate, since nothing can enqueue
117
+ * behind it.
118
+ */
119
+ stop(): void;
120
+ /**
121
+ * Wait out lease work already on the wire, so a close releases what that
122
+ * work installs instead of orphaning it. Bounded: whatever has not landed
123
+ * by `timeoutMs` is abandoned rather than stalling the caller's shutdown,
124
+ * and the credits it holds fall back to server-side expiry.
125
+ */
126
+ drain(timeoutMs?: number): Promise<void>;
57
127
  /**
58
128
  * Release every live lease held in the store. ONLY safe when the store is
59
129
  * per-process (in-memory): those leases are exclusively this process's, so
@@ -63,6 +133,8 @@ export declare class CreditLeaseManager {
63
133
  * drawing on the same leases — and is excluded by the `list` capability
64
134
  * check (only the in-memory store implements it). Best-effort: failures
65
135
  * are logged and the lease falls back to server-side expiry.
136
+ * Bounded by `timeoutMs`, so a store or wire call that never lands cannot
137
+ * hold a closing client open; whatever is abandoned expires server-side.
66
138
  */
67
- releaseAllLocalLeases(): Promise<void>;
139
+ releaseAllLocalLeases(timeoutMs?: number): Promise<void>;
68
140
  }
@@ -21,6 +21,14 @@ export interface LeaseEntry {
21
21
  localRemainingCredits: number;
22
22
  expiresAt: Date;
23
23
  }
24
+ /**
25
+ * Outcome of a successful `tryReserve`: the post-debit balance plus the ID of
26
+ * the lease the credits actually came out of.
27
+ */
28
+ export interface ReserveResult {
29
+ balance: number;
30
+ leaseId: string;
31
+ }
24
32
  /** Backing-store contract shared by `LeaseStore` (in-memory) and `RedisLeaseStore` (shared). */
25
33
  export interface ILeaseStore {
26
34
  get(companyId: string, creditTypeId: string): Promise<LeaseEntry | undefined> | LeaseEntry | undefined;
@@ -65,15 +73,23 @@ export interface ILeaseStore {
65
73
  drop(companyId: string, creditTypeId: string): Promise<void>;
66
74
  /**
67
75
  * Atomically check-and-debit `credits` from the lease's remaining balance.
68
- * Returns the post-debit `localRemainingCredits` on success, or `null` if
69
- * there is no live lease, the balance is insufficient, or `credits` is not
70
- * a finite non-negative number (NaN must never reach the debit — it slips
71
- * through every numeric comparison and would poison the balance into
72
- * allowing everything). Returning the balance rather than a boolean lets
73
- * the caller derive the pre-debit figure (`returned + credits`) without a
74
- * follow-up read.
76
+ * Returns the post-debit `localRemainingCredits` together with the
77
+ * `leaseId` the debit landed on, or `null` if there is no live lease, the
78
+ * balance is insufficient, or `credits` is not a finite non-negative
79
+ * number (NaN must never reach the debit — it slips through every numeric
80
+ * comparison and would poison the balance into allowing everything).
81
+ * Returning the balance rather than a boolean lets the caller derive the
82
+ * pre-debit figure (`returned + credits`) without a follow-up read.
83
+ *
84
+ * The debit is NOT keyed by lease ID: it charges whichever lease occupies
85
+ * the slot at that moment, which need not be the one the caller's acquire
86
+ * handed back — the slot's lease can be replaced in between (by the
87
+ * sweeper, or by a sibling pod on a shared backend). The caller MUST
88
+ * therefore pin its reservation to the returned `leaseId`, never to the
89
+ * acquired one: the settle refund, the sweep refund, and the Track event's
90
+ * `lease_id` all have to name the lease that was actually charged.
75
91
  */
76
- tryReserve(companyId: string, creditTypeId: string, credits: number): Promise<number | null>;
92
+ tryReserve(companyId: string, creditTypeId: string, credits: number): Promise<ReserveResult | null>;
77
93
  /**
78
94
  * Refund credits to the slot's lease balance (clamped at `grantedAmount`).
79
95
  * When `leaseId` is supplied, the refund applies ONLY if the slot still
@@ -126,10 +142,10 @@ export declare class LeaseStore implements ILeaseStore {
126
142
  drop(companyId: string, creditTypeId: string): Promise<void>;
127
143
  /**
128
144
  * Attempt to reserve `credits` from the local remaining balance.
129
- * Returns the post-debit balance on success, `null` if there isn't enough
130
- * remaining (see `ILeaseStore.tryReserve`).
145
+ * Returns the post-debit balance and the charged lease's ID on success,
146
+ * `null` if there isn't enough remaining (see `ILeaseStore.tryReserve`).
131
147
  */
132
- tryReserve(companyId: string, creditTypeId: string, credits: number): Promise<number | null>;
148
+ tryReserve(companyId: string, creditTypeId: string, credits: number): Promise<ReserveResult | null>;
133
149
  /**
134
150
  * Refund credits back to the local balance (capped at grantedAmount).
135
151
  * When `leaseId` is given, the refund is dropped if the slot now holds a
@@ -1,5 +1,5 @@
1
1
  import type { RedisClient } from "../cache/redis";
2
- import { type ILeaseStore, type LeaseEntry } from "./lease-store";
2
+ import { type ILeaseStore, type LeaseEntry, type ReserveResult } from "./lease-store";
3
3
  /**
4
4
  * Redis-backed lease store. One hash per `(companyId, creditTypeId)` slot, with
5
5
  * atomic mutations via single-key Lua scripts so it stays correct on both
@@ -25,6 +25,6 @@ export declare class RedisLeaseStore implements ILeaseStore {
25
25
  replace(entry: Omit<LeaseEntry, "localRemainingCredits">): Promise<boolean>;
26
26
  extend(companyId: string, creditTypeId: string, grantedAmount: number, newExpiresAt?: Date, leaseId?: string): Promise<void>;
27
27
  drop(companyId: string, creditTypeId: string): Promise<void>;
28
- tryReserve(companyId: string, creditTypeId: string, credits: number): Promise<number | null>;
28
+ tryReserve(companyId: string, creditTypeId: string, credits: number): Promise<ReserveResult | null>;
29
29
  refund(companyId: string, creditTypeId: string, credits: number, leaseId?: string): Promise<void>;
30
30
  }