@lyxa.ai/core 1.1.96 → 1.1.97

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.
@@ -22,7 +22,7 @@ Perfect for sharing types between frontend and backend applications.
22
22
 
23
23
  ## Version
24
24
 
25
- Version: 1.1.96
25
+ Version: 1.1.97
26
26
 
27
27
  ## Dependencies
28
28
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/types",
3
- "version": "1.1.96",
3
+ "version": "1.1.97",
4
4
  "description": "Lyxa type definitions and validation schemas for both frontend and backend",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",
@@ -1,4 +1,4 @@
1
- export declare function calculateWalletDeduction(currentMainBalance: number, deductionAmount: number, isDualCurrencyEnabled?: true): {
1
+ export declare function calculateWalletDeduction(currentMainBalance: number, deductionAmount: number, isDualCurrencyEnabled?: boolean): {
2
2
  mainWalletChange: number;
3
3
  reserveWalletChange: number;
4
4
  };
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.calculateWalletDeduction = calculateWalletDeduction;
4
4
  const shared_1 = require("./shared");
5
- function calculateWalletDeduction(currentMainBalance, deductionAmount, isDualCurrencyEnabled) {
5
+ function calculateWalletDeduction(currentMainBalance, deductionAmount, isDualCurrencyEnabled = true) {
6
6
  const round = isDualCurrencyEnabled ? shared_1.roundSecondaryCurrency : shared_1.roundBaseCurrency;
7
7
  const remainingAfterMain = round(currentMainBalance - deductionAmount);
8
8
  if (remainingAfterMain >= 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"wallet.js","sourceRoot":"/","sources":["utilities/wallet.ts"],"names":[],"mappings":";;AAOA,4DAkBC;AAzBD,qCAAqE;AAOrE,SAAgB,wBAAwB,CACvC,kBAA0B,EAC1B,eAAuB,EACvB,qBAA4B;IAK5B,MAAM,KAAK,GAAG,qBAAqB,CAAC,CAAC,CAAC,+BAAsB,CAAC,CAAC,CAAC,0BAAiB,CAAC;IACjF,MAAM,kBAAkB,GAAG,KAAK,CAAC,kBAAkB,GAAG,eAAe,CAAC,CAAC;IAGvE,IAAI,kBAAkB,IAAI,CAAC,EAAE,CAAC;QAC7B,OAAO,EAAE,gBAAgB,EAAE,CAAC,eAAe,EAAE,mBAAmB,EAAE,CAAC,EAAE,CAAC;IACvE,CAAC;IAGD,OAAO,EAAE,gBAAgB,EAAE,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;AAC3F,CAAC","sourcesContent":["import { roundBaseCurrency, roundSecondaryCurrency } from './shared';\n\n/**\n * Calculates how much to deduct from a user's wallets.\n * Deducts from the main wallet first, then from the reserve wallet if needed.\n * Returns negative values (for use with $inc updates in MongoDB).\n */\nexport function calculateWalletDeduction(\n\tcurrentMainBalance: number,\n\tdeductionAmount: number,\n\tisDualCurrencyEnabled?: true\n): {\n\tmainWalletChange: number;\n\treserveWalletChange: number;\n} {\n\tconst round = isDualCurrencyEnabled ? roundSecondaryCurrency : roundBaseCurrency;\n\tconst remainingAfterMain = round(currentMainBalance - deductionAmount);\n\n\t// If main has enough, reserve doesn't change\n\tif (remainingAfterMain >= 0) {\n\t\treturn { mainWalletChange: -deductionAmount, reserveWalletChange: 0 };\n\t}\n\n\t// Otherwise, deduct all from main and the remainder (negative) from reserve\n\treturn { mainWalletChange: -currentMainBalance, reserveWalletChange: remainingAfterMain };\n}\n"]}
1
+ {"version":3,"file":"wallet.js","sourceRoot":"/","sources":["utilities/wallet.ts"],"names":[],"mappings":";;AAOA,4DAkBC;AAzBD,qCAAqE;AAOrE,SAAgB,wBAAwB,CACvC,kBAA0B,EAC1B,eAAuB,EACvB,wBAAiC,IAAI;IAKrC,MAAM,KAAK,GAAG,qBAAqB,CAAC,CAAC,CAAC,+BAAsB,CAAC,CAAC,CAAC,0BAAiB,CAAC;IACjF,MAAM,kBAAkB,GAAG,KAAK,CAAC,kBAAkB,GAAG,eAAe,CAAC,CAAC;IAGvE,IAAI,kBAAkB,IAAI,CAAC,EAAE,CAAC;QAC7B,OAAO,EAAE,gBAAgB,EAAE,CAAC,eAAe,EAAE,mBAAmB,EAAE,CAAC,EAAE,CAAC;IACvE,CAAC;IAGD,OAAO,EAAE,gBAAgB,EAAE,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;AAC3F,CAAC","sourcesContent":["import { roundBaseCurrency, roundSecondaryCurrency } from './shared';\n\n/**\n * Calculates how much to deduct from a user's wallets.\n * Deducts from the main wallet first, then from the reserve wallet if needed.\n * Returns negative values (for use with $inc updates in MongoDB).\n */\nexport function calculateWalletDeduction(\n\tcurrentMainBalance: number,\n\tdeductionAmount: number,\n\tisDualCurrencyEnabled: boolean = true\n): {\n\tmainWalletChange: number;\n\treserveWalletChange: number;\n} {\n\tconst round = isDualCurrencyEnabled ? roundSecondaryCurrency : roundBaseCurrency;\n\tconst remainingAfterMain = round(currentMainBalance - deductionAmount);\n\n\t// If main has enough, reserve doesn't change\n\tif (remainingAfterMain >= 0) {\n\t\treturn { mainWalletChange: -deductionAmount, reserveWalletChange: 0 };\n\t}\n\n\t// Otherwise, deduct all from main and the remainder (negative) from reserve\n\treturn { mainWalletChange: -currentMainBalance, reserveWalletChange: remainingAfterMain };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/core",
3
- "version": "1.1.96",
3
+ "version": "1.1.97",
4
4
  "description": "The Core system of the Lyxa services.",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",