@lyxa.ai/core 1.1.31-alpha.2 → 1.1.31-alpha.3

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.31-alpha.2
25
+ Version: 1.1.31-alpha.3
26
26
 
27
27
  ## Dependencies
28
28
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/types",
3
- "version": "1.1.31-alpha.2",
3
+ "version": "1.1.31-alpha.3",
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",
@@ -19,7 +19,7 @@ const getSecondaryCurrencyStage = ({ valuePath, exchangeRate, }) => {
19
19
  return 0;
20
20
  }
21
21
  const decimals = (roundingFactor.toString().split('.')[1] || '').length;
22
- const rounded = Math.round(amount / roundingFactor) * roundingFactor;
22
+ const rounded = Math.round((amount * exchangeRate) / roundingFactor) * roundingFactor;
23
23
  return Number(rounded.toFixed(decimals));
24
24
  }.toString(),
25
25
  args: [valuePath, exchangeRate, shared_1.SecondaryCurrencyRoundTo],
@@ -1 +1 @@
1
- {"version":3,"file":"common-pipeline-functions.js","sourceRoot":"/","sources":["utilities/pipelines/common-pipeline-functions.ts"],"names":[],"mappings":";;;AAAA,sCAAqD;AAE9C,MAAM,yBAAyB,GAAG,CAAC,EACzC,SAAS,EACT,YAAY,GAIZ,EAAO,EAAE;IACT,OAAO;QACN,KAAK,EAAE;YACN,EAAE,OAAO,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE;YAC/B;gBACC,SAAS,EAAE;oBACV,IAAI,EAAE,UAAU,MAAc,EAAE,YAAoB,EAAE,cAAsB;wBAC3E,IACC,OAAO,MAAM,KAAK,QAAQ;4BAC1B,KAAK,CAAC,MAAM,CAAC;4BACb,OAAO,YAAY,KAAK,QAAQ;4BAChC,KAAK,CAAC,YAAY,CAAC;4BACnB,OAAO,cAAc,KAAK,QAAQ;4BAClC,cAAc,IAAI,CAAC;4BACnB,MAAM,KAAK,CAAC,EACX,CAAC;4BACF,OAAO,CAAC,CAAC;wBACV,CAAC;wBAED,MAAM,QAAQ,GAAG,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;wBACxE,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,cAAc,CAAC,GAAG,cAAc,CAAC;wBAErE,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;oBAC1C,CAAC,CAAC,QAAQ,EAAE;oBACZ,IAAI,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,iCAAwB,CAAC;oBACzD,IAAI,EAAE,IAAI;iBACV;aACD;YACD,IAAI;SACJ;KACD,CAAC;AACH,CAAC,CAAC;AArCW,QAAA,yBAAyB,6BAqCpC","sourcesContent":["import { SecondaryCurrencyRoundTo } from '../shared';\n\nexport const getSecondaryCurrencyStage = ({\n\tvaluePath,\n\texchangeRate,\n}: {\n\tvaluePath: string;\n\texchangeRate: number;\n}): any => {\n\treturn {\n\t\t$cond: [\n\t\t\t{ $ifNull: [valuePath, false] },\n\t\t\t{\n\t\t\t\t$function: {\n\t\t\t\t\tbody: function (amount: number, exchangeRate: number, roundingFactor: number) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttypeof amount !== 'number' ||\n\t\t\t\t\t\t\tisNaN(amount) ||\n\t\t\t\t\t\t\ttypeof exchangeRate !== 'number' ||\n\t\t\t\t\t\t\tisNaN(exchangeRate) ||\n\t\t\t\t\t\t\ttypeof roundingFactor !== 'number' ||\n\t\t\t\t\t\t\troundingFactor <= 0 ||\n\t\t\t\t\t\t\tamount === 0\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst decimals = (roundingFactor.toString().split('.')[1] || '').length;\n\t\t\t\t\t\tconst rounded = Math.round(amount / roundingFactor) * roundingFactor;\n\n\t\t\t\t\t\treturn Number(rounded.toFixed(decimals));\n\t\t\t\t\t}.toString(),\n\t\t\t\t\targs: [valuePath, exchangeRate, SecondaryCurrencyRoundTo],\n\t\t\t\t\tlang: 'js',\n\t\t\t\t},\n\t\t\t},\n\t\t\tnull,\n\t\t],\n\t};\n};\n"]}
1
+ {"version":3,"file":"common-pipeline-functions.js","sourceRoot":"/","sources":["utilities/pipelines/common-pipeline-functions.ts"],"names":[],"mappings":";;;AAAA,sCAAqD;AAE9C,MAAM,yBAAyB,GAAG,CAAC,EACzC,SAAS,EACT,YAAY,GAIZ,EAAO,EAAE;IACT,OAAO;QACN,KAAK,EAAE;YACN,EAAE,OAAO,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE;YAC/B;gBACC,SAAS,EAAE;oBACV,IAAI,EAAE,UAAU,MAAc,EAAE,YAAoB,EAAE,cAAsB;wBAC3E,IACC,OAAO,MAAM,KAAK,QAAQ;4BAC1B,KAAK,CAAC,MAAM,CAAC;4BACb,OAAO,YAAY,KAAK,QAAQ;4BAChC,KAAK,CAAC,YAAY,CAAC;4BACnB,OAAO,cAAc,KAAK,QAAQ;4BAClC,cAAc,IAAI,CAAC;4BACnB,MAAM,KAAK,CAAC,EACX,CAAC;4BACF,OAAO,CAAC,CAAC;wBACV,CAAC;wBAED,MAAM,QAAQ,GAAG,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;wBACxE,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,YAAY,CAAC,GAAG,cAAc,CAAC,GAAG,cAAc,CAAC;wBAEtF,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;oBAC1C,CAAC,CAAC,QAAQ,EAAE;oBACZ,IAAI,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,iCAAwB,CAAC;oBACzD,IAAI,EAAE,IAAI;iBACV;aACD;YACD,IAAI;SACJ;KACD,CAAC;AACH,CAAC,CAAC;AArCW,QAAA,yBAAyB,6BAqCpC","sourcesContent":["import { SecondaryCurrencyRoundTo } from '../shared';\n\nexport const getSecondaryCurrencyStage = ({\n\tvaluePath,\n\texchangeRate,\n}: {\n\tvaluePath: string;\n\texchangeRate: number;\n}): any => {\n\treturn {\n\t\t$cond: [\n\t\t\t{ $ifNull: [valuePath, false] },\n\t\t\t{\n\t\t\t\t$function: {\n\t\t\t\t\tbody: function (amount: number, exchangeRate: number, roundingFactor: number) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttypeof amount !== 'number' ||\n\t\t\t\t\t\t\tisNaN(amount) ||\n\t\t\t\t\t\t\ttypeof exchangeRate !== 'number' ||\n\t\t\t\t\t\t\tisNaN(exchangeRate) ||\n\t\t\t\t\t\t\ttypeof roundingFactor !== 'number' ||\n\t\t\t\t\t\t\troundingFactor <= 0 ||\n\t\t\t\t\t\t\tamount === 0\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst decimals = (roundingFactor.toString().split('.')[1] || '').length;\n\t\t\t\t\t\tconst rounded = Math.round((amount * exchangeRate) / roundingFactor) * roundingFactor;\n\n\t\t\t\t\t\treturn Number(rounded.toFixed(decimals));\n\t\t\t\t\t}.toString(),\n\t\t\t\t\targs: [valuePath, exchangeRate, SecondaryCurrencyRoundTo],\n\t\t\t\t\tlang: 'js',\n\t\t\t\t},\n\t\t\t},\n\t\t\tnull,\n\t\t],\n\t};\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/core",
3
- "version": "1.1.31-alpha.2",
3
+ "version": "1.1.31-alpha.3",
4
4
  "description": "The Core system of the Lyxa services.",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",