@owostack/types 0.3.2 → 0.4.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/README.md +3 -0
- package/dist/index.d.ts +36 -10
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -25,9 +25,12 @@ import type {
|
|
|
25
25
|
OwostackConfig,
|
|
26
26
|
AttachParams,
|
|
27
27
|
CheckResult,
|
|
28
|
+
CreditsBalanceDetails,
|
|
28
29
|
} from "@owostack/types";
|
|
29
30
|
```
|
|
30
31
|
|
|
32
|
+
`CheckResult` and `TrackResult` expose canonical credit-backed balance state via `credits`, which is `null` for non-credit features and otherwise resolves to either a `credit_system` or `prepaid` shape.
|
|
33
|
+
|
|
31
34
|
## License
|
|
32
35
|
|
|
33
36
|
Apache-2.0
|
package/dist/index.d.ts
CHANGED
|
@@ -168,14 +168,37 @@ interface ResponseDetails {
|
|
|
168
168
|
pricing?: PricingDetails;
|
|
169
169
|
}
|
|
170
170
|
/** Plan credit breakdown for credit system features */
|
|
171
|
-
interface
|
|
171
|
+
interface CreditPlanBalance {
|
|
172
172
|
/** Credits used this period */
|
|
173
173
|
used: number;
|
|
174
174
|
/** Plan credit limit */
|
|
175
175
|
limit: number | null;
|
|
176
|
+
/** Remaining plan credits: limit - used (null = unlimited) */
|
|
177
|
+
balance: number | null;
|
|
176
178
|
/** ISO timestamp when plan credits reset */
|
|
177
179
|
resetsAt: string;
|
|
178
180
|
}
|
|
181
|
+
interface CreditSystemBalanceDetails {
|
|
182
|
+
/** Source of the balance details */
|
|
183
|
+
source: "credit_system";
|
|
184
|
+
/** Credit system slug backing this feature */
|
|
185
|
+
systemSlug: string;
|
|
186
|
+
/** Credit cost per unit for this feature */
|
|
187
|
+
costPerUnit: number;
|
|
188
|
+
/** Purchased add-on balance remaining for this credit system */
|
|
189
|
+
addonBalance: number;
|
|
190
|
+
/** Plan-provided balance for the current reset window */
|
|
191
|
+
plan: CreditPlanBalance;
|
|
192
|
+
}
|
|
193
|
+
interface PrepaidBalanceDetails {
|
|
194
|
+
/** Source of the balance details */
|
|
195
|
+
source: "prepaid";
|
|
196
|
+
/** Purchased add-on balance is not applicable for prepaid features */
|
|
197
|
+
addonBalance: null;
|
|
198
|
+
/** Plan-provided balance for the current reset window */
|
|
199
|
+
plan: CreditPlanBalance;
|
|
200
|
+
}
|
|
201
|
+
type CreditsBalanceDetails = CreditSystemBalanceDetails | PrepaidBalanceDetails;
|
|
179
202
|
interface CheckResult {
|
|
180
203
|
/** Whether access is allowed */
|
|
181
204
|
allowed: boolean;
|
|
@@ -191,10 +214,8 @@ interface CheckResult {
|
|
|
191
214
|
resetsAt: string | null;
|
|
192
215
|
/** Reset interval (null for boolean features) */
|
|
193
216
|
resetInterval: string | null;
|
|
194
|
-
/**
|
|
195
|
-
|
|
196
|
-
/** Plan credit breakdown (only for credit system features) */
|
|
197
|
-
planCredits?: PlanCredits;
|
|
217
|
+
/** Canonical balance details for credit-backed features */
|
|
218
|
+
credits: CreditsBalanceDetails | null;
|
|
198
219
|
/** Contextual details (trial info, plan name, overage, human message) */
|
|
199
220
|
details: ResponseDetails;
|
|
200
221
|
}
|
|
@@ -232,10 +253,8 @@ interface TrackResult {
|
|
|
232
253
|
resetsAt: string | null;
|
|
233
254
|
/** Reset interval */
|
|
234
255
|
resetInterval: string | null;
|
|
235
|
-
/**
|
|
236
|
-
|
|
237
|
-
/** Plan credit breakdown (only for credit system features) */
|
|
238
|
-
planCredits?: PlanCredits;
|
|
256
|
+
/** Canonical balance details for credit-backed features */
|
|
257
|
+
credits: CreditsBalanceDetails | null;
|
|
239
258
|
/** Contextual details (trial info, plan name, overage, human message) */
|
|
240
259
|
details: ResponseDetails;
|
|
241
260
|
}
|
|
@@ -494,6 +513,8 @@ type CatalogEntry = PlanDefinition | CreditSystemDefinition | CreditPackDefiniti
|
|
|
494
513
|
interface MeteredFeatureConfig {
|
|
495
514
|
/** Limit for this plan (null = unlimited) */
|
|
496
515
|
limit?: number | null;
|
|
516
|
+
/** Limit for this plan during a trial period (null = unlimited) */
|
|
517
|
+
trialLimit?: number | null;
|
|
497
518
|
/** Reset interval (default: "monthly") */
|
|
498
519
|
reset?: ResetInterval;
|
|
499
520
|
/** Overage behavior (default: "block") */
|
|
@@ -693,6 +714,8 @@ interface PublicPlanFeature {
|
|
|
693
714
|
enabled: boolean;
|
|
694
715
|
/** Usage limit (null = unlimited) */
|
|
695
716
|
limit: number | null;
|
|
717
|
+
/** Trial usage limit (null = unlimited) */
|
|
718
|
+
trialLimit?: number | null;
|
|
696
719
|
/** Reset interval */
|
|
697
720
|
resetInterval: string | null;
|
|
698
721
|
/** Unit label (e.g. "call", "message", "GB") */
|
|
@@ -738,6 +761,8 @@ interface PublicPlan {
|
|
|
738
761
|
planGroup: string | null;
|
|
739
762
|
/** Trial period in days (0 = no trial) */
|
|
740
763
|
trialDays: number;
|
|
764
|
+
/** Whether a card is required to start the trial */
|
|
765
|
+
trialCardRequired: boolean;
|
|
741
766
|
/** Features included in this plan */
|
|
742
767
|
features: PublicPlanFeature[];
|
|
743
768
|
}
|
|
@@ -795,6 +820,7 @@ interface SyncPayload {
|
|
|
795
820
|
slug: string;
|
|
796
821
|
enabled: boolean;
|
|
797
822
|
limit?: number | null;
|
|
823
|
+
trialLimit?: number | null;
|
|
798
824
|
reset?: ResetInterval;
|
|
799
825
|
usageModel?: "included" | "usage_based" | "prepaid";
|
|
800
826
|
pricePerUnit?: number;
|
|
@@ -934,4 +960,4 @@ interface ListEntitiesResult {
|
|
|
934
960
|
total: number;
|
|
935
961
|
}
|
|
936
962
|
|
|
937
|
-
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,
|
|
963
|
+
export type { AddEntityParams, AddEntityResult, AddonParams, AddonResult, AttachParams, AttachResult, BillingFeatureUsage, BillingTierBreakdown, BillingUsageParams, BillingUsageResult, BooleanFeatureConfig, CardInfo, CatalogEntry, CheckCode, CheckParams, CheckResult, CreditPackDefinition, CreditPlanBalance, CreditSystemBalanceDetails, CreditSystemDefinition, CreditSystemFeatureEntry, CreditsBalanceDetails, 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, PlanDefinition, PlanFeatureEntry, PlanInterval, PlansParams, PlansResult, PrepaidBalanceDetails, 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.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Shared TypeScript types for Owostack",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"exports": {
|
|
18
18
|
".": {
|
|
19
19
|
"types": "./dist/index.d.ts",
|
|
20
|
+
"development": "./src/index.ts",
|
|
20
21
|
"import": "./dist/index.js"
|
|
21
22
|
}
|
|
22
23
|
},
|