@owostack/types 0.2.0 → 0.3.1

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 (2) hide show
  1. package/dist/index.d.ts +90 -4
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -90,6 +90,56 @@ interface OverageDetails {
90
90
  /** Number of units per billing increment */
91
91
  billingUnits?: number | null;
92
92
  }
93
+ /** A single tier in a usage pricing model */
94
+ interface PricingTier {
95
+ /** Inclusive upper bound for this tier; null means infinity */
96
+ upTo: number | null;
97
+ /** Optional price per unit in minor currency units */
98
+ unitPrice?: number;
99
+ /** Optional flat fee charged when this tier is entered */
100
+ flatFee?: number;
101
+ }
102
+ /** How billable usage is converted into money */
103
+ type RatingModel = "package" | "graduated" | "volume";
104
+ /** Current tier for tiered pricing responses */
105
+ interface CurrentPricingTier {
106
+ /** Zero-based tier index */
107
+ index: number;
108
+ /** Usage at which this tier starts */
109
+ startsAt: number;
110
+ /** Inclusive upper bound of the tier; null means infinity */
111
+ endsAt: number | null;
112
+ /** Price per unit for this tier; 0 when the tier is flat-only */
113
+ unitPrice: number;
114
+ /** Optional flat fee charged when this tier is entered */
115
+ flatFee?: number;
116
+ }
117
+ /** Pricing metadata returned alongside access/billing responses */
118
+ interface PricingDetails {
119
+ /** Entitlement model for this feature */
120
+ usageModel?: "included" | "usage_based" | "prepaid";
121
+ /** Rating model used when usage is billable */
122
+ ratingModel?: RatingModel;
123
+ /** Package or per-unit price in minor currency units */
124
+ pricePerUnit?: number | null;
125
+ /** Package size for package pricing */
126
+ billingUnits?: number | null;
127
+ /** Current tier when using graduated or volume pricing */
128
+ currentTier?: CurrentPricingTier;
129
+ }
130
+ /** Per-tier billing breakdown for rated usage */
131
+ interface BillingTierBreakdown {
132
+ /** Zero-based tier index */
133
+ tier: number;
134
+ /** Units billed in this tier */
135
+ units: number;
136
+ /** Price per unit for this tier; 0 when the tier is flat-only */
137
+ unitPrice: number;
138
+ /** Optional flat fee applied for the tier */
139
+ flatFee?: number;
140
+ /** Amount billed for this tier in minor currency units */
141
+ amount: number;
142
+ }
93
143
  /**
94
144
  * Contextual details object returned alongside standard check/track fields.
95
145
  * Contains all optional/situational information that isn't part of the
@@ -114,6 +164,8 @@ interface ResponseDetails {
114
164
  addonCreditsUsed?: number;
115
165
  /** Remaining add-on credits after this request */
116
166
  addonCreditsRemaining?: number;
167
+ /** Pricing metadata for chargeable metered features */
168
+ pricing?: PricingDetails;
117
169
  }
118
170
  /** Plan credit breakdown for credit system features */
