@happyvertical/smrt-subscriptions 0.43.9 → 0.44.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/AGENTS.md +15 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +200 -31
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +1 -1
- package/dist/services/commercial.d.ts +25 -2
- package/dist/services/commercial.d.ts.map +1 -1
- package/dist/services/index.d.ts +2 -2
- package/dist/services/index.d.ts.map +1 -1
- package/dist/smrt-knowledge.json +5 -5
- package/package.json +5 -5
package/AGENTS.md
CHANGED
|
@@ -34,6 +34,21 @@ that reverted to DECIMAL passes every SQLite suite.
|
|
|
34
34
|
compare charge sums against `limitAmount` exactly.
|
|
35
35
|
- **`adjust()` rejects a fractional amount.** Negative amounts are legitimate
|
|
36
36
|
(a credit); fractional ones almost always mean the caller passed major units.
|
|
37
|
+
- **Billing rejects immediate JSON write-back.** The JSON adapter's default
|
|
38
|
+
`writeStrategy: 'immediate'` and DuckDB with that write-back strategy export
|
|
39
|
+
files before transaction commit, while adapter rollback restores only the
|
|
40
|
+
database transaction. `CommercialUsageService` therefore fails before setup
|
|
41
|
+
on those configurations. PostgreSQL, SQLite, ordinary DuckDB, and explicit
|
|
42
|
+
non-immediate write strategies remain supported. When supplying an already
|
|
43
|
+
resolved database handle, also pass `billingStorage` so this capability
|
|
44
|
+
decision is explicit rather than inferred from private adapter state.
|
|
45
|
+
- **Embedded sourced adjustments serialize per database.** SQLite, DuckDB, and
|
|
46
|
+
supported non-immediate JSON handles multiplex local writes; the complete
|
|
47
|
+
deterministic adjustment flow, including recovery reads, runs under one
|
|
48
|
+
database-scoped lock. Every supported embedded adjustment transaction,
|
|
49
|
+
sourced or unsourced, also holds the core embedded write queue for its full
|
|
50
|
+
lifetime; transaction-bound model saves re-enter that hold so adjustments
|
|
51
|
+
cannot absorb, roll back, or deadlock with unrelated ordinary writes.
|
|
37
52
|
- **UI formats by dividing, never by `toFixed`.** `PlanPicker` and
|
|
38
53
|
`CommercialOverview` scale back to major units using the currency's own
|
|
39
54
|
minor-unit exponent, so zero-decimal currencies (JPY, KRW) are not divided.
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ export { SubscriptionPlanCollection, TenantSubscriptionCollection, TenantUsageMe
|
|
|
2
2
|
export { migrateSubscriptionsMoneyToMinorUnits, preflightSubscriptionsMoneyMinorUnits, SUBSCRIPTIONS_MONEY_COLUMNS, SUBSCRIPTIONS_MONEY_MINOR_UNITS_BACKFILL, } from './migrations/moneyMinorUnits.js';
|
|
3
3
|
export type { PricingStrategy, SpendingPeriod, SpendingPolicyBehavior, } from './models/index.js';
|
|
4
4
|
export { BillingAdjustment, BillingAdjustmentCollection, ClientCharge, ClientChargeCollection, PricingRule, PricingRuleCollection, SpendingPolicy, SpendingPolicyCollection, SubscriptionPlan, TenantSubscription, TenantUsageMetric, } from './models/index.js';
|
|
5
|
-
export type { CustomPricingContext, CustomPricingStrategy, PriceUsageOptions, SpendingDecision, } from './services/index.js';
|
|
6
|
-
export { CommercialUsageService, evaluateThreshold, evaluateThresholds, SpendingPolicyEvaluator, type SubscriptionPlanReader, SubscriptionResolver, type SubscriptionResolverReaders, type TenantSubscriptionReader, TenantUsageMeter, type UsageSummaryReader, } from './services/index.js';
|
|
5
|
+
export type { CommercialBillingStorage, CommercialUsageServiceOptions, CustomPricingContext, CustomPricingStrategy, PriceUsageOptions, SpendingDecision, } from './services/index.js';
|
|
6
|
+
export { assertCommercialBillingStorageSupported, CommercialBillingStorageConfigurationError, CommercialUsageService, evaluateThreshold, evaluateThresholds, SpendingPolicyEvaluator, type SubscriptionPlanReader, SubscriptionResolver, type SubscriptionResolverReaders, type TenantSubscriptionReader, TenantUsageMeter, UnsupportedCommercialBillingStorageError, type UsageSummaryReader, } from './services/index.js';
|
|
7
7
|
export type { AiUsageSummary, BillingInterval, EntitlementResolution, EntitlementResolutionContext, JsonObject, PlanFeatureGrant, PlanThreshold, RecordUsageOptions, Subscriber, SubscriberKind, SubscriptionPlanStatus, SubscriptionResolverOptions, SubscriptionStatus, SummarizeAiUsageOptions, SummarizeUsageBatchOptions, SummarizeUsageOptions, ThresholdEnforcement, ThresholdEvaluation, ThresholdWindow, UsageMeterOptions, UsageMetricRecord, UsageSummary, UsageWindow, } from './types.js';
|
|
8
8
|
export { assertSubscriberInvariant, getWindowForThreshold, getWindowKey, isValidThreshold, normalizeFeatureGrants, normalizeSubscriber, subscriberToColumns, } from './utils.js';
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,2BAA2B,GAC5B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,qCAAqC,EACrC,qCAAqC,EACrC,2BAA2B,EAC3B,wCAAwC,GACzC,MAAM,iCAAiC,CAAC;AACzC,YAAY,EACV,eAAe,EACf,cAAc,EACd,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,iBAAiB,EACjB,2BAA2B,EAC3B,YAAY,EACZ,sBAAsB,EACtB,WAAW,EACX,qBAAqB,EACrB,cAAc,EACd,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,EACvB,KAAK,sBAAsB,EAC3B,oBAAoB,EACpB,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,gBAAgB,EAChB,KAAK,kBAAkB,GACxB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,4BAA4B,EAC5B,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,UAAU,EACV,cAAc,EACd,sBAAsB,EACtB,2BAA2B,EAC3B,kBAAkB,EAClB,uBAAuB,EACvB,0BAA0B,EAC1B,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,YAAY,EACZ,gBAAgB,EAChB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,2BAA2B,GAC5B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,qCAAqC,EACrC,qCAAqC,EACrC,2BAA2B,EAC3B,wCAAwC,GACzC,MAAM,iCAAiC,CAAC;AACzC,YAAY,EACV,eAAe,EACf,cAAc,EACd,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,iBAAiB,EACjB,2BAA2B,EAC3B,YAAY,EACZ,sBAAsB,EACtB,WAAW,EACX,qBAAqB,EACrB,cAAc,EACd,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,wBAAwB,EACxB,6BAA6B,EAC7B,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AA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