@nehorai/credits 2.0.0 → 2.1.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.
Files changed (43) hide show
  1. package/README.md +384 -377
  2. package/dist/adapters/index.cjs +10 -6
  3. package/dist/adapters/index.cjs.map +1 -1
  4. package/dist/adapters/index.d.cts +3 -2
  5. package/dist/adapters/index.d.ts +3 -2
  6. package/dist/adapters/index.js +10 -6
  7. package/dist/adapters/index.js.map +1 -1
  8. package/dist/auth/index.cjs.map +1 -1
  9. package/dist/auth/index.js.map +1 -1
  10. package/dist/core/index.cjs +4 -2
  11. package/dist/core/index.cjs.map +1 -1
  12. package/dist/core/index.d.cts +4 -4
  13. package/dist/core/index.d.ts +4 -4
  14. package/dist/core/index.js +4 -2
  15. package/dist/core/index.js.map +1 -1
  16. package/dist/index.cjs +10 -6
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +6 -4
  19. package/dist/index.d.ts +6 -4
  20. package/dist/index.js +10 -6
  21. package/dist/index.js.map +1 -1
  22. package/dist/repository/index.cjs +4 -2
  23. package/dist/repository/index.cjs.map +1 -1
  24. package/dist/repository/index.d.cts +3 -3
  25. package/dist/repository/index.d.ts +3 -3
  26. package/dist/repository/index.js +4 -2
  27. package/dist/repository/index.js.map +1 -1
  28. package/dist/sdk/index.cjs.map +1 -1
  29. package/dist/sdk/index.d.cts +2 -2
  30. package/dist/sdk/index.d.ts +2 -2
  31. package/dist/sdk/index.js.map +1 -1
  32. package/dist/service/index.cjs +4 -2
  33. package/dist/service/index.cjs.map +1 -1
  34. package/dist/service/index.d.cts +2 -2
  35. package/dist/service/index.d.ts +2 -2
  36. package/dist/service/index.js +4 -2
  37. package/dist/service/index.js.map +1 -1
  38. package/dist/{types-BmG5Omzj.d.ts → types-BhCdep_t.d.ts} +1 -1
  39. package/dist/{types-DJ8yqaVr.d.ts → types-Dzc443vy.d.cts} +5 -1
  40. package/dist/{types-DJ8yqaVr.d.cts → types-Dzc443vy.d.ts} +5 -1
  41. package/dist/{types-C8hZMe8a.d.cts → types-wtksMa4n.d.cts} +1 -1
  42. package/package.json +71 -70
  43. package/LICENSE +0 -21
@@ -1,5 +1,5 @@
1
- import { c as PortableUserCredits, g as CreditCheckResult, C as CreditOperationType, a as PortableReservation, d as PortableUsageLog, D as DeductCreditsResult, S as SubscriptionTier, j as UsageHistoryResponse, f as PortableJournalEntry } from '../types-DJ8yqaVr.cjs';
2
- import { I as ICreditRepository, n as ReserveOutcome, l as ReservationTransitionOptions, C as CommitOutcome, R as ReleaseOutcome, A as AddCreditsAtomicOptions, a as AddCreditsOutcome, J as JournalEntryQuery } from '../types-C8hZMe8a.cjs';
1
+ import { c as PortableUserCredits, g as CreditCheckResult, C as CreditOperationType, a as PortableReservation, d as PortableUsageLog, D as DeductCreditsResult, S as SubscriptionTier, j as UsageHistoryResponse, f as PortableJournalEntry } from '../types-Dzc443vy.cjs';
2
+ import { I as ICreditRepository, n as ReserveOutcome, l as ReservationTransitionOptions, C as CommitOutcome, R as ReleaseOutcome, A as AddCreditsAtomicOptions, a as AddCreditsOutcome, J as JournalEntryQuery } from '../types-wtksMa4n.cjs';
3
3
 
4
4
  /**
5
5
  * Notification callback type for low balance notifications
@@ -1,5 +1,5 @@
1
- import { c as PortableUserCredits, g as CreditCheckResult, C as CreditOperationType, a as PortableReservation, d as PortableUsageLog, D as DeductCreditsResult, S as SubscriptionTier, j as UsageHistoryResponse, f as PortableJournalEntry } from '../types-DJ8yqaVr.js';
2
- import { I as ICreditRepository, n as ReserveOutcome, l as ReservationTransitionOptions, C as CommitOutcome, R as ReleaseOutcome, A as AddCreditsAtomicOptions, a as AddCreditsOutcome, J as JournalEntryQuery } from '../types-BmG5Omzj.js';
1
+ import { c as PortableUserCredits, g as CreditCheckResult, C as CreditOperationType, a as PortableReservation, d as PortableUsageLog, D as DeductCreditsResult, S as SubscriptionTier, j as UsageHistoryResponse, f as PortableJournalEntry } from '../types-Dzc443vy.js';
2
+ import { I as ICreditRepository, n as ReserveOutcome, l as ReservationTransitionOptions, C as CommitOutcome, R as ReleaseOutcome, A as AddCreditsAtomicOptions, a as AddCreditsOutcome, J as JournalEntryQuery } from '../types-BhCdep_t.js';
3
3
 
4
4
  /**
5
5
  * Notification callback type for low balance notifications
@@ -199,11 +199,13 @@ var creditSystemConfigSchema = z.object({
199
199
  /**
200
200
  * Operation costs in credits
201
201
  * Keys are operation type names (any non-empty string)
202
- * Values are positive numbers representing credit cost
202
+ * Values are non-negative numbers representing credit cost. 0 marks a free
203
+ * operation: `withCredits` runs it without touching the ledger. Amounts that
204
+ * move credits stay strictly positive, so `reserveCredits` refuses a 0.
203
205
  */
204
206
  operationCosts: z.record(
205
207
  z.string().min(1),
206
- z.number().positive()
208
+ z.number().nonnegative()
207
209
  ),
208
210
  /**
209
211
  * Display labels for operation types (English canonical labels).