@nehorai/credits 3.0.0 → 3.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.
- package/dist/adapters/index.cjs +169 -156
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.d.cts +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/adapters/index.js +169 -156
- package/dist/adapters/index.js.map +1 -1
- package/dist/core/index.cjs +9 -1
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +9 -1
- package/dist/core/index.js.map +1 -1
- package/dist/index-BrogG0Gc.d.cts +277 -0
- package/dist/index-DOvJES2m.d.ts +277 -0
- package/dist/index.cjs +78 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +76 -10
- package/dist/index.js.map +1 -1
- package/dist/repository/index.cjs +71 -8
- package/dist/repository/index.cjs.map +1 -1
- package/dist/repository/index.d.cts +3 -255
- package/dist/repository/index.d.ts +3 -255
- package/dist/repository/index.js +71 -8
- package/dist/repository/index.js.map +1 -1
- package/dist/service/index.cjs +17 -3
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.d.cts +1 -1
- package/dist/service/index.d.ts +1 -1
- package/dist/service/index.js +17 -3
- package/dist/service/index.js.map +1 -1
- package/dist/{types-CY-oHIMA.d.ts → types-BL3YqxUD.d.ts} +9 -3
- package/dist/{types-DOjguhEX.d.cts → types-YLAB8bFk.d.cts} +9 -3
- package/package.json +1 -1
|
@@ -369,6 +369,7 @@ interface CreditBalanceUpdate {
|
|
|
369
369
|
balance?: number;
|
|
370
370
|
bonusCredits?: number;
|
|
371
371
|
reserved?: number;
|
|
372
|
+
/** Writes no journal line. To change a tier, use `updateUserTier`. */
|
|
372
373
|
tier?: SubscriptionTier;
|
|
373
374
|
monthlyLimit?: number;
|
|
374
375
|
monthlyUsed?: number;
|
|
@@ -461,7 +462,9 @@ interface ICreditRepository extends Partial<ICreditRepositoryV2>, Partial<ICredi
|
|
|
461
462
|
*/
|
|
462
463
|
getUserCredits(userId: string): Promise<PortableUserCredits | null>;
|
|
463
464
|
/**
|
|
464
|
-
* Initialize credits for a new user
|
|
465
|
+
* Initialize credits for a new user. Creating an account with a balance above 0
|
|
466
|
+
* writes its journal line (`signupGrantJournalInput`) in the same atomic step, and
|
|
467
|
+
* a call that finds the account writes nothing.
|
|
465
468
|
* @param userId - User ID
|
|
466
469
|
* @param tier - Initial subscription tier
|
|
467
470
|
* @param initialBalance - Initial credit balance
|
|
@@ -469,13 +472,16 @@ interface ICreditRepository extends Partial<ICreditRepositoryV2>, Partial<ICredi
|
|
|
469
472
|
*/
|
|
470
473
|
initializeUserCredits(userId: string, tier: SubscriptionTier, initialBalance: number): Promise<PortableUserCredits>;
|
|
471
474
|
/**
|
|
472
|
-
*
|
|
475
|
+
* Patch fields of the account. This writes no journal line, whatever it changes.
|
|
476
|
+
* A tier change goes through `updateUserTier`, which journals a balance it moves.
|
|
473
477
|
* @param userId - User ID
|
|
474
478
|
* @param updates - Partial updates to apply
|
|
475
479
|
*/
|
|
476
480
|
updateUserCredits(userId: string, updates: CreditBalanceUpdate): Promise<void>;
|
|
477
481
|
/**
|
|
478
|
-
* Update user subscription tier
|
|
482
|
+
* Update user subscription tier. A write that moves the balance writes one journal
|
|
483
|
+
* line (`tierChangeJournalInput`) in the same atomic step, and one that does not
|
|
484
|
+
* writes none.
|
|
479
485
|
* @param userId - User ID
|
|
480
486
|
* @param input - Tier update data
|
|
481
487
|
*/
|
|
@@ -369,6 +369,7 @@ interface CreditBalanceUpdate {
|
|
|
369
369
|
balance?: number;
|
|
370
370
|
bonusCredits?: number;
|
|
371
371
|
reserved?: number;
|
|
372
|
+
/** Writes no journal line. To change a tier, use `updateUserTier`. */
|
|
372
373
|
tier?: SubscriptionTier;
|
|
373
374
|
monthlyLimit?: number;
|
|
374
375
|
monthlyUsed?: number;
|
|
@@ -461,7 +462,9 @@ interface ICreditRepository extends Partial<ICreditRepositoryV2>, Partial<ICredi
|
|
|
461
462
|
*/
|
|
462
463
|
getUserCredits(userId: string): Promise<PortableUserCredits | null>;
|
|
463
464
|
/**
|
|
464
|
-
* Initialize credits for a new user
|
|
465
|
+
* Initialize credits for a new user. Creating an account with a balance above 0
|
|
466
|
+
* writes its journal line (`signupGrantJournalInput`) in the same atomic step, and
|
|
467
|
+
* a call that finds the account writes nothing.
|
|
465
468
|
* @param userId - User ID
|
|
466
469
|
* @param tier - Initial subscription tier
|
|
467
470
|
* @param initialBalance - Initial credit balance
|
|
@@ -469,13 +472,16 @@ interface ICreditRepository extends Partial<ICreditRepositoryV2>, Partial<ICredi
|
|
|
469
472
|
*/
|
|
470
473
|
initializeUserCredits(userId: string, tier: SubscriptionTier, initialBalance: number): Promise<PortableUserCredits>;
|
|
471
474
|
/**
|
|
472
|
-
*
|
|
475
|
+
* Patch fields of the account. This writes no journal line, whatever it changes.
|
|
476
|
+
* A tier change goes through `updateUserTier`, which journals a balance it moves.
|
|
473
477
|
* @param userId - User ID
|
|
474
478
|
* @param updates - Partial updates to apply
|
|
475
479
|
*/
|
|
476
480
|
updateUserCredits(userId: string, updates: CreditBalanceUpdate): Promise<void>;
|
|
477
481
|
/**
|
|
478
|
-
* Update user subscription tier
|
|
482
|
+
* Update user subscription tier. A write that moves the balance writes one journal
|
|
483
|
+
* line (`tierChangeJournalInput`) in the same atomic step, and one that does not
|
|
484
|
+
* writes none.
|
|
479
485
|
* @param userId - User ID
|
|
480
486
|
* @param input - Tier update data
|
|
481
487
|
*/
|