119
171
  interface PlanCredits {
@@ -209,6 +261,14 @@ interface BillingFeatureUsage {
209
261
  estimatedAmount: number;
210
262
  /** Usage billing model */
211
263
  usageModel: string;
264
+ /** Rating model used to calculate the estimated amount */
265
+ ratingModel?: RatingModel;
266
+ /** Package or per-unit price in minor currency units */
267
+ pricePerUnit?: number | null;
268
+ /** Package size when using package pricing */
269
+ billingUnits?: number | null;
270
+ /** Optional tier breakdown for graduated or volume pricing */
271
+ tierBreakdown?: BillingTierBreakdown[];
212
272
  }
213
273
  interface BillingUsageResult {
214
274
  /** Whether the request succeeded */
@@ -232,10 +292,14 @@ interface InvoiceLineItem {
232
292
  description: string;
233
293
  /** Quantity */
234
294
  quantity: number;
235
- /** Unit price in minor currency units */
295
+ /** Unit price component in minor currency units; tiered lines rely on tierBreakdown for exact pricing */
236
296
  unitPrice: number;
237
- /** Line total in minor currency units */
297
+ /** Line total in minor currency units; may include package rounding or flat tier amounts */
238
298
  amount: number;
299
+ /** Rating model used for tiered usage lines */
300
+ ratingModel?: RatingModel;
301
+ /** Optional tier breakdown for graduated or volume usage lines */
302
+ tierBreakdown?: BillingTierBreakdown[];
239
303
  }
240
304
  interface Invoice {
241
305
  /** Invoice ID */
@@ -332,7 +396,7 @@ interface AddonResult {
332
396
  type PaymentChannel = "card" | "bank" | "bank_transfer" | "ussd" | "mobile_money" | "qr";
333
397
  type Currency = "NGN" | "GHS" | "ZAR" | "KES" | "USD" | "CAD" | "EUR" | "GBP" | "CHF" | "SEK" | "NOK" | "DKK" | "PLN" | "CZK" | "JPY" | "CNY" | "INR" | "SGD" | "HKD" | "AUD" | "NZD" | "BRL" | "MXN" | "ARS" | "COP" | "AED" | "SAR" | "EGP" | (string & {});
334
398
  type PlanInterval = "daily" | "weekly" | "monthly" | "quarterly" | "yearly";
335
- type ResetInterval = "never" | "5min" | "15min" | "30min" | "hourly" | "daily" | "weekly" | "monthly" | "quarterly" | "yearly";
399
+ type ResetInterval = "none" | "never" | "5min" | "15min" | "30min" | "hourly" | "daily" | "weekly" | "monthly" | "quarterly" | "semi_annual" | "yearly";
336
400
  type SubscriptionStatus = "active" | "canceled" | "expired" | "incomplete" | "incomplete_expired" | "past_due" | "trialing" | "unpaid";
337
401
  /**
338
402
  * Plan and feature definitions
@@ -440,6 +504,14 @@ interface MeteredFeatureConfig {
440
504
  maxOverageUnits?: number;
441
505
  /** Billing units for overage */
442
506
  billingUnits?: number;
507
+ /** Entitlement model for this feature */
508
+ usageModel?: "included" | "usage_based" | "prepaid";
509
+ /** Package or per-unit price in minor currency units */
510
+ pricePerUnit?: number;
511
+ /** Rating model used for billable usage */
512
+ ratingModel?: RatingModel;
513
+ /** Tiers used for graduated or volume pricing */
514
+ tiers?: PricingTier[];
443
515
  /** Credit cost for credit systems */
444
516
  creditCost?: number;
445
517
  /** Whether feature is enabled (default: true) */
@@ -627,6 +699,16 @@ interface PublicPlanFeature {
627
699
  overage?: "block" | "charge";
628
700
  /** Overage price per unit in minor currency units */
629
701
  overagePrice?: number | null;
702
+ /** Entitlement model for metered features */
703
+ usageModel?: "included" | "usage_based" | "prepaid";
704
+ /** Package or per-unit price in minor currency units */
705
+ pricePerUnit?: number | null;
706
+ /** Package size for package pricing */
707
+ billingUnits?: number | null;
708
+ /** Rating model used for billable usage */
709
+ ratingModel?: RatingModel;
710
+ /** Tier definitions for graduated or volume pricing */
711
+ tiers?: PricingTier[] | null;
630
712
  }
631
713
  /** A plan as returned by the public API — safe for client-side consumption */
632
714
  interface PublicPlan {
@@ -711,6 +793,10 @@ interface SyncPayload {
711
793
  enabled: boolean;
712
794
  limit?: number | null;
713
795
  reset?: ResetInterval;
796
+ usageModel?: "included" | "usage_based" | "prepaid";
797
+ pricePerUnit?: number;
798
+ ratingModel?: RatingModel;
799
+ tiers?: PricingTier[];
714
800
  overage?: "block" | "charge";
715
801
  overagePrice?: number;
716
802
  maxOverageUnits?: number;
@@ -845,4 +931,4 @@ interface ListEntitiesResult {
845
931
  total: number;
846
932
  }
847
933
 
848
- export type { AddEntityParams, AddEntityResult, AddonParams, AddonResult, AttachParams, AttachResult, BillingFeatureUsage, BillingUsageParams, BillingUsageResult, BooleanFeatureConfig, CardInfo, CatalogEntry, CheckCode, CheckParams, CheckResult, CreditPackDefinition, CreditSystemDefinition, CreditSystemFeatureEntry, Currency, Customer, CustomerData, CustomerParams, CustomerResult, Entitlement, Entity, Feature, FeatureLimit, Invoice, InvoiceLineItem, InvoiceParams, InvoiceResult, InvoicesParams, InvoicesResult, ListEntitiesParams, ListEntitiesResult, MeteredFeatureConfig, OverageDetails, OwostackConfig, PayInvoiceParams, PayInvoiceResult, PaymentChannel, PaymentMethodInfo, Plan, PlanCredits, PlanDefinition, PlanFeatureEntry, PlanInterval, PlansParams, PlansResult, PublicPlan, PublicPlanFeature, RemoveEntityParams, RemoveEntityResult, ResetInterval, ResponseDetails, Subscription, SubscriptionStatus, SyncChanges, SyncPayload, SyncResult, TrackCode, TrackParams, TrackResult, UsageRecord, WalletRemoveResult, WalletResult, WalletSetupParams, WalletSetupResult };
934
+ export type { AddEntityParams, AddEntityResult, AddonParams, AddonResult, AttachParams, AttachResult, BillingFeatureUsage, BillingTierBreakdown, BillingUsageParams, BillingUsageResult, BooleanFeatureConfig, CardInfo, CatalogEntry, CheckCode, CheckParams, CheckResult, CreditPackDefinition, CreditSystemDefinition, CreditSystemFeatureEntry, Currency, CurrentPricingTier, Customer, CustomerData, CustomerParams, CustomerResult, Entitlement, Entity, Feature, FeatureLimit, Invoice, InvoiceLineItem, InvoiceParams, InvoiceResult, InvoicesParams, InvoicesResult, ListEntitiesParams, ListEntitiesResult, MeteredFeatureConfig, OverageDetails, OwostackConfig, PayInvoiceParams, PayInvoiceResult, PaymentChannel, PaymentMethodInfo, Plan, PlanCredits, PlanDefinition, PlanFeatureEntry, PlanInterval, PlansParams, PlansResult, PricingDetails, PricingTier, PublicPlan, PublicPlanFeature, RatingModel, RemoveEntityParams, RemoveEntityResult, ResetInterval, ResponseDetails, Subscription, SubscriptionStatus, SyncChanges, SyncPayload, SyncResult, TrackCode, TrackParams, TrackResult, UsageRecord, WalletRemoveResult, WalletResult, WalletSetupParams, WalletSetupResult };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owostack/types",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "Shared TypeScript types for Owostack",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